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

worker: add ESM version examples to worker docs #57645

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fisker
Copy link
Contributor

@fisker fisker commented Mar 27, 2025

  • Add ESM version to all examples
  • Add 'use strict' directive to all cjs blocks, doing this only because there are blocks includes them, better add it consistently
  • Change first argument to new Worker() in ESM version from url.fileURLToPath(import.meta.url) to new URL(import.meta.url)

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. worker Issues and PRs related to Worker support. labels Mar 27, 2025
parentPort.postMessage(parse(script));
}

export default function parseJSAsync(script) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ESM version can't conditional add exports like CJS, it should be fine to always add a export.

@fisker fisker changed the title docs: add ESM version examples to worker_threads docs docs(worker_threads): add ESM version examples to worker_threads docs Mar 27, 2025
@fisker fisker changed the title docs(worker_threads): add ESM version examples to worker_threads docs docs(worker): add ESM version examples to worker_threads docs Mar 27, 2025
@fisker fisker force-pushed the worker_threads-esm-doc branch from 6d41acc to e1eda74 Compare March 27, 2025 10:56
@fisker fisker changed the title docs(worker): add ESM version examples to worker_threads docs docs(worker): add ESM version examples to worker docs Mar 27, 2025
@fisker fisker force-pushed the worker_threads-esm-doc branch from e1eda74 to 132b6bf Compare March 27, 2025 11:01
@fisker fisker changed the title docs(worker): add ESM version examples to worker docs docs: worker: add ESM version examples to worker docs Mar 27, 2025
@fisker fisker force-pushed the worker_threads-esm-doc branch from 132b6bf to c9a76b5 Compare March 27, 2025 11:09
@fisker fisker changed the title docs: worker: add ESM version examples to worker docs worker: add ESM version examples to worker docs Mar 27, 2025
@fisker fisker marked this pull request as ready for review March 28, 2025 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. worker Issues and PRs related to Worker support.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants