or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.md
tile.json

tessl/npm-babel--preset-stage-1

Deprecated Babel preset that previously provided Stage 1 JavaScript experimental features

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@babel/preset-stage-1@7.8.x

To install, run

npx @tessl/cli install tessl/npm-babel--preset-stage-1@7.8.0

index.mddocs/

@babel/preset-stage-1

@babel/preset-stage-1 is a deprecated Babel preset package that previously provided Stage 1 JavaScript experimental features and language proposals. As of Babel v7.0.0-beta.55, all stage presets have been removed and this package now only exports an error-throwing function to guide users toward explicit plugin configuration.

Package Information

  • Package Name: @babel/preset-stage-1
  • Package Type: npm
  • Language: JavaScript (ES6 modules)
  • Installation: npm install @babel/preset-stage-1 (not recommended - deprecated)
  • Status: Deprecated since v7.0.0-beta.55

Core Imports

import preset from "@babel/preset-stage-1";

For CommonJS:

const preset = require("@babel/preset-stage-1");

Basic Usage

Warning: This package is deprecated and will throw an error when used.

import preset from "@babel/preset-stage-1";

// This will throw an Error with deprecation information
const config = preset();

Babel configuration (will throw error):

{
  "presets": ["@babel/preset-stage-1"]
}

Architecture

This package contains a single function that immediately throws an error when called. The error provides comprehensive migration guidance including:

  • Explanation of why stage presets were deprecated
  • Link to official blog post about the decision
  • Reference to the babel-upgrade migration tool
  • Complete example configuration showing equivalent plugin setup
  • Instructions for creating custom preset alternatives

Capabilities

Preset Factory Function

The main and only export that throws a deprecation error with migration guidance.

/**
 * Deprecated preset factory that throws an error with migration guidance
 * @throws {Error} Always throws with detailed deprecation information
 * @returns {never} Never returns - always throws
 */
export default function(): never;

The thrown error message includes:

  • Deprecation Notice: Explains removal of stage presets in v7.0.0-beta.55
  • Blog Post Reference: https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets
  • Migration Tool: Instructions for using babel-upgrade (npx babel-upgrade) with reference to https://github.com/babel/babel-upgrade
  • Manual Configuration: Complete plugin list equivalent to the original preset:
{
  "plugins": [
    // Stage 1
    "@babel/plugin-proposal-export-default-from",
    "@babel/plugin-proposal-logical-assignment-operators",
    ["@babel/plugin-proposal-optional-chaining", { "loose": false }],
    ["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }],
    ["@babel/plugin-proposal-nullish-coalescing-operator", { "loose": false }],
    "@babel/plugin-proposal-do-expressions",

    // Stage 2
    ["@babel/plugin-proposal-decorators", { "legacy": true }],
    "@babel/plugin-proposal-function-sent",
    "@babel/plugin-proposal-export-namespace-from",
    "@babel/plugin-proposal-numeric-separator",
    "@babel/plugin-proposal-throw-expressions",

    // Stage 3
    "@babel/plugin-syntax-dynamic-import",
    "@babel/plugin-syntax-import-meta",
    ["@babel/plugin-proposal-class-properties", { "loose": false }],
    "@babel/plugin-proposal-json-strings"
  ]
}
  • Custom Preset Example: Template for creating custom presets with selected plugins:
module.exports = function() {
  return {
    plugins: [
      require("@babel/plugin-syntax-dynamic-import"),
      [require("@babel/plugin-proposal-decorators"), { "legacy": true }],
      [require("@babel/plugin-proposal-class-properties"), { "loose": false }],
    ],
    presets: [
      // ...
    ],
  };
};

Error Handling

This package always throws an Error when the preset function is called. The error is intentional and provides migration guidance. There is no way to suppress this error - the package is designed to prevent usage and direct users to explicit plugin configuration.

Historical Context

@babel/preset-stage-1 originally provided access to experimental JavaScript features that were in Stage 1 of the TC39 proposal process. These included:

  • Export Default From: export { default } from './module' syntax
  • Logical Assignment Operators: &&=, ||=, ??= operators
  • Optional Chaining: obj?.prop?.method?.() syntax
  • Pipeline Operator: value |> transform syntax (minimal proposal)
  • Nullish Coalescing: value ?? fallback operator
  • Do Expressions: let x = do { ... } syntax

The deprecation was part of Babel's shift toward more explicit, maintainable configuration where developers consciously choose specific experimental features rather than opting into entire stage groupings.

Migration

Instead of using this deprecated preset, explicitly configure the individual plugins you need:

  1. Use babel-upgrade: npx babel-upgrade for automatic migration
  2. Manual Configuration: Copy relevant plugins from the error message
  3. Custom Preset: Create your own preset with selected plugins

For compatibility, ensure @babel/plugin-proposal-decorators comes before @babel/plugin-proposal-class-properties, and use loose: true for class properties when using legacy decorators.