MCPcopy
hub / github.com/rollup/rollup / runCodeSplitTest

Function runCodeSplitTest

test/function/index.js:30–56  ·  view source on GitHub ↗
(codeMap, entryId, configContext)

Source from the content-addressed store, hash-verified

28}
29
30function runCodeSplitTest(codeMap, entryId, configContext) {
31 const exportsMap = Object.create(null);
32
33 const requireFromOutputVia = importer => importee => {
34 const outputId = path.posix.join(path.posix.dirname(importer), importee);
35 if (outputId in exportsMap) {
36 return exportsMap[outputId];
37 }
38 const code = codeMap[outputId];
39 return code === undefined
40 ? require(importee)
41 : (exportsMap[outputId] = requireWithContext(
42 code,
43 { require: requireFromOutputVia(outputId), ...context },
44 (exportsMap[outputId] = {})
45 ));
46 };
47
48 const context = { assert, ...configContext };
49 let exports;
50 try {
51 exports = requireFromOutputVia(entryId)(entryId);
52 } catch (error) {
53 return { error, exports: error.exports };
54 }
55 return { exports };
56}
57
58runTestSuiteWithSamples(
59 'function',

Callers 1

index.jsFile · 0.85

Calls 1

requireFromOutputViaFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…