mirror of
https://github.com/huhu/rust-search-extension
synced 2024-11-14 15:47:12 +00:00
79 lines
3.8 KiB
Text
79 lines
3.8 KiB
Text
// Format: jsonnetfmt -i manifest.jsonnet
|
|
|
|
local utils = import 'core/utils.libsonnet';
|
|
|
|
local icons() = {
|
|
[size]: 'assets/rust.png'
|
|
for size in ['16', '48', '128']
|
|
};
|
|
|
|
local name = 'Rust Search Extension';
|
|
local version = '1.13.0';
|
|
local keyword = 'rs';
|
|
local description = 'Rust Search Extension - the ultimate search extension for Rust';
|
|
|
|
local browser = std.extVar('browser');
|
|
|
|
local host_permissions = ['*://crates.io/api/v1/crates/*', 'https://rust.extension.sh/*'];
|
|
local optional_host_permissions = ['file:///*'];
|
|
local json = if std.member(['chrome', 'edge'], browser) then
|
|
local manifest_v3 = import 'core/manifest_v3.libsonnet';
|
|
manifest_v3.new(name, keyword, description, version, service_worker='service-worker.js', module_type=true)
|
|
.addWebAccessibleResources(
|
|
resources=['script/*.js', 'wasm/*.wasm', 'assets/*.svg'],
|
|
matches=[
|
|
'*://docs.rs/*',
|
|
'*://doc.rust-lang.org/*',
|
|
],
|
|
) {
|
|
description: 'A handy browser extension to search Rust docs and crates, etc in the address bar instantly!',
|
|
// The production extension public key to get the constant extension id during development.
|
|
[if browser == 'chrome' then 'key' else null]: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxOX+QfzcFnxPwwmzXDhuU59XGCSMZq+FGo0vOx/ufg/Vw7HfKEPVb9TKzrGtqW38kafWkjxOxGhF7VyyX2ymi55W0xqf8BedePbvMtV6H1tY5bscJ0dLKGH/ZG4T4f645LgvOWOBgyv8s3NDWXzwOMS57ER1y+EtHjDsWD1M0nfe0VCCLW18QlAsNTHfLZk6lUeEeGXZrl6+jK+pZxwhQFmc8cJvOyw7uAq6IJ9lnGDvxFVjGUepA0lKbLuIZjN3p70mgVUIuBYzKE6R8HDk4oBbKAK0HyyKfnuAYbfwVYotHw4def+OW9uADSlZEDC10wwIpU9NoP3szh+vWSnk0QIDAQAB',
|
|
}
|
|
.addHostPermissions(host_permissions)
|
|
.addOptionalHostPermissions(optional_host_permissions)
|
|
else
|
|
local manifest_v2 = import 'core/manifest.libsonnet';
|
|
manifest_v2.new(name, keyword, description, version)
|
|
.addWebAccessibleResources(utils.js_files('script', ['lib', 'add-search-index']))
|
|
.addWebAccessibleResources(['wasm/*.wasm', 'assets/*.svg'])
|
|
.addBackgroundScripts(['settings.js', 'deminifier.js'])
|
|
.addBackgroundScripts(utils.js_files('search', ['algorithm', 'book', 'crate', 'attribute', 'caniuse', 'lint']))
|
|
.addBackgroundScripts(utils.js_files('search/docs', ['base', 'crate-doc', 'rustc']))
|
|
.addBackgroundScripts(utils.js_files('index', ['attributes', 'books', 'caniuse', 'crates', 'std-docs', 'lints', 'labels', 'rfcs', 'commands', 'rustc', 'targets']))
|
|
.addBackgroundScripts(utils.js_files('command', ['label', 'help', 'stable', 'rfc', 'rustc', 'target']))
|
|
.addBackgroundScripts(['statistics.js', 'rust-version.js', 'crate-manager.js', 'index-manager.js', 'main.js'])
|
|
.addPermissions(host_permissions)
|
|
;
|
|
|
|
json.addIcons(icons())
|
|
.addPermissions(['storage', 'unlimitedStorage'])
|
|
.setOptionsUi('manage/index.html')
|
|
.addContentScript(
|
|
matches=['*://docs.rs/*'],
|
|
js=['content-script-bundle.js'] + utils.js_files('script', ['lib', 'docs-rs', 'svgs', 'rust-src-navigate', 'semver']),
|
|
css=['script/docs-rs.css', 'script/details-toggle.css'],
|
|
)
|
|
.addContentScript(
|
|
matches=['*://doc.rust-lang.org/*'],
|
|
js=['content-script-bundle.js'] + utils.js_files('script', ['lib', 'doc-rust-lang-org', 'rust-src-navigate']),
|
|
css=['script/doc-rust-lang-org.css', 'script/details-toggle.css'],
|
|
exclude_matches=['*://doc.rust-lang.org/nightly/nightly-rustc/*'],
|
|
)
|
|
.addContentScript(
|
|
matches=['*://doc.rust-lang.org/nightly/nightly-rustc/*'],
|
|
js=utils.js_files('script', ['lib', 'rustc', 'rust-src-navigate']),
|
|
css=['script/details-toggle.css'],
|
|
)
|
|
.addContentScript(
|
|
matches=['*://rust.extension.sh/update'],
|
|
js=['content-script-bundle.js'] + utils.js_files('script', ['rust-extension-sh']),
|
|
css=[],
|
|
).addContentScript(
|
|
matches=[
|
|
'*://docs.rs/*',
|
|
'*://doc.rust-lang.org/*',
|
|
],
|
|
js=['content-script-bundle.js'] + utils.js_files('script', ['lib', 'macro-railroad', 'macro-railroad-wasm']),
|
|
css=['script/macro-railroad.css'],
|
|
)
|