MCPcopy Create free account
hub / github.com/react-dnd/react-dnd / buildHasteMap

Function buildHasteMap

scripts/resolvers.js:5–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3var path = require('path');
4
5function buildHasteMap() {
6 var root = path.resolve(__dirname, '../src');
7 var hasteMap = {};
8 glob.sync(root + '/**/*.{js,css}').forEach(function(file) {
9 var code = fs.readFileSync(file);
10 var regex = /@providesModule ([^\s*]+)/;
11 var result = regex.exec(code);
12 if (result) {
13 var id = result[1];
14 if (path.extname(file) === '.css') {
15 id += '.css';
16 }
17 hasteMap[id] = file;
18 }
19 });
20 return hasteMap;
21};
22
23function resolveHasteDefines() {
24 // Run in the context of webpack's compiler.

Callers 1

resolveHasteDefinesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected