-
-
Notifications
You must be signed in to change notification settings - Fork 787
fix: add symlink to file dep #11693
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
Closed
Closed
fix: add symlink to file dep #11693
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default 0; | ||
--- | ||
export default 1; |
12 changes: 12 additions & 0 deletions
12
tests/rspack-test/cacheCases/invalidation/symlink/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import value from "./driver"; | ||
import version from "./tool" | ||
|
||
it("should invalidate work when symlink changes", async () => { | ||
if (COMPILER_INDEX == 0) { | ||
expect(version).toBe(100); | ||
await NEXT_START(); | ||
} | ||
if (COMPILER_INDEX == 1) { | ||
expect(version).toBe(200); | ||
} | ||
}); |
32 changes: 32 additions & 0 deletions
32
tests/rspack-test/cacheCases/invalidation/symlink/rspack.config.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const path = require("path"); | ||
const fs = require("fs/promises"); | ||
|
||
let index = 1 | ||
const libPath = path.join(__dirname, "./tool") | ||
/** @type {import("@rspack/core").Configuration} */ | ||
module.exports = { | ||
context: __dirname, | ||
experiments: { | ||
cache: { | ||
type: "persistent", | ||
snapshot: { | ||
managedPaths: [path.join(__dirname, "./tool")] | ||
} | ||
} | ||
}, | ||
plugins: [ | ||
{ | ||
apply(compiler) { | ||
compiler.hooks.beforeCompile.tapPromise("Test Plugin", async function () { | ||
try { | ||
await fs.unlink(libPath); | ||
} catch {} | ||
|
||
await fs.symlink(libPath + '_' + index, libPath); | ||
|
||
index++; | ||
}); | ||
} | ||
} | ||
] | ||
}; |
1 change: 1 addition & 0 deletions
1
tests/rspack-test/cacheCases/invalidation/symlink/tool_1/file.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 100 |
5 changes: 5 additions & 0 deletions
5
tests/rspack-test/cacheCases/invalidation/symlink/tool_1/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "managed-paths-test-lib", | ||
"version": "0.100.0", | ||
"main": "./file.js" | ||
} |
1 change: 1 addition & 0 deletions
1
tests/rspack-test/cacheCases/invalidation/symlink/tool_2/file.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 200 |
5 changes: 5 additions & 0 deletions
5
tests/rspack-test/cacheCases/invalidation/symlink/tool_2/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "managed-paths-test-lib", | ||
"version": "0.200.0", | ||
"main": "./file.js" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
file_dependencies
belong to the current dependency, not the module. Setting this here is unreasonable. If the module already exists, the value of this part may even be discarded. The correct approach is to make factorizeInfo effective for all dependencies.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.
But compilation calcuates modules that need rebuild using buildInfo.
Could you elaborate on this?
Uh oh!
There was an error while loading. Please reload this page.
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.
Ah, if I understand #11643 correctly, it could be possible to leverage
FactorizeInfo
for this scenario.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.
BuildInfo is used to check if a module needs to be rebuilt, and factorizeInfo is used to check if a dependency needs to be refactorize. The dependencies you add to buildInfo should actually be added to factorizeInfo, and rebuilding the dependencies will also fix this problem.
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.
Yes, but it seems that repack only rebuild failed dependencies at the moment.
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.
yes, #11643 will fix it and check all dependencies factorizeinfo when rebuilding.