Skip to content

Commit

Permalink
fix: preProcessJs return type
Browse files Browse the repository at this point in the history
  • Loading branch information
sonofmagic committed Sep 15, 2023
1 parent f0750a4 commit c871ede
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/js/pre.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export function loadPresets() {
]
}

export function preProcessJs(options: IPreProcessJsOptions) {
export function preProcessJs(options: IPreProcessJsOptions): string {
const { code, replaceMap, id, ctx } = options
const magicString = typeof code === 'string' ? new MagicString(code) : code
let ast: ParseResult<babel.types.File>
Expand All @@ -140,10 +140,10 @@ export function preProcessJs(options: IPreProcessJsOptions) {
if (file) {
ast = file
} else {
return code
return code.toString()
}
} catch {
return code
return code.toString()
}
const markedArray: [number, number][] = []
babel.traverse(ast, {
Expand Down Expand Up @@ -216,7 +216,7 @@ interface IPreProcessRawCodeOptions {
ctx: Context
}

export function preProcessRawCode(options: IPreProcessRawCodeOptions) {
export function preProcessRawCode(options: IPreProcessRawCodeOptions): string {
const { code, replaceMap, ctx } = options
const magicString = typeof code === 'string' ? new MagicString(code) : code
const markArr: [number, number][] = []
Expand Down

0 comments on commit c871ede

Please sign in to comment.