(parser)
| 36 | * @returns {void} |
| 37 | */ |
| 38 | const handler = (parser) => { |
| 39 | parser.hooks.call.for("eval").tap(PLUGIN_NAME, () => { |
| 40 | const buildInfo = |
| 41 | /** @type {JavascriptModuleBuildInfo} */ |
| 42 | (parser.state.module.buildInfo); |
| 43 | buildInfo.moduleConcatenationBailout = "eval()"; |
| 44 | const currentSymbol = innerGraph.getTopLevelSymbol(parser.state); |
| 45 | if (currentSymbol) { |
| 46 | innerGraph.addUsage(parser.state, null, currentSymbol); |
| 47 | } else { |
| 48 | innerGraph.bailout(parser.state); |
| 49 | } |
| 50 | }); |
| 51 | parser.hooks.finish.tap(PLUGIN_NAME, () => { |
| 52 | const buildInfo = |
| 53 | /** @type {BuildInfo} */ |
| 54 | (parser.state.module.buildInfo); |
| 55 | let topLevelDeclarations = buildInfo.topLevelDeclarations; |
| 56 | if (topLevelDeclarations === undefined) { |
| 57 | topLevelDeclarations = buildInfo.topLevelDeclarations = new Set(); |
| 58 | } |
| 59 | for (const name of parser.scope.definitions.asSet()) { |
| 60 | if (parser.isVariableDefined(name)) { |
| 61 | topLevelDeclarations.add(name); |
| 62 | } |
| 63 | } |
| 64 | }); |
| 65 | }; |
| 66 | |
| 67 | normalModuleFactory.hooks.parser |
| 68 | .for(JAVASCRIPT_MODULE_TYPE_AUTO) |
nothing calls this directly
no test coverage detected