babel-compat
Advanced tools
Comparing version 0.22.2-alpha.0 to 0.22.2-alpha.1
@@ -11,10 +11,37 @@ /* | ||
const UNEVALUATED_HELPERS = [ | ||
'arrayLikeToArray', | ||
"classApplyDescriptorDestructureSet", | ||
"classApplyDescriptorGet", | ||
"classApplyDescriptorSet", | ||
"classCheckPrivateStaticAccess", | ||
"classCheckPrivateStaticFieldDescriptor", | ||
"classExtractFieldDescriptor", | ||
"classStaticPrivateFieldDestructureSet", | ||
'classPrivateFieldDestructureSet', | ||
'classPrivateMethodGet', | ||
'classPrivateMethodSet', | ||
'classStaticPrivateMethodGet', | ||
'classStaticPrivateMethodSet', | ||
'createForOfIteratorHelper', | ||
'createForOfIteratorHelperLoose', | ||
'createSuper', | ||
'isNativeReflectConstruct', | ||
'maybeArrayLike', | ||
'objectSpread2', | ||
'tdz', | ||
'toPrimitive', | ||
'unsupportedIterableToArray', | ||
'wrapRegExp', | ||
'writeOnlyError', | ||
]; | ||
/** | ||
* List of all the supported babel helpers. | ||
*/ | ||
const HELPERS_WHITELIST = [ | ||
const SUPPORTED_HELPERS = [ | ||
'AsyncGenerator', | ||
'AwaitValue', | ||
'applyDecoratedDescriptor', | ||
'arrayLikeToArray', | ||
'arrayWithHoles', | ||
@@ -29,13 +56,5 @@ 'arrayWithoutHoles', | ||
'classNameTDZError', | ||
'classPrivateFieldDestructureSet', | ||
'classPrivateMethodGet', | ||
'classPrivateMethodSet', | ||
'classStaticPrivateFieldSpecGet', | ||
'classStaticPrivateFieldSpecSet', | ||
'classStaticPrivateMethodGet', | ||
'classStaticPrivateMethodSet', | ||
'createClass', | ||
'createForOfIteratorHelper', | ||
'createForOfIteratorHelperLoose', | ||
'createSuper', | ||
'decorate', | ||
@@ -59,3 +78,2 @@ 'defaults', | ||
'isNativeFunction', | ||
'isNativeReflectConstruct', | ||
'iterableToArray', | ||
@@ -65,3 +83,2 @@ 'iterableToArrayLimit', | ||
'jsx', | ||
'maybeArrayLike', | ||
@@ -73,3 +90,2 @@ 'newArrowCheck', | ||
'objectSpread', | ||
'objectSpread2', | ||
'objectWithoutProperties', | ||
@@ -85,3 +101,2 @@ 'objectWithoutPropertiesLoose', | ||
'taggedTemplateLiteralLoose', | ||
'tdz', | ||
'temporalRef', | ||
@@ -91,10 +106,7 @@ 'temporalUndefined', | ||
'toConsumableArray', | ||
'toPrimitive', | ||
'toPropertyKey', | ||
'typeof', | ||
'unsupportedIterableToArray', | ||
'wrapAsyncGenerator', | ||
'wrapNativeSuper', | ||
'wrapRegExp', | ||
'writeOnlyError', | ||
...UNEVALUATED_HELPERS, | ||
]; | ||
@@ -105,3 +117,3 @@ | ||
const helpers = HELPERS_WHITELIST; | ||
const helpers = SUPPORTED_HELPERS; | ||
const pureHelpers = PURE_HELPERS; | ||
@@ -120,3 +132,3 @@ | ||
function generateHelperAST(helperName) { | ||
if (HELPERS_WHITELIST.includes(helperName)) { | ||
if (SUPPORTED_HELPERS.includes(helperName)) { | ||
const helperNodes = getHelper(helperName); | ||
@@ -123,0 +135,0 @@ return tranformRelativeImports(helperNodes); |
@@ -0,26 +1,6 @@ | ||
import classApplyDescriptorDestructureSet from "./classApplyDescriptorDestructureSet"; | ||
import classExtractFieldDescriptor from "./classExtractFieldDescriptor"; | ||
export default function _classPrivateFieldDestructureSet(receiver, privateMap) { | ||
if (!privateMap.has(receiver)) { | ||
throw new TypeError("attempted to set private field on non-instance"); | ||
} | ||
var descriptor = privateMap.get(receiver); | ||
if (descriptor.set) { | ||
if (!("__destrObj" in descriptor)) { | ||
descriptor.__destrObj = { | ||
set value(v) { | ||
descriptor.set.call(receiver, v); | ||
} | ||
}; | ||
} | ||
return descriptor.__destrObj; | ||
} else { | ||
if (!descriptor.writable) { | ||
throw new TypeError("attempted to set read only private field"); | ||
} | ||
return descriptor; | ||
} | ||
var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); | ||
return classApplyDescriptorDestructureSet(receiver, descriptor); | ||
} |
@@ -0,11 +1,8 @@ | ||
import classApplyDescriptorGet from "./classApplyDescriptorGet"; | ||
import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess"; | ||
import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor"; | ||
export default function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) { | ||
if (receiver !== classConstructor) { | ||
throw new TypeError("Private static access of wrong provenance"); | ||
} | ||
if (descriptor.get) { | ||
return descriptor.get.call(receiver); | ||
} | ||
return descriptor.value; | ||
classCheckPrivateStaticAccess(receiver, classConstructor); | ||
classCheckPrivateStaticFieldDescriptor(descriptor, "get"); | ||
return classApplyDescriptorGet(receiver, descriptor); | ||
} |
@@ -0,17 +1,9 @@ | ||
import classApplyDescriptorSet from "./classApplyDescriptorSet"; | ||
import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess"; | ||
import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor"; | ||
export default function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) { | ||
if (receiver !== classConstructor) { | ||
throw new TypeError("Private static access of wrong provenance"); | ||
} | ||
if (descriptor.set) { | ||
descriptor.set.call(receiver, value); | ||
} else { | ||
if (!descriptor.writable) { | ||
throw new TypeError("attempted to set read only private field"); | ||
} | ||
descriptor.value = value; | ||
} | ||
classCheckPrivateStaticAccess(receiver, classConstructor); | ||
classCheckPrivateStaticFieldDescriptor(descriptor, "set"); | ||
classApplyDescriptorSet(receiver, descriptor, value); | ||
return value; | ||
} |
@@ -0,7 +1,5 @@ | ||
import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess"; | ||
export default function _classStaticPrivateMethodGet(receiver, classConstructor, method) { | ||
if (receiver !== classConstructor) { | ||
throw new TypeError("Private static access of wrong provenance"); | ||
} | ||
classCheckPrivateStaticAccess(receiver, classConstructor); | ||
return method; | ||
} |
{ | ||
"name": "babel-compat", | ||
"version": "0.22.2-alpha.0", | ||
"version": "0.22.2-alpha.1", | ||
"main": "build/index.js", | ||
@@ -12,9 +12,9 @@ "description": "Babel helpers customized for COMPAT", | ||
"dependencies": { | ||
"@babel/core": "7.13.8", | ||
"@babel/core": "7.13.10", | ||
"@babel/generator": "7.13.9", | ||
"@babel/helpers": "7.13.0", | ||
"@babel/helpers": "7.13.10", | ||
"@babel/types": "7.13.0", | ||
"regenerator-runtime": "^0.12.0" | ||
}, | ||
"gitHead": "262077fff9c4c0634eec4d07c10f47674f24dbfe" | ||
"gitHead": "e869e5c8d6e1c8334786d27742a44ec72f80e0a7" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
69710
88
1924
0
+ Added@babel/core@7.13.10(transitive)
+ Added@babel/helpers@7.13.10(transitive)
- Removed@babel/core@7.13.8(transitive)
- Removed@babel/helpers@7.13.0(transitive)
Updated@babel/core@7.13.10
Updated@babel/helpers@7.13.10