Commit 87e0734
node: make builtin libs available for
Make the builtin libraries available for the `--eval` and
`--print` CLI options, using the same mechanism that the
REPL uses.
This renders workarounds like `node -e 'require("fs").doStuff()'`
unnecessary.
As part of this, the list of builtin modules and the code for
adding the corresponding properties to the target context is moved
to `internal/module.js`, and the previously missing `repl` entry
is added.
PR-URL: #6207
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>--eval
1 parent 2ac14ee commit 87e0734Copy full SHA for 87e0734
File tree
Expand file treeCollapse file tree
5 files changed
+48
-23
lines changedOpen diff view settings
Filter options
- doc/api
- lib
- internal
- test/parallel
Expand file treeCollapse file tree
5 files changed
+48
-23
lines changedOpen diff view settings
Collapse file
+2-1Lines changed: 2 additions & 1 deletion
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
36 | 36 | |
37 | 37 | |
38 | 38 | |
39 | | - |
| 39 | + |
| 40 | + |
40 | 41 | |
41 | 42 | |
42 | 43 | |
|
Collapse file
lib/internal/bootstrap_node.js
Copy file name to clipboardExpand all lines: lib/internal/bootstrap_node.js+3Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
94 | 94 | |
95 | 95 | |
96 | 96 | |
| 97 | + |
| 98 | + |
| 99 | + |
97 | 100 | |
98 | 101 | |
99 | 102 | |
|
Collapse file
+34-1Lines changed: 34 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
2 | 2 | |
3 | | - |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
4 | 8 | |
5 | 9 | |
6 | 10 | |
| ||
44 | 48 | |
45 | 49 | |
46 | 50 | |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
Collapse file
+2-21Lines changed: 2 additions & 21 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
64 | 64 | |
65 | 65 | |
66 | 66 | |
67 | | - |
68 | | - |
69 | | - |
70 | | - |
| 67 | + |
71 | 68 | |
72 | 69 | |
73 | 70 | |
| ||
559 | 556 | |
560 | 557 | |
561 | 558 | |
562 | | - |
563 | | - |
564 | | - |
565 | | - |
566 | | - |
567 | | - |
568 | | - |
569 | | - |
570 | | - |
571 | | - |
572 | | - |
573 | | - |
574 | | - |
575 | | - |
576 | | - |
577 | | - |
578 | | - |
| 559 | + |
579 | 560 | |
580 | 561 | |
581 | 562 | |
|
Collapse file
test/parallel/test-cli-eval.js
Copy file name to clipboardExpand all lines: test/parallel/test-cli-eval.js+7Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
53 | 53 | |
54 | 54 | |
55 | 55 | |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
56 | 63 | |
57 | 64 | |
58 | 65 | |
|
0 commit comments