@babel/plugin-proposal-nullish-coalescing-operator
Advanced tools
Comparing version 7.21.4-esm.2 to 7.21.4-esm.3
@@ -1,5 +0,11 @@ | ||
import { declare } from "@babel/helper-plugin-utils"; | ||
import syntaxNullishCoalescingOperator from "@babel/plugin-syntax-nullish-coalescing-operator"; | ||
import { types as t, template } from "@babel/core"; | ||
export default declare((api, { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _helperPluginUtils = require("@babel/helper-plugin-utils"); | ||
var _pluginSyntaxNullishCoalescingOperator = require("@babel/plugin-syntax-nullish-coalescing-operator"); | ||
var _core = require("@babel/core"); | ||
var _default = (0, _helperPluginUtils.declare)((api, { | ||
loose = false | ||
@@ -12,3 +18,3 @@ }) => { | ||
name: "proposal-nullish-coalescing-operator", | ||
inherits: syntaxNullishCoalescingOperator.default, | ||
inherits: _pluginSyntaxNullishCoalescingOperator.default, | ||
visitor: { | ||
@@ -27,5 +33,5 @@ LogicalExpression(path) { | ||
ref = node.left; | ||
assignment = t.cloneNode(node.left); | ||
assignment = _core.types.cloneNode(node.left); | ||
} else if (scope.path.isPattern()) { | ||
path.replaceWith(template.statement.ast`(() => ${path.node})()`); | ||
path.replaceWith(_core.template.statement.ast`(() => ${path.node})()`); | ||
return; | ||
@@ -35,7 +41,7 @@ } else { | ||
scope.push({ | ||
id: t.cloneNode(ref) | ||
id: _core.types.cloneNode(ref) | ||
}); | ||
assignment = t.assignmentExpression("=", ref, node.left); | ||
assignment = _core.types.assignmentExpression("=", ref, node.left); | ||
} | ||
path.replaceWith(t.conditionalExpression(noDocumentAll ? t.binaryExpression("!=", assignment, t.nullLiteral()) : t.logicalExpression("&&", t.binaryExpression("!==", assignment, t.nullLiteral()), t.binaryExpression("!==", t.cloneNode(ref), scope.buildUndefinedNode())), t.cloneNode(ref), node.right)); | ||
path.replaceWith(_core.types.conditionalExpression(noDocumentAll ? _core.types.binaryExpression("!=", assignment, _core.types.nullLiteral()) : _core.types.logicalExpression("&&", _core.types.binaryExpression("!==", assignment, _core.types.nullLiteral()), _core.types.binaryExpression("!==", _core.types.cloneNode(ref), scope.buildUndefinedNode())), _core.types.cloneNode(ref), node.right)); | ||
} | ||
@@ -45,3 +51,4 @@ } | ||
}); | ||
exports.default = _default; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@babel/plugin-proposal-nullish-coalescing-operator", | ||
"version": "7.21.4-esm.2", | ||
"version": "7.21.4-esm.3", | ||
"description": "Remove nullish coalescing operator", | ||
@@ -20,3 +20,3 @@ "repository": { | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "7.21.4-esm.2", | ||
"@babel/helper-plugin-utils": "7.21.4-esm.3", | ||
"@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" | ||
@@ -28,4 +28,4 @@ }, | ||
"devDependencies": { | ||
"@babel/core": "7.21.4-esm.2", | ||
"@babel/helper-plugin-test-runner": "7.21.4-esm.2" | ||
"@babel/core": "7.21.4-esm.3", | ||
"@babel/helper-plugin-test-runner": "7.21.4-esm.3" | ||
}, | ||
@@ -32,0 +32,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
9116
49
+ Added@babel/helper-plugin-utils@7.21.4-esm.3(transitive)
- Removed@babel/helper-plugin-utils@7.21.4-esm.2(transitive)