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.
@@ -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
- const fileUrl = import.meta.resolve(args.path);
671
- if (fileUrl.startsWith("node:")) {
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 resolvedPath = fileURLToPath(fileUrl);
675
- if (resolvedPath.includes(`node_modules`)) {
676
- return { path: resolvedPath, external: true };
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: resolvedPath };
691
+ return { path: args.path, external: true };
679
692
  });
680
693
  }
681
694
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elegance-js",
3
- "version": "1.8.4",
3
+ "version": "1.9.1",
4
4
  "description": "Web-Framework",
5
5
  "type": "module",
6
6
  "bin": {