https://github.com/eemeli/resolve-chrome-uri
https://github.com/eemeli/resolve-chrome-uri
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/eemeli/resolve-chrome-uri
- Owner: eemeli
- Created: 2021-09-09T11:30:25.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-11-26T13:20:48.000Z (over 4 years ago)
- Last Synced: 2025-03-28T16:49:08.874Z (about 1 year ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# resolve-chrome-uri
A really hacky utility for resolving `chrome://` URIs into file paths under mozilla-central.
Internally, parses `%` lines from `jar.mn` files and then looks around.
Falls back to matching file names.
Results are cached to disk, as this is a bit slow.
Supports only `content` and `locale` URIs.
To use as a library:
```js
import { clearCache, resolveChromeUri } from 'resolve-chrome-uri'
const root = 'path/to/mozilla-central'
const uri = 'chrome://mozapps/content/update/history.xhtml'
const res = await resolveChromeUri(root, uri)
> Set(1) {
'/absolute/path/to/mozilla-central/toolkit/mozapps/update/content/history.xhtml'
}
```
Provides a CLI which uses the current directory as the root and takes the URI
as a single argument:
```sh
$ npx resolve-chrome-uri chrome://mozapps/content/update/history.xhtml
toolkit/mozapps/update/content/history.xhtml
```
To clear the cache, use `-c` or `--clear` as the argument.