1 | var prettier = require("prettier");
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | module.exports = function(bundle, npmContext) {
|
10 | var push = [].push;
|
11 | push.apply(bundle.nodes, [makeAddNpmPackagesNode(npmContext)]);
|
12 | };
|
13 |
|
14 | function makeAddNpmPackagesNode(npmContext) {
|
15 | var packages = npmContext.packages || [];
|
16 |
|
17 | return {
|
18 | deps: [],
|
19 | load: {
|
20 | name: "[steal-add-npm-packages]",
|
21 | metadata: {
|
22 | format: "global"
|
23 | },
|
24 | source: prettier.format(
|
25 | `if (steal && typeof steal.addNpmPackages === "function") {
|
26 | steal.addNpmPackages(${JSON.stringify(packages)});
|
27 | }`,
|
28 | { tabWidth: 4 }
|
29 | )
|
30 | }
|
31 | };
|
32 | }
|