How to use the @babel/traverse.explode function in @babel/traverse

To help you get started, we’ve selected a few @babel/traverse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github babel / babel / packages / babel-core / src / config / option-manager.js View on Github external
(
    { value, options, dirname, alias }: LoadedDescriptor,
    cache: CacheConfigurator<{ envName: string }>,
  ): Plugin => {
    const pluginObj = validatePluginObject(value);

    const plugin = Object.assign({}, pluginObj);
    if (plugin.visitor) {
      plugin.visitor = traverse.explode(clone(plugin.visitor));
    }

    if (plugin.inherits) {
      const inheritsDescriptor = {
        name: undefined,
        alias: `${alias}$inherits`,
        value: plugin.inherits,
        options,
        dirname,
      };

      // If the inherited plugin changes, reinstantiate this plugin.
      const inherits = cache.invalidate(data =>
        loadPluginDescriptor(inheritsDescriptor, data.envName),
      );
github babel / babel / packages / babel-core / src / config / full.js View on Github external
(
    { value, options, dirname, alias }: LoadedDescriptor,
    cache: CacheConfigurator,
  ): Plugin => {
    const pluginObj = validatePluginObject(value);

    const plugin = {
      ...pluginObj,
    };
    if (plugin.visitor) {
      plugin.visitor = traverse.explode({
        ...plugin.visitor,
      });
    }

    if (plugin.inherits) {
      const inheritsDescriptor = {
        name: undefined,
        alias: `${alias}$inherits`,
        value: plugin.inherits,
        options,
        dirname,
      };

      // If the inherited plugin changes, reinstantiate this plugin.
      const inherits = cache.invalidate(data =>
        loadPluginDescriptor(inheritsDescriptor, data),

@babel/traverse

The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes

MIT
Latest version published 26 days ago

Package Health Score

95 / 100
Full package analysis