fix(javascript): resolve bundled exports by binding identity
Identify the factory exports parameter through the existing semantic binding owner, including renamed and minified Webpack parameters. Reject nested targets, bare alias rebinding, and shadowed identifiers. Prune the duplicated source happy path after validating the public CLI workflow. Validation: public analyze-javascript-application CLI acceptance and focused semantic traversal/module-index tests. Fixes #2171
This commit is contained in:
1 parent
921bb95755
commit
5ab0cbb48e
5 files changed
+150
-25
No files matched your search
@@ -50,6 +50,18 @@ it("does not infer a bootstrap from a function table without a matching loader",
|
||||
expect(analysis.bundler_registrations).toEqual([]);
|
||||
});
|
||||
|
||||
it("does not treat a same-named shadow as the factory exports parameter", () => {
|
||||
const analysis =
|
||||
analyzeJavaScriptStaticSource(`globalThis.webpackChunkApp.push([[1], {
|
||||
first(module, e, require) {
|
||||
{ const e = {}; require.d(e, { shadowed: () => 1 }); e.other = 2; }
|
||||
}
|
||||
}]);`);
|
||||
expect(analysis.bundler_registrations[0]?.modules).toMatchObject([
|
||||
{ module_key: "first", exports: [] },
|
||||
]);
|
||||
});
|
||||
|
||||
it("does not confuse a shadowed dispatch table with the outer module table", () => {
|
||||
const analysis = analyzeJavaScriptStaticSource(`(() => {
|
||||
const modules = { 17(module) { module.exports = require("electron"); } };
|
||||
|
||||
Reference in new issue
Block a user