Skip to content

Commit

Permalink
chore: update bench
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Dec 29, 2023
1 parent ace063b commit 5682dc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bench/index.bench.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable test/consistent-test-it */
import { readFile } from 'node:fs/promises'
import { bench, describe } from 'vitest'
import { createIsLiteralPositionAcorn, stripLiteralAcorn, stripLiteralRegex } from '../src'
import { _stripLiteralJsTokens, stripLiteralAcorn, stripLiteralRegex } from '../src'

const modules = {
'vue-global': './node_modules/vue/dist/vue.runtime.global.js',
Expand All @@ -11,14 +11,14 @@ const modules = {
Object.entries(modules).forEach(([name, path]) => {
describe(`bench ${name}`, async () => {
const code = await readFile(path, 'utf-8')
bench('stripLiteral (js-tokens)', () => {
_stripLiteralJsTokens(code)
})
bench('stripLiteral (regex)', () => {
stripLiteralRegex(code)
})
bench('stripLiteral (acorn)', () => {
stripLiteralAcorn(code)
})
bench('createIsLiteralPositionAcorn (acorn)', () => {
createIsLiteralPositionAcorn(code)
})
})
})
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { StripLiteralOptions } from './types'

export { stripLiteralAcorn, createIsLiteralPositionAcorn } from './acorn'
export { stripLiteralRegex } from './regex'
export { _stripLiteralJsTokens } from './js-tokens'
export * from './types'

/**
Expand Down

0 comments on commit 5682dc6

Please sign in to comment.