-
-
Notifications
You must be signed in to change notification settings - Fork 53
fix: support run with worker eval #300
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
Conversation
🦋 Changeset detectedLatest commit: c067e37 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughA new changeset file was added to document a patch release for the Changes
Sequence Diagram(s)sequenceDiagram
participant Module as src/meta.ts
participant NodeEnv as Node.js Environment
NodeEnv->>Module: Execute module
Module->>Module: Check if __filename is in EVAL_FILENAMES set
alt __filename in EVAL_FILENAMES
Module->>Module: Use createRequire(import.meta.url)
else
Module->>Module: Use native require
end
Assessment against linked issues
Possibly related PRs
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/meta.tsOops! Something went wrong! :( ESLint: 9.24.0 Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/lib/index.js' imported from /eslint.config.js ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/meta.ts:5
- [nitpick] The constant name 'EVAL' may be ambiguous given its expanded use with worker eval. Consider renaming it to something more descriptive, such as 'EVAL_FILENAMES' or 'VALID_EVAL_FILENAMES'.
const EVAL = new Set(['[eval]', '[worker eval]'])
WalkthroughThis pull request addresses issue #296 by modifying the logic to support running with 'worker eval'. It introduces a new Changes
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Reviewed everything up to b62981b in 1 minute and 18 seconds
More details
- Looked at
16
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. src/meta.ts:5
- Draft comment:
Good addition: Using a set to include both '[eval]' and '[worker eval]' improves environment detection. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
2. src/meta.ts:8
- Draft comment:
Ensure that __filename reliably equals '[worker eval]' in worker eval contexts. This resolves issue #296 by covering both eval types. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
3. src/meta.ts:5
- Draft comment:
Consider renaming the constant 'EVAL' to a more descriptive name (e.g., 'SPECIAL_FILENAMES') and adding a short inline comment explaining why these specific __filename values ('[eval]', '[worker eval]') trigger use of createRequire. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
4. src/meta.ts:8
- Draft comment:
The condition using EVAL.has(__filename) now covers both '[eval]' and '[worker eval]'. Ensure that all worker evaluation contexts produce an __filename matching these values, and document this assumption if necessary. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
Workflow ID: wflow_GzytOMsR2Jf9N9U9
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #300 +/- ##
==========================================
- Coverage 96.01% 95.99% -0.03%
==========================================
Files 91 91
Lines 4743 4744 +1
Branches 1784 1763 -21
==========================================
Hits 4554 4554
- Misses 188 189 +1
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.changeset/spotty-months-end.md (1)
5-5
: Fix typo in changeset descriptionThere's a typo in the changeset description: "suppprt" should be "support".
-fix: suppprt run with worker eval +fix: support run with worker eval
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.changeset/spotty-months-end.md
(1 hunks)src/meta.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on windows-latest
🔇 Additional comments (1)
src/meta.ts (1)
5-9
: Well-implemented solution for supporting worker eval environmentsThe introduction of a
Set
to manage evaluation contexts is a robust solution to handle multiple eval scenarios, including '[worker eval]'. This approach enhances the flexibility and correctness of the module loading logic, making it easier to add more eval contexts in the future if needed.
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 501d643 in 45 seconds
More details
- Looked at
43
lines of code in2
files - Skipped
1
files when reviewing. - Skipped posting
7
drafted comments based on config settings.
1. package.json:74
- Draft comment:
Dependency update: Verify that '@pkgr/core' v0.2.4 correctly exports EVAL_FILENAMES needed for worker eval detection. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
2. package.json:160
- Draft comment:
Dependency update: Confirm 'type-fest' v4.40.0 behaves as expected with no breaking changes. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
3. src/meta.ts:3
- Draft comment:
Importing EVAL_FILENAMES from '@pkgr/core' centralizes eval detection; ensure this constant is maintained. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
4. src/meta.ts:7
- Draft comment:
Using createRequire when in a worker/eval context (detected via EVAL_FILENAMES) resolves #296; logic looks correct. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
5. package.json:74
- Draft comment:
Upgrade @pkgr/core to ^0.2.4 provides the necessary EVAL_FILENAMES export. Confirm new API is backward compatible. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
6. package.json:160
- Draft comment:
Bump type-fest to ^4.40.0; ensure no regressions arise from this minor version update. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
7. src/meta.ts:9
- Draft comment:
Using imported EVAL_FILENAMES for the eval check simplifies maintenance and resolves #296. Verify it covers all relevant eval cases. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
Workflow ID: wflow_EsxUTE8yKlcwrrVe
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (3)
.changeset/spotty-months-end.md
(1 hunks)package.json
(2 hunks)src/meta.ts
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- package.json
🚧 Files skipped from review as they are similar to previous changes (1)
- .changeset/spotty-months-end.md
🧰 Additional context used
🧠 Learnings (1)
src/meta.ts (1)
Learnt from: JounQin
PR: un-ts/eslint-plugin-import-x#0
File: :0-0
Timestamp: 2025-03-30T09:56:52.604Z
Learning: The project supports both ESM and CommonJS module systems simultaneously, even as it migrates to use ESM as the primary module system. Using `cjsRequire` is part of this strategy to maintain compatibility with both systems.
🪛 GitHub Check: codecov/patch
src/meta.ts
[warning] 9-9: src/meta.ts#L9
Added line #L9 was not covered by tests
⏰ Context from checks skipped due to timeout of 90000ms (21)
- GitHub Check: Lint and Test with Node.js 22 and ESLint 8.56 on windows-latest
- GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
- GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on windows-latest
- GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on windows-latest
- GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on macos-latest
- GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on ubuntu-latest
- GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
- GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on ubuntu-latest
- GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on ubuntu-latest
- GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on macos-latest
- GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on macos-latest
- GitHub Check: Lint and Test with Node.js 18 and ESLint 8.56 on windows-latest
- GitHub Check: Lint and Test with Node.js 18 and ESLint 9 on windows-latest
- GitHub Check: Lint and Test with Node.js 22 and ESLint 8 on windows-latest
- GitHub Check: Lint and Test with Node.js 18 and ESLint 8 on windows-latest
- GitHub Check: Lint and Test with Node.js 22 and ESLint 9 on windows-latest
- GitHub Check: Lint and Test with Node.js 20 and ESLint 8 on windows-latest
- GitHub Check: Lint and Test with Node.js 20 and ESLint 8.56 on windows-latest
- GitHub Check: Lint and Test with Node.js 20 and ESLint 9 on windows-latest
- GitHub Check: Lint and Test with Node.js 22 and ESLint 8.56 on windows-latest
- GitHub Check: Codacy Static Code Analysis
close #296
Important
Fixes worker evaluation mode compatibility in
src/meta.ts
and updates dependencies inpackage.json
.src/meta.ts
, updatedcjsRequire
logic to useEVAL_FILENAMES.has(__filename)
for compatibility with worker evaluation mode.@pkgr/core
to^0.2.4
andtype-fest
to^4.40.0
inpackage.json
.spotty-months-end.md
for a patch release ofeslint-plugin-import-x
.This description was created by
for 501d643. It will automatically update as commits are pushed.
Summary by CodeRabbit