8889841cREADME.md 0000666 00000000526 15047700413 0006033 0 ustar 00 # @babel/helper-replace-supers
> Helper function to replace supers
See our website [@babel/helper-replace-supers](https://babeljs.io/docs/en/babel-helper-replace-supers) for more information.
## Install
Using npm:
```sh
npm install --save @babel/helper-replace-supers
```
or using yarn:
```sh
yarn add @babel/helper-replace-supers
```
lib/index.js 0000666 00000017342 15047700413 0006773 0 ustar 00 "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
Object.defineProperty(exports, "environmentVisitor", {
enumerable: true,
get: function () {
return _helperEnvironmentVisitor.default;
}
});
Object.defineProperty(exports, "skipAllButComputedKey", {
enumerable: true,
get: function () {
return _helperEnvironmentVisitor.skipAllButComputedKey;
}
});
var _helperEnvironmentVisitor = require("@babel/helper-environment-visitor");
var _helperMemberExpressionToFunctions = require("@babel/helper-member-expression-to-functions");
var _helperOptimiseCallExpression = require("@babel/helper-optimise-call-expression");
var _template = require("@babel/template");
var _traverse = require("@babel/traverse");
var _t = require("@babel/types");
const {
assignmentExpression,
booleanLiteral,
callExpression,
cloneNode,
identifier,
memberExpression,
sequenceExpression,
stringLiteral,
thisExpression
} = _t;
function getPrototypeOfExpression(objectRef, isStatic, file, isPrivateMethod) {
objectRef = cloneNode(objectRef);
const targetRef = isStatic || isPrivateMethod ? objectRef : memberExpression(objectRef, identifier("prototype"));
return callExpression(file.addHelper("getPrototypeOf"), [targetRef]);
}
const visitor = _traverse.default.visitors.merge([_helperEnvironmentVisitor.default, {
Super(path, state) {
const {
node,
parentPath
} = path;
if (!parentPath.isMemberExpression({
object: node
})) return;
state.handle(parentPath);
}
}]);
const unshadowSuperBindingVisitor = _traverse.default.visitors.merge([_helperEnvironmentVisitor.default, {
Scopable(path, {
refName
}) {
const binding = path.scope.getOwnBinding(refName);
if (binding && binding.identifier.name === refName) {
path.scope.rename(refName);
}
}
}]);
const specHandlers = {
memoise(superMember, count) {
const {
scope,
node
} = superMember;
const {
computed,
property
} = node;
if (!computed) {
return;
}
const memo = scope.maybeGenerateMemoised(property);
if (!memo) {
return;
}
this.memoiser.set(property, memo, count);
},
prop(superMember) {
const {
computed,
property
} = superMember.node;
if (this.memoiser.has(property)) {
return cloneNode(this.memoiser.get(property));
}
if (computed) {
return cloneNode(property);
}
return stringLiteral(property.name);
},
get(superMember) {
return this._get(superMember, this._getThisRefs());
},
_get(superMember, thisRefs) {
const proto = getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod);
return callExpression(this.file.addHelper("get"), [
thisRefs.memo ? sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), thisRefs.this]);
},
_getThisRefs() {
if (!this.isDerivedConstructor) {
return {
this: thisExpression()
};
}
const thisRef = this.scope.generateDeclaredUidIdentifier("thisSuper");
return {
memo: assignmentExpression("=", thisRef, thisExpression()),
this: cloneNode(thisRef)
};
},
set(superMember, value) {
const thisRefs = this._getThisRefs();
const proto = getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod);
return callExpression(this.file.addHelper("set"), [
thisRefs.memo ? sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), value, thisRefs.this, booleanLiteral(superMember.isInStrictMode())]);
},
destructureSet(superMember) {
throw superMember.buildCodeFrameError(`Destructuring to a super field is not supported yet.`);
},
call(superMember, args) {
const thisRefs = this._getThisRefs();
return (0, _helperOptimiseCallExpression.default)(this._get(superMember, thisRefs), cloneNode(thisRefs.this), args, false);
},
optionalCall(superMember, args) {
const thisRefs = this._getThisRefs();
return (0, _helperOptimiseCallExpression.default)(this._get(superMember, thisRefs), cloneNode(thisRefs.this), args, true);
},
delete(superMember) {
if (superMember.node.computed) {
return sequenceExpression([callExpression(this.file.addHelper("toPropertyKey"), [cloneNode(superMember.node.property)]), _template.default.expression.ast`
function () { throw new ReferenceError("'delete super[expr]' is invalid"); }()
`]);
} else {
return _template.default.expression.ast`
function () { throw new ReferenceError("'delete super.prop' is invalid"); }()
`;
}
}
};
const looseHandlers = Object.assign({}, specHandlers, {
prop(superMember) {
const {
property
} = superMember.node;
if (this.memoiser.has(property)) {
return cloneNode(this.memoiser.get(property));
}
return cloneNode(property);
},
get(superMember) {
const {
isStatic,
getSuperRef
} = this;
const {
computed
} = superMember.node;
const prop = this.prop(superMember);
let object;
if (isStatic) {
var _getSuperRef;
object = (_getSuperRef = getSuperRef()) != null ? _getSuperRef : memberExpression(identifier("Function"), identifier("prototype"));
} else {
var _getSuperRef2;
object = memberExpression((_getSuperRef2 = getSuperRef()) != null ? _getSuperRef2 : identifier("Object"), identifier("prototype"));
}
return memberExpression(object, prop, computed);
},
set(superMember, value) {
const {
computed
} = superMember.node;
const prop = this.prop(superMember);
return assignmentExpression("=", memberExpression(thisExpression(), prop, computed), value);
},
destructureSet(superMember) {
const {
computed
} = superMember.node;
const prop = this.prop(superMember);
return memberExpression(thisExpression(), prop, computed);
},
call(superMember, args) {
return (0, _helperOptimiseCallExpression.default)(this.get(superMember), thisExpression(), args, false);
},
optionalCall(superMember, args) {
return (0, _helperOptimiseCallExpression.default)(this.get(superMember), thisExpression(), args, true);
}
});
class ReplaceSupers {
constructor(opts) {
var _opts$constantSuper;
const path = opts.methodPath;
this.methodPath = path;
this.isDerivedConstructor = path.isClassMethod({
kind: "constructor"
}) && !!opts.superRef;
this.isStatic = path.isObjectMethod() ||
path.node.static || (path.isStaticBlock == null ? void 0 : path.isStaticBlock());
this.isPrivateMethod = path.isPrivate() && path.isMethod();
this.file = opts.file;
this.constantSuper = (_opts$constantSuper = opts.constantSuper) != null ? _opts$constantSuper : opts.isLoose;
this.opts = opts;
}
getObjectRef() {
return cloneNode(this.opts.objectRef || this.opts.getObjectRef());
}
getSuperRef() {
if (this.opts.superRef) return cloneNode(this.opts.superRef);
if (this.opts.getSuperRef) {
return cloneNode(this.opts.getSuperRef());
}
}
replace() {
if (this.opts.refToPreserve) {
this.methodPath.traverse(unshadowSuperBindingVisitor, {
refName: this.opts.refToPreserve.name
});
}
const handler = this.constantSuper ? looseHandlers : specHandlers;
(0, _helperMemberExpressionToFunctions.default)(this.methodPath, visitor, Object.assign({
file: this.file,
scope: this.methodPath.scope,
isDerivedConstructor: this.isDerivedConstructor,
isStatic: this.isStatic,
isPrivateMethod: this.isPrivateMethod,
getObjectRef: this.getObjectRef.bind(this),
getSuperRef: this.getSuperRef.bind(this),
boundGet: handler.get
}, handler));
}
}
exports.default = ReplaceSupers;
//# sourceMappingURL=index.js.map
lib/index.js.map 0000666 00000051002 15047700413 0007536 0 ustar 00 {"version":3,"names":["assignmentExpression","booleanLiteral","callExpression","cloneNode","identifier","memberExpression","sequenceExpression","stringLiteral","thisExpression","getPrototypeOfExpression","objectRef","isStatic","file","isPrivateMethod","targetRef","addHelper","visitor","traverse","visitors","merge","environmentVisitor","Super","path","state","node","parentPath","isMemberExpression","object","handle","unshadowSuperBindingVisitor","Scopable","refName","binding","scope","getOwnBinding","name","rename","specHandlers","memoise","superMember","count","computed","property","memo","maybeGenerateMemoised","memoiser","set","prop","has","get","_get","_getThisRefs","thisRefs","proto","getObjectRef","this","isDerivedConstructor","thisRef","generateDeclaredUidIdentifier","value","isInStrictMode","destructureSet","buildCodeFrameError","call","args","optimiseCall","optionalCall","delete","template","expression","ast","looseHandlers","getSuperRef","ReplaceSupers","constructor","opts","methodPath","isClassMethod","kind","superRef","isObjectMethod","static","isStaticBlock","isPrivate","isMethod","constantSuper","isLoose","replace","refToPreserve","handler","memberExpressionToFunctions","bind","boundGet"],"sources":["../src/index.ts"],"sourcesContent":["import type { File } from \"@babel/core\";\nimport environmentVisitor from \"@babel/helper-environment-visitor\";\nimport memberExpressionToFunctions from \"@babel/helper-member-expression-to-functions\";\nimport type { HandlerState } from \"@babel/helper-member-expression-to-functions\";\nimport optimiseCall from \"@babel/helper-optimise-call-expression\";\nimport template from \"@babel/template\";\nimport traverse from \"@babel/traverse\";\nimport type { NodePath, Scope } from \"@babel/traverse\";\nimport {\n assignmentExpression,\n booleanLiteral,\n callExpression,\n cloneNode,\n identifier,\n memberExpression,\n sequenceExpression,\n stringLiteral,\n thisExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\n// TODO (Babel 8): Don't export this.\nexport {\n default as environmentVisitor,\n skipAllButComputedKey,\n} from \"@babel/helper-environment-visitor\";\n\ntype ThisRef =\n | {\n memo: t.AssignmentExpression;\n this: t.Identifier;\n }\n | { this: t.ThisExpression };\n/**\n * Creates an expression which result is the proto of objectRef.\n *\n * @example
isStatic === true\n *\n * helpers.getPrototypeOf(CLASS)\n *\n * @example isStatic === false\n *\n * helpers.getPrototypeOf(CLASS.prototype)\n */\nfunction getPrototypeOfExpression(\n objectRef: t.Identifier,\n isStatic: boolean,\n file: File,\n isPrivateMethod: boolean,\n) {\n objectRef = cloneNode(objectRef);\n const targetRef =\n isStatic || isPrivateMethod\n ? objectRef\n : memberExpression(objectRef, identifier(\"prototype\"));\n\n return callExpression(file.addHelper(\"getPrototypeOf\"), [targetRef]);\n}\n\nconst visitor = traverse.visitors.merge<\n HandlerState & ReplaceState\n>([\n environmentVisitor,\n {\n Super(path, state) {\n const { node, parentPath } = path;\n if (!parentPath.isMemberExpression({ object: node })) return;\n state.handle(parentPath);\n },\n },\n]);\n\nconst unshadowSuperBindingVisitor = traverse.visitors.merge<{\n refName: string;\n}>([\n environmentVisitor,\n {\n Scopable(path, { refName }) {\n // https://github.com/Zzzen/babel/pull/1#pullrequestreview-564833183\n const binding = path.scope.getOwnBinding(refName);\n if (binding && binding.identifier.name === refName) {\n path.scope.rename(refName);\n }\n },\n },\n]);\n\ntype SharedState = {\n file: File;\n scope: Scope;\n isDerivedConstructor: boolean;\n isStatic: boolean;\n isPrivateMethod: boolean;\n getObjectRef: () => t.Identifier;\n getSuperRef: () => t.Identifier;\n // we dont need boundGet here, but memberExpressionToFunctions handler needs it.\n boundGet: HandlerState[\"get\"];\n};\n\ntype Handler = HandlerState & SharedState;\ntype SuperMember = NodePath<\n | t.MemberExpression & {\n object: t.Super;\n property: Exclude;\n }\n>;\n\ninterface SpecHandler\n extends Pick<\n Handler,\n | \"memoise\"\n | \"get\"\n | \"set\"\n | \"destructureSet\"\n | \"call\"\n | \"optionalCall\"\n | \"delete\"\n > {\n _get(\n this: Handler & SpecHandler,\n superMember: SuperMember,\n thisRefs: ThisRef,\n ): t.CallExpression;\n _getThisRefs(): ThisRef;\n prop(this: Handler & SpecHandler, superMember: SuperMember): t.Expression;\n}\n\nconst specHandlers: SpecHandler = {\n memoise(\n this: Handler & SpecHandler,\n superMember: SuperMember,\n count: number,\n ) {\n const { scope, node } = superMember;\n const { computed, property } = node;\n if (!computed) {\n return;\n }\n\n const memo = scope.maybeGenerateMemoised(property);\n if (!memo) {\n return;\n }\n\n this.memoiser.set(property, memo, count);\n },\n\n prop(this: Handler & SpecHandler, superMember: SuperMember) {\n const { computed, property } = superMember.node;\n if (this.memoiser.has(property)) {\n return cloneNode(this.memoiser.get(property));\n }\n\n if (computed) {\n return cloneNode(property);\n }\n\n return stringLiteral((property as t.Identifier).name);\n },\n\n get(this: Handler & SpecHandler, superMember: SuperMember) {\n return this._get(superMember, this._getThisRefs());\n },\n\n _get(\n this: Handler & SpecHandler,\n superMember: SuperMember,\n thisRefs: ThisRef,\n ) {\n const proto = getPrototypeOfExpression(\n this.getObjectRef(),\n this.isStatic,\n this.file,\n this.isPrivateMethod,\n );\n return callExpression(this.file.addHelper(\"get\"), [\n // @ts-expect-error memo does not exist when this.isDerivedConstructor is false\n thisRefs.memo ? sequenceExpression([thisRefs.memo, proto]) : proto,\n this.prop(superMember),\n thisRefs.this,\n ]);\n },\n\n _getThisRefs(this: Handler & SpecHandler): ThisRef {\n if (!this.isDerivedConstructor) {\n return { this: thisExpression() };\n }\n const thisRef = this.scope.generateDeclaredUidIdentifier(\"thisSuper\");\n return {\n memo: assignmentExpression(\"=\", thisRef, thisExpression()),\n this: cloneNode(thisRef),\n };\n },\n\n set(\n this: Handler & SpecHandler,\n superMember: SuperMember,\n value: t.Expression,\n ) {\n const thisRefs = this._getThisRefs();\n const proto = getPrototypeOfExpression(\n this.getObjectRef(),\n this.isStatic,\n this.file,\n this.isPrivateMethod,\n );\n return callExpression(this.file.addHelper(\"set\"), [\n // @ts-expect-error memo does not exist when this.isDerivedConstructor is false\n thisRefs.memo ? sequenceExpression([thisRefs.memo, proto]) : proto,\n this.prop(superMember),\n value,\n thisRefs.this,\n booleanLiteral(superMember.isInStrictMode()),\n ]);\n },\n\n destructureSet(this: Handler & SpecHandler, superMember: SuperMember) {\n throw superMember.buildCodeFrameError(\n `Destructuring to a super field is not supported yet.`,\n );\n },\n\n call(\n this: Handler & SpecHandler,\n superMember: SuperMember,\n args: t.CallExpression[\"arguments\"],\n ) {\n const thisRefs = this._getThisRefs();\n return optimiseCall(\n this._get(superMember, thisRefs),\n cloneNode(thisRefs.this),\n args,\n false,\n );\n },\n\n optionalCall(\n this: Handler & SpecHandler,\n superMember: SuperMember,\n args: t.CallExpression[\"arguments\"],\n ) {\n const thisRefs = this._getThisRefs();\n return optimiseCall(\n this._get(superMember, thisRefs),\n cloneNode(thisRefs.this),\n args,\n true,\n );\n },\n\n delete(this: Handler & SpecHandler, superMember: SuperMember) {\n if (superMember.node.computed) {\n return sequenceExpression([\n callExpression(this.file.addHelper(\"toPropertyKey\"), [\n cloneNode(superMember.node.property),\n ]),\n template.expression.ast`\n function () { throw new ReferenceError(\"'delete super[expr]' is invalid\"); }()\n `,\n ]);\n } else {\n return template.expression.ast`\n function () { throw new ReferenceError(\"'delete super.prop' is invalid\"); }()\n `;\n }\n },\n};\n\nconst looseHandlers = {\n ...specHandlers,\n\n prop(this: Handler & typeof specHandlers, superMember: SuperMember) {\n const { property } = superMember.node;\n if (this.memoiser.has(property)) {\n return cloneNode(this.memoiser.get(property));\n }\n\n return cloneNode(property);\n },\n\n get(this: Handler & typeof specHandlers, superMember: SuperMember) {\n const { isStatic, getSuperRef } = this;\n const { computed } = superMember.node;\n const prop = this.prop(superMember);\n\n let object;\n if (isStatic) {\n object =\n getSuperRef() ??\n memberExpression(identifier(\"Function\"), identifier(\"prototype\"));\n } else {\n object = memberExpression(\n getSuperRef() ?? identifier(\"Object\"),\n identifier(\"prototype\"),\n );\n }\n\n return memberExpression(object, prop, computed);\n },\n\n set(\n this: Handler & typeof specHandlers,\n superMember: SuperMember,\n value: t.Expression,\n ) {\n const { computed } = superMember.node;\n const prop = this.prop(superMember);\n\n return assignmentExpression(\n \"=\",\n memberExpression(thisExpression(), prop, computed),\n value,\n );\n },\n\n destructureSet(\n this: Handler & typeof specHandlers,\n superMember: SuperMember,\n ) {\n const { computed } = superMember.node;\n const prop = this.prop(superMember);\n\n return memberExpression(thisExpression(), prop, computed);\n },\n\n call(\n this: Handler & typeof specHandlers,\n superMember: SuperMember,\n args: t.CallExpression[\"arguments\"],\n ) {\n return optimiseCall(this.get(superMember), thisExpression(), args, false);\n },\n\n optionalCall(\n this: Handler & typeof specHandlers,\n superMember: SuperMember,\n args: t.CallExpression[\"arguments\"],\n ) {\n return optimiseCall(this.get(superMember), thisExpression(), args, true);\n },\n};\n\ntype ReplaceSupersOptionsBase = {\n methodPath: NodePath<\n | t.ClassMethod\n | t.ClassProperty\n | t.ObjectMethod\n | t.ClassPrivateMethod\n | t.ClassPrivateProperty\n | t.StaticBlock\n >;\n constantSuper?: boolean;\n file: File;\n // objectRef might have been shadowed in child scopes,\n // in that case, we need to rename related variables.\n refToPreserve?: t.Identifier;\n};\n\ntype ReplaceSupersOptions = ReplaceSupersOptionsBase &\n (\n | { objectRef?: undefined; getObjectRef: () => t.Node }\n | { objectRef: t.Node; getObjectRef?: undefined }\n ) &\n (\n | { superRef?: undefined; getSuperRef: () => t.Node }\n | { superRef: t.Node; getSuperRef?: undefined }\n );\n\ninterface ReplaceState {\n file: File;\n scope: Scope;\n isDerivedConstructor: boolean;\n isStatic: boolean;\n isPrivateMethod: boolean;\n getObjectRef: ReplaceSupers[\"getObjectRef\"];\n getSuperRef: ReplaceSupers[\"getSuperRef\"];\n}\n\nexport default class ReplaceSupers {\n constructor(opts: ReplaceSupersOptions) {\n const path = opts.methodPath;\n\n this.methodPath = path;\n this.isDerivedConstructor =\n path.isClassMethod({ kind: \"constructor\" }) && !!opts.superRef;\n this.isStatic =\n path.isObjectMethod() ||\n // @ts-expect-error static is not in ClassPrivateMethod\n path.node.static ||\n path.isStaticBlock?.();\n this.isPrivateMethod = path.isPrivate() && path.isMethod();\n\n this.file = opts.file;\n this.constantSuper = process.env.BABEL_8_BREAKING\n ? opts.constantSuper\n : // Fallback to isLoose for backward compatibility\n opts.constantSuper ?? (opts as any).isLoose;\n this.opts = opts;\n }\n\n declare file: File;\n declare isDerivedConstructor: boolean;\n declare constantSuper: boolean;\n declare isPrivateMethod: boolean;\n declare isStatic: boolean;\n declare methodPath: NodePath;\n declare opts: ReplaceSupersOptions;\n\n getObjectRef() {\n return cloneNode(this.opts.objectRef || this.opts.getObjectRef());\n }\n\n getSuperRef() {\n if (this.opts.superRef) return cloneNode(this.opts.superRef);\n if (this.opts.getSuperRef) {\n return cloneNode(this.opts.getSuperRef());\n }\n }\n\n replace() {\n // https://github.com/babel/babel/issues/11994\n if (this.opts.refToPreserve) {\n this.methodPath.traverse(unshadowSuperBindingVisitor, {\n refName: this.opts.refToPreserve.name,\n });\n }\n\n const handler = this.constantSuper ? looseHandlers : specHandlers;\n\n memberExpressionToFunctions(this.methodPath, visitor, {\n file: this.file,\n scope: this.methodPath.scope,\n isDerivedConstructor: this.isDerivedConstructor,\n isStatic: this.isStatic,\n isPrivateMethod: this.isPrivateMethod,\n getObjectRef: this.getObjectRef.bind(this),\n getSuperRef: this.getSuperRef.bind(this),\n // we dont need boundGet here, but memberExpressionToFunctions handler needs it.\n boundGet: handler.get,\n ...handler,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AACA;AACA;AAEA;AACA;AACA;AAEA;AAUsB;EATpBA,oBAAoB;EACpBC,cAAc;EACdC,cAAc;EACdC,SAAS;EACTC,UAAU;EACVC,gBAAgB;EAChBC,kBAAkB;EAClBC,aAAa;E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ACI,QAAQ,EAAE,OAAO5E,SAAS,CAAC,IAAI,CAACwE,IAAI,CAACI,QAAQ,CAAC;IAC5D,IAAI,IAAI,CAACJ,IAAI,CAACH,WAAW,EAAE;MACzB,OAAOrE,SAAS,CAAC,IAAI,CAACwE,IAAI,CAACH,WAAW,EAAE,CAAC;IAC3C;EACF;EAEAe,OAAO,GAAG;IAER,IAAI,IAAI,CAACZ,IAAI,CAACa,aAAa,EAAE;MAC3B,IAAI,CAACZ,UAAU,CAAC3D,QAAQ,CAACY,2BAA2B,EAAE;QACpDE,OAAO,EAAE,IAAI,CAAC4C,IAAI,CAACa,aAAa,CAACrD;MACnC,CAAC,CAAC;IACJ;IAEA,MAAMsD,OAAO,GAAG,IAAI,CAACJ,aAAa,GAAGd,aAAa,GAAGlC,YAAY;IAEjE,IAAAqD,0CAA2B,EAAe,IAAI,CAACd,UAAU,EAAE5D,OAAO;MAChEJ,IAAI,EAAE,IAAI,CAACA,IAAI;MACfqB,KAAK,EAAE,IAAI,CAAC2C,UAAU,CAAC3C,KAAK;MAC5BuB,oBAAoB,EAAE,IAAI,CAACA,oBAAoB;MAC/C7C,QAAQ,EAAE,IAAI,CAACA,QAAQ;MACvBE,eAAe,EAAE,IAAI,CAACA,eAAe;MACrCyC,YAAY,EAAE,IAAI,CAACA,YAAY,CAACqC,IAAI,CAAC,IAAI,CAAC;MAC1CnB,WAAW,EAAE,IAAI,CAACA,WAAW,CAACmB,IAAI,CAAC,IAAI,CAAC;MAExCC,QAAQ,EAAEH,OAAO,CAACxC;IAAG,GAClBwC,OAAO,EACV;EACJ;AACF;AAAC"} LICENSE 0000666 00000002122 15047700413 0005553 0 ustar 00 MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package.json 0000666 00000001527 15047700413 0007044 0 ustar 00 {
"name": "@babel/helper-replace-supers",
"version": "7.20.7",
"description": "Helper function to replace supers",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-helper-replace-supers"
},
"homepage": "https://babel.dev/docs/en/next/babel-helper-replace-supers",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "./lib/index.js",
"dependencies": {
"@babel/helper-environment-visitor": "^7.18.9",
"@babel/helper-member-expression-to-functions": "^7.20.7",
"@babel/helper-optimise-call-expression": "^7.18.6",
"@babel/template": "^7.20.7",
"@babel/traverse": "^7.20.7",
"@babel/types": "^7.20.7"
},
"engines": {
"node": ">=6.9.0"
},
"author": "The Babel Team (https://babel.dev/team)",
"type": "commonjs"
}