Created
August 26, 2020 08:42
-
-
Save radex/cc0e443f019bc0f94a76fcbd9200b48e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ModuleGraph/worker/JSFileWrapping.js | |
function normalizeFileName(name) { | |
return '_' + name.replace(/[^a-zA-Z0-9]/g, '_') | |
} | |
function wrapModule( | |
// ... | |
, fileName) { | |
// ... | |
const factory = functionFromProgram(fileAst.program, params, normalizeFileName(fileName)) | |
// ... | |
} | |
function functionFromProgram(program, parameters, name) { | |
return t.functionExpression( | |
t.identifier(name || ''), | |
parameters.map(makeIdentifier), | |
t.blockStatement(program.body, program.directives), | |
) | |
} | |
// JSTransformer/worker.js | |
var _JsFileWrapping$wrapM = JsFileWrapping.wrapModule( | |
// ... | |
filename | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
facebook/metro#585