Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40d4078
commit ad4c05d
Showing
2 changed files
with
14 additions
and
8 deletions.
There are no files selected for viewing
20 changes: 12 additions & 8 deletions
20
packages/babel-plugin-proposal-class-properties/src/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
import { declare } from "@babel/helper-plugin-utils"; | ||
import proposalEnhancedClasses from "@babel/plugin-proposal-enhanced-classes"; | ||
import proposalEnhancedClasses, { | ||
enableFeature, | ||
FEATURES, | ||
setLoose, | ||
} from "@babel/plugin-proposal-enhanced-classes"; | ||
|
||
export default declare((api, options) => { | ||
api.assertVersion(7); | ||
|
||
const { loose } = options; | ||
|
||
return { | ||
inherits(babel) { | ||
return proposalEnhancedClasses(babel, { | ||
loose, | ||
instanceFields: true, | ||
staticFields: true, | ||
}); | ||
}, | ||
inherits: proposalEnhancedClasses, | ||
|
||
manipulateOptions(opts, parserOpts) { | ||
parserOpts.plugins.push("classProperties", "classPrivateProperties"); | ||
}, | ||
|
||
pre() { | ||
setLoose(this.file, loose); | ||
enableFeature(this.file, FEATURES.instanceFields); | ||
enableFeature(this.file, FEATURES.staticFields); | ||
}, | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters