Skip to content

feat: remove shebang when executing the code via vite-node#1224

Merged
antfu merged 3 commits intovitest-dev:mainfrom
togami2864:feat/remove-shebang
May 6, 2022
Merged

feat: remove shebang when executing the code via vite-node#1224
antfu merged 3 commits intovitest-dev:mainfrom
togami2864:feat/remove-shebang

Conversation

@togami2864
Copy link
Copy Markdown
Contributor

fix #1175

@netlify
Copy link
Copy Markdown

netlify bot commented May 1, 2022

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit 57bb94b
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/6274f61873631b00088858dc
😎 Deploy Preview https://deploy-preview-1224--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@togami2864
Copy link
Copy Markdown
Contributor Author

The PR for vite is merged!! I'll rebase main branch after the next vite release and update this PR.

@patak-cat
Copy link
Copy Markdown
Member

Thanks for the PR in vite @togami2864! vite@2.9.8 has been released with it.

@togami2864 togami2864 force-pushed the feat/remove-shebang branch from e0210a4 to 0e2c402 Compare May 6, 2022 06:26

// add 'use strict' since ESM enables it by default
const fn = vm.runInThisContext(`'use strict';async (${Object.keys(context).join(',')})=>{{${transformed}\n}}`, {
const fn = vm.runInThisContext(`'use strict';async (${Object.keys(context).join(',')})=>{{${transformed.replace(/^\#\!.*/, '')}\n}}`, {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
const fn = vm.runInThisContext(`'use strict';async (${Object.keys(context).join(',')})=>{{${transformed.replace(/^\#\!.*/, '')}\n}}`, {
const fn = vm.runInThisContext(`'use strict';async (${Object.keys(context).join(',')})=>{{${transformed.replace(/^\#\!.*/, s => ' '.repeat(s.length))}\n}}`, {

To avoid index changes.

@antfu antfu changed the title feat: enable to remove shebang when executing the code via vite-node feat: remove shebang when executing the code via vite-node May 6, 2022
@antfu antfu merged commit 5dcfea7 into vitest-dev:main May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vite-node fails to parse hashbang

4 participants