*Add support for node-gyp-build-optional-packages
This commit is contained in:
parent
1f5eb3657e
commit
d220d9831e
12
src/index.ts
12
src/index.ts
|
@ -80,7 +80,8 @@ export default function bundleNativeModulesPlugin() {
|
||||||
return edits.push([node.start, node.end]);
|
return edits.push([node.start, node.end]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const findLoady = astMatcher("require('loady')(__str_aName, __any)");
|
for (const matchString of ["require('loady')(__str_aName, __any)"]) {
|
||||||
|
const findLoady = astMatcher(matchString);
|
||||||
const loadyMatches = findLoady(ast);
|
const loadyMatches = findLoady(ast);
|
||||||
|
|
||||||
if (loadyMatches?.length) {
|
if (loadyMatches?.length) {
|
||||||
|
@ -97,8 +98,13 @@ export default function bundleNativeModulesPlugin() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const findNodeBuildGyp = astMatcher("require('node-gyp-build')(__any)");
|
for (const matchString of [
|
||||||
|
"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) {
|
||||||
|
@ -121,7 +127,7 @@ export default function bundleNativeModulesPlugin() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (edits.length === 0) {
|
if (edits.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue