Commit efec7ab9 authored by Luke Sandberg's avatar Luke Sandberg

update a test and fix a comment

parent 744e3624
...@@ -78,21 +78,13 @@ describe('deobfuscateModuleId', () => { ...@@ -78,21 +78,13 @@ describe('deobfuscateModuleId', () => {
describe('removeFreeCallWrapper', () => { describe('removeFreeCallWrapper', () => {
test('removes (0, ) wrapper', () => { test('removes (0, ) wrapper', () => {
expect(removeFreeCallWrapper('(0, foo)')).toBe('foo') expect(removeFreeCallWrapper('(0, foo.bar)')).toBe('foo.bar')
}) })
test('removes (0 , ) wrapper with spaces', () => { test('removes (0 , ) wrapper with spaces', () => {
expect(removeFreeCallWrapper('(0 , foo.bar)')).toBe('foo.bar') expect(removeFreeCallWrapper('(0 , foo.bar)')).toBe('foo.bar')
}) })
test('handles nested expressions', () => {
expect(
removeFreeCallWrapper(
'(0 , __TURBOPACK__imported__module__$5b$project$5d$__.foo)'
)
).toBe('__TURBOPACK__imported__module__$5b$project$5d$__.foo')
})
test('leaves non-free-call expressions unchanged', () => { test('leaves non-free-call expressions unchanged', () => {
expect(removeFreeCallWrapper('(foo, bar)')).toBe('(foo, bar)') expect(removeFreeCallWrapper('(foo, bar)')).toBe('(foo, bar)')
expect(removeFreeCallWrapper('foo()')).toBe('foo()') expect(removeFreeCallWrapper('foo()')).toBe('foo()')
......
...@@ -137,7 +137,8 @@ export function removeFreeCallWrapper(text: string): string { ...@@ -137,7 +137,8 @@ export function removeFreeCallWrapper(text: string): string {
* 3. Removing free call wrappers * 3. Removing free call wrappers
*/ */
export function deobfuscateText(text: string): string { export function deobfuscateText(text: string): string {
// First, remove free call wrappers, by doing this // First, remove free call wrappers, doing this first is important since the demangling might
// introduce whitespace character that complicate the matching.
let result = removeFreeCallWrapper(text) let result = removeFreeCallWrapper(text)
// Then decode magic identifiers and clean up module IDs // Then decode magic identifiers and clean up module IDs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment