Skip to content

Commit

Permalink
Update regexpu-core (#15996)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Sep 25, 2023
1 parent 7e69e32 commit b06dab5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 14 deletions.
Expand Up @@ -19,7 +19,7 @@
],
"dependencies": {
"@babel/helper-annotate-as-pure": "workspace:^",
"regexpu-core": "^5.3.1",
"regexpu-core": "^6.0.0",
"semver": "condition:BABEL_8_BREAKING ? ^7.3.4 : ^6.3.1"
},
"peerDependencies": {
Expand Down
11 changes: 3 additions & 8 deletions packages/babel-helper-create-regexp-features-plugin/src/util.ts
Expand Up @@ -7,13 +7,8 @@ export function generateRegexpuOptions(
pattern: string,
toTransform: number,
): RegexpuOptions {
type Experimental = 1;

const feat = <Stability extends 0 | 1 = 0>(
name: keyof typeof FEATURES,
ok: "transform" | (Stability extends 0 ? never : "parse") = "transform",
) => {
return hasFeature(toTransform, FEATURES[name]) ? ok : false;
const feat = (name: keyof typeof FEATURES) => {
return hasFeature(toTransform, FEATURES[name]) ? "transform" : false;
};

const featDuplicateNamedGroups = (): "transform" | false => {
Expand All @@ -33,7 +28,7 @@ export function generateRegexpuOptions(

return {
unicodeFlag: feat("unicodeFlag"),
unicodeSetsFlag: feat<Experimental>("unicodeSetsFlag") || "parse",
unicodeSetsFlag: feat("unicodeSetsFlag"),
dotAllFlag: feat("dotAllFlag"),
unicodePropertyEscapes: feat("unicodePropertyEscape"),
namedGroups: feat("namedCaptureGroups") || featDuplicateNamedGroups(),
Expand Down
@@ -1,6 +1,6 @@
/(?:[\0-JL-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/.test(string);
/(?:[\0-jl-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/.test(string);
/(?:[\0-\u2129\u212B-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/.test(string);
/(?:[\0-JL-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF])/.test(string);
/(?:[\0-jl-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF])/.test(string);
/(?:[\0-\u2129\u212B-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF])/.test(string);
/(?:(?![K\u212A\uD800-\uDFFF])[\s\S]|[\uD800-\uDBFF][\uDC00-\uDFFF])/i.test(string);
/(?:(?![k\u212A\uD800-\uDFFF])[\s\S]|[\uD800-\uDBFF][\uDC00-\uDFFF])/i.test(string);
/(?:(?![K\u212A\uD800-\uDFFF])[\s\S]|[\uD800-\uDBFF][\uDC00-\uDFFF])/i.test(string);
36 changes: 34 additions & 2 deletions yarn.lock
Expand Up @@ -721,7 +721,7 @@ __metadata:
"@babel/core": "workspace:^"
"@babel/helper-annotate-as-pure": "workspace:^"
"@babel/helper-plugin-test-runner": "workspace:^"
regexpu-core: ^5.3.1
regexpu-core: ^6.0.0
semver: "condition:BABEL_8_BREAKING ? ^7.3.4 : ^6.3.1"
peerDependencies:
"@babel/core": ^7.0.0
Expand Down Expand Up @@ -14183,7 +14183,7 @@ __metadata:
languageName: node
linkType: hard

"regenerate-unicode-properties@npm:^10.1.0":
"regenerate-unicode-properties@npm:^10.1.0, regenerate-unicode-properties@npm:^10.1.1":
version: 10.1.1
resolution: "regenerate-unicode-properties@npm:10.1.1"
dependencies:
Expand Down Expand Up @@ -14264,6 +14264,38 @@ __metadata:
languageName: node
linkType: hard

"regexpu-core@npm:^6.0.0":
version: 6.0.0
resolution: "regexpu-core@npm:6.0.0"
dependencies:
regenerate: ^1.4.2
regenerate-unicode-properties: ^10.1.1
regjsgen: ^0.8.0
regjsparser: ^0.10.0
unicode-match-property-ecmascript: ^2.0.0
unicode-match-property-value-ecmascript: ^2.1.0
checksum: d5c4957d4608732536c47607ccffc059a24324d54291b54c2f8343b6c4ea62daab07c5911dfdf18f26881a5b1bd5dc2beae7fbddff143c9e8fe12de8b4ad2c8d
languageName: node
linkType: hard

"regjsgen@npm:^0.8.0":
version: 0.8.0
resolution: "regjsgen@npm:0.8.0"
checksum: a1d925ff14a4b2be774e45775ee6b33b256f89c42d480e6d85152d2133f18bd3d6af662161b226fa57466f7efec367eaf7ccd2a58c0ec2a1306667ba2ad07b0d
languageName: node
linkType: hard

"regjsparser@npm:^0.10.0":
version: 0.10.0
resolution: "regjsparser@npm:0.10.0"
dependencies:
jsesc: ~0.5.0
bin:
regjsparser: bin/parser
checksum: 17550661f43ba792f8365fb95b3dbdb64e25f14e31ef7c2c11876c240a60e87b7bfc28c98589f4e76b7cf49307e45fb24d030f57d68dd0cc41c56b4d378e9254
languageName: node
linkType: hard

"regjsparser@npm:^0.9.1":
version: 0.9.1
resolution: "regjsparser@npm:0.9.1"
Expand Down

0 comments on commit b06dab5

Please sign in to comment.