Skip to content

Commit

Permalink
create a separate file to detect bridges
Browse files Browse the repository at this point in the history
  • Loading branch information
shinnn committed May 2, 2019
1 parent 80109b5 commit 06d380f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/is-cjs-esm-bridge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = ({ functions }) => {
// https://github.com/nodejs/node/blob/v12.1.0/lib/internal/modules/esm/create_dynamic_module.js#L11-L19
return functions.length === 3 &&
functions[0].functionName === '' &&
functions[0].isBlockCoverage === true &&
functions[1].functionName === 'get' &&
functions[1].isBlockCoverage === false &&
functions[2].functionName === 'set' &&
functions[2].isBlockCoverage === true
}

0 comments on commit 06d380f

Please sign in to comment.