elegance-js 1.8.4 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/page_compiler.mjs +20 -7
- package/package.json +1 -1
package/dist/page_compiler.mjs
CHANGED
|
@@ -662,20 +662,33 @@ var build = async () => {
|
|
|
662
662
|
}
|
|
663
663
|
const projectFiles = getProjectFiles(options.pagesDirectory);
|
|
664
664
|
const start = performance.now();
|
|
665
|
+
const recursionFlag = Symbol("external-node-modules-recursion");
|
|
665
666
|
{
|
|
666
667
|
const externalPackagesPlugin = {
|
|
667
668
|
name: "external-packages",
|
|
668
669
|
setup(build2) {
|
|
669
|
-
build2.onResolve({ filter: /^[^./]/ }, (args) => {
|
|
670
|
-
|
|
671
|
-
|
|
670
|
+
build2.onResolve({ filter: /^[^./]/ }, async (args) => {
|
|
671
|
+
if (args.pluginData?.[recursionFlag]) {
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
const result = await build2.resolve(args.path, {
|
|
675
|
+
resolveDir: args.resolveDir,
|
|
676
|
+
kind: args.kind,
|
|
677
|
+
importer: args.importer,
|
|
678
|
+
pluginData: { [recursionFlag]: true }
|
|
679
|
+
});
|
|
680
|
+
if (result.errors.length > 0 || result.external || !result.path) {
|
|
672
681
|
return { path: args.path, external: true };
|
|
673
682
|
}
|
|
674
|
-
const
|
|
675
|
-
if (
|
|
676
|
-
return
|
|
683
|
+
const nodeModulesIndex = result.path.indexOf("node_modules");
|
|
684
|
+
if (nodeModulesIndex === -1) {
|
|
685
|
+
return result;
|
|
686
|
+
}
|
|
687
|
+
const isNested = result.path.includes("node_modules", nodeModulesIndex + 14);
|
|
688
|
+
if (isNested) {
|
|
689
|
+
return { path: args.path, external: true };
|
|
677
690
|
}
|
|
678
|
-
return { path:
|
|
691
|
+
return { path: args.path, external: true };
|
|
679
692
|
});
|
|
680
693
|
}
|
|
681
694
|
};
|