Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make @babel/plugin-class-features a normal helper package (#9083)
* Make @babel/plugin-class-features a normal helper package This effectively disallows using it directly. * Rename helper * Style * Don't add prefix to plugin name * Move private methods plugin
- Loading branch information
1 parent
c4d6f6d
commit 4e28459
Showing
16 changed files
with
33 additions
and
79 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../babel-plugin-class-features/package.json → ...create-class-features-plugin/package.json
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
21 changes: 9 additions & 12 deletions
21
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,25 +1,22 @@ | ||
/* eslint-disable local-rules/plugin-name */ | ||
|
||
import { declare } from "@babel/helper-plugin-utils"; | ||
import pluginClassFeatures, { | ||
enableFeature, | ||
import { | ||
createClassFeaturePlugin, | ||
FEATURES, | ||
} from "@babel/plugin-class-features"; | ||
} from "@babel/helper-create-class-features-plugin"; | ||
|
||
export default declare((api, options) => { | ||
api.assertVersion(7); | ||
|
||
const { loose } = options; | ||
|
||
return { | ||
return createClassFeaturePlugin({ | ||
name: "proposal-class-properties", | ||
|
||
inherits: pluginClassFeatures, | ||
feature: FEATURES.fields, | ||
loose: options.loose, | ||
|
||
manipulateOptions(opts, parserOpts) { | ||
parserOpts.plugins.push("classProperties", "classPrivateProperties"); | ||
}, | ||
|
||
pre() { | ||
enableFeature(this.file, FEATURES.fields, loose); | ||
}, | ||
}; | ||
}); | ||
}); |
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
21 changes: 9 additions & 12 deletions
21
packages/babel-plugin-proposal-private-methods/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,25 +1,22 @@ | ||
/* eslint-disable local-rules/plugin-name */ | ||
|
||
import { declare } from "@babel/helper-plugin-utils"; | ||
import pluginClassFeatures, { | ||
enableFeature, | ||
import { | ||
createClassFeaturePlugin, | ||
FEATURES, | ||
} from "@babel/plugin-class-features"; | ||
} from "@babel/helper-create-class-features-plugin"; | ||
|
||
export default declare((api, options) => { | ||
api.assertVersion(7); | ||
|
||
const { loose } = options; | ||
|
||
return { | ||
return createClassFeaturePlugin({ | ||
name: "proposal-private-methods", | ||
|
||
inherits: pluginClassFeatures, | ||
feature: FEATURES.privateMethods, | ||
loose: options.loose, | ||
|
||
manipulateOptions(opts, parserOpts) { | ||
parserOpts.plugins.push("classPrivateMethods"); | ||
}, | ||
|
||
pre() { | ||
enableFeature(this.file, FEATURES.privateMethods, loose); | ||
}, | ||
}; | ||
}); | ||
}); |