Skip to content

feat(core): enable thenable params processing for $ literals#1237

Merged
antongolub merged 7 commits intogoogle:mainfrom
antongolub:thenables-in-literals
Jun 23, 2025
Merged

feat(core): enable thenable params processing for $ literals#1237
antongolub merged 7 commits intogoogle:mainfrom
antongolub:thenables-in-literals

Conversation

@antongolub
Copy link
Collaborator

@antongolub antongolub commented Jun 22, 2025

Before

const a1 = await $`echo foo`
const a2 = await new Promise((resolve) => setTimeout(resolve, 20, ['bar', 'baz']))

await $`echo ${a1} ${a2}` // foo bar baz

After

const a1 = $`echo foo`
const a2 = new Promise((resolve) => setTimeout(resolve, 20, ['bar', 'baz']))

await $`echo ${a1} ${a2}` // foo bar baz
  • Tests pass
  • Appropriate changes to README are included in PR

@antongolub antongolub requested a review from Copilot June 22, 2025 13:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables thenable parameter processing for shell literals by awaiting any thenable arguments before executing the command. Key changes include new tests to validate thenable resolution and error handling, updates to the core proxy and process execution logic in both TypeScript and CommonJS builds, and documentation updates describing the feature.

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/core.test.js Added tests for handling thenable arguments including successful resolution and error cases.
src/core.ts Updated the $ proxy and ProcessPromise run callback to support thenable parameters.
docs/getting-started.md Expanded documentation with examples showing the thenable parameter feature.
build/core.cjs Applied similar thenable handling updates to the CommonJS build.
.size-limit.json Updated bundle size limits.

@antongolub antongolub force-pushed the thenables-in-literals branch 2 times, most recently from 9732e09 to a99e747 Compare June 22, 2025 14:41
@antongolub antongolub requested a review from antonmedv June 22, 2025 14:42
@antongolub antongolub force-pushed the thenables-in-literals branch from 6917ff2 to 0fa8633 Compare June 23, 2025 09:02
@antongolub antongolub merged commit fcddea8 into google:main Jun 23, 2025
28 checks passed
@antongolub antongolub deleted the thenables-in-literals branch June 23, 2025 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants