MCPcopy Create free account
hub / github.com/babel/babel / pushModule

Function pushModule

packages/babel-plugin-transform-modules-systemjs/src/index.ts:289–306  ·  view source on GitHub ↗
(
            source: string,
            key: "imports" | "exports",
            specifiers: t.ModuleSpecifier[] | t.ExportAllDeclaration,
          )

Source from the content-addressed store, hash-verified

287 }
288
289 function pushModule(
290 source: string,
291 key: "imports" | "exports",
292 specifiers: t.ModuleSpecifier[] | t.ExportAllDeclaration,
293 ) {
294 let module: ModuleMetadata | undefined;
295 modules.forEach(function (m) {
296 if (m.key === source) {
297 module = m;
298 }
299 });
300 if (!module) {
301 modules.push(
302 (module = { key: source, imports: [], exports: [] }),
303 );
304 }
305 module[key] = module[key].concat(specifiers);
306 }
307
308 function buildExportCall(name: string, val: t.Expression) {
309 return t.expressionStatement(

Callers 1

exitFunction · 0.85

Calls 2

pushMethod · 0.45
concatMethod · 0.45

Tested by

no test coverage detected