Skip to content

Commit

Permalink
cleanup things
Browse files Browse the repository at this point in the history
  • Loading branch information
remorses committed Nov 1, 2024
1 parent a599df4 commit f362f13
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions next-superjson/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ import path from 'path'
const enabled = !!process.env.DEBUG_ELACCA
export const logger = {
log(...args) {
enabled && console.log('[elacca]:', ...args)
enabled && console.log('[superjson]:', ...args)
},
error(...args) {
enabled && console.log('[elacca]:', ...args)
enabled && console.log('[superjson]:', ...args)
},
}

export const elaccaDirective = 'skip ssr'

const filesToSkip = ([] as string[]).concat(
...['_document', '_error'].map((name) => [
name + '.js',
Expand All @@ -21,7 +19,7 @@ const filesToSkip = ([] as string[]).concat(
]),
)

export function shouldBeSkipped({ pagesDir, filePath, program = null as any }) {
export function shouldBeSkipped({ pagesDir, filePath }) {
if (!filePath.includes('pages' + path.sep)) {
return true
}
Expand All @@ -37,14 +35,6 @@ export function shouldBeSkipped({ pagesDir, filePath, program = null as any }) {
console.log('skipping', abs, 'because outside of pagesDir', pagesDir)
return true
}
if (!program) {
return false
}
const dir = program.node.directives?.find(
(x) => x.value?.value === elaccaDirective,
)
if (!dir) {
return true
}

return false
}

0 comments on commit f362f13

Please sign in to comment.