-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use deps declared on rollup_bundle (#1287)
* refactor: use deps declared on rollup_bundle This replaces the dynamic_deps mechanism for pulling user-specified plugins into the node_modules tree * refactor: instead of special case for rollup, generally patch realpath/lstat * refactor: use new no-loader mode for npm_package_bin This should unblock usage from Angular architect, Jest, webpack and others
- Loading branch information
Showing
16 changed files
with
230 additions
and
65 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,38 @@ | ||
// Adapt node programs to run under Bazel | ||
// Meant to be run in a --require hook | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const orig = {}; | ||
// TODO: more functions need patched like | ||
// the async and native versions | ||
orig['realPathSync'] = fs.realpathSync; | ||
orig['lstatSync'] = fs.lstatSync; | ||
|
||
// To fully resolve a symlink requires recursively | ||
// following symlinks until the target is a file | ||
// rather than a symlink, so we must make this look | ||
// like a file. | ||
function lstatSync(p) { | ||
const result = orig.lstatSync(p); | ||
result.isSymbolicLink = () => false; | ||
result.isFile = () => true; | ||
return result; | ||
} | ||
|
||
function realpathSync(...s) { | ||
// Realpath returns an absolute path, so we should too | ||
return path.resolve(s[0]); | ||
} | ||
|
||
function monkeypatch() { | ||
fs.realpathSync = realpathSync; | ||
fs.lstatSync = lstatSync; | ||
} | ||
|
||
function unmonkeypatch() { | ||
fs.realpathSync = orig.realPathSync; | ||
fs.lstatSync = orig.lstatSync; | ||
} | ||
|
||
monkeypatch(); |
This file contains 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 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 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 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 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 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.