How to use the @babel/helpers/package.json.version function in @babel/helpers

To help you get started, we’ve selected a few @babel/helpers 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 instructure / instructure-ui / packages / ui-babel-preset / lib / index.js View on Github external
transform: (importName, matches) => {
            if (!matches || !matches[1] || matches[1] === '@instructure/ui-test-utils') return
            return `${matches[1]}/lib/${importName}`
          }
        }
      }
    ])
  }

  // Work around https://github.com/babel/babel/issues/10261, which causes
  // Babel to not use the runtime helpers for things like _objectSpread.
  // Remove this once that babel issue is fixed
  let babelHelperVersion = {}
  try {
    // eslint-disable-next-line import/no-extraneous-dependencies
    const version = require('@babel/helpers/package.json').version
    babelHelperVersion.version = version
  } catch (e) {
    // if something goes wrong, continue and don't try to explicitly set a helper version
  }

  plugins = plugins.concat([
    require('babel-plugin-macros'),
    require('@babel/plugin-transform-destructuring').default,
    [require('@babel/plugin-proposal-decorators').default, { legacy: true }], // must run before themeable-styles plugin below
    [require('@babel/plugin-proposal-class-properties').default, { loose: true }],
    require('@babel/plugin-proposal-export-default-from').default,
    [require('@babel/plugin-proposal-object-rest-spread').default, { useBuiltIns: true }],
    require('@babel/plugin-proposal-optional-chaining').default,
    [require('@babel/plugin-transform-runtime').default, {
      ...babelHelperVersion,
      corejs: false,
github Automattic / wp-calypso / packages / calypso-build / babel / default.js View on Github external
plugins: [
		require.resolve( '@babel/plugin-proposal-class-properties' ),
		require.resolve( '@babel/plugin-proposal-nullish-coalescing-operator' ),
		require.resolve( '@babel/plugin-proposal-optional-chaining' ),
		require.resolve( '@babel/plugin-syntax-dynamic-import' ),
		[
			require.resolve( '@babel/plugin-transform-runtime' ),
			{
				corejs: false, // we polyfill so we don't need core-js
				helpers: true,
				regenerator: false,
				useESModules: false,
				// Needed so that helpers aren't duplicated.
				// This will need to be kept up to date while https://github.com/babel/babel/issues/10261 is unresolved.
				// eslint-disable-next-line import/no-extraneous-dependencies
				version: require( '@babel/helpers/package.json' ).version,
			},
		],
	],
} );

@babel/helpers

Collection of helper functions used by Babel transforms.

MIT
Latest version published 2 months ago

Package Health Score

95 / 100
Full package analysis

Similar packages