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

Function pushModule

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

Source from the content-addressed store, hash-verified

279 }
280
281 function pushModule(
282 source: string,
283 key: "imports" | "exports",
284 specifiers: t.ModuleSpecifier[] | t.ExportAllDeclaration,
285 ) {
286 let module: ModuleMetadata | undefined;
287 modules.forEach(function (m) {
288 if (m.key === source) {
289 module = m;
290 }
291 });
292 if (!module) {
293 modules.push(
294 (module = { key: source, imports: [], exports: [] }),
295 );
296 }
297 module[key] = module[key].concat(specifiers);
298 }
299
300 function buildExportCall(name: string, val: t.Expression) {
301 return t.expressionStatement(

Callers 1

exitFunction · 0.85

Calls 2

pushMethod · 0.45
concatMethod · 0.45

Tested by

no test coverage detected