diff --git a/src/utils/normalizers.ts b/src/utils/normalizers.ts index 58da5bbd..474d772e 100644 --- a/src/utils/normalizers.ts +++ b/src/utils/normalizers.ts @@ -24,24 +24,6 @@ export function normalizeToAngleBracketComponent(name: string) { }); } -export function normalizeToNamedBlockName(name: string) { - const SIMPLE_DASHERIZE_REGEXP = /[a-z]|\/|-/g; - const ALPHA = /[A-Za-z0-9]/; - - if (name.includes('.')) { - return name; - } - - return name.replace(SIMPLE_DASHERIZE_REGEXP, (char, index) => { - if (index !== 0 && !ALPHA.test(name[index - 1])) { - return char.toUpperCase(); - } - - // Remove all occurrences of '-'s from the name that aren't starting with `-` - return char === '-' ? '' : char.toLowerCase(); - }); -} - // https://github.com/rwjblue/ember-angle-bracket-invocation-polyfill/blob/master/lib/ast-transform.js#L33 export function normalizeToClassicComponent(rawName: string) { const name = rawName.split('$').pop() || ''; diff --git a/src/utils/template-tokens-collector.ts b/src/utils/template-tokens-collector.ts index 53b5019a..9c4216c3 100644 --- a/src/utils/template-tokens-collector.ts +++ b/src/utils/template-tokens-collector.ts @@ -1,5 +1,5 @@ import { preprocess, traverse, ASTv1 } from '@glimmer/syntax'; -import { normalizeToClassicComponent, normalizeToNamedBlockName } from './normalizers'; +import { normalizeToClassicComponent } from './normalizers'; function tokensFromType(node: ASTv1.BaseNode, scopedTokens: string[]) { const tokensMap = { @@ -126,7 +126,7 @@ export function getTemplateBlocks(html: string): string[] { }, }); - return Array.from(tokensSet).map((el) => normalizeToNamedBlockName(el)); + return Array.from(tokensSet); } function getTemplateTokens(ast: ASTv1.Template, nativeTokens: string[]) { diff --git a/test/utils/normalizers-test.ts b/test/utils/normalizers-test.ts index 1c58de69..02afa15c 100644 --- a/test/utils/normalizers-test.ts +++ b/test/utils/normalizers-test.ts @@ -1,4 +1,4 @@ -import { normalizeToAngleBracketComponent, normalizeToNamedBlockName, normalizeToClassicComponent, normalizeServiceName } from '../../src/utils/normalizers'; +import { normalizeToAngleBracketComponent, normalizeToClassicComponent, normalizeServiceName } from '../../src/utils/normalizers'; describe('normalizeServiceName', () => { it('able to convert service to path', () => { @@ -27,14 +27,6 @@ describe('normalizeToClassicComponent', () => { }); }); -describe('normalizeToNamedBlockName', () => { - it('able to convert dasherized blocks to camel-case', () => { - expect(normalizeToNamedBlockName('foo')).toEqual('foo'); - expect(normalizeToNamedBlockName('foo-bar')).toEqual('fooBar'); - expect(normalizeToNamedBlockName('fooBar')).toEqual('fooBar'); - }); -}); - describe('normalizeToAngleBracketComponent', () => { it('able to convert path to angle brackets', () => { expect(normalizeToAngleBracketComponent('-foo')).toEqual('-Foo');