Debian Codegraph @

packages/babel-plugin-transform-named-capturing-groups-regex/src/index.ts

raw
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 runtime?: boolean;
7 }
8
9 export default declare((api, options: Options) => {
10 const { runtime } = options;
11 if (runtime !== undefined && typeof runtime !== "boolean") {
12 throw new Error("The 'runtime' option must be boolean");
13 }
14
15 return createRegExpFeaturePlugin({
16 name: "transform-named-capturing-groups-regex",
17 feature: "namedCaptureGroups",
18 options: { runtime },
19 });
20 });