mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[PR #5090] [MERGED] feat: migrate to a unified scripting system based on faraday-cage #5052
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#5052
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/5090
Author: @jamesgeorge007
Created: 5/21/2025
Status: ✅ Merged
Merged: 5/23/2025
Merged by: @jamesgeorge007
Base:
next← Head:feat/unify-scripting-with-fadaray-cage📝 Commits (6)
b3afddafeat: migrate to a unified scripting system based onfaraday-cage06f35d7fix(desktop): csp override forfaraday-cagedc20a29fix: handle deserialization ofDatestrings in sandbox contextc8c10a0docs: update CLIREADME.md11c10cbchore: formatting updatesb23bdb5chore: bump CLI version📊 Changes
51 files changed (+2122 additions, -659 deletions)
View changed files
📝
packages/hoppscotch-cli/README.md(+51 -31)📝
packages/hoppscotch-cli/package.json(+1 -1)📝
packages/hoppscotch-cli/src/__tests__/e2e/commands/__snapshots__/test.spec.ts.snap(+2 -2)📝
packages/hoppscotch-cli/src/__tests__/functions/mutators/parseCollectionData.spec.ts(+1 -3)📝
packages/hoppscotch-cli/src/commands/test.ts(+11 -2)📝
packages/hoppscotch-cli/src/index.ts(+1 -0)📝
packages/hoppscotch-cli/src/interfaces/response.ts(+1 -0)📝
packages/hoppscotch-cli/src/options/test/delay.ts(+4 -4)📝
packages/hoppscotch-cli/src/types/collections.ts(+1 -0)📝
packages/hoppscotch-cli/src/types/commands.ts(+1 -0)📝
packages/hoppscotch-cli/src/types/request.ts(+1 -0)📝
packages/hoppscotch-cli/src/utils/collections.ts(+15 -4)📝
packages/hoppscotch-cli/src/utils/display.ts(+3 -1)📝
packages/hoppscotch-cli/src/utils/functions/array.ts(+1 -1)📝
packages/hoppscotch-cli/src/utils/pre-request.ts(+8 -4)📝
packages/hoppscotch-cli/src/utils/request.ts(+5 -3)📝
packages/hoppscotch-cli/src/utils/test.ts(+13 -5)📝
packages/hoppscotch-common/locales/en.json(+5 -0)📝
packages/hoppscotch-common/package.json(+3 -2)📝
packages/hoppscotch-common/src/components.d.ts(+3 -0)...and 31 more files
📄 Description
The pre-existing scripting system is powered by a web worker-based sandbox implementation for browser platforms and the Node.js target is powered by isolated-vm for the CLI. This PR aims to migrate the existing system powering scripting to a unified implementation backed by the in-house library faraday-cage built on top of QuickJS.
There is a user-facing addition as part of the experimental scripting sandbox implementation with an in-app console supporting the basic methods like
log,debug,info,warnanderror. Allconsolemethods are supported in the scripting context and will continue to be recorded in the dev tools console. Non-primitive values will be rendered in a tree viewer. The response section (scoped per request) will have a new tab where the log entries will be rendered. In the context of the collection runner, this would be displayed in the response section when selecting a request to view its response. Logs will appear beneath every request on the CLI.The new scripting implementation will be the default going ahead with the ability to opt out via the settings page on web platforms and the
--legacy-scriptingflag on the CLI.Closes HFE-830.
Preview
What's changed
faraday-cage.Experimental scripting sandboxoption under settings on the web app and a new--legacy-scriptingCLI flag to toggle between the experimental and legacy scripting implementations.js-sandboxpackage.consoleEntriesfield addition keeping track of the console entries per request.faraday-cagedependency addition underjs-sandbox.Notes to reviewers
fetch,crypto, etc.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.