1 line
18 KiB
Plaintext
1 line
18 KiB
Plaintext
|
{"version":3,"names":["version","split","reduce","v","x","versionKey","createClassFeaturePlugin","name","feature","loose","manipulateOptions","api","assumption","inherits","setPublicClassFields","privateFieldsAsProperties","constantSuper","noDocumentAll","explicit","undefined","push","length","console","warn","join","pre","file","enableFeature","get","set","visitor","Class","path","shouldTransform","isClassDeclaration","assertFieldTransformed","isLoose","constructor","isDecorated","hasDecorators","node","props","elements","computedPaths","privateNames","Set","body","isClassProperty","isClassMethod","computed","isPrivate","key","id","getName","setName","isClassPrivateMethod","kind","has","buildCodeFrameError","add","isProperty","isStaticBlock","innerBinding","ref","isClassExpression","nameFunction","scope","generateUidIdentifier","t","cloneNode","privateNamesMap","buildPrivateNamesMap","privateNamesNodes","buildPrivateNamesNodes","transformPrivateNamesUsage","keysNodes","staticNodes","instanceNodes","pureStaticNodes","wrapClass","buildDecoratedClass","extractComputedKeys","buildFieldsInitNodes","superClass","injectInitialization","referenceVisitor","state","prop","static","traverse","wrappedPath","insertBefore","insertAfter","find","parent","isStatement","isDeclaration","ExportDefaultDeclaration","decl","splitExportDeclaration","type"],"sources":["../src/index.ts"],"sourcesContent":["import { types as t } from \"@babel/core\";\nimport type { PluginAPI, PluginObject } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport nameFunction from \"@babel/helper-function-name\";\nimport splitExportDeclaration from \"@babel/helper-split-export-declaration\";\nimport {\n buildPrivateNamesNodes,\n buildPrivateNamesMap,\n transformPrivateNamesUsage,\n buildFieldsInitNodes,\n buildCheckInRHS,\n} from \"./fields\";\nimport type { PropPath } from \"./fields\";\nimport { buildDecoratedClass, hasDecorators } from \"./decorators\";\nimport { injectInitialization, extractComputedKeys } from \"./misc\";\nimport { enableFeature, FEATURES, isLoose, shouldTransform } from \"./features\";\nimport { assertFieldTransformed } from \"./typescript\";\n\nexport { FEATURES, enableFeature, injectInitialization, buildCheckInRHS };\n\ndeclare const PACKAGE_JSON: { name: string; version: string };\n\n// Note: Versions are represented as an integer. e.g. 7.1.5 is represented\n// as 70000100005. This method is easier than using a semver-parsing\n// package, but it breaks if we release x.y.z where x, y or z are\n// greater than 99_999.\nconst version = PACKAGE_JSON.version\n .split(\".\")\n .reduce((v, x) => v * 1e5 + +x, 0);\nconst versionKey = \"@babel/plugin-class-features/version\";\n\ninterface Options {\n name: string;\n feature: number;\n loose?: boolean;\n inherits?: PluginObject[\"inherits\"];\n manipulateOptions?: PluginObject[\"manipulateOptions\"];\n api?: PluginAPI;\n}\n\nexport function createClassFeaturePlugin({\n name,\n feature,\n loose,\n manipulateOptions,\n // @ts-ignore(Babel 7 vs Babel 8) TODO(Babel 8): Remove the default value\n api = { assumption: () => void 0 },\n inherits,\n}: Options): PluginObject {\n const setPublicClassFields = api.assumption(\"setPublicClassFields\");\n const privateFieldsAsProperties = api.assumption(\"privateFieldsAsProperties\");\n const constantSuper = api.assumption(\"constantSuper\");\n const noDocumentAll = api.assumption(\"noDocumentAll\");\n\n if (loose === true) {\n const explicit = [];\n\n if (setPublicClassFields !== undefined) {\n explicit.push(`\"setPublicClassFields\"`);\n }\n if (privateFieldsAsProperties !== undefined) {\n explicit.push(`\"privateFieldsAsProperties\"`);\n }\n if (explicit.length !== 0) {\n console.warn(\n `[${name}]: You are using the \"loose: true\" option and you are` +\n ` explicitly setting a value for the ${explicit.join(\" and \")}` +\n ` assumption${explicit.length > 1 ? \"s\" : \"\"}. The \"loose\" option` +\n ` can cause incompatibili
|