softarc-consulting / sheriff

Lightweight Modularity for TypeScript Projects
MIT License
179 stars 14 forks source link

Path resolver failes #67

Open rainerhahnekamp opened 6 months ago

rainerhahnekamp commented 6 months ago
    "paths": {
      "@app/*": ["apps/eternal/src/app/*"],
      "@app/customers/api": ["libs/customers/api/src/index.ts"],
      "@app/customers/data": ["libs/customers/data/src/index.ts"],
      "@app/customers/feat-main": ["libs/customers/feat-main/src/index.ts"],
      "@app/customers/model": ["libs/customers/model/src/index.ts"],
      "@app/customers/ui": ["libs/customers/ui/src/index.ts"],
      "@app/holidays/api": ["libs/holidays/api/src/index.ts"],
      "@app/holidays/data": ["libs/holidays/data/src/index.ts"],
      "@app/holidays/feat-brochure": [
        "libs/holidays/feat-brochure/src/index.ts"
      ],

Will always fail because the path resolver stops at the first and doesn't continue.

bradley-carestia-jbh commented 2 months ago

Seems to not work on wildcard paths in general, saying "libs/libName/*/src/index.ts" does not exist. This means that it can't be used for secondary entry-points, which IMO is the primary benefit of this lib in an Nx repo (where we can otherwise use Nx module boundaries)

rainerhahnekamp commented 2 months ago

@bradley-carestia-jbh is this the same as #17?

bradley-carestia-jbh commented 2 months ago

Looks like it, yes!

rainerhahnekamp commented 2 months ago

Okay, that should be covered with the Caching Milestone.

Currently, the algorithm reads every file separately, which makes wildcards inefficient. With the cache, we load all files and, therefore, have full knowledge of the existing files and directories.