MCPcopy Create free account
hub / github.com/parse-community/parse-server / plugin

Function plugin

resources/buildConfigDefinitions.js:355–383  ·  view source on GitHub ↗
(babel)

Source from the content-addressed store, hash-verified

353};
354let docs = ``;
355const plugin = function (babel) {
356 const t = babel.types;
357 const moduleExports = t.memberExpression(t.identifier('module'), t.identifier('exports'));
358 return {
359 visitor: {
360 ImportDeclaration: function (path) {
361 path.remove();
362 },
363 Program: function (path) {
364 // Inject the parser's loader
365 path.unshiftContainer('body', makeRequire('parsers', './parsers', t));
366 },
367 ExportDeclaration: function (path) {
368 // Export declaration on an interface
369 if (
370 path.node &&
371 path.node.declaration &&
372 path.node.declaration.type == 'InterfaceDeclaration'
373 ) {
374 const { results, comments } = inject(t, doInterface(path.node.declaration));
375 const id = path.node.declaration.id.name;
376 const exports = t.memberExpression(moduleExports, t.identifier(id));
377 docs += `/**\n * @interface ${id}\n${comments} */\n\n`;
378 path.replaceWith(t.assignmentExpression('=', exports, t.objectExpression(results)));
379 }
380 },
381 },
382 };
383};
384
385const auxiliaryCommentBefore = `
386**** GENERATED CODE ****

Callers

nothing calls this directly

Calls 3

makeRequireFunction · 0.85
injectFunction · 0.85
doInterfaceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…