Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[library resolver] local waypoints. #9

Closed
favonia opened this issue Jun 23, 2020 · 0 comments
Closed

[library resolver] local waypoints. #9

favonia opened this issue Jun 23, 2020 · 0 comments

Comments

@favonia
Copy link
Collaborator

favonia commented Jun 23, 2020

This is the spec of waypoints that point to local library roots. A library reference in this scheme is a string library.name. Waypoints are stored in YAML files of a name specified by the client. Maybe it's waypoint. This special file name is referred to as ${waypoint} below.

Direct waypoints

These are the basic waypoints pointing to the roots of libraries. The resolver will keep moving up in the file system until some matching waypoint is found. If the root directory is reached and there's still no matching waypoint, the resolution fails.

- "basis":
    at: ["src", "basis"]
- "frontend":
    at: ["src", "frontend"]

Indirect waypoints

Indirect waypoints delegate the resolution to other waypoints, which can also be indirect. The resolution is thus recursive. The library name must be explicitly listed in the next waypoint file. That is, it will not move up in the file system when no applicable waypoint is found. Otherwise, one can easily have unintentional infinite looping due to a typo.

- "bantorra":
    "next": ["mylib", "bantorra"] # the resolver will look up the library in "mylib/bantorra/${waypoint}"
- "cool.basis":
    "next": ["mylib", "cool"] # the resolver will look up the library in "mylib/cool/${waypoint}"
    "rename": "basis" # optional field for the new name to look up

Mixed waypoints

Of course, you can have both direct and indirect waypoints in a single file.

- "cool.basis":
    "next": ["mylib", "cool"]
    "rename": "basis"
- "bantorra":
    "next": ["mylib", "bantorra"]
- "builtin":
    "at": ["runtime", "builtin"]

Name uniqueness

The YAML format demands unique library names within a waypoint file, so there should not be any ambiguity. The order of waypoints in a file should not matter.

@favonia favonia changed the title Support local and maybe hierarchical waypoints. Support local waypoints. Jun 23, 2020
@favonia favonia changed the title Support local waypoints. Local waypoints. Jun 23, 2020
@favonia favonia changed the title Local waypoints. [resolver] local waypoints. Jun 24, 2020
@favonia favonia changed the title [resolver] local waypoints. [library resolver] local waypoints. Jun 24, 2020
favonia added a commit that referenced this issue Jun 25, 2020
favonia added a commit that referenced this issue Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant