-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
src: add an option to make compile cache path relative #58797
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
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #58797 +/- ##
==========================================
+ Coverage 89.37% 89.89% +0.52%
==========================================
Files 654 667 +13
Lines 192554 196670 +4116
Branches 37434 38617 +1183
==========================================
+ Hits 172086 176794 +4708
+ Misses 12995 12331 -664
- Partials 7473 7545 +72
🚀 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.
Can you add some integration to module.enableCompileCache()
as well? I think having it in options bag when the first argument is an object might work well enough. The path can be options.path
in that case.
0d4fb87
to
b6eb597
Compare
b6eb597
to
4143c2f
Compare
5abcfc9
to
de78d1a
Compare
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.
The file://
URL handling in this is incorrect. Either support for file://
URLs here at all should be dropped or they should be correctly handled.
ddd3bcd
to
d03bf27
Compare
Adds an option (NODE_COMPILE_CACHE_PORTABLE) for the built-in compile cache to encode the hashes with relative file paths. On enabling the option, the source directory along with cache directory can be bundled and moved, and the cache continues to work. When enabled, paths encoded in hash are relative to compile cache directory.
849e6ba
to
b879f6b
Compare
Failed to start CI⚠ Commits were pushed since the last approving review: ⚠ - src: add an option to make compile cache portable ✘ Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/17295846847 |
Landed in 94422e8 |
Adds an option (NODE_COMPILE_CACHE_PORTABLE) for the built-in compile cache to encode the hashes with relative file paths. On enabling the option, the source directory along with cache directory can be bundled and moved, and the cache continues to work. When enabled, paths encoded in hash are relative to compile cache directory. PR-URL: #58797 Fixes: #58755 Refs: #52696 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* - `portable`: If `portable` is true, the cache directory will be considered relative. Defaults to false. | ||
* If cache path is undefined, it defaults to the NODE_MODULE_CACHE environment variable. | ||
* If `NODE_MODULE_CACHE` isn't set, it defaults to `path.join(os.tmpdir(), 'node-compile-cache')`. | ||
* @param {string | { path?: string, portable?: boolean } | undefined} options |
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.
I just noticed an issue with the new options - it should be directory
instead of path
to align with the return value. Marking the PR with dont-land labels to fix it before it gets released.
Notable changes: http: * (SEMVER-MINOR) add shouldUpgradeCallback to let servers control HTTP upgrades (Tim Perry) #59824 sqlite: * (SEMVER-MINOR) cleanup ERM support and export Session class (James M Snell) #58378 * (SEMVER-MINOR) add tagged template (0hm☘️) #58748 src: * (SEMVER-MINOR) add an option to make compile cache portable (Aditi) #58797 worker: * (SEMVER-MINOR) add heap profile API (theanarkh) #59846 PR-URL: #59997
Adds an option (NODE_COMPILE_CACHE_RELATIVE_PATH) for the built-in compile cache to encode the hashes with relative file paths. On enabling the option,
the source directory along with cache directory can be bundled and moved, and the cache continues to work.
When enabled, paths encoded in hash are relative to compile cache directory.
Fixes: #58755
Refs: #52696
Thanks @joyeecheung for all the help :)