diff options
author | Vladimír Čunát <v@cunat.cz> | 2023-08-01 18:22:43 +0200 |
---|---|---|
committer | Vladimír Čunát <v@cunat.cz> | 2023-08-01 18:22:43 +0200 |
commit | 55f778d2b5aad1f300340818db7df7aad05e0136 (patch) | |
tree | 31e4af49927443e8c81b56058fc13f3e8a8c5fdb /pkgs/tools/typesetting/bibtex-tidy | |
parent | d61583bbc8fa6cdf4796b0bfd6003292ab8d1be8 (diff) | |
parent | 4f3a41ff8a5c9dde6737f0143c111565495513c2 (diff) | |
download | nixpkgs-55f778d2b5aad1f300340818db7df7aad05e0136.tar nixpkgs-55f778d2b5aad1f300340818db7df7aad05e0136.tar.gz nixpkgs-55f778d2b5aad1f300340818db7df7aad05e0136.tar.bz2 nixpkgs-55f778d2b5aad1f300340818db7df7aad05e0136.tar.lz nixpkgs-55f778d2b5aad1f300340818db7df7aad05e0136.tar.xz nixpkgs-55f778d2b5aad1f300340818db7df7aad05e0136.tar.zst nixpkgs-55f778d2b5aad1f300340818db7df7aad05e0136.zip |
Merge branch 'master' into staging-next
Diffstat (limited to 'pkgs/tools/typesetting/bibtex-tidy')
-rw-r--r-- | pkgs/tools/typesetting/bibtex-tidy/default.nix | 35 | ||||
-rw-r--r-- | pkgs/tools/typesetting/bibtex-tidy/remove-google-font-loader.patch | 52 |
2 files changed, 87 insertions, 0 deletions
diff --git a/pkgs/tools/typesetting/bibtex-tidy/default.nix b/pkgs/tools/typesetting/bibtex-tidy/default.nix new file mode 100644 index 00000000000..7aeaf13fb02 --- /dev/null +++ b/pkgs/tools/typesetting/bibtex-tidy/default.nix @@ -0,0 +1,35 @@ +{ lib +, buildNpmPackage +, fetchFromGitHub +}: + +buildNpmPackage rec { + pname = "bibtex-tidy"; + version = "1.11.0"; + + src = fetchFromGitHub { + owner = "FlamingTempura"; + repo = "bibtex-tidy"; + rev = "v${version}"; + hash = "sha256-VjQuMQr3OJgjgX6FdH/C4mehf8H7XjDZ9Rxs92hyQVo="; + }; + + patches = [ + # downloads Google fonts during `npm run build` + ./remove-google-font-loader.patch + ]; + + npmDepsHash = "sha256-u2lyG95F00S/bvsVwu0hIuUw2UZYQWFakCF31LIijSU="; + + env = { + PUPPETEER_SKIP_DOWNLOAD = true; + }; + + meta = { + changelog = "https://github.com/FlamingTempura/bibtex-tidy/blob/${src.rev}/CHANGELOG.md"; + description = "Cleaner and Formatter for BibTeX files"; + homepage = "https://github.com/FlamingTempura/bibtex-tidy"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ bertof ]; + }; +} diff --git a/pkgs/tools/typesetting/bibtex-tidy/remove-google-font-loader.patch b/pkgs/tools/typesetting/bibtex-tidy/remove-google-font-loader.patch new file mode 100644 index 00000000000..79c6850cf6c --- /dev/null +++ b/pkgs/tools/typesetting/bibtex-tidy/remove-google-font-loader.patch @@ -0,0 +1,52 @@ +diff --git a/build.ts b/build.ts +index ae4e350..3498ae7 100644 +--- a/build.ts ++++ b/build.ts +@@ -312,7 +312,6 @@ async function buildWebBundle() { + target: ['esnext'], + plugins: [ + sveltePlugin({ preprocess: autoPreprocess() }), +- googleFontPlugin, + regexpuPlugin, + ], + }); +@@ -344,7 +343,6 @@ async function serveWeb() { + preprocess: autoPreprocess(), + compilerOptions: { enableSourcemap: true }, + }), +- googleFontPlugin, + ], + }); + const server = await ctx.serve({ servedir: WEB_PATH }); +@@ -375,31 +373,6 @@ const regexpuPlugin: Plugin = { + }, + }; + +-// Downloads google fonts and injects them as base64 urls into bundle css +-const googleFontPlugin: Plugin = { +- name: 'google-font-loader', +- setup(build) { +- build.onResolve({ filter: /^https?:\/\/fonts\./ }, (args) => ({ +- path: args.path, +- namespace: 'http-url', +- })); +- build.onLoad( +- { filter: /.*/, namespace: 'http-url' }, +- async (args): Promise<OnLoadResult> => { +- const res = await fetch(args.path, { +- headers: { +- // ensures google responds with woff2 fonts +- 'User-Agent': 'Mozilla/5.0 Firefox/90.0', +- }, +- }); +- const contents = Buffer.from(await res.arrayBuffer()); +- const loader = args.path.endsWith('.woff2') ? 'dataurl' : 'css'; +- return { contents, loader }; +- } +- ); +- }, +-}; +- + /** + * swc converts js syntax to support older browsers. ESBuild can kinda do this + * but only for more recent browsers. swc is also far easier to configure than |