From 8ff05e13a1abeb4296e855f9a008b71bd7c7142c Mon Sep 17 00:00:00 2001 From: Evan Wallace Date: Fri, 17 Jun 2022 23:07:09 -0400 Subject: [PATCH] rename more features --- CHANGELOG.md | 12 ++++----- internal/compat/js_table.go | 48 ++++++++++++++++----------------- internal/js_parser/js_parser.go | 24 ++++++++--------- scripts/compat-table.js | 24 ++++++++--------- 4 files changed, 54 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d48b143f2b2..51d8176137d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,12 +59,12 @@ * `object-rest-spread` * `optional-catch-binding` * `optional-chain` - * `reg-exp-dot-all-flag` - * `reg-exp-lookbehind-assertions` - * `reg-exp-match-indices` - * `reg-exp-named-capture-groups` - * `reg-exp-sticky-and-unicode-flags` - * `reg-exp-unicode-property-escapes` + * `regexp-dot-all-flag` + * `regexp-lookbehind-assertions` + * `regexp-match-indices` + * `regexp-named-capture-groups` + * `regexp-sticky-and-unicode-flags` + * `regexp-unicode-property-escapes` * `rest-argument` * `template-literal` * `top-level-await` diff --git a/internal/compat/js_table.go b/internal/compat/js_table.go index bf8612d4720..fd834981462 100644 --- a/internal/compat/js_table.go +++ b/internal/compat/js_table.go @@ -83,12 +83,12 @@ const ( ObjectRestSpread OptionalCatchBinding OptionalChain - RegExpDotAllFlag - RegExpLookbehindAssertions - RegExpMatchIndices - RegExpNamedCaptureGroups - RegExpStickyAndUnicodeFlags - RegExpUnicodePropertyEscapes + RegexpDotAllFlag + RegexpLookbehindAssertions + RegexpMatchIndices + RegexpNamedCaptureGroups + RegexpStickyAndUnicodeFlags + RegexpUnicodePropertyEscapes RestArgument TemplateLiteral TopLevelAwait @@ -137,12 +137,12 @@ var StringToJSFeature = map[string]JSFeature{ "object-rest-spread": ObjectRestSpread, "optional-catch-binding": OptionalCatchBinding, "optional-chain": OptionalChain, - "reg-exp-dot-all-flag": RegExpDotAllFlag, - "reg-exp-lookbehind-assertions": RegExpLookbehindAssertions, - "reg-exp-match-indices": RegExpMatchIndices, - "reg-exp-named-capture-groups": RegExpNamedCaptureGroups, - "reg-exp-sticky-and-unicode-flags": RegExpStickyAndUnicodeFlags, - "reg-exp-unicode-property-escapes": RegExpUnicodePropertyEscapes, + "regexp-dot-all-flag": RegexpDotAllFlag, + "regexp-lookbehind-assertions": RegexpLookbehindAssertions, + "regexp-match-indices": RegexpMatchIndices, + "regexp-named-capture-groups": RegexpNamedCaptureGroups, + "regexp-sticky-and-unicode-flags": RegexpStickyAndUnicodeFlags, + "regexp-unicode-property-escapes": RegexpUnicodePropertyEscapes, "rest-argument": RestArgument, "template-literal": TemplateLiteral, "top-level-await": TopLevelAwait, @@ -191,12 +191,12 @@ var JSFeatureToString = map[JSFeature]string{ ObjectRestSpread: "object-rest-spread", OptionalCatchBinding: "optional-catch-binding", OptionalChain: "optional-chain", - RegExpDotAllFlag: "reg-exp-dot-all-flag", - RegExpLookbehindAssertions: "reg-exp-lookbehind-assertions", - RegExpMatchIndices: "reg-exp-match-indices", - RegExpNamedCaptureGroups: "reg-exp-named-capture-groups", - RegExpStickyAndUnicodeFlags: "reg-exp-sticky-and-unicode-flags", - RegExpUnicodePropertyEscapes: "reg-exp-unicode-property-escapes", + RegexpDotAllFlag: "regexp-dot-all-flag", + RegexpLookbehindAssertions: "regexp-lookbehind-assertions", + RegexpMatchIndices: "regexp-match-indices", + RegexpNamedCaptureGroups: "regexp-named-capture-groups", + RegexpStickyAndUnicodeFlags: "regexp-sticky-and-unicode-flags", + RegexpUnicodePropertyEscapes: "regexp-unicode-property-escapes", RestArgument: "rest-argument", TemplateLiteral: "template-literal", TopLevelAwait: "top-level-await", @@ -583,7 +583,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{ Opera: {{start: v{77, 0, 0}}}, Safari: {{start: v{13, 1, 0}}}, }, - RegExpDotAllFlag: { + RegexpDotAllFlag: { Chrome: {{start: v{62, 0, 0}}}, Edge: {{start: v{79, 0, 0}}}, ES: {{start: v{2018, 0, 0}}}, @@ -593,7 +593,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{ Opera: {{start: v{49, 0, 0}}}, Safari: {{start: v{11, 1, 0}}}, }, - RegExpLookbehindAssertions: { + RegexpLookbehindAssertions: { Chrome: {{start: v{62, 0, 0}}}, Edge: {{start: v{79, 0, 0}}}, ES: {{start: v{2018, 0, 0}}}, @@ -601,7 +601,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{ Node: {{start: v{8, 10, 0}}}, Opera: {{start: v{49, 0, 0}}}, }, - RegExpMatchIndices: { + RegexpMatchIndices: { Chrome: {{start: v{90, 0, 0}}}, Edge: {{start: v{90, 0, 0}}}, ES: {{start: v{2022, 0, 0}}}, @@ -610,7 +610,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{ Opera: {{start: v{76, 0, 0}}}, Safari: {{start: v{15, 0, 0}}}, }, - RegExpNamedCaptureGroups: { + RegexpNamedCaptureGroups: { Chrome: {{start: v{64, 0, 0}}}, Edge: {{start: v{79, 0, 0}}}, ES: {{start: v{2018, 0, 0}}}, @@ -620,7 +620,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{ Opera: {{start: v{51, 0, 0}}}, Safari: {{start: v{11, 1, 0}}}, }, - RegExpStickyAndUnicodeFlags: { + RegexpStickyAndUnicodeFlags: { Chrome: {{start: v{50, 0, 0}}}, Edge: {{start: v{13, 0, 0}}}, ES: {{start: v{2015, 0, 0}}}, @@ -630,7 +630,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{ Opera: {{start: v{37, 0, 0}}}, Safari: {{start: v{12, 0, 0}}}, }, - RegExpUnicodePropertyEscapes: { + RegexpUnicodePropertyEscapes: { Chrome: {{start: v{64, 0, 0}}}, Edge: {{start: v{79, 0, 0}}}, ES: {{start: v{2018, 0, 0}}}, diff --git a/internal/js_parser/js_parser.go b/internal/js_parser/js_parser.go index 0ceaf749a3f..2391f153039 100644 --- a/internal/js_parser/js_parser.go +++ b/internal/js_parser/js_parser.go @@ -11633,17 +11633,17 @@ pattern: tail := pattern[i:] if strings.HasPrefix(tail, "?<=") || strings.HasPrefix(tail, "?'); end >= 0 { - feature = compat.RegExpNamedCaptureGroups + feature = compat.RegexpNamedCaptureGroups what = "Named capture groups in regular expressions are not available" r = logger.Range{Loc: logger.Loc{Start: loc.Start + int32(i) + 1}, Len: int32(end) + 1} isUnsupported = true @@ -11667,9 +11667,9 @@ pattern: tail := pattern[i:] if isUnicode && (strings.HasPrefix(tail, "p{") || strings.HasPrefix(tail, "P{")) { - if p.options.unsupportedJSFeatures.Has(compat.RegExpUnicodePropertyEscapes) { + if p.options.unsupportedJSFeatures.Has(compat.RegexpUnicodePropertyEscapes) { if end := strings.IndexByte(tail, '}'); end >= 0 { - feature = compat.RegExpUnicodePropertyEscapes + feature = compat.RegexpUnicodePropertyEscapes what = "Unicode property escapes in regular expressions are not available" r = logger.Range{Loc: logger.Loc{Start: loc.Start + int32(i)}, Len: int32(end) + 2} isUnsupported = true @@ -11689,22 +11689,22 @@ pattern: continue // These are part of ES5 and are always supported case 's': - if !p.options.unsupportedJSFeatures.Has(compat.RegExpDotAllFlag) { + if !p.options.unsupportedJSFeatures.Has(compat.RegexpDotAllFlag) { continue // This is part of ES2018 } - feature = compat.RegExpDotAllFlag + feature = compat.RegexpDotAllFlag case 'y', 'u': - if !p.options.unsupportedJSFeatures.Has(compat.RegExpStickyAndUnicodeFlags) { + if !p.options.unsupportedJSFeatures.Has(compat.RegexpStickyAndUnicodeFlags) { continue // These are part of ES2018 } - feature = compat.RegExpStickyAndUnicodeFlags + feature = compat.RegexpStickyAndUnicodeFlags case 'd': - if !p.options.unsupportedJSFeatures.Has(compat.RegExpMatchIndices) { + if !p.options.unsupportedJSFeatures.Has(compat.RegexpMatchIndices) { continue // This is part of ES2022 } - feature = compat.RegExpMatchIndices + feature = compat.RegexpMatchIndices default: // Unknown flags are never supported diff --git a/scripts/compat-table.js b/scripts/compat-table.js index e5744d7b522..a47fd442f7f 100644 --- a/scripts/compat-table.js +++ b/scripts/compat-table.js @@ -37,7 +37,7 @@ const features = { 'class': { target: 'Class' }, 'generators': { target: 'Generator' }, 'Unicode code point escapes': { target: 'UnicodeEscapes' }, - 'RegExp "y" and "u" flags': { target: 'RegExpStickyAndUnicodeFlags' }, + 'RegExp "y" and "u" flags': { target: 'RegexpStickyAndUnicodeFlags' }, // >ES6 features 'exponentiation (**) operator': { target: 'ExponentOperator' }, @@ -45,10 +45,10 @@ const features = { 'nested rest destructuring, parameters': { target: 'NestedRestBinding' }, 'async functions': { target: 'AsyncAwait' }, 'object rest/spread properties': { target: 'ObjectRestSpread' }, - 'RegExp Lookbehind Assertions': { target: 'RegExpLookbehindAssertions' }, - 'RegExp named capture groups': { target: 'RegExpNamedCaptureGroups' }, - 'RegExp Unicode Property Escapes': { target: 'RegExpUnicodePropertyEscapes' }, - 's (dotAll) flag for regular expressions': { target: 'RegExpDotAllFlag' }, + 'RegExp Lookbehind Assertions': { target: 'RegexpLookbehindAssertions' }, + 'RegExp named capture groups': { target: 'RegexpNamedCaptureGroups' }, + 'RegExp Unicode Property Escapes': { target: 'RegexpUnicodePropertyEscapes' }, + 's (dotAll) flag for regular expressions': { target: 'RegexpDotAllFlag' }, 'Asynchronous Iterators: async generators': { target: 'AsyncGenerator' }, 'Asynchronous Iterators: for-await-of loops': { target: 'ForAwait' }, 'optional catch binding': { target: 'OptionalCatchBinding' }, @@ -143,7 +143,7 @@ mergeVersions('ForOf', { es2015: true }) mergeVersions('Generator', { es2015: true }) mergeVersions('NewTarget', { es2015: true }) mergeVersions('ObjectExtensions', { es2015: true }) -mergeVersions('RegExpStickyAndUnicodeFlags', { es2015: true }) +mergeVersions('RegexpStickyAndUnicodeFlags', { es2015: true }) mergeVersions('RestArgument', { es2015: true }) mergeVersions('TemplateLiteral', { es2015: true }) mergeVersions('UnicodeEscapes', { es2015: true }) @@ -155,10 +155,10 @@ mergeVersions('AsyncAwait', { es2017: true }) mergeVersions('AsyncGenerator', { es2018: true }) mergeVersions('ForAwait', { es2018: true }) mergeVersions('ObjectRestSpread', { es2018: true }) -mergeVersions('RegExpDotAllFlag', { es2018: true }) -mergeVersions('RegExpLookbehindAssertions', { es2018: true }) -mergeVersions('RegExpNamedCaptureGroups', { es2018: true }) -mergeVersions('RegExpUnicodePropertyEscapes', { es2018: true }) +mergeVersions('RegexpDotAllFlag', { es2018: true }) +mergeVersions('RegexpLookbehindAssertions', { es2018: true }) +mergeVersions('RegexpNamedCaptureGroups', { es2018: true }) +mergeVersions('RegexpUnicodePropertyEscapes', { es2018: true }) mergeVersions('OptionalCatchBinding', { es2019: true }) mergeVersions('Bigint', { es2020: true }) mergeVersions('ImportMeta', { es2020: true }) @@ -178,7 +178,7 @@ mergeVersions('ClassStaticBlocks', { es2022: true }) mergeVersions('ClassStaticField', { es2022: true }) mergeVersions('TopLevelAwait', { es2022: true }) mergeVersions('ArbitraryModuleNamespaceNames', { es2022: true }) -mergeVersions('RegExpMatchIndices', { es2022: true }) +mergeVersions('RegexpMatchIndices', { es2022: true }) mergeVersions('ImportAssertions', {}) // Manually copied from https://caniuse.com/?search=export%20*%20as @@ -295,7 +295,7 @@ mergeVersions('ClassStaticBlocks', { }) // Manually copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/hasIndices -mergeVersions('RegExpMatchIndices', { +mergeVersions('RegexpMatchIndices', { chrome90: true, edge90: true, firefox88: true,