| 1 | /* eslint-disable @babel/development/plugin-name */ |
| 2 | import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; |
| 3 | import { declare } from "@babel/helper-plugin-utils"; |
| 4 | |
| 5 | export interface Options { |
| 6 | useUnicodeFlag?: boolean; |
| 7 | } |
| 8 | |
| 9 | export default declare((api, options: Options) => { |
| 10 | api.assertVersion(7); |
| 11 | |
| 12 | const { useUnicodeFlag = true } = options; |
| 13 | if (typeof useUnicodeFlag !== "boolean") { |
| 14 | throw new Error(".useUnicodeFlag must be a boolean, or undefined"); |
| 15 | } |
| 16 | |
| 17 | return createRegExpFeaturePlugin({ |
| 18 | name: "proposal-unicode-property-regex", |
| 19 | feature: "unicodePropertyEscape", |
| 20 | options: { useUnicodeFlag }, |
| 21 | }); |
| 22 | }); |