Compare commits

..

No commits in common. "366ffe1ac9c3a61cc98212f8bb7d9e59b02a16f4" and "1f5eb3657e6699067003be2e8ff146aef0115355" have entirely different histories.

2 changed files with 57 additions and 70 deletions

11
dist/index.js vendored
View File

@ -69,8 +69,7 @@ function bundleNativeModulesPlugin() {
// Not edited // Not edited
return edits.push([node.start, node.end]); return edits.push([node.start, node.end]);
} }
for (const matchString of ["require('loady')(__str_aName, __any)"]) { const findLoady = (0, ast_matcher_1.default)("require('loady')(__str_aName, __any)");
const findLoady = (0, ast_matcher_1.default)(matchString);
const loadyMatches = findLoady(ast); const loadyMatches = findLoady(ast);
if (loadyMatches?.length) { if (loadyMatches?.length) {
for (const match of loadyMatches) { for (const match of loadyMatches) {
@ -82,12 +81,7 @@ function bundleNativeModulesPlugin() {
} }
} }
} }
} const findNodeBuildGyp = (0, ast_matcher_1.default)("require('node-gyp-build')(__any)");
for (const matchString of [
"require('node-gyp-build')(__any)",
"loadNAPI(__any)",
]) {
const findNodeBuildGyp = (0, ast_matcher_1.default)(matchString);
const nodeBuildGypMatches = findNodeBuildGyp(ast); const nodeBuildGypMatches = findNodeBuildGyp(ast);
if (nodeBuildGypMatches?.length) { if (nodeBuildGypMatches?.length) {
for (const match of nodeBuildGypMatches) { for (const match of nodeBuildGypMatches) {
@ -105,7 +99,6 @@ function bundleNativeModulesPlugin() {
} }
} }
} }
}
if (edits.length === 0) { if (edits.length === 0) {
return null; return null;
} }

View File

@ -80,8 +80,7 @@ export default function bundleNativeModulesPlugin() {
return edits.push([node.start, node.end]); return edits.push([node.start, node.end]);
} }
for (const matchString of ["require('loady')(__str_aName, __any)"]) { const findLoady = astMatcher("require('loady')(__str_aName, __any)");
const findLoady = astMatcher(matchString);
const loadyMatches = findLoady(ast); const loadyMatches = findLoady(ast);
if (loadyMatches?.length) { if (loadyMatches?.length) {
@ -98,13 +97,8 @@ export default function bundleNativeModulesPlugin() {
} }
} }
} }
}
for (const matchString of [ const findNodeBuildGyp = astMatcher("require('node-gyp-build')(__any)");
"require('node-gyp-build')(__any)",
"loadNAPI(__any)",
]) {
const findNodeBuildGyp = astMatcher(matchString);
const nodeBuildGypMatches = findNodeBuildGyp(ast); const nodeBuildGypMatches = findNodeBuildGyp(ast);
if (nodeBuildGypMatches?.length) { if (nodeBuildGypMatches?.length) {
@ -127,7 +121,7 @@ export default function bundleNativeModulesPlugin() {
} }
} }
} }
}
if (edits.length === 0) { if (edits.length === 0) {
return null; return null;
} }