UNPKG

725 BJavaScriptView Raw
1/* eslint-env node */
2const { sync } = require('glob');
3const { basename, resolve } = require('path');
4const extname = require('path-complete-extname');
5const config = require('@rails/webpacker/package/config');
6
7const { extensions, source_path, source_entry_path } = config;
8
9const extensionGlob = `*{${extensions.join(',')}}*`;
10const packPaths = sync(resolve(source_path, source_entry_path, extensionGlob));
11
12module.exports = packPaths.reduce((map, entry, i) => {
13 const bname = basename(entry, extname(entry));
14 const localMap = map;
15 const path = ['./' + source_entry_path + '/' + basename(entry)];
16 if (i === 0) {
17 path.push('@morsedigital/morse-marker');
18 }
19 localMap[bname] = path;
20 return localMap;
21}, {});