MCPcopy
hub / github.com/plopjs/plop / load

Function load

packages/node-plop/src/node-plop.js:101–155  ·  view source on GitHub ↗
(targets, loadCfg = {}, includeOverride)

Source from the content-addressed store, hash-verified

99 };
100
101 async function load(targets, loadCfg = {}, includeOverride) {
102 if (typeof targets === "string") {
103 targets = [targets];
104 }
105 const config = Object.assign(
106 {
107 destBasePath: getDestBasePath(),
108 },
109 loadCfg,
110 );
111
112 await Promise.all(
113 targets.map(async function (target) {
114 const targetPath = resolve.sync(target, { basedir: getPlopfilePath() });
115 const proxy = await nodePlop(targetPath, config);
116 const proxyDefaultInclude = proxy.getDefaultInclude() || {};
117 const includeCfg = includeOverride || proxyDefaultInclude;
118 const include = Object.assign(
119 {
120 generators: false,
121 helpers: false,
122 partials: false,
123 actionTypes: false,
124 },
125 includeCfg,
126 );
127
128 const genNameList = proxy.getGeneratorList().map((g) => g.name);
129 loadAsset(
130 genNameList,
131 includeCfg === true || include.generators,
132 setGenerator,
133 (proxyName) => ({ proxyName, proxy }),
134 );
135 loadAsset(
136 proxy.getPartialList(),
137 includeCfg === true || include.partials,
138 setPartial,
139 proxy.getPartial,
140 );
141 loadAsset(
142 proxy.getHelperList(),
143 includeCfg === true || include.helpers,
144 setHelper,
145 proxy.getHelper,
146 );
147 loadAsset(
148 proxy.getActionTypeList(),
149 includeCfg === true || include.actionTypes,
150 setActionType,
151 proxy.getActionType,
152 );
153 }),
154 );
155 }
156
157 function loadAsset(nameList, include, addFunc, getFunc) {
158 var incArr;

Callers

nothing calls this directly

Calls 9

getDestBasePathFunction · 0.85
getPlopfilePathFunction · 0.85
nodePlopFunction · 0.85
loadAssetFunction · 0.85
getDefaultIncludeMethod · 0.80
getGeneratorListMethod · 0.80
getPartialListMethod · 0.80
getHelperListMethod · 0.80
getActionTypeListMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…