How to use @babel/plugin-proposal-pipeline-operator - 2 common examples

To help you get started, we’ve selected a few @babel/plugin-proposal-pipeline-operator 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 electron-userland / electron-builder / packages / app-builder-lib / src / ProtonFramework.ts View on Github external
function testOnlyBabel(babel: any, babelOptions: any, nodeVersion: string) {
  // out test dir can be located outside of electron-builder node_modules and babel cannot resolve string names of preset
  babelOptions.presets = [
    [require("@babel/preset-env").default, {targets: {node: nodeVersion}}],
    require("@babel/preset-react"),
  ]
  babelOptions.plugins = [
    // stage 0
    require("@babel/plugin-proposal-function-bind").default,

    // stage 1
    require("@babel/plugin-proposal-export-default-from").default,
    require("@babel/plugin-proposal-logical-assignment-operators").default,
    [require("@babel/plugin-proposal-optional-chaining").default, {loose: false}],
    [require("@babel/plugin-proposal-pipeline-operator").default, {proposal: "minimal"}],
    [require("@babel/plugin-proposal-nullish-coalescing-operator").default, {loose: false}],
    require("@babel/plugin-proposal-do-expressions").default,

    // stage 2
    [require("@babel/plugin-proposal-decorators").default, {legacy: true}],
    require("@babel/plugin-proposal-function-sent").default,
    require("@babel/plugin-proposal-export-namespace-from").default,
    require("@babel/plugin-proposal-numeric-separator").default,
    require("@babel/plugin-proposal-throw-expressions").default,

    // stage 3
    require("@babel/plugin-syntax-dynamic-import").default,
    require("@babel/plugin-syntax-import-meta").default,
    [require("@babel/plugin-proposal-class-properties").default, {loose: false}],
    require("@babel/plugin-proposal-json-strings").default,
  ]
github babel / babel / packages / babel-preset-stage-0 / src / index.js View on Github external
}

  if (decoratorsLegacy !== true) {
    throw new Error(
      "The new decorators proposal is not supported yet." +
        ' You must pass the `"decoratorsLegacy": true` option to' +
        " @babel/preset-stage-0",
    );
  }

  if (typeof pipelineProposal !== "string") {
    throw new Error(
      "The pipeline operator requires a proposal set." +
        " You must pass 'pipelineProposal' option to" +
        " @babel/preset-stage-0 whose value must be one of: " +
        proposals.join(", "),
    );
  }

  return {
    presets: [
      [
        presetStage1,
        { loose, useBuiltIns, decoratorsLegacy, pipelineProposal },
      ],
    ],
    plugins: [transformFunctionBind],
  };
});

@babel/plugin-proposal-pipeline-operator

Transform pipeline operator into call expressions

MIT
Latest version published 2 months ago

Package Health Score

95 / 100
Full package analysis