File resolution
: shell
: file-resolution
:
: /modules/core/io/services/file-resolution.js
: https://github.com/DecentCMS/DecentCMS/blob/master/modules/core/io/services/file-resolution.js
FileResolution
Kind: global class
- FileResolution
- new FileResolution(scope)
- .getCacheKey(pathTokens) ⇒
String - .resolve(fileName) ⇒
String - .all(fileName) ⇒
Array
new FileResolution(scope)
Resolves local paths to the physical path of the file in the first module in dependency order (most dependent modules are first) that has it. For example, if module1 and module 2 both have the file, but a service in module 2 depends on module 1, then the path of the file in module 2 is returned.
| Param | Type | Description |
|---|---|---|
| scope | object |
the scope |
fileResolution.getCacheKey(pathTokens) ⇒ String
Builds a cache key from the string and regular expression path tokens that are passed as arguments.
Kind: instance method of FileResolution
Returns: String - The cache key.
| Param | Type | Description |
|---|---|---|
| pathTokens | Array |
The local path under the module's root of the file to find, or the pattern to match. More than one argument may be passed, each of which can be a string or regular expression representing the name of parent folders. |
fileResolution.resolve(fileName) ⇒ String
Resolves local paths to the physical path of the file in the first module in dependency order (dependencies are last) that has it. For example, if module1 and module 2 both have the file, but a service in module 2 depends on module 1, then the path of the file in module 2 is returned.
Kind: instance method of FileResolution
Returns: String - The physical path of the found file, or null if it wasn't found.
| Param | Type | Description |
|---|---|---|
| fileName | RegExp |
The local path under the module's root of the file to find, or the pattern to match. More than one argument may be passed, each of which can be a string or regular expression representing the name of parent folders. |
fileResolution.all(fileName) ⇒ Array
Finds all occurrences of the file whose path is passed in, in order of dependency, starting from dependencies.
Kind: instance method of FileResolution
Returns: Array - The list of paths found.
| Param | Type | Description |
|---|---|---|
| fileName | RegExp |
The local path under the module's root of the file to find, or the pattern to match. More than one argument may be passed, each of which can be a string or regular expression representing the name of parent folders. |