asset忘了上传了,重新传一下,增加了模板引擎(见README),修复了printable的目录bug
This commit is contained in:
1 parent
0817d33309
commit
8b88de4942
7268 files changed
+1257020
No files matched your search
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
if [[ ! -d "/home/helloworld/Projects/wpep/tools/gp" ]]; then
|
||||
echo "Cannot find source directory; Did you move it?"
|
||||
echo "(Looking for "/home/helloworld/Projects/wpep/tools/gp")"
|
||||
echo 'Cannot force reload with this script - use "direnv reload" manually and then try again'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# rebuild the cache forcefully
|
||||
_nix_direnv_force_reload=1 direnv exec "/home/helloworld/Projects/wpep/tools/gp" true
|
||||
+1
@@ -0,0 +1 @@
|
||||
/nix/store/01x5k4nlxcpyd85nnr0b9gm89rm8ff4x-source
|
||||
+1
@@ -0,0 +1 @@
|
||||
/nix/store/0d1kf07ph2ply64i1y247f9q2an9cw00-source
|
||||
+1
@@ -0,0 +1 @@
|
||||
/nix/store/5msh8h99hcj2pp1bn49bf5j1hz0k59fl-source
|
||||
+1
@@ -0,0 +1 @@
|
||||
/nix/store/ljcx5g5zlms59kb3bd7jm0ilc22y4ab7-source
|
||||
+1
@@ -0,0 +1 @@
|
||||
/nix/store/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source
|
||||
+1
@@ -0,0 +1 @@
|
||||
/nix/store/x0in9psz97m9zgqszgcg1ndsajc0jpw7-nix-shell-env
|
||||
+2166
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
use flake
|
||||
@@ -0,0 +1,4 @@
|
||||
tmps/*
|
||||
outputs/*
|
||||
private_key.asc
|
||||
node_modules/
|
||||
+373
@@ -0,0 +1,373 @@
|
||||
{
|
||||
"nixEnvSelector.nixFile": "${workspaceFolder}/flake.nix",
|
||||
"terminal.integrated.env.linux": {
|
||||
"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD": "1",
|
||||
"CHROMIUM_PATH": "/nix/store/13xp1mgxcw3c1ys21dk9dp5cmy5fsz7w-chromium-147.0.7727.55/bin/chromium",
|
||||
"SHELL": "/nix/store/v8sa6r6q037ihghxfbwzjj4p59v2x0pv-bash-5.3p9/bin/bash",
|
||||
"__HM_SESS_VARS_SOURCED": "1",
|
||||
"COLORTERM": "truecolor",
|
||||
"XDG_CONFIG_DIRS": "/etc/xdg:/home/arch/.local/share/flatpak/exports/etc/xdg:/var/lib/flatpak/exports/etc/xdg:/home/arch/.nix-profile/etc/xdg:/nix/profile/etc/xdg:/home/arch/.local/state/nix/profile/etc/xdg:/etc/profiles/per-user/arch/etc/xdg:/nix/var/nix/profiles/default/etc/xdg:/run/current-system/sw/etc/xdg:/nix/store/zh9bq7ndr6gxx6hagc57c8mdrpdjp0v0-gnome-settings-daemon-49.1/etc/xdg",
|
||||
"NIX_LD_LIBRARY_PATH": "/run/current-system/sw/share/nix-ld/lib",
|
||||
"NIX_BUILD_CORES": "12",
|
||||
"NIX_GCROOT": "/nix/store/0r1baggl4cim2yv1my7xv6ylwhj8jjlh-nix-shell-env",
|
||||
"XDG_MENU_PREFIX": "gnome-",
|
||||
"TERM_PROGRAM_VERSION": "49.2",
|
||||
"GTK_IM_MODULE": "fcitx",
|
||||
"configureFlags": "",
|
||||
"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL": "1",
|
||||
"mesonFlags": "",
|
||||
"shell": "/nix/store/v8sa6r6q037ihghxfbwzjj4p59v2x0pv-bash-5.3p9/bin/bash",
|
||||
"depsHostHost": "",
|
||||
"LC_ADDRESS": "zh_CN.UTF-8",
|
||||
"LC_NAME": "zh_CN.UTF-8",
|
||||
"SSH_AUTH_SOCK": "/run/user/1000/gcr/ssh",
|
||||
"DIRENV_DIR": "-/home/arch/Projects/wpep/tools/gp",
|
||||
"STRINGS": "strings",
|
||||
"depsTargetTarget": "",
|
||||
"XCURSOR_PATH": "/home/arch/.icons:/home/arch/.local/share/icons:/home/arch/.local/share/flatpak/exports/share/icons:/home/arch/.local/share/flatpak/exports/share/pixmaps:/var/lib/flatpak/exports/share/icons:/var/lib/flatpak/exports/share/pixmaps:/home/arch/.nix-profile/share/icons:/home/arch/.nix-profile/share/pixmaps:/nix/profile/share/icons:/nix/profile/share/pixmaps:/home/arch/.local/state/nix/profile/share/icons:/home/arch/.local/state/nix/profile/share/pixmaps:/etc/profiles/per-user/arch/share/icons:/etc/profiles/per-user/arch/share/pixmaps:/nix/var/nix/profiles/default/share/icons:/nix/var/nix/profiles/default/share/pixmaps:/run/current-system/sw/share/icons:/run/current-system/sw/share/pixmaps",
|
||||
"MEMORY_PRESSURE_WRITE": "c29tZSAyMDAwMDAgMjAwMDAwMAA=",
|
||||
"ELECTRON_RUN_AS_NODE": "1",
|
||||
"stdenv": "/nix/store/gvq9hvvnmkvrk27mba0jjjppj068z55x-stdenv-linux",
|
||||
"LOCALE_ARCHIVE_2_27": "/nix/store/s7627r57hh0hyb4ik6d92ms5zzclrawp-glibc-locales-2.42-51/lib/locale/locale-archive",
|
||||
"builder": "/nix/store/v8sa6r6q037ihghxfbwzjj4p59v2x0pv-bash-5.3p9/bin/bash",
|
||||
"XMODIFIERS": "@im=fcitx",
|
||||
"DESKTOP_SESSION": "gnome",
|
||||
"LC_MONETARY": "zh_CN.UTF-8",
|
||||
"GDK_PIXBUF_MODULE_FILE": "/nix/store/kn9lwgvdaa94nl9nsxx5p198gry21n03-librsvg-2.61.4/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache",
|
||||
"shellHook": "export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1",
|
||||
" export CHROMIUM_PATH": "\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\"",
|
||||
"echo \"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD": "$PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD\"",
|
||||
" echo \"CHROMIUM_PATH": "$CHROMIUM_PATH\"",
|
||||
"NO_AT_BRIDGE": "1",
|
||||
"DIRENV_FILE": "/home/arch/Projects/wpep/tools/gp/.envrc",
|
||||
"EDITOR": "nano",
|
||||
"phases": "buildPhase",
|
||||
"DBUS_STARTER_BUS_TYPE": "session",
|
||||
"NAUTILUS_4_EXTENSION_DIR": "/nix/store/58b287bvfpkzf5gif1xz5bippfkd7f66-system-path/lib/nautilus/extensions-4",
|
||||
"PWD": "/home/arch/Projects/wpep/tools/gp",
|
||||
"NIX_PROFILES": "/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/arch /home/arch/.local/state/nix/profile /nix/profile /home/arch/.nix-profile /var/lib/flatpak/exports /home/arch/.local/share/flatpak/exports",
|
||||
"NIX_GSETTINGS_OVERRIDES_DIR": "/nix/store/pw378mnm4z97k9vj6kmg0qab9zbnwf47-gnome-gsettings-overrides/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas",
|
||||
"SOURCE_DATE_EPOCH": "315532800",
|
||||
"XDG_SESSION_DESKTOP": "gnome",
|
||||
"LOGNAME": "arch",
|
||||
"XDG_SESSION_TYPE": "wayland",
|
||||
"NIX_ENFORCE_NO_NATIVE": "1",
|
||||
"CUPS_DATADIR": "/nix/store/yflb7rc8rasa1pfvqkm3dp1z69vz2ba9-cups-progs/share/cups",
|
||||
"NIX_PATH": "/home/arch/.nix-defexpr/channels:nixpkgs=flake:nixpkgs:/nix/var/nix/profiles/per-user/root/channels",
|
||||
"COPILOT_OTEL_FILE_EXPORTER_PATH": "/dev/null",
|
||||
"VSCODE_ESM_ENTRYPOINT": "vs/workbench/api/node/extensionHostProcess",
|
||||
"SYSTEMD_EXEC_PID": "2256",
|
||||
"VSCODE_CODE_CACHE_PATH": "/home/arch/.config/Code/CachedData/41dd792b5e652393e7787322889ed5fdc58bd75b",
|
||||
"NIXPKGS_CONFIG": "/etc/nix/nixpkgs-config.nix",
|
||||
"CXX": "g++",
|
||||
"XAUTHORITY": "/run/user/1000/.mutter-Xwaylandauth.5ZVIO3",
|
||||
"TEMPDIR": "/tmp/nix-shell.ILezom/nix-shell.AtazSx",
|
||||
"system": "x86_64-linux",
|
||||
"HOST_PATH": "/nix/store/74sind1d6vf2bfwd7yklg8chsvzqxmmq-coreutils-9.10/bin:/nix/store/c89zz4vh8v9dbs8169wk8ahwxvrdxgm5-findutils-4.10.0/bin:/nix/store/355mp4ns4042sb5p51rx3ys4mlliiwc5-diffutils-3.12/bin:/nix/store/jpsqy47rdl0j0dvyyzb4kw8gqajw8nx0-gnused-4.9/bin:/nix/store/h6hdbgkfh59np7bi7h8qa76pq27ixz8r-gnugrep-3.12/bin:/nix/store/gg169kyil5vhsg5aqcpagyhs8fwl0r5r-gawk-5.3.2/bin:/nix/store/kvmqv1jqv4792rsihf7yjc5kwk3d8z6x-gnutar-1.35/bin:/nix/store/pnxiz967z73a45f4x7c1icldjaaqmlcp-gzip-1.14/bin:/nix/store/by6npbc13ly5a1zgsqghv7wv5bklyiny-bzip2-1.0.8-bin/bin:/nix/store/1fvcxyhg3i5fvw0j4l8wmyml10dnvm7q-gnumake-4.4.1/bin:/nix/store/v8sa6r6q037ihghxfbwzjj4p59v2x0pv-bash-5.3p9/bin:/nix/store/ca84rbhb0bhwdcci7q51dad20nkbn9xc-patch-2.8/bin:/nix/store/g6mlwdvpg92rchq352ll7jbi0pz7h43r-xz-5.8.2-bin/bin:/nix/store/kjg8z2k0zvsczaij78803g7imlfm1vfb-file-5.45/bin",
|
||||
"GDM_LANG": "zh_CN.UTF-8",
|
||||
"IN_NIX_SHELL": "impure",
|
||||
"doInstallCheck": "",
|
||||
"GI_TYPELIB_PATH": "/nix/store/d864rlg855kf2hnnnfdzcx54grp8n10x-glib-2.86.3/lib/girepository-1.0:/nix/store/argh931zkmvlr78nkwxz45c6y49dnri0-gdk-pixbuf-2.44.5/lib/girepository-1.0:/nix/store/1h06bl72cj25gmv34cazvkixnvysj9q2-graphene-1.10.8/lib/girepository-1.0:/nix/store/bicq9gpqf10dx09li6q0pxd73wc5yx2x-harfbuzz-12.3.0/lib/girepository-1.0:/nix/store/apbb9j812kbr57qw1f1dgrqxf4gzbd3m-pango-1.57.0/lib/girepository-1.0:/nix/store/xsfc5fcy12nmcdsdwm3dx1xfffh7xv30-gsettings-desktop-schemas-49.1/lib/girepository-1.0:/nix/store/hjp25ksf3axb4czp7sllvzl1bkpfwsyg-gtk4-4.20.3/lib/girepository-1.0:/nix/store/kn9lwgvdaa94nl9nsxx5p198gry21n03-librsvg-2.61.4/lib/girepository-1.0:/nix/store/sf2lb971dqfwf326qddixn3yanc53nl0-gnome-desktop-44.5/lib/girepository-1.0:/nix/store/r9krxd5xlwggdj8997yvqyizscaa2x8y-json-glib-1.10.8/lib/girepository-1.0",
|
||||
"HOME": "/home/arch",
|
||||
"USERNAME": "arch",
|
||||
"NIX_BINTOOLS": "/nix/store/x7ikkplbrv5dlihy1bqq32gp6lilkval-binutils-wrapper-2.44",
|
||||
"LC_PAPER": "zh_CN.UTF-8",
|
||||
"LANG": "zh_CN.UTF-8",
|
||||
"LS_COLORS": "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.7z=01;31:*.ace=01;31:*.alz=01;31:*.apk=01;31:*.arc=01;31:*.arj=01;31:*.bz=01;31:*.bz2=01;31:*.cab=01;31:*.cpio=01;31:*.crate=01;31:*.deb=01;31:*.drpm=01;31:*.dwm=01;31:*.dz=01;31:*.ear=01;31:*.egg=01;31:*.esd=01;31:*.gz=01;31:*.jar=01;31:*.lha=01;31:*.lrz=01;31:*.lz=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.lzo=01;31:*.pyz=01;31:*.rar=01;31:*.rpm=01;31:*.rz=01;31:*.sar=01;31:*.swm=01;31:*.t7z=01;31:*.tar=01;31:*.taz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tgz=01;31:*.tlz=01;31:*.txz=01;31:*.tz=01;31:*.tzo=01;31:*.tzst=01;31:*.udeb=01;31:*.war=01;31:*.whl=01;31:*.wim=01;31:*.xz=01;31:*.z=01;31:*.zip=01;31:*.zoo=01;31:*.zst=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.jxl=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:",
|
||||
"XDG_CURRENT_DESKTOP": "GNOME",
|
||||
"depsTargetTargetPropagated": "",
|
||||
"VSCODE_DOTNET_INSTALL_TOOL_ORIGINAL_HOME": "/home/arch",
|
||||
"VSCODE_IPC_HOOK": "/run/user/1000/vscode-2fafacbe-1.11-main.sock",
|
||||
"MEMORY_PRESSURE_WATCH": "/sys/fs/cgroup/user.slice/user-1000.slice/[email protected]/session.slice/dbus.service/memory.pressure",
|
||||
"STARSHIP_SHELL": "zsh",
|
||||
"VTE_VERSION": "8203",
|
||||
"WAYLAND_DISPLAY": "wayland-0",
|
||||
"cmakeFlags": "",
|
||||
"STARSHIP_CONFIG": "/home/arch/.config/starship.toml",
|
||||
"outputs": "out",
|
||||
"GIO_EXTRA_MODULES": "/nix/store/y8dqwhsf4bvggqawlv7zia65lbr8rp51-dconf-0.49.0-lib/lib/gio/modules:/nix/store/jhx50gyrf0zr45xxvdl11z4jlkky05my-gvfs-1.58.4/lib/gio/modules:/nix/store/yd01p9dyhm7p06wrsjz1zpqg063b4jfs-glib-networking-2.80.1/lib/gio/modules:GTK_PATH=/home/arch/.local/share/flatpak/exports/lib/gtk-2.0:/home/arch/.local/share/flatpak/exports/lib/gtk-3.0:/home/arch/.local/share/flatpak/exports/lib/gtk-4.0:/var/lib/flatpak/exports/lib/gtk-2.0:/var/lib/flatpak/exports/lib/gtk-3.0:/var/lib/flatpak/exports/lib/gtk-4.0:/home/arch/.nix-profile/lib/gtk-2.0:/home/arch/.nix-profile/lib/gtk-3.0:/home/arch/.nix-profile/lib/gtk-4.0:/nix/profile/lib/gtk-2.0:/nix/profile/lib/gtk-3.0:/nix/profile/lib/gtk-4.0:/home/arch/.local/state/nix/profile/lib/gtk-2.0:/home/arch/.local/state/nix/profile/lib/gtk-3.0:/home/arch/.local/state/nix/profile/lib/gtk-4.0:/etc/profiles/per-user/arch/lib/gtk-2.0:/etc/profiles/per-user/arch/lib/gtk-3.0:/etc/profiles/per-user/arch/lib/gtk-4.0:/nix/var/nix/profiles/default/lib/gtk-2.0:/nix/var/nix/profiles/default/lib/gtk-3.0:/nix/var/nix/profiles/default/lib/gtk-4.0:/run/current-system/sw/lib/gtk-2.0:/run/current-system/sw/lib/gtk-3.0:/run/current-system/sw/lib/gtk-4.0",
|
||||
"VSCODE_CLI": "1",
|
||||
"NIX_STORE": "/nix/store",
|
||||
"TMPDIR": "/tmp/nix-shell.ILezom/nix-shell.AtazSx",
|
||||
"VSCODE_L10N_BUNDLE_LOCATION": "file:///home/arch/.vscode/extensions/ms-ceintl.vscode-language-pack-zh-hans-1.110.2026041514/translations/extensions/vscode.html-language-features.i18n.json",
|
||||
"LD": "ld",
|
||||
"buildPhase": "{ echo \"------------------------------------------------------------\";",
|
||||
"MANAGERPID": "2237",
|
||||
"DIRENV_DIFF": "eJzsWnlz2zqS_yoszvyxW2NSvA9PvT_kI7byHMmRncTJeEsFAiAJEgRBgOL16n33LUpyLB9JXo7Zqa1yKrakRv-6mw2g8YPaf6hcPfxDvZxen6uH6oSRbiLrUuBJCnLbsE0SRLxoUBVTELiVV9lR0lacR4aWUBJplh54uq1FhE0iwg738EliemHeE-o2qUxcUEEOkj6VQdxSQ7hCS0Cba65u69ZjaOqlKEryOHVDxv2I-GlQAd_jleWTbgiElrB1IjDXbN18As64rHrHF4gamYGavh8iJ2-DpAJZG7DOGMESI83Rw8dQ35GEIRN5TWxFcYv8PqdJAFPZDFVXFJUGS4HXNaFSC3XTeAyvGCMJFyR2G5GF0IhynnmtwZDjxYVdFFqbEphqlm7Zj6FtnPCUciZEA83UgxkCFeXc7zzRo6DptATXsGTxJulQs3TH0lxza0Ws2aQVgHMs5FaSlgWeAAHTiU5LCOhEpkDgSUxBzUE-wR0vRb3TbYCYUBI9P7hniJFO46KMCcX3wT8QPPVagxo_1cM1vBPICcdCW0sstsDPhseo9oBygnAM1rS-f2K4FgKzWpO9rHExke04pB6oNydnq5Pp9XR1MltePVzRwDVDbre0aFBXGZA6vd_3YKi4G8qg6YnWSFgirJm6abq6sc3a_ix1MoZuDHvTYgVEErWFjTqzi-M49bvGNrRE4romLJEawjKvS65JmOICSM0JdXM3DfdKu8HJ12H7EfTU7akduqTqgiBHZuHTzud-5LnMyOIu1JI6_4et2brl6O5XHO5r7ds3QIjiLMxi2rtm3kWBLYHVdMTsU1BZZq4lrCywBksmS4rH8KynaUozbrm5jG3QRQ4cuC8pbQZqRjmPW9knY5CO5uiWodtfC_FO55cE-JyLJ6r7noqYIlJkRlPwBolGgsyuBukGme8PkA5850liKUnJvpCK__yK-XdOxpCGUeUzJLyk67wUJND1YVAgwVHGjcb4nKK7WAEutqn6ypN9EfJLJucrHu9V9z0hEdpUeNRxSU5ZO-QWbdvBGwYn8XuTdztPBSkw4Fw-XQKGDbMIuANt0syOLaOjrZVGjIYkK7wwCO5m8DP0L1bvnfaX6vdTY_sVfC_KR6K_UMV3ml-p43vmv1jJdzrP1_InWcxN0SZOb6QNKyrHsCLT9mTDvSItotz23LsJTzGl4xw635ruz4q_wIv654HKRhY1XaqHKhDqgTodzx4g1QP1-Fg9VBMIx7fny8Wb2bs3q6dsy7Q7bhZJB1sbmr20TJSHiLuw6N1YDn6rwVSUBVkXmun4uqH7vuXrrjseepO7odHDYv5qdra6Oj-9uHjooAkk8IRXGbZP0iTt4qgdsszhbthYncEbLQIyHekY39CiyfhxNHhzM4b_j3-oB-rJbHk6fz8erOqhqu2tlEtRZhjWctJyzCd1WVI5Sfg94tXs4nSM5luIiY5ZI-A98MP0-vj8dEwlft1D47RetMP03XJ9FuJXw_v1TRR4pPo4a6OboQiuPPlp-bEuSTd3PrXV0avqSDoau8KXwc1xtHx7PoPIS9ZvzSx-zcWHcBZ9Wtwcfaxl_enTvCFun62K4LU4veZDZXhvl91sgaDvN9ji9hQhAV4nbh3D-Mann6wbS5CZwMv3QZp-yM7i15_Q1YV5cQJcXGZGFIHXxhGdvnK1368ThubhkWeS8PjcSOnvxx_Td9L7NA1hGnMqi7e4fmt8vPTefpA3-dvfr2bN8QWVVtTPRbqGR6-OpMPO3mE-vX79ySuM-ezNB5QReL5wmz4yL83ZGx7XJ-ubRfh-cMilEdwsg3hlYdc8vw7erwRdtNPpahXe1NFFpx6o54ur62dW4E-SXxiEw-A0adCEKJKB6YVtHoC07RqBuqRwtZgwtIU7umnoTwzYrltwh0nHcCwZudw1RWf30ikoJaSFroZIHG8N_GLa_1PXjZ-45uRNUTVmVjWOH1pCkjT2-wy6eZvbKBi88WhZ10Bopm67j7GcdWQIPX_wbeC4sdP50CSQogyAqqCQa8lA-MhkncfIqPcYj6Bp094F5pDIKkkbv23cKKc9Yb0WDYRbmqkbevDcvc6MG9j1aWITN25aI3No0BZ9QU0DsabwqzHqAuRYc3RHNx-jv7MMPVhhIHBElEZGlLYIQuJXrokAsgyWRyzsoMZBvbleBU_myCtoixqehJaAaWW7FqV-FhGDD37q2ELrBs3VA9167nnzLAkGKzeGRsIBkMwPAsNOfFLQuDCbONLGY01zdcfd3UBm89V8dvO5BpOCrwVWD9SLE_VQpUg9UMfho9n8erG4eHRF6XyS55xGonERJWlvRlVlWwn3KKF5A-gY4HYP7G5841XQeWRy9WE5vbw8Xa6up8uz0-vVZsN3gbfynNWa5axs2YoStu5WCVurh6p5h383uzhZHS-Wm4prWg_E14vLMdS64GO42yNQn13goSx2epuDbn9bRVYk3Thx27wwnM71XN_2K-Sy1Ep7l-VaAuHnxzBd3dKNz5Z-9BGOX11Mz65Wx4s3l9szR9FiARgqC01ijH4zhBmBJKEOVDSypRvKfshWBAQEZu7yooE9DeNWDK2IHMjMyHICjZUIZ1KzLH38PyEM0jXCz9qCLUGJH0QV9G0gUTQ0Lvd81Bp54tDcYlrFUayZ1qYyfM3QfzqoXWpP568Wy-PT1Xyxmk-vZ-9P99J-Pl2enM5n87PV6Xx6tEl8RBhiZavEpShAPb7UJO7vXm2Fkgh2XQoEwoywJAayVjiBisBUlIqsAcwhBTLloqwxrEnJtsLd51IoshYE1jHFHRAC9NLcScoGi5iWrTJgMTJYOtZ9gRO5C_biZLNIRg4jOKhT5du8pFzXfF3L8XUk24qiXewllWVBiqIAMDvzQyaayKSx2RCztXkknXhk-KzULN3Xww36ATgKUmnnoVXkEHVRS2SawKIgNq-coUkMuj8j2kj0n1j4P3e_y-PV9WJ5-mDLjwNv1EOVjSVhcfT6eHH5UT1UyyiDJe-3spN3by63MrQuRo74lIl8zwM9Psq_c688ghM02ClvzNxpGga91HS9kLSg46BtrbYqHmTjubPxx1n8vhmZ2bHX21lQmIFtUiOpCjOSuRk7XjbkMdqedJjGmqGPhfNJFr6_8j42QZs2AR5pqIkcylpjIDIEmTRE1YUJd8jGxPPQMC3sDBVenjuFw3mbwW5wpIkkapAXE_bwO8zn0viTVPTHDtHHVkTMA5rmDqKh7GPmOaKN7NSGvu1YHjeCeyvPoV_Y9AubfmHTP8umD1_6US_9qP_f_ajLi-nHD8vZ2fn16ur32eXqaLn4cHW6XJ0sPswvFtOTHYteTucXsyP1UBWAbSnW8nR6cnrxahRhgDCN1QP1avZpZFySDCPXulq8Gwn5yfT6dHV6uTgeaZRtuq5tBcZ4lbq6Xs7mG6I7EmO2IcCj7HInGdnX9embr93rxuHt931f1Pg6_lvwr7TrvocGPu1BfScRfGLgR6ncE0NZB6GVmkaa9nDw-zCzXKu3rLSKzEIAp9FYWZdaXLJaajDLNQnYSCkMw3lq67uJ4RMLLz3Qlx7oSw_0pQf60gN96YH-2h7ogbpayVqsYb0WGE3rWkj1UFUP1GhNKJoxvq73BZcpkFg9VP9QMExL5VbVfuLfrfrPW6bcWVI-TJfz2fzsUKlTrOCOyBoziJUyVuqUSGXzpR-RCitrJVkDAViNMdIfGZnVow5gCmE1FgxQhRSc4gKzGmy-jkS4BoQqcSkUnidSL_KrDbd5aOcXPdbmzd-UJYalQAqgVNlkUSGbvCpAKmLNalJgBWGOGcIMEiw36M1m-Oct-1O5XRuGjbe_lVv17-W6vlVv2d2UYPFLWsZwvK--oiDZTfd4TyDJWuzLEObyaPS5-fWc7FKUHCSgxo9Hr4FIcP2s8DnMeSnr8eep5DntrZ3HLvalT1DlcYphfvdhxmQNKH0gY_UUoRMiQUTxCebXAmzGRtpfYFmyvbwwUIyb4jNR1jBrNuKaNPjowUb6Mab8E42FH-0jKD_PqpVfwqfVA7Vc13_pDxH2vvDfonZJ337esuzdlPGxkI3v98ragcoFjrG4GE-PuyVubsR3q-focVW8H5o_M9vqgbpZEL9kh24snZfluAq35UH51jX1N_OW3TISK_9StGGsHQ_-luVWVf7nn2O1ZWPFIbECy6IADClao9zN6K76TBBuJmxNqWLdlyPLM-_hdyVLeeDit1v17__1jNn_HiuYomD6vFctEmUrsfg3eb8zvx_FvxStU27VyZRzSuDmrJCTs7JMKFaORxzWAeeT45LVmNVy8gbAxdVDhYf5_GJIP-diNB2TWzb-3LLdcfXNdfD3b2mMhrdZYN9YJzuXD5_qMeCWYSrxl9TvjnGJa303BVutC8LW3aECEFIY6cbz-W-fF2IpFLIt0_eLc0u7tJYg_NBQMabu8DPgQQ4nx3fwcVlI_GiGNobG7I5brkZjKX-we5OmCtOmYUXeiNzyiwgYWZZxnhleMLhup21B2qbRvbEhCKxPML8rCJuY1UN12xjf6f355_8GAAD___V7WAE=",
|
||||
"READELF": "readelf",
|
||||
"CHROME_DESKTOP": "code.desktop",
|
||||
"STARSHIP_SESSION_KEY": "5100215998796124",
|
||||
"NIX_USER_PROFILE_DIR": "/nix/var/nix/profiles/per-user/arch",
|
||||
"INFOPATH": "/home/arch/.local/share/flatpak/exports/info:/home/arch/.local/share/flatpak/exports/share/info:/var/lib/flatpak/exports/info:/var/lib/flatpak/exports/share/info:/home/arch/.nix-profile/info:/home/arch/.nix-profile/share/info:/nix/profile/info:/nix/profile/share/info:/home/arch/.local/state/nix/profile/info:/home/arch/.local/state/nix/profile/share/info:/etc/profiles/per-user/arch/info:/etc/profiles/per-user/arch/share/info:/nix/var/nix/profiles/default/info:/nix/var/nix/profiles/default/share/info:/run/current-system/sw/info:/run/current-system/sw/share/info",
|
||||
"doCheck": "",
|
||||
"GNOME_SETUP_DISPLAY": ":1",
|
||||
"depsBuildBuild": "",
|
||||
"XDG_SESSION_CLASS": "user",
|
||||
"COPILOT_OTEL_ENABLED": "true",
|
||||
"TERM": "xterm-256color",
|
||||
"LC_IDENTIFICATION": "zh_CN.UTF-8",
|
||||
"GTK_PATH": "/home/arch/.local/share/flatpak/exports/lib/gtk-2.0:/home/arch/.local/share/flatpak/exports/lib/gtk-3.0:/home/arch/.local/share/flatpak/exports/lib/gtk-4.0:/var/lib/flatpak/exports/lib/gtk-2.0:/var/lib/flatpak/exports/lib/gtk-3.0:/var/lib/flatpak/exports/lib/gtk-4.0:/home/arch/.nix-profile/lib/gtk-2.0:/home/arch/.nix-profile/lib/gtk-3.0:/home/arch/.nix-profile/lib/gtk-4.0:/nix/profile/lib/gtk-2.0:/nix/profile/lib/gtk-3.0:/nix/profile/lib/gtk-4.0:/home/arch/.local/state/nix/profile/lib/gtk-2.0:/home/arch/.local/state/nix/profile/lib/gtk-3.0:/home/arch/.local/state/nix/profile/lib/gtk-4.0:/etc/profiles/per-user/arch/lib/gtk-2.0:/etc/profiles/per-user/arch/lib/gtk-3.0:/etc/profiles/per-user/arch/lib/gtk-4.0:/nix/var/nix/profiles/default/lib/gtk-2.0:/nix/var/nix/profiles/default/lib/gtk-3.0:/nix/var/nix/profiles/default/lib/gtk-4.0:/run/current-system/sw/lib/gtk-2.0:/run/current-system/sw/lib/gtk-3.0:/run/current-system/sw/lib/gtk-4.0",
|
||||
"SIZE": "size",
|
||||
"propagatedNativeBuildInputs": "",
|
||||
"strictDeps": "",
|
||||
"USER": "arch",
|
||||
"TZDIR": "/etc/zoneinfo",
|
||||
"NIX_LD": "/run/current-system/sw/share/nix-ld/lib/ld.so",
|
||||
"AR": "ar",
|
||||
"AS": "as",
|
||||
"TEMP": "/tmp/nix-shell.ILezom/nix-shell.AtazSx",
|
||||
"NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu": "1",
|
||||
"DISPLAY": ":0",
|
||||
"VSCODE_PID": "4067",
|
||||
"SHLVL": "2",
|
||||
"NIX_BUILD_TOP": "/tmp/nix-shell.ILezom/nix-shell.AtazSx",
|
||||
"NM": "nm",
|
||||
"__HM_ZSH_SESS_VARS_SOURCED": "1",
|
||||
"PAGER": "less",
|
||||
"NIX_CFLAGS_COMPILE": " -frandom-seed=0r1baggl4c -isystem /nix/store/h2barca1k5pmvcyl9fwrzwrb4cn1b248-nodejs-22.22.2/include -isystem /nix/store/cwidg78bqc73asdbzv5p67dw0kg4lk2n-qpdf-12.3.2/include -isystem /nix/store/h2barca1k5pmvcyl9fwrzwrb4cn1b248-nodejs-22.22.2/include -isystem /nix/store/cwidg78bqc73asdbzv5p67dw0kg4lk2n-qpdf-12.3.2/include",
|
||||
"LC_TELEPHONE": "zh_CN.UTF-8",
|
||||
"QTWEBKIT_PLUGIN_PATH": "/home/arch/.local/share/flatpak/exports/lib/mozilla/plugins/:/var/lib/flatpak/exports/lib/mozilla/plugins/:/home/arch/.nix-profile/lib/mozilla/plugins/:/nix/profile/lib/mozilla/plugins/:/home/arch/.local/state/nix/profile/lib/mozilla/plugins/:/etc/profiles/per-user/arch/lib/mozilla/plugins/:/nix/var/nix/profiles/default/lib/mozilla/plugins/:/run/current-system/sw/lib/mozilla/plugins/",
|
||||
"patches": "",
|
||||
"QT_IM_MODULE": "fcitx",
|
||||
"APPLICATIONINSIGHTS_CONFIGURATION_CONTENT": "{}",
|
||||
"LC_MEASUREMENT": "zh_CN.UTF-8",
|
||||
"__NIXOS_SET_ENVIRONMENT_DONE": "1",
|
||||
"VSCODE_CWD": "/home/arch/Projects/wpep/tools/gp",
|
||||
"buildInputs": "",
|
||||
"DBUS_STARTER_ADDRESS": "unix:path=/run/user/1000/bus,guid=df5051e64effbfdd124009b669f232d4",
|
||||
"preferLocalBuild": "1",
|
||||
"LOCALE_ARCHIVE": "/run/current-system/sw/lib/locale/locale-archive",
|
||||
"MANAGERPIDFDID": "2238",
|
||||
"LESSKEYIN_SYSTEM": "/nix/store/ndjvymnavjb3xy2h54aci8cd2nmir587-lessconfig",
|
||||
"TERMINFO_DIRS": "/home/arch/.local/share/flatpak/exports/share/terminfo:/var/lib/flatpak/exports/share/terminfo:/home/arch/.nix-profile/share/terminfo:/nix/profile/share/terminfo:/home/arch/.local/state/nix/profile/share/terminfo:/etc/profiles/per-user/arch/share/terminfo:/nix/var/nix/profiles/default/share/terminfo:/run/current-system/sw/share/terminfo",
|
||||
"FC_FONTATIONS": "1",
|
||||
"LD_LIBRARY_PATH": "/nix/store/pcjb2l7xad0c9j25g4h9xd9pirchvl2m-libdbusmenu-glib-16.04.0/lib:/nix/store/dzpjlkm1r63x8jwyswqp6wfsr87hcv3g-pipewire-1.6.2-jack/lib",
|
||||
"VSCODE_CRASH_REPORTER_PROCESS_TYPE": "extensionHost",
|
||||
"XDG_RUNTIME_DIR": "/run/user/1000",
|
||||
"depsBuildTarget": "",
|
||||
"OBJCOPY": "objcopy",
|
||||
"NIX_XDG_DESKTOP_PORTAL_DIR": "/run/current-system/sw/share/xdg-desktop-portal/portals",
|
||||
"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true",
|
||||
"out": "/home/arch/Projects/wpep/tools/gp/outputs/out",
|
||||
"LC_TIME": "zh_CN.UTF-8",
|
||||
"ELECTRON_NO_ATTACH_CONSOLE": "1",
|
||||
"STRIP": "strip",
|
||||
"XDG_DATA_DIRS": "/nix/store/nj8hdb8an3j79nrvb1lf1vi1w3pbs4f8-deno-2.7.9/share:/nix/store/h2barca1k5pmvcyl9fwrzwrb4cn1b248-nodejs-22.22.2/share:/nix/store/13xp1mgxcw3c1ys21dk9dp5cmy5fsz7w-chromium-147.0.7727.55/share:/nix/store/jxcc2h10hhycz7y9j252y22hqb1mra4v-noto-fonts-cjk-sans-2.004/share:/nix/store/sj3f6y3j8m1831l0gqm1bsk1f46jzkfd-patchelf-0.15.2/share:/nix/store/nj8hdb8an3j79nrvb1lf1vi1w3pbs4f8-deno-2.7.9/share:/nix/store/h2barca1k5pmvcyl9fwrzwrb4cn1b248-nodejs-22.22.2/share:/nix/store/13xp1mgxcw3c1ys21dk9dp5cmy5fsz7w-chromium-147.0.7727.55/share:/nix/store/jxcc2h10hhycz7y9j252y22hqb1mra4v-noto-fonts-cjk-sans-2.004/share:/nix/store/sj3f6y3j8m1831l0gqm1bsk1f46jzkfd-patchelf-0.15.2/share:/nix/store/a519p3wlmvdxq0cl4y7yyazqp59s8vyi-vscode-1.115.0/share:/nix/store/xsfc5fcy12nmcdsdwm3dx1xfffh7xv30-gsettings-desktop-schemas-49.1/share/gsettings-schemas/gsettings-desktop-schemas-49.1:/nix/store/yl5yl395iqx88kd1m7lx7p7b65n0jfx9-gtk+3-3.24.51/share/gsettings-schemas/gtk+3-3.24.51:/nix/store/0a9dfj9jfly51kxb83sa2vxi1yhaq21k-gnome-console-49.2/share:/nix/store/hjp25ksf3axb4czp7sllvzl1bkpfwsyg-gtk4-4.20.3/share/gsettings-schemas/gtk4-4.20.3:/nix/store/0a9dfj9jfly51kxb83sa2vxi1yhaq21k-gnome-console-49.2/share/gsettings-schemas/gnome-console-49.2:/nix/store/mfldimj0vmpvdrvsaj3qzs58j77zclzp-gnome-session-49.2/share:/nix/store/xsfc5fcy12nmcdsdwm3dx1xfffh7xv30-gsettings-desktop-schemas-49.1/share/gsettings-schemas/gsettings-desktop-schemas-49.1:/nix/store/hjp25ksf3axb4czp7sllvzl1bkpfwsyg-gtk4-4.20.3/share/gsettings-schemas/gtk4-4.20.3:/nix/store/zh9bq7ndr6gxx6hagc57c8mdrpdjp0v0-gnome-settings-daemon-49.1/share/gsettings-schemas/gnome-settings-daemon-49.1:/nix/store/mfldimj0vmpvdrvsaj3qzs58j77zclzp-gnome-session-49.2/share/gsettings-schemas/gnome-session-49.2:/nix/store/dr93lr6l45iklnwzk2lwwz6zz4g7y1px-gnome-mimeapps/share:/nix/store/03cjba5zlvhj3f20xlw2hbnl9ijm6988-desktops/share:/home/arch/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/home/arch/.nix-profile/share:/nix/profile/share:/home/arch/.local/state/nix/profile/share:/etc/profiles/per-user/arch/share:/nix/var/nix/profiles/default/share:/run/current-system/sw/share:/nix/store/k1rwg4y0hvnmq402b136svp6mhmbk365-gnome-shell-49.4/share/gsettings-schemas/gnome-shell-49.4:/nix/store/k1rwg4y0hvnmq402b136svp6mhmbk365-gnome-shell-49.4/share",
|
||||
"GDK_BACKEND": "wayland",
|
||||
"LIBEXEC_PATH": "/home/arch/.local/share/flatpak/exports/libexec:/var/lib/flatpak/exports/libexec:/home/arch/.nix-profile/libexec:/nix/profile/libexec:/home/arch/.local/state/nix/profile/libexec:/etc/profiles/per-user/arch/libexec:/nix/var/nix/profiles/default/libexec:/run/current-system/sw/libexec",
|
||||
"TMP": "/tmp/nix-shell.ILezom/nix-shell.AtazSx",
|
||||
"OBJDUMP": "objdump",
|
||||
"PATH": "/nix/store/nj8hdb8an3j79nrvb1lf1vi1w3pbs4f8-deno-2.7.9/bin:/nix/store/h2barca1k5pmvcyl9fwrzwrb4cn1b248-nodejs-22.22.2/bin:/nix/store/idz3hpv1k4vvnc6h1569iwaxpaww2wqm-qpdf-12.3.2-bin/bin:/nix/store/13xp1mgxcw3c1ys21dk9dp5cmy5fsz7w-chromium-147.0.7727.55/bin:/nix/store/sj3f6y3j8m1831l0gqm1bsk1f46jzkfd-patchelf-0.15.2/bin:/nix/store/hb2bs5fg5wkm04x565737qd5nh2hy5nk-gcc-wrapper-15.2.0/bin:/nix/store/lvwga6ivl1d4lnw0zis9ajs0rqx9gp4i-gcc-15.2.0/bin:/nix/store/9hm3jdm6kk4m4ppwjcxz4s1dsdvd6fin-glibc-2.42-51-bin/bin:/nix/store/74sind1d6vf2bfwd7yklg8chsvzqxmmq-coreutils-9.10/bin:/nix/store/x7ikkplbrv5dlihy1bqq32gp6lilkval-binutils-wrapper-2.44/bin:/nix/store/rfp8lhk4dl9syfn64rwb3h3c73426p08-binutils-2.44/bin:/nix/store/74sind1d6vf2bfwd7yklg8chsvzqxmmq-coreutils-9.10/bin:/nix/store/c89zz4vh8v9dbs8169wk8ahwxvrdxgm5-findutils-4.10.0/bin:/nix/store/355mp4ns4042sb5p51rx3ys4mlliiwc5-diffutils-3.12/bin:/nix/store/jpsqy47rdl0j0dvyyzb4kw8gqajw8nx0-gnused-4.9/bin:/nix/store/h6hdbgkfh59np7bi7h8qa76pq27ixz8r-gnugrep-3.12/bin:/nix/store/gg169kyil5vhsg5aqcpagyhs8fwl0r5r-gawk-5.3.2/bin:/nix/store/kvmqv1jqv4792rsihf7yjc5kwk3d8z6x-gnutar-1.35/bin:/nix/store/pnxiz967z73a45f4x7c1icldjaaqmlcp-gzip-1.14/bin:/nix/store/by6npbc13ly5a1zgsqghv7wv5bklyiny-bzip2-1.0.8-bin/bin:/nix/store/1fvcxyhg3i5fvw0j4l8wmyml10dnvm7q-gnumake-4.4.1/bin:/nix/store/v8sa6r6q037ihghxfbwzjj4p59v2x0pv-bash-5.3p9/bin:/nix/store/ca84rbhb0bhwdcci7q51dad20nkbn9xc-patch-2.8/bin:/nix/store/g6mlwdvpg92rchq352ll7jbi0pz7h43r-xz-5.8.2-bin/bin:/nix/store/kjg8z2k0zvsczaij78803g7imlfm1vfb-file-5.45/bin:/nix/store/nj8hdb8an3j79nrvb1lf1vi1w3pbs4f8-deno-2.7.9/bin:/nix/store/h2barca1k5pmvcyl9fwrzwrb4cn1b248-nodejs-22.22.2/bin:/nix/store/idz3hpv1k4vvnc6h1569iwaxpaww2wqm-qpdf-12.3.2-bin/bin:/nix/store/13xp1mgxcw3c1ys21dk9dp5cmy5fsz7w-chromium-147.0.7727.55/bin:/nix/store/sj3f6y3j8m1831l0gqm1bsk1f46jzkfd-patchelf-0.15.2/bin:/nix/store/hb2bs5fg5wkm04x565737qd5nh2hy5nk-gcc-wrapper-15.2.0/bin:/nix/store/lvwga6ivl1d4lnw0zis9ajs0rqx9gp4i-gcc-15.2.0/bin:/nix/store/9hm3jdm6kk4m4ppwjcxz4s1dsdvd6fin-glibc-2.42-51-bin/bin:/nix/store/74sind1d6vf2bfwd7yklg8chsvzqxmmq-coreutils-9.10/bin:/nix/store/x7ikkplbrv5dlihy1bqq32gp6lilkval-binutils-wrapper-2.44/bin:/nix/store/rfp8lhk4dl9syfn64rwb3h3c73426p08-binutils-2.44/bin:/nix/store/74sind1d6vf2bfwd7yklg8chsvzqxmmq-coreutils-9.10/bin:/nix/store/c89zz4vh8v9dbs8169wk8ahwxvrdxgm5-findutils-4.10.0/bin:/nix/store/355mp4ns4042sb5p51rx3ys4mlliiwc5-diffutils-3.12/bin:/nix/store/jpsqy47rdl0j0dvyyzb4kw8gqajw8nx0-gnused-4.9/bin:/nix/store/h6hdbgkfh59np7bi7h8qa76pq27ixz8r-gnugrep-3.12/bin:/nix/store/gg169kyil5vhsg5aqcpagyhs8fwl0r5r-gawk-5.3.2/bin:/nix/store/kvmqv1jqv4792rsihf7yjc5kwk3d8z6x-gnutar-1.35/bin:/nix/store/pnxiz967z73a45f4x7c1icldjaaqmlcp-gzip-1.14/bin:/nix/store/by6npbc13ly5a1zgsqghv7wv5bklyiny-bzip2-1.0.8-bin/bin:/nix/store/1fvcxyhg3i5fvw0j4l8wmyml10dnvm7q-gnumake-4.4.1/bin:/nix/store/v8sa6r6q037ihghxfbwzjj4p59v2x0pv-bash-5.3p9/bin:/nix/store/ca84rbhb0bhwdcci7q51dad20nkbn9xc-patch-2.8/bin:/nix/store/g6mlwdvpg92rchq352ll7jbi0pz7h43r-xz-5.8.2-bin/bin:/nix/store/kjg8z2k0zvsczaij78803g7imlfm1vfb-file-5.45/bin:/nix/store/hak3031i8bpmvdqfla85q6q3bgwqppb0-glib-2.86.3-bin/bin:/nix/store/gg169kyil5vhsg5aqcpagyhs8fwl0r5r-gawk-5.3.2/bin:/nix/store/h6hdbgkfh59np7bi7h8qa76pq27ixz8r-gnugrep-3.12/bin:/nix/store/jpsqy47rdl0j0dvyyzb4kw8gqajw8nx0-gnused-4.9/bin:/nix/store/74sind1d6vf2bfwd7yklg8chsvzqxmmq-coreutils-9.10/bin:/nix/store/qnnigprif5vrj9c0bkpj6w0nd46fm3mm-which-2.23/bin:/nix/store/wfgphlpnrrvc1h6cjdaqlpp7x6ryd8vx-getconf-glibc-2.42-51/bin:/run/wrappers/bin:/home/arch/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/arch/.nix-profile/bin:/nix/profile/bin:/home/arch/.local/state/nix/profile/bin:/etc/profiles/per-user/arch/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin",
|
||||
"propagatedBuildInputs": "",
|
||||
"dontAddDisableDepTrack": "1",
|
||||
"GDMSESSION": "gnome",
|
||||
"CC": "gcc",
|
||||
"NIX_CC": "/nix/store/hb2bs5fg5wkm04x565737qd5nh2hy5nk-gcc-wrapper-15.2.0",
|
||||
"APPLICATION_INSIGHTS_NO_STATSBEAT": "true",
|
||||
"DBUS_SESSION_BUS_ADDRESS": "unix:path=/run/user/1000/bus,guid=df5051e64effbfdd124009b669f232d4",
|
||||
"depsBuildTargetPropagated": "",
|
||||
"depsBuildBuildPropagated": "",
|
||||
"DIRENV_WATCHES": "eJyc0EtOwzAURuG9eFzVuXb86iqYIwbXzm8S6sZRYtoixN4ZwqBFqBs4-nSeP8XCbRQHIcd6guQ1jfJprW9IbZOXBYtstZZNvi5yj_m8JrETpzq06QRxIOdc77ve2p3AddraJg5tfcfX7lZ2X2riIreRV8hhWjGfJZdSL1LDa5eoj0bbaJ0BlAF5-KTgndN9B61i9CH0hlKCYhUs6ZA9chfplsmQetQ0YP6QWsXkQKSIvCLls2byNrhucBFBs4nGUepATJZ6m0NIMWdjicHO5vyb1P1IMpftDuXO9Vz4iP08XR8f_2e51HT8V_rlOwAA__9XtbLx",
|
||||
"VSCODE_NLS_CONFIG": "{\"userLocale\":\"zh-cn\",\"osLocale\":\"zh-cn\",\"resolvedLanguage\":\"zh-cn\",\"defaultMessagesFile\":\"/nix/store/a519p3wlmvdxq0cl4y7yyazqp59s8vyi-vscode-1.115.0/lib/vscode/resources/app/out/nls.messages.json\",\"languagePack\":{\"translationsConfigFile\":\"/home/arch/.config/Code/clp/b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn/tcf.json\",\"messagesFile\":\"/home/arch/.config/Code/clp/b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn/41dd792b5e652393e7787322889ed5fdc58bd75b/nls.messages.json\",\"corruptMarkerFile\":\"/home/arch/.config/Code/clp/b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn/corrupted.info\"},\"locale\":\"zh-cn\",\"availableLanguages\":{\"*\":\"zh-cn\"},\"_languagePackId\":\"b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn\",\"_languagePackSupport\":true,\"_translationsConfigFile\":\"/home/arch/.config/Code/clp/b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn/tcf.json\",\"_cacheRoot\":\"/home/arch/.config/Code/clp/b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn\",\"_resolvedLanguagePackCoreLocation\":\"/home/arch/.config/Code/clp/b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn/41dd792b5e652393e7787322889ed5fdc58bd75b\",\"_corruptedFile\":\"/home/arch/.config/Code/clp/b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn/corrupted.info\"}",
|
||||
"NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu": "1",
|
||||
"QT_PLUGIN_PATH": "/nix/store/zi0yx7hlacqsnf6i5jqys4ybx53zzan2-fcitx5-with-addons-5.1.19/lib/qt-6/plugins",
|
||||
"CONFIG_SHELL": "/nix/store/v8sa6r6q037ihghxfbwzjj4p59v2x0pv-bash-5.3p9/bin/bash",
|
||||
"__structuredAttrs": "",
|
||||
"RANLIB": "ranlib",
|
||||
"NIX_HARDENING_ENABLE": "bindnow format fortify fortify3 libcxxhardeningfast pic relro stackclashprotection stackprotector strictflexarrays1 strictoverflow zerocallusedregs",
|
||||
"VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
|
||||
"LC_NUMERIC": "zh_CN.UTF-8",
|
||||
"OLDPWD": "",
|
||||
"NIX_LDFLAGS": "-rpath /home/arch/Projects/wpep/tools/gp/outputs/out/lib -L/nix/store/nj8hdb8an3j79nrvb1lf1vi1w3pbs4f8-deno-2.7.9/lib -L/nix/store/b8hs3k92mkcdxbwishgcmmi3pq4zvg0l-qpdf-12.3.2-lib/lib -L/nix/store/nj8hdb8an3j79nrvb1lf1vi1w3pbs4f8-deno-2.7.9/lib -L/nix/store/b8hs3k92mkcdxbwishgcmmi3pq4zvg0l-qpdf-12.3.2-lib/lib",
|
||||
"nativeBuildInputs": "/nix/store/nj8hdb8an3j79nrvb1lf1vi1w3pbs4f8-deno-2.7.9 /nix/store/h2barca1k5pmvcyl9fwrzwrb4cn1b248-nodejs-22.22.2 /nix/store/cwidg78bqc73asdbzv5p67dw0kg4lk2n-qpdf-12.3.2 /nix/store/13xp1mgxcw3c1ys21dk9dp5cmy5fsz7w-chromium-147.0.7727.55 /nix/store/jxcc2h10hhycz7y9j252y22hqb1mra4v-noto-fonts-cjk-sans-2.004",
|
||||
"COPILOT_OTEL_EXPORTER_TYPE": "file",
|
||||
"name": "nix-shell-env",
|
||||
"TERM_PROGRAM": "kgx",
|
||||
"depsHostHostPropagated": ""
|
||||
},
|
||||
"terminal.integrated.env.osx": {
|
||||
"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD": "1",
|
||||
"CHROMIUM_PATH": "/nix/store/13xp1mgxcw3c1ys21dk9dp5cmy5fsz7w-chromium-147.0.7727.55/bin/chromium",
|
||||
"SHELL": "/nix/store/v8sa6r6q037ihghxfbwzjj4p59v2x0pv-bash-5.3p9/bin/bash",
|
||||
"__HM_SESS_VARS_SOURCED": "1",
|
||||
"COLORTERM": "truecolor",
|
||||
"XDG_CONFIG_DIRS": "/etc/xdg:/home/arch/.local/share/flatpak/exports/etc/xdg:/var/lib/flatpak/exports/etc/xdg:/home/arch/.nix-profile/etc/xdg:/nix/profile/etc/xdg:/home/arch/.local/state/nix/profile/etc/xdg:/etc/profiles/per-user/arch/etc/xdg:/nix/var/nix/profiles/default/etc/xdg:/run/current-system/sw/etc/xdg:/nix/store/zh9bq7ndr6gxx6hagc57c8mdrpdjp0v0-gnome-settings-daemon-49.1/etc/xdg",
|
||||
"NIX_LD_LIBRARY_PATH": "/run/current-system/sw/share/nix-ld/lib",
|
||||
"NIX_BUILD_CORES": "12",
|
||||
"NIX_GCROOT": "/nix/store/0r1baggl4cim2yv1my7xv6ylwhj8jjlh-nix-shell-env",
|
||||
"XDG_MENU_PREFIX": "gnome-",
|
||||
"TERM_PROGRAM_VERSION": "49.2",
|
||||
"GTK_IM_MODULE": "fcitx",
|
||||
"configureFlags": "",
|
||||
"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL": "1",
|
||||
"mesonFlags": "",
|
||||
"shell": "/nix/store/v8sa6r6q037ihghxfbwzjj4p59v2x0pv-bash-5.3p9/bin/bash",
|
||||
"depsHostHost": "",
|
||||
"LC_ADDRESS": "zh_CN.UTF-8",
|
||||
"LC_NAME": "zh_CN.UTF-8",
|
||||
"SSH_AUTH_SOCK": "/run/user/1000/gcr/ssh",
|
||||
"DIRENV_DIR": "-/home/arch/Projects/wpep/tools/gp",
|
||||
"STRINGS": "strings",
|
||||
"depsTargetTarget": "",
|
||||
"XCURSOR_PATH": "/home/arch/.icons:/home/arch/.local/share/icons:/home/arch/.local/share/flatpak/exports/share/icons:/home/arch/.local/share/flatpak/exports/share/pixmaps:/var/lib/flatpak/exports/share/icons:/var/lib/flatpak/exports/share/pixmaps:/home/arch/.nix-profile/share/icons:/home/arch/.nix-profile/share/pixmaps:/nix/profile/share/icons:/nix/profile/share/pixmaps:/home/arch/.local/state/nix/profile/share/icons:/home/arch/.local/state/nix/profile/share/pixmaps:/etc/profiles/per-user/arch/share/icons:/etc/profiles/per-user/arch/share/pixmaps:/nix/var/nix/profiles/default/share/icons:/nix/var/nix/profiles/default/share/pixmaps:/run/current-system/sw/share/icons:/run/current-system/sw/share/pixmaps",
|
||||
"MEMORY_PRESSURE_WRITE": "c29tZSAyMDAwMDAgMjAwMDAwMAA=",
|
||||
"ELECTRON_RUN_AS_NODE": "1",
|
||||
"stdenv": "/nix/store/gvq9hvvnmkvrk27mba0jjjppj068z55x-stdenv-linux",
|
||||
"LOCALE_ARCHIVE_2_27": "/nix/store/s7627r57hh0hyb4ik6d92ms5zzclrawp-glibc-locales-2.42-51/lib/locale/locale-archive",
|
||||
"builder": "/nix/store/v8sa6r6q037ihghxfbwzjj4p59v2x0pv-bash-5.3p9/bin/bash",
|
||||
"XMODIFIERS": "@im=fcitx",
|
||||
"DESKTOP_SESSION": "gnome",
|
||||
"LC_MONETARY": "zh_CN.UTF-8",
|
||||
"GDK_PIXBUF_MODULE_FILE": "/nix/store/kn9lwgvdaa94nl9nsxx5p198gry21n03-librsvg-2.61.4/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache",
|
||||
"shellHook": "export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1",
|
||||
" export CHROMIUM_PATH": "\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\"",
|
||||
"echo \"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD": "$PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD\"",
|
||||
" echo \"CHROMIUM_PATH": "$CHROMIUM_PATH\"",
|
||||
"NO_AT_BRIDGE": "1",
|
||||
"DIRENV_FILE": "/home/arch/Projects/wpep/tools/gp/.envrc",
|
||||
"EDITOR": "nano",
|
||||
"phases": "buildPhase",
|
||||
"DBUS_STARTER_BUS_TYPE": "session",
|
||||
"NAUTILUS_4_EXTENSION_DIR": "/nix/store/58b287bvfpkzf5gif1xz5bippfkd7f66-system-path/lib/nautilus/extensions-4",
|
||||
"PWD": "/home/arch/Projects/wpep/tools/gp",
|
||||
"NIX_PROFILES": "/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/arch /home/arch/.local/state/nix/profile /nix/profile /home/arch/.nix-profile /var/lib/flatpak/exports /home/arch/.local/share/flatpak/exports",
|
||||
"NIX_GSETTINGS_OVERRIDES_DIR": "/nix/store/pw378mnm4z97k9vj6kmg0qab9zbnwf47-gnome-gsettings-overrides/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas",
|
||||
"SOURCE_DATE_EPOCH": "315532800",
|
||||
"XDG_SESSION_DESKTOP": "gnome",
|
||||
"LOGNAME": "arch",
|
||||
"XDG_SESSION_TYPE": "wayland",
|
||||
"NIX_ENFORCE_NO_NATIVE": "1",
|
||||
"CUPS_DATADIR": "/nix/store/yflb7rc8rasa1pfvqkm3dp1z69vz2ba9-cups-progs/share/cups",
|
||||
"NIX_PATH": "/home/arch/.nix-defexpr/channels:nixpkgs=flake:nixpkgs:/nix/var/nix/profiles/per-user/root/channels",
|
||||
"COPILOT_OTEL_FILE_EXPORTER_PATH": "/dev/null",
|
||||
"VSCODE_ESM_ENTRYPOINT": "vs/workbench/api/node/extensionHostProcess",
|
||||
"SYSTEMD_EXEC_PID": "2256",
|
||||
"VSCODE_CODE_CACHE_PATH": "/home/arch/.config/Code/CachedData/41dd792b5e652393e7787322889ed5fdc58bd75b",
|
||||
"NIXPKGS_CONFIG": "/etc/nix/nixpkgs-config.nix",
|
||||
"CXX": "g++",
|
||||
"XAUTHORITY": "/run/user/1000/.mutter-Xwaylandauth.5ZVIO3",
|
||||
"TEMPDIR": "/tmp/nix-shell.ILezom/nix-shell.AtazSx",
|
||||
"system": "x86_64-linux",
|
||||
"HOST_PATH": "/nix/store/74sind1d6vf2bfwd7yklg8chsvzqxmmq-coreutils-9.10/bin:/nix/store/c89zz4vh8v9dbs8169wk8ahwxvrdxgm5-findutils-4.10.0/bin:/nix/store/355mp4ns4042sb5p51rx3ys4mlliiwc5-diffutils-3.12/bin:/nix/store/jpsqy47rdl0j0dvyyzb4kw8gqajw8nx0-gnused-4.9/bin:/nix/store/h6hdbgkfh59np7bi7h8qa76pq27ixz8r-gnugrep-3.12/bin:/nix/store/gg169kyil5vhsg5aqcpagyhs8fwl0r5r-gawk-5.3.2/bin:/nix/store/kvmqv1jqv4792rsihf7yjc5kwk3d8z6x-gnutar-1.35/bin:/nix/store/pnxiz967z73a45f4x7c1icldjaaqmlcp-gzip-1.14/bin:/nix/store/by6npbc13ly5a1zgsqghv7wv5bklyiny-bzip2-1.0.8-bin/bin:/nix/store/1fvcxyhg3i5fvw0j4l8wmyml10dnvm7q-gnumake-4.4.1/bin:/nix/store/v8sa6r6q037ihghxfbwzjj4p59v2x0pv-bash-5.3p9/bin:/nix/store/ca84rbhb0bhwdcci7q51dad20nkbn9xc-patch-2.8/bin:/nix/store/g6mlwdvpg92rchq352ll7jbi0pz7h43r-xz-5.8.2-bin/bin:/nix/store/kjg8z2k0zvsczaij78803g7imlfm1vfb-file-5.45/bin",
|
||||
"GDM_LANG": "zh_CN.UTF-8",
|
||||
"IN_NIX_SHELL": "impure",
|
||||
"doInstallCheck": "",
|
||||
"GI_TYPELIB_PATH": "/nix/store/d864rlg855kf2hnnnfdzcx54grp8n10x-glib-2.86.3/lib/girepository-1.0:/nix/store/argh931zkmvlr78nkwxz45c6y49dnri0-gdk-pixbuf-2.44.5/lib/girepository-1.0:/nix/store/1h06bl72cj25gmv34cazvkixnvysj9q2-graphene-1.10.8/lib/girepository-1.0:/nix/store/bicq9gpqf10dx09li6q0pxd73wc5yx2x-harfbuzz-12.3.0/lib/girepository-1.0:/nix/store/apbb9j812kbr57qw1f1dgrqxf4gzbd3m-pango-1.57.0/lib/girepository-1.0:/nix/store/xsfc5fcy12nmcdsdwm3dx1xfffh7xv30-gsettings-desktop-schemas-49.1/lib/girepository-1.0:/nix/store/hjp25ksf3axb4czp7sllvzl1bkpfwsyg-gtk4-4.20.3/lib/girepository-1.0:/nix/store/kn9lwgvdaa94nl9nsxx5p198gry21n03-librsvg-2.61.4/lib/girepository-1.0:/nix/store/sf2lb971dqfwf326qddixn3yanc53nl0-gnome-desktop-44.5/lib/girepository-1.0:/nix/store/r9krxd5xlwggdj8997yvqyizscaa2x8y-json-glib-1.10.8/lib/girepository-1.0",
|
||||
"HOME": "/home/arch",
|
||||
"USERNAME": "arch",
|
||||
"NIX_BINTOOLS": "/nix/store/x7ikkplbrv5dlihy1bqq32gp6lilkval-binutils-wrapper-2.44",
|
||||
"LC_PAPER": "zh_CN.UTF-8",
|
||||
"LANG": "zh_CN.UTF-8",
|
||||
"LS_COLORS": "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.7z=01;31:*.ace=01;31:*.alz=01;31:*.apk=01;31:*.arc=01;31:*.arj=01;31:*.bz=01;31:*.bz2=01;31:*.cab=01;31:*.cpio=01;31:*.crate=01;31:*.deb=01;31:*.drpm=01;31:*.dwm=01;31:*.dz=01;31:*.ear=01;31:*.egg=01;31:*.esd=01;31:*.gz=01;31:*.jar=01;31:*.lha=01;31:*.lrz=01;31:*.lz=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.lzo=01;31:*.pyz=01;31:*.rar=01;31:*.rpm=01;31:*.rz=01;31:*.sar=01;31:*.swm=01;31:*.t7z=01;31:*.tar=01;31:*.taz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tgz=01;31:*.tlz=01;31:*.txz=01;31:*.tz=01;31:*.tzo=01;31:*.tzst=01;31:*.udeb=01;31:*.war=01;31:*.whl=01;31:*.wim=01;31:*.xz=01;31:*.z=01;31:*.zip=01;31:*.zoo=01;31:*.zst=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.jxl=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:",
|
||||
"XDG_CURRENT_DESKTOP": "GNOME",
|
||||
"depsTargetTargetPropagated": "",
|
||||
"VSCODE_DOTNET_INSTALL_TOOL_ORIGINAL_HOME": "/home/arch",
|
||||
"VSCODE_IPC_HOOK": "/run/user/1000/vscode-2fafacbe-1.11-main.sock",
|
||||
"MEMORY_PRESSURE_WATCH": "/sys/fs/cgroup/user.slice/user-1000.slice/[email protected]/session.slice/dbus.service/memory.pressure",
|
||||
"STARSHIP_SHELL": "zsh",
|
||||
"VTE_VERSION": "8203",
|
||||
"WAYLAND_DISPLAY": "wayland-0",
|
||||
"cmakeFlags": "",
|
||||
"STARSHIP_CONFIG": "/home/arch/.config/starship.toml",
|
||||
"outputs": "out",
|
||||
"GIO_EXTRA_MODULES": "/nix/store/y8dqwhsf4bvggqawlv7zia65lbr8rp51-dconf-0.49.0-lib/lib/gio/modules:/nix/store/jhx50gyrf0zr45xxvdl11z4jlkky05my-gvfs-1.58.4/lib/gio/modules:/nix/store/yd01p9dyhm7p06wrsjz1zpqg063b4jfs-glib-networking-2.80.1/lib/gio/modules:GTK_PATH=/home/arch/.local/share/flatpak/exports/lib/gtk-2.0:/home/arch/.local/share/flatpak/exports/lib/gtk-3.0:/home/arch/.local/share/flatpak/exports/lib/gtk-4.0:/var/lib/flatpak/exports/lib/gtk-2.0:/var/lib/flatpak/exports/lib/gtk-3.0:/var/lib/flatpak/exports/lib/gtk-4.0:/home/arch/.nix-profile/lib/gtk-2.0:/home/arch/.nix-profile/lib/gtk-3.0:/home/arch/.nix-profile/lib/gtk-4.0:/nix/profile/lib/gtk-2.0:/nix/profile/lib/gtk-3.0:/nix/profile/lib/gtk-4.0:/home/arch/.local/state/nix/profile/lib/gtk-2.0:/home/arch/.local/state/nix/profile/lib/gtk-3.0:/home/arch/.local/state/nix/profile/lib/gtk-4.0:/etc/profiles/per-user/arch/lib/gtk-2.0:/etc/profiles/per-user/arch/lib/gtk-3.0:/etc/profiles/per-user/arch/lib/gtk-4.0:/nix/var/nix/profiles/default/lib/gtk-2.0:/nix/var/nix/profiles/default/lib/gtk-3.0:/nix/var/nix/profiles/default/lib/gtk-4.0:/run/current-system/sw/lib/gtk-2.0:/run/current-system/sw/lib/gtk-3.0:/run/current-system/sw/lib/gtk-4.0",
|
||||
"VSCODE_CLI": "1",
|
||||
"NIX_STORE": "/nix/store",
|
||||
"TMPDIR": "/tmp/nix-shell.ILezom/nix-shell.AtazSx",
|
||||
"VSCODE_L10N_BUNDLE_LOCATION": "file:///home/arch/.vscode/extensions/ms-ceintl.vscode-language-pack-zh-hans-1.110.2026041514/translations/extensions/vscode.html-language-features.i18n.json",
|
||||
"LD": "ld",
|
||||
"buildPhase": "{ echo \"------------------------------------------------------------\";",
|
||||
"MANAGERPID": "2237",
|
||||
"DIRENV_DIFF": "eJzsWnlz2zqS_yoszvyxW2NSvA9PvT_kI7byHMmRncTJeEsFAiAJEgRBgOL16n33LUpyLB9JXo7Zqa1yKrakRv-6mw2g8YPaf6hcPfxDvZxen6uH6oSRbiLrUuBJCnLbsE0SRLxoUBVTELiVV9lR0lacR4aWUBJplh54uq1FhE0iwg738EliemHeE-o2qUxcUEEOkj6VQdxSQ7hCS0Cba65u69ZjaOqlKEryOHVDxv2I-GlQAd_jleWTbgiElrB1IjDXbN18As64rHrHF4gamYGavh8iJ2-DpAJZG7DOGMESI83Rw8dQ35GEIRN5TWxFcYv8PqdJAFPZDFVXFJUGS4HXNaFSC3XTeAyvGCMJFyR2G5GF0IhynnmtwZDjxYVdFFqbEphqlm7Zj6FtnPCUciZEA83UgxkCFeXc7zzRo6DptATXsGTxJulQs3TH0lxza0Ws2aQVgHMs5FaSlgWeAAHTiU5LCOhEpkDgSUxBzUE-wR0vRb3TbYCYUBI9P7hniJFO46KMCcX3wT8QPPVagxo_1cM1vBPICcdCW0sstsDPhseo9oBygnAM1rS-f2K4FgKzWpO9rHExke04pB6oNydnq5Pp9XR1MltePVzRwDVDbre0aFBXGZA6vd_3YKi4G8qg6YnWSFgirJm6abq6sc3a_ix1MoZuDHvTYgVEErWFjTqzi-M49bvGNrRE4romLJEawjKvS65JmOICSM0JdXM3DfdKu8HJ12H7EfTU7akduqTqgiBHZuHTzud-5LnMyOIu1JI6_4et2brl6O5XHO5r7ds3QIjiLMxi2rtm3kWBLYHVdMTsU1BZZq4lrCywBksmS4rH8KynaUozbrm5jG3QRQ4cuC8pbQZqRjmPW9knY5CO5uiWodtfC_FO55cE-JyLJ6r7noqYIlJkRlPwBolGgsyuBukGme8PkA5850liKUnJvpCK__yK-XdOxpCGUeUzJLyk67wUJND1YVAgwVHGjcb4nKK7WAEutqn6ypN9EfJLJucrHu9V9z0hEdpUeNRxSU5ZO-QWbdvBGwYn8XuTdztPBSkw4Fw-XQKGDbMIuANt0syOLaOjrZVGjIYkK7wwCO5m8DP0L1bvnfaX6vdTY_sVfC_KR6K_UMV3ml-p43vmv1jJdzrP1_InWcxN0SZOb6QNKyrHsCLT9mTDvSItotz23LsJTzGl4xw635ruz4q_wIv654HKRhY1XaqHKhDqgTodzx4g1QP1-Fg9VBMIx7fny8Wb2bs3q6dsy7Q7bhZJB1sbmr20TJSHiLuw6N1YDn6rwVSUBVkXmun4uqH7vuXrrjseepO7odHDYv5qdra6Oj-9uHjooAkk8IRXGbZP0iTt4qgdsszhbthYncEbLQIyHekY39CiyfhxNHhzM4b_j3-oB-rJbHk6fz8erOqhqu2tlEtRZhjWctJyzCd1WVI5Sfg94tXs4nSM5luIiY5ZI-A98MP0-vj8dEwlft1D47RetMP03XJ9FuJXw_v1TRR4pPo4a6OboQiuPPlp-bEuSTd3PrXV0avqSDoau8KXwc1xtHx7PoPIS9ZvzSx-zcWHcBZ9Wtwcfaxl_enTvCFun62K4LU4veZDZXhvl91sgaDvN9ji9hQhAV4nbh3D-Mann6wbS5CZwMv3QZp-yM7i15_Q1YV5cQJcXGZGFIHXxhGdvnK1368ThubhkWeS8PjcSOnvxx_Td9L7NA1hGnMqi7e4fmt8vPTefpA3-dvfr2bN8QWVVtTPRbqGR6-OpMPO3mE-vX79ySuM-ezNB5QReL5wmz4yL83ZGx7XJ-ubRfh-cMilEdwsg3hlYdc8vw7erwRdtNPpahXe1NFFpx6o54ur62dW4E-SXxiEw-A0adCEKJKB6YVtHoC07RqBuqRwtZgwtIU7umnoTwzYrltwh0nHcCwZudw1RWf30ikoJaSFroZIHG8N_GLa_1PXjZ-45uRNUTVmVjWOH1pCkjT2-wy6eZvbKBi88WhZ10Bopm67j7GcdWQIPX_wbeC4sdP50CSQogyAqqCQa8lA-MhkncfIqPcYj6Bp094F5pDIKkkbv23cKKc9Yb0WDYRbmqkbevDcvc6MG9j1aWITN25aI3No0BZ9QU0DsabwqzHqAuRYc3RHNx-jv7MMPVhhIHBElEZGlLYIQuJXrokAsgyWRyzsoMZBvbleBU_myCtoixqehJaAaWW7FqV-FhGDD37q2ELrBs3VA9167nnzLAkGKzeGRsIBkMwPAsNOfFLQuDCbONLGY01zdcfd3UBm89V8dvO5BpOCrwVWD9SLE_VQpUg9UMfho9n8erG4eHRF6XyS55xGonERJWlvRlVlWwn3KKF5A-gY4HYP7G5841XQeWRy9WE5vbw8Xa6up8uz0-vVZsN3gbfynNWa5axs2YoStu5WCVurh6p5h383uzhZHS-Wm4prWg_E14vLMdS64GO42yNQn13goSx2epuDbn9bRVYk3Thx27wwnM71XN_2K-Sy1Ep7l-VaAuHnxzBd3dKNz5Z-9BGOX11Mz65Wx4s3l9szR9FiARgqC01ijH4zhBmBJKEOVDSypRvKfshWBAQEZu7yooE9DeNWDK2IHMjMyHICjZUIZ1KzLH38PyEM0jXCz9qCLUGJH0QV9G0gUTQ0Lvd81Bp54tDcYlrFUayZ1qYyfM3QfzqoXWpP568Wy-PT1Xyxmk-vZ-9P99J-Pl2enM5n87PV6Xx6tEl8RBhiZavEpShAPb7UJO7vXm2Fkgh2XQoEwoywJAayVjiBisBUlIqsAcwhBTLloqwxrEnJtsLd51IoshYE1jHFHRAC9NLcScoGi5iWrTJgMTJYOtZ9gRO5C_biZLNIRg4jOKhT5du8pFzXfF3L8XUk24qiXewllWVBiqIAMDvzQyaayKSx2RCztXkknXhk-KzULN3Xww36ATgKUmnnoVXkEHVRS2SawKIgNq-coUkMuj8j2kj0n1j4P3e_y-PV9WJ5-mDLjwNv1EOVjSVhcfT6eHH5UT1UyyiDJe-3spN3by63MrQuRo74lIl8zwM9Psq_c688ghM02ClvzNxpGga91HS9kLSg46BtrbYqHmTjubPxx1n8vhmZ2bHX21lQmIFtUiOpCjOSuRk7XjbkMdqedJjGmqGPhfNJFr6_8j42QZs2AR5pqIkcylpjIDIEmTRE1YUJd8jGxPPQMC3sDBVenjuFw3mbwW5wpIkkapAXE_bwO8zn0viTVPTHDtHHVkTMA5rmDqKh7GPmOaKN7NSGvu1YHjeCeyvPoV_Y9AubfmHTP8umD1_6US_9qP_f_ajLi-nHD8vZ2fn16ur32eXqaLn4cHW6XJ0sPswvFtOTHYteTucXsyP1UBWAbSnW8nR6cnrxahRhgDCN1QP1avZpZFySDCPXulq8Gwn5yfT6dHV6uTgeaZRtuq5tBcZ4lbq6Xs7mG6I7EmO2IcCj7HInGdnX9embr93rxuHt931f1Pg6_lvwr7TrvocGPu1BfScRfGLgR6ncE0NZB6GVmkaa9nDw-zCzXKu3rLSKzEIAp9FYWZdaXLJaajDLNQnYSCkMw3lq67uJ4RMLLz3Qlx7oSw_0pQf60gN96YH-2h7ogbpayVqsYb0WGE3rWkj1UFUP1GhNKJoxvq73BZcpkFg9VP9QMExL5VbVfuLfrfrPW6bcWVI-TJfz2fzsUKlTrOCOyBoziJUyVuqUSGXzpR-RCitrJVkDAViNMdIfGZnVow5gCmE1FgxQhRSc4gKzGmy-jkS4BoQqcSkUnidSL_KrDbd5aOcXPdbmzd-UJYalQAqgVNlkUSGbvCpAKmLNalJgBWGOGcIMEiw36M1m-Oct-1O5XRuGjbe_lVv17-W6vlVv2d2UYPFLWsZwvK--oiDZTfd4TyDJWuzLEObyaPS5-fWc7FKUHCSgxo9Hr4FIcP2s8DnMeSnr8eep5DntrZ3HLvalT1DlcYphfvdhxmQNKH0gY_UUoRMiQUTxCebXAmzGRtpfYFmyvbwwUIyb4jNR1jBrNuKaNPjowUb6Mab8E42FH-0jKD_PqpVfwqfVA7Vc13_pDxH2vvDfonZJ337esuzdlPGxkI3v98ragcoFjrG4GE-PuyVubsR3q-focVW8H5o_M9vqgbpZEL9kh24snZfluAq35UH51jX1N_OW3TISK_9StGGsHQ_-luVWVf7nn2O1ZWPFIbECy6IADClao9zN6K76TBBuJmxNqWLdlyPLM-_hdyVLeeDit1v17__1jNn_HiuYomD6vFctEmUrsfg3eb8zvx_FvxStU27VyZRzSuDmrJCTs7JMKFaORxzWAeeT45LVmNVy8gbAxdVDhYf5_GJIP-diNB2TWzb-3LLdcfXNdfD3b2mMhrdZYN9YJzuXD5_qMeCWYSrxl9TvjnGJa303BVutC8LW3aECEFIY6cbz-W-fF2IpFLIt0_eLc0u7tJYg_NBQMabu8DPgQQ4nx3fwcVlI_GiGNobG7I5brkZjKX-we5OmCtOmYUXeiNzyiwgYWZZxnhleMLhup21B2qbRvbEhCKxPML8rCJuY1UN12xjf6f355_8GAAD___V7WAE=",
|
||||
"READELF": "readelf",
|
||||
"CHROME_DESKTOP": "code.desktop",
|
||||
"STARSHIP_SESSION_KEY": "5100215998796124",
|
||||
"NIX_USER_PROFILE_DIR": "/nix/var/nix/profiles/per-user/arch",
|
||||
"INFOPATH": "/home/arch/.local/share/flatpak/exports/info:/home/arch/.local/share/flatpak/exports/share/info:/var/lib/flatpak/exports/info:/var/lib/flatpak/exports/share/info:/home/arch/.nix-profile/info:/home/arch/.nix-profile/share/info:/nix/profile/info:/nix/profile/share/info:/home/arch/.local/state/nix/profile/info:/home/arch/.local/state/nix/profile/share/info:/etc/profiles/per-user/arch/info:/etc/profiles/per-user/arch/share/info:/nix/var/nix/profiles/default/info:/nix/var/nix/profiles/default/share/info:/run/current-system/sw/info:/run/current-system/sw/share/info",
|
||||
"doCheck": "",
|
||||
"GNOME_SETUP_DISPLAY": ":1",
|
||||
"depsBuildBuild": "",
|
||||
"XDG_SESSION_CLASS": "user",
|
||||
"COPILOT_OTEL_ENABLED": "true",
|
||||
"TERM": "xterm-256color",
|
||||
"LC_IDENTIFICATION": "zh_CN.UTF-8",
|
||||
"GTK_PATH": "/home/arch/.local/share/flatpak/exports/lib/gtk-2.0:/home/arch/.local/share/flatpak/exports/lib/gtk-3.0:/home/arch/.local/share/flatpak/exports/lib/gtk-4.0:/var/lib/flatpak/exports/lib/gtk-2.0:/var/lib/flatpak/exports/lib/gtk-3.0:/var/lib/flatpak/exports/lib/gtk-4.0:/home/arch/.nix-profile/lib/gtk-2.0:/home/arch/.nix-profile/lib/gtk-3.0:/home/arch/.nix-profile/lib/gtk-4.0:/nix/profile/lib/gtk-2.0:/nix/profile/lib/gtk-3.0:/nix/profile/lib/gtk-4.0:/home/arch/.local/state/nix/profile/lib/gtk-2.0:/home/arch/.local/state/nix/profile/lib/gtk-3.0:/home/arch/.local/state/nix/profile/lib/gtk-4.0:/etc/profiles/per-user/arch/lib/gtk-2.0:/etc/profiles/per-user/arch/lib/gtk-3.0:/etc/profiles/per-user/arch/lib/gtk-4.0:/nix/var/nix/profiles/default/lib/gtk-2.0:/nix/var/nix/profiles/default/lib/gtk-3.0:/nix/var/nix/profiles/default/lib/gtk-4.0:/run/current-system/sw/lib/gtk-2.0:/run/current-system/sw/lib/gtk-3.0:/run/current-system/sw/lib/gtk-4.0",
|
||||
"SIZE": "size",
|
||||
"propagatedNativeBuildInputs": "",
|
||||
"strictDeps": "",
|
||||
"USER": "arch",
|
||||
"TZDIR": "/etc/zoneinfo",
|
||||
"NIX_LD": "/run/current-system/sw/share/nix-ld/lib/ld.so",
|
||||
"AR": "ar",
|
||||
"AS": "as",
|
||||
"TEMP": "/tmp/nix-shell.ILezom/nix-shell.AtazSx",
|
||||
"NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu": "1",
|
||||
"DISPLAY": ":0",
|
||||
"VSCODE_PID": "4067",
|
||||
"SHLVL": "2",
|
||||
"NIX_BUILD_TOP": "/tmp/nix-shell.ILezom/nix-shell.AtazSx",
|
||||
"NM": "nm",
|
||||
"__HM_ZSH_SESS_VARS_SOURCED": "1",
|
||||
"PAGER": "less",
|
||||
"NIX_CFLAGS_COMPILE": " -frandom-seed=0r1baggl4c -isystem /nix/store/h2barca1k5pmvcyl9fwrzwrb4cn1b248-nodejs-22.22.2/include -isystem /nix/store/cwidg78bqc73asdbzv5p67dw0kg4lk2n-qpdf-12.3.2/include -isystem /nix/store/h2barca1k5pmvcyl9fwrzwrb4cn1b248-nodejs-22.22.2/include -isystem /nix/store/cwidg78bqc73asdbzv5p67dw0kg4lk2n-qpdf-12.3.2/include",
|
||||
"LC_TELEPHONE": "zh_CN.UTF-8",
|
||||
"QTWEBKIT_PLUGIN_PATH": "/home/arch/.local/share/flatpak/exports/lib/mozilla/plugins/:/var/lib/flatpak/exports/lib/mozilla/plugins/:/home/arch/.nix-profile/lib/mozilla/plugins/:/nix/profile/lib/mozilla/plugins/:/home/arch/.local/state/nix/profile/lib/mozilla/plugins/:/etc/profiles/per-user/arch/lib/mozilla/plugins/:/nix/var/nix/profiles/default/lib/mozilla/plugins/:/run/current-system/sw/lib/mozilla/plugins/",
|
||||
"patches": "",
|
||||
"QT_IM_MODULE": "fcitx",
|
||||
"APPLICATIONINSIGHTS_CONFIGURATION_CONTENT": "{}",
|
||||
"LC_MEASUREMENT": "zh_CN.UTF-8",
|
||||
"__NIXOS_SET_ENVIRONMENT_DONE": "1",
|
||||
"VSCODE_CWD": "/home/arch/Projects/wpep/tools/gp",
|
||||
"buildInputs": "",
|
||||
"DBUS_STARTER_ADDRESS": "unix:path=/run/user/1000/bus,guid=df5051e64effbfdd124009b669f232d4",
|
||||
"preferLocalBuild": "1",
|
||||
"LOCALE_ARCHIVE": "/run/current-system/sw/lib/locale/locale-archive",
|
||||
"MANAGERPIDFDID": "2238",
|
||||
"LESSKEYIN_SYSTEM": "/nix/store/ndjvymnavjb3xy2h54aci8cd2nmir587-lessconfig",
|
||||
"TERMINFO_DIRS": "/home/arch/.local/share/flatpak/exports/share/terminfo:/var/lib/flatpak/exports/share/terminfo:/home/arch/.nix-profile/share/terminfo:/nix/profile/share/terminfo:/home/arch/.local/state/nix/profile/share/terminfo:/etc/profiles/per-user/arch/share/terminfo:/nix/var/nix/profiles/default/share/terminfo:/run/current-system/sw/share/terminfo",
|
||||
"FC_FONTATIONS": "1",
|
||||
"LD_LIBRARY_PATH": "/nix/store/pcjb2l7xad0c9j25g4h9xd9pirchvl2m-libdbusmenu-glib-16.04.0/lib:/nix/store/dzpjlkm1r63x8jwyswqp6wfsr87hcv3g-pipewire-1.6.2-jack/lib",
|
||||
"VSCODE_CRASH_REPORTER_PROCESS_TYPE": "extensionHost",
|
||||
"XDG_RUNTIME_DIR": "/run/user/1000",
|
||||
"depsBuildTarget": "",
|
||||
"OBJCOPY": "objcopy",
|
||||
"NIX_XDG_DESKTOP_PORTAL_DIR": "/run/current-system/sw/share/xdg-desktop-portal/portals",
|
||||
"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true",
|
||||
"out": "/home/arch/Projects/wpep/tools/gp/outputs/out",
|
||||
"LC_TIME": "zh_CN.UTF-8",
|
||||
"ELECTRON_NO_ATTACH_CONSOLE": "1",
|
||||
"STRIP": "strip",
|
||||
"XDG_DATA_DIRS": "/nix/store/nj8hdb8an3j79nrvb1lf1vi1w3pbs4f8-deno-2.7.9/share:/nix/store/h2barca1k5pmvcyl9fwrzwrb4cn1b248-nodejs-22.22.2/share:/nix/store/13xp1mgxcw3c1ys21dk9dp5cmy5fsz7w-chromium-147.0.7727.55/share:/nix/store/jxcc2h10hhycz7y9j252y22hqb1mra4v-noto-fonts-cjk-sans-2.004/share:/nix/store/sj3f6y3j8m1831l0gqm1bsk1f46jzkfd-patchelf-0.15.2/share:/nix/store/nj8hdb8an3j79nrvb1lf1vi1w3pbs4f8-deno-2.7.9/share:/nix/store/h2barca1k5pmvcyl9fwrzwrb4cn1b248-nodejs-22.22.2/share:/nix/store/13xp1mgxcw3c1ys21dk9dp5cmy5fsz7w-chromium-147.0.7727.55/share:/nix/store/jxcc2h10hhycz7y9j252y22hqb1mra4v-noto-fonts-cjk-sans-2.004/share:/nix/store/sj3f6y3j8m1831l0gqm1bsk1f46jzkfd-patchelf-0.15.2/share:/nix/store/a519p3wlmvdxq0cl4y7yyazqp59s8vyi-vscode-1.115.0/share:/nix/store/xsfc5fcy12nmcdsdwm3dx1xfffh7xv30-gsettings-desktop-schemas-49.1/share/gsettings-schemas/gsettings-desktop-schemas-49.1:/nix/store/yl5yl395iqx88kd1m7lx7p7b65n0jfx9-gtk+3-3.24.51/share/gsettings-schemas/gtk+3-3.24.51:/nix/store/0a9dfj9jfly51kxb83sa2vxi1yhaq21k-gnome-console-49.2/share:/nix/store/hjp25ksf3axb4czp7sllvzl1bkpfwsyg-gtk4-4.20.3/share/gsettings-schemas/gtk4-4.20.3:/nix/store/0a9dfj9jfly51kxb83sa2vxi1yhaq21k-gnome-console-49.2/share/gsettings-schemas/gnome-console-49.2:/nix/store/mfldimj0vmpvdrvsaj3qzs58j77zclzp-gnome-session-49.2/share:/nix/store/xsfc5fcy12nmcdsdwm3dx1xfffh7xv30-gsettings-desktop-schemas-49.1/share/gsettings-schemas/gsettings-desktop-schemas-49.1:/nix/store/hjp25ksf3axb4czp7sllvzl1bkpfwsyg-gtk4-4.20.3/share/gsettings-schemas/gtk4-4.20.3:/nix/store/zh9bq7ndr6gxx6hagc57c8mdrpdjp0v0-gnome-settings-daemon-49.1/share/gsettings-schemas/gnome-settings-daemon-49.1:/nix/store/mfldimj0vmpvdrvsaj3qzs58j77zclzp-gnome-session-49.2/share/gsettings-schemas/gnome-session-49.2:/nix/store/dr93lr6l45iklnwzk2lwwz6zz4g7y1px-gnome-mimeapps/share:/nix/store/03cjba5zlvhj3f20xlw2hbnl9ijm6988-desktops/share:/home/arch/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/home/arch/.nix-profile/share:/nix/profile/share:/home/arch/.local/state/nix/profile/share:/etc/profiles/per-user/arch/share:/nix/var/nix/profiles/default/share:/run/current-system/sw/share:/nix/store/k1rwg4y0hvnmq402b136svp6mhmbk365-gnome-shell-49.4/share/gsettings-schemas/gnome-shell-49.4:/nix/store/k1rwg4y0hvnmq402b136svp6mhmbk365-gnome-shell-49.4/share",
|
||||
"GDK_BACKEND": "wayland",
|
||||
"LIBEXEC_PATH": "/home/arch/.local/share/flatpak/exports/libexec:/var/lib/flatpak/exports/libexec:/home/arch/.nix-profile/libexec:/nix/profile/libexec:/home/arch/.local/state/nix/profile/libexec:/etc/profiles/per-user/arch/libexec:/nix/var/nix/profiles/default/libexec:/run/current-system/sw/libexec",
|
||||
"TMP": "/tmp/nix-shell.ILezom/nix-shell.AtazSx",
|
||||
"OBJDUMP": "objdump",
|
||||
"PATH": "/nix/store/nj8hdb8an3j79nrvb1lf1vi1w3pbs4f8-deno-2.7.9/bin:/nix/store/h2barca1k5pmvcyl9fwrzwrb4cn1b248-nodejs-22.22.2/bin:/nix/store/idz3hpv1k4vvnc6h1569iwaxpaww2wqm-qpdf-12.3.2-bin/bin:/nix/store/13xp1mgxcw3c1ys21dk9dp5cmy5fsz7w-chromium-147.0.7727.55/bin:/nix/store/sj3f6y3j8m1831l0gqm1bsk1f46jzkfd-patchelf-0.15.2/bin:/nix/store/hb2bs5fg5wkm04x565737qd5nh2hy5nk-gcc-wrapper-15.2.0/bin:/nix/store/lvwga6ivl1d4lnw0zis9ajs0rqx9gp4i-gcc-15.2.0/bin:/nix/store/9hm3jdm6kk4m4ppwjcxz4s1dsdvd6fin-glibc-2.42-51-bin/bin:/nix/store/74sind1d6vf2bfwd7yklg8chsvzqxmmq-coreutils-9.10/bin:/nix/store/x7ikkplbrv5dlihy1bqq32gp6lilkval-binutils-wrapper-2.44/bin:/nix/store/rfp8lhk4dl9syfn64rwb3h3c73426p08-binutils-2.44/bin:/nix/store/74sind1d6vf2bfwd7yklg8chsvzqxmmq-coreutils-9.10/bin:/nix/store/c89zz4vh8v9dbs8169wk8ahwxvrdxgm5-findutils-4.10.0/bin:/nix/store/355mp4ns4042sb5p51rx3ys4mlliiwc5-diffutils-3.12/bin:/nix/store/jpsqy47rdl0j0dvyyzb4kw8gqajw8nx0-gnused-4.9/bin:/nix/store/h6hdbgkfh59np7bi7h8qa76pq27ixz8r-gnugrep-3.12/bin:/nix/store/gg169kyil5vhsg5aqcpagyhs8fwl0r5r-gawk-5.3.2/bin:/nix/store/kvmqv1jqv4792rsihf7yjc5kwk3d8z6x-gnutar-1.35/bin:/nix/store/pnxiz967z73a45f4x7c1icldjaaqmlcp-gzip-1.14/bin:/nix/store/by6npbc13ly5a1zgsqghv7wv5bklyiny-bzip2-1.0.8-bin/bin:/nix/store/1fvcxyhg3i5fvw0j4l8wmyml10dnvm7q-gnumake-4.4.1/bin:/nix/store/v8sa6r6q037ihghxfbwzjj4p59v2x0pv-bash-5.3p9/bin:/nix/store/ca84rbhb0bhwdcci7q51dad20nkbn9xc-patch-2.8/bin:/nix/store/g6mlwdvpg92rchq352ll7jbi0pz7h43r-xz-5.8.2-bin/bin:/nix/store/kjg8z2k0zvsczaij78803g7imlfm1vfb-file-5.45/bin:/nix/store/nj8hdb8an3j79nrvb1lf1vi1w3pbs4f8-deno-2.7.9/bin:/nix/store/h2barca1k5pmvcyl9fwrzwrb4cn1b248-nodejs-22.22.2/bin:/nix/store/idz3hpv1k4vvnc6h1569iwaxpaww2wqm-qpdf-12.3.2-bin/bin:/nix/store/13xp1mgxcw3c1ys21dk9dp5cmy5fsz7w-chromium-147.0.7727.55/bin:/nix/store/sj3f6y3j8m1831l0gqm1bsk1f46jzkfd-patchelf-0.15.2/bin:/nix/store/hb2bs5fg5wkm04x565737qd5nh2hy5nk-gcc-wrapper-15.2.0/bin:/nix/store/lvwga6ivl1d4lnw0zis9ajs0rqx9gp4i-gcc-15.2.0/bin:/nix/store/9hm3jdm6kk4m4ppwjcxz4s1dsdvd6fin-glibc-2.42-51-bin/bin:/nix/store/74sind1d6vf2bfwd7yklg8chsvzqxmmq-coreutils-9.10/bin:/nix/store/x7ikkplbrv5dlihy1bqq32gp6lilkval-binutils-wrapper-2.44/bin:/nix/store/rfp8lhk4dl9syfn64rwb3h3c73426p08-binutils-2.44/bin:/nix/store/74sind1d6vf2bfwd7yklg8chsvzqxmmq-coreutils-9.10/bin:/nix/store/c89zz4vh8v9dbs8169wk8ahwxvrdxgm5-findutils-4.10.0/bin:/nix/store/355mp4ns4042sb5p51rx3ys4mlliiwc5-diffutils-3.12/bin:/nix/store/jpsqy47rdl0j0dvyyzb4kw8gqajw8nx0-gnused-4.9/bin:/nix/store/h6hdbgkfh59np7bi7h8qa76pq27ixz8r-gnugrep-3.12/bin:/nix/store/gg169kyil5vhsg5aqcpagyhs8fwl0r5r-gawk-5.3.2/bin:/nix/store/kvmqv1jqv4792rsihf7yjc5kwk3d8z6x-gnutar-1.35/bin:/nix/store/pnxiz967z73a45f4x7c1icldjaaqmlcp-gzip-1.14/bin:/nix/store/by6npbc13ly5a1zgsqghv7wv5bklyiny-bzip2-1.0.8-bin/bin:/nix/store/1fvcxyhg3i5fvw0j4l8wmyml10dnvm7q-gnumake-4.4.1/bin:/nix/store/v8sa6r6q037ihghxfbwzjj4p59v2x0pv-bash-5.3p9/bin:/nix/store/ca84rbhb0bhwdcci7q51dad20nkbn9xc-patch-2.8/bin:/nix/store/g6mlwdvpg92rchq352ll7jbi0pz7h43r-xz-5.8.2-bin/bin:/nix/store/kjg8z2k0zvsczaij78803g7imlfm1vfb-file-5.45/bin:/nix/store/hak3031i8bpmvdqfla85q6q3bgwqppb0-glib-2.86.3-bin/bin:/nix/store/gg169kyil5vhsg5aqcpagyhs8fwl0r5r-gawk-5.3.2/bin:/nix/store/h6hdbgkfh59np7bi7h8qa76pq27ixz8r-gnugrep-3.12/bin:/nix/store/jpsqy47rdl0j0dvyyzb4kw8gqajw8nx0-gnused-4.9/bin:/nix/store/74sind1d6vf2bfwd7yklg8chsvzqxmmq-coreutils-9.10/bin:/nix/store/qnnigprif5vrj9c0bkpj6w0nd46fm3mm-which-2.23/bin:/nix/store/wfgphlpnrrvc1h6cjdaqlpp7x6ryd8vx-getconf-glibc-2.42-51/bin:/run/wrappers/bin:/home/arch/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/arch/.nix-profile/bin:/nix/profile/bin:/home/arch/.local/state/nix/profile/bin:/etc/profiles/per-user/arch/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin",
|
||||
"propagatedBuildInputs": "",
|
||||
"dontAddDisableDepTrack": "1",
|
||||
"GDMSESSION": "gnome",
|
||||
"CC": "gcc",
|
||||
"NIX_CC": "/nix/store/hb2bs5fg5wkm04x565737qd5nh2hy5nk-gcc-wrapper-15.2.0",
|
||||
"APPLICATION_INSIGHTS_NO_STATSBEAT": "true",
|
||||
"DBUS_SESSION_BUS_ADDRESS": "unix:path=/run/user/1000/bus,guid=df5051e64effbfdd124009b669f232d4",
|
||||
"depsBuildTargetPropagated": "",
|
||||
"depsBuildBuildPropagated": "",
|
||||
"DIRENV_WATCHES": "eJyc0EtOwzAURuG9eFzVuXb86iqYIwbXzm8S6sZRYtoixN4ZwqBFqBs4-nSeP8XCbRQHIcd6guQ1jfJprW9IbZOXBYtstZZNvi5yj_m8JrETpzq06QRxIOdc77ve2p3AddraJg5tfcfX7lZ2X2riIreRV8hhWjGfJZdSL1LDa5eoj0bbaJ0BlAF5-KTgndN9B61i9CH0hlKCYhUs6ZA9chfplsmQetQ0YP6QWsXkQKSIvCLls2byNrhucBFBs4nGUepATJZ6m0NIMWdjicHO5vyb1P1IMpftDuXO9Vz4iP08XR8f_2e51HT8V_rlOwAA__9XtbLx",
|
||||
"VSCODE_NLS_CONFIG": "{\"userLocale\":\"zh-cn\",\"osLocale\":\"zh-cn\",\"resolvedLanguage\":\"zh-cn\",\"defaultMessagesFile\":\"/nix/store/a519p3wlmvdxq0cl4y7yyazqp59s8vyi-vscode-1.115.0/lib/vscode/resources/app/out/nls.messages.json\",\"languagePack\":{\"translationsConfigFile\":\"/home/arch/.config/Code/clp/b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn/tcf.json\",\"messagesFile\":\"/home/arch/.config/Code/clp/b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn/41dd792b5e652393e7787322889ed5fdc58bd75b/nls.messages.json\",\"corruptMarkerFile\":\"/home/arch/.config/Code/clp/b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn/corrupted.info\"},\"locale\":\"zh-cn\",\"availableLanguages\":{\"*\":\"zh-cn\"},\"_languagePackId\":\"b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn\",\"_languagePackSupport\":true,\"_translationsConfigFile\":\"/home/arch/.config/Code/clp/b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn/tcf.json\",\"_cacheRoot\":\"/home/arch/.config/Code/clp/b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn\",\"_resolvedLanguagePackCoreLocation\":\"/home/arch/.config/Code/clp/b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn/41dd792b5e652393e7787322889ed5fdc58bd75b\",\"_corruptedFile\":\"/home/arch/.config/Code/clp/b3d577d0e0e421f69f6e9379a6ee9c57.zh-cn/corrupted.info\"}",
|
||||
"NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu": "1",
|
||||
"QT_PLUGIN_PATH": "/nix/store/zi0yx7hlacqsnf6i5jqys4ybx53zzan2-fcitx5-with-addons-5.1.19/lib/qt-6/plugins",
|
||||
"CONFIG_SHELL": "/nix/store/v8sa6r6q037ihghxfbwzjj4p59v2x0pv-bash-5.3p9/bin/bash",
|
||||
"__structuredAttrs": "",
|
||||
"RANLIB": "ranlib",
|
||||
"NIX_HARDENING_ENABLE": "bindnow format fortify fortify3 libcxxhardeningfast pic relro stackclashprotection stackprotector strictflexarrays1 strictoverflow zerocallusedregs",
|
||||
"VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
|
||||
"LC_NUMERIC": "zh_CN.UTF-8",
|
||||
"OLDPWD": "",
|
||||
"NIX_LDFLAGS": "-rpath /home/arch/Projects/wpep/tools/gp/outputs/out/lib -L/nix/store/nj8hdb8an3j79nrvb1lf1vi1w3pbs4f8-deno-2.7.9/lib -L/nix/store/b8hs3k92mkcdxbwishgcmmi3pq4zvg0l-qpdf-12.3.2-lib/lib -L/nix/store/nj8hdb8an3j79nrvb1lf1vi1w3pbs4f8-deno-2.7.9/lib -L/nix/store/b8hs3k92mkcdxbwishgcmmi3pq4zvg0l-qpdf-12.3.2-lib/lib",
|
||||
"nativeBuildInputs": "/nix/store/nj8hdb8an3j79nrvb1lf1vi1w3pbs4f8-deno-2.7.9 /nix/store/h2barca1k5pmvcyl9fwrzwrb4cn1b248-nodejs-22.22.2 /nix/store/cwidg78bqc73asdbzv5p67dw0kg4lk2n-qpdf-12.3.2 /nix/store/13xp1mgxcw3c1ys21dk9dp5cmy5fsz7w-chromium-147.0.7727.55 /nix/store/jxcc2h10hhycz7y9j252y22hqb1mra4v-noto-fonts-cjk-sans-2.004",
|
||||
"COPILOT_OTEL_EXPORTER_TYPE": "file",
|
||||
"name": "nix-shell-env",
|
||||
"TERM_PROGRAM": "kgx",
|
||||
"depsHostHostPropagated": ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
# GP 工农解放报刊物生成器
|
||||
|
||||
GP 是一个基于 Deno、Markdown 和 HTML 模板的刊物构建工具,可以将一组文章排版为 PDF,也可以导出合并后的 Markdown 或纯文本。PDF 支持自动生成目录、PDF 线性化和 OpenPGP 签名。
|
||||
|
||||
## 工作流程
|
||||
|
||||
```text
|
||||
文章 Markdown + HTML 模板
|
||||
|
|
||||
v
|
||||
Markdown 转 HTML
|
||||
|
|
||||
v
|
||||
Playwright + Chromium 生成 PDF
|
||||
|
|
||||
+------+------+
|
||||
| |
|
||||
目录 qpdf / OpenPGP
|
||||
| |
|
||||
+------+------+
|
||||
v
|
||||
输出文件
|
||||
```
|
||||
|
||||
## 环境准备
|
||||
|
||||
### 使用 Nix Flake
|
||||
|
||||
项目提供 `flake.nix`,会提供 Deno、Node.js、qpdf、ripgrep;Linux 环境还会提供 Chromium 和 CJK 字体。
|
||||
|
||||
```bash
|
||||
nix develop
|
||||
```
|
||||
|
||||
开发环境会设置 `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1`,并在能找到浏览器时自动设置 `CHROMIUM_PATH`。如果没有自动找到浏览器,请手动设置:
|
||||
|
||||
```bash
|
||||
export CHROMIUM_PATH="$(command -v chromium)"
|
||||
```
|
||||
|
||||
macOS 示例:
|
||||
|
||||
```bash
|
||||
export CHROMIUM_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
||||
```
|
||||
|
||||
### 手动安装
|
||||
|
||||
至少需要:
|
||||
|
||||
- [Deno](https://deno.com/)
|
||||
- Chromium 或 Google Chrome
|
||||
- qpdf(仅在启用 PDF 线性化时需要)
|
||||
- GnuPG 密钥(仅在启用 PDF 签名时需要)
|
||||
|
||||
首次运行时,Deno 会根据 `deno.json` 下载依赖。
|
||||
|
||||
## 快速开始
|
||||
|
||||
默认读取当前目录的 `config.json`:
|
||||
|
||||
```bash
|
||||
deno run -A main.ts generate pdf
|
||||
```
|
||||
|
||||
选择自定义配置文件:
|
||||
|
||||
```bash
|
||||
deno run -A main.ts --config ./config.release.json generate pdf
|
||||
```
|
||||
|
||||
当配置中有多个 `settings` 时,可以只生成指定名称的 PDF 配置:
|
||||
|
||||
```bash
|
||||
deno run -A main.ts --name mobile generate pdf
|
||||
```
|
||||
|
||||
使用 `--from` 可临时覆盖配置中的 `journal.from_directory`。参数是现存目录时直接读取该目录;否则按刊物版本处理,从 `../../publications/<版本>` 读取:
|
||||
|
||||
```bash
|
||||
deno run -A main.ts --from ./draft-publication generate pdf
|
||||
deno run -A main.ts --from 26.0.0 generate md
|
||||
```
|
||||
|
||||
其他导出命令:
|
||||
|
||||
```bash
|
||||
# 将每个配置的文章合并导出为 Markdown
|
||||
deno run -A main.ts generate md
|
||||
|
||||
# 根据 md.path 导出为纯文本(输出文件名中的 md 会替换为 txt)
|
||||
deno run -A main.ts generate txt
|
||||
```
|
||||
|
||||
## 模板变量
|
||||
|
||||
HTML 模板和 Markdown 正文使用 Nunjucks 模板语法。最常用的变量写法是
|
||||
`{{ title }}`,也支持 `{% if %}`、`{% for %}`、过滤器和 `{% set %}` 常量:
|
||||
|
||||
```markdown
|
||||
{% set accent = "#b40000" %}
|
||||
<span style="color: {{ accent }}">{{ headline | upper }}</span>
|
||||
{% if draft %}(草稿){% endif %}
|
||||
```
|
||||
|
||||
变量可以通过命令行传入。命令行值会自动识别为数字、布尔值或 `null`,并覆盖同名变量:
|
||||
|
||||
```bash
|
||||
deno run -A main.ts --name mobile --vars-file ./vars.toml \
|
||||
--headline "工人报" --draft false generate pdf
|
||||
```
|
||||
|
||||
TOML 文件可以包含嵌套对象和数组:
|
||||
|
||||
```toml
|
||||
headline = "工人报"
|
||||
draft = false
|
||||
|
||||
[theme]
|
||||
accent = "#b40000"
|
||||
```
|
||||
|
||||
内置变量包括 `now`、`currentTime`、`currentDate`、`year`、`month`、`day`、
|
||||
`weekday`、`timestamp`、`unixTimestamp`、`timezone`、`locale`、`platform`、
|
||||
`architecture`、`runtime` 和 `config`。每篇文章还可以使用 `document.title`、
|
||||
`document.index`、`document.file`,以及当前栏目的 `column.name` 和
|
||||
`column.index`。配置中的 `journal.variables` 可作为项目默认变量。
|
||||
|
||||
PDF 生成时会根据配置执行以下步骤:生成 PDF、插入目录、使用 qpdf 线性化、使用 OpenPGP 签名。目录、qpdf 和签名是否执行分别由 `pdf.generate_index`、`pdf.use_qpdf.enabled` 和 `pdf.signing.enabled` 控制。
|
||||
|
||||
## 源文件组织
|
||||
|
||||
每个 `settings` 对象通过 `journal.from_directory` 指向一个刊物源目录。`journal.build_mode` 有两种模式。
|
||||
|
||||
### flat 模式
|
||||
|
||||
HTML 模板和 Markdown 文件放在同一个目录中。Markdown 文件名格式为:
|
||||
|
||||
```text
|
||||
栏目顺序::栏目名::文章顺序::文章标题.md
|
||||
```
|
||||
|
||||
顺序使用整数解析,并按栏目顺序、栏目内文章顺序排序。例如:
|
||||
|
||||
```text
|
||||
26.4.0/
|
||||
├── cover_page.html
|
||||
├── style.html
|
||||
├── fonts.html
|
||||
├── 1::理论::1::发刊词.md
|
||||
├── 1::理论::2::编辑部文章.md
|
||||
├── 2::文艺::1::诗歌.md
|
||||
└── end_page.html
|
||||
```
|
||||
|
||||
### detached 模式
|
||||
|
||||
模板单独放在 `journal.template_directory`,文章按栏目分目录。栏目目录格式为:
|
||||
|
||||
```text
|
||||
栏目顺序::栏目名/
|
||||
```
|
||||
|
||||
目录中的 Markdown 文件格式为:
|
||||
|
||||
```text
|
||||
文章顺序::文章标题.md
|
||||
```
|
||||
|
||||
例如:
|
||||
|
||||
```text
|
||||
templates/
|
||||
├── cover_page.html
|
||||
├── style.html
|
||||
└── end_page.html
|
||||
publications/
|
||||
├── 1::理论/
|
||||
│ ├── 1::发刊词.md
|
||||
│ └── 2::编辑部文章.md
|
||||
└── 2::文艺/
|
||||
└── 1::诗歌.md
|
||||
```
|
||||
|
||||
`cover_page.html`、`style.html` 和 `end_page.html` 是特殊模板文件;目录中的其他 `.html` 文件也会作为模板插入。Markdown 文件可以包含图片、链接及项目启用的 Markdown 扩展语法。
|
||||
|
||||
## 配置文件
|
||||
|
||||
配置文件是 JSON,不是 TOML。顶层必须包含 `settings` 数组,每个对象通常包含 `name`、`journal`、`pdf`、`playwright` 和 `md`:
|
||||
|
||||
```json
|
||||
{
|
||||
"settings": [
|
||||
{
|
||||
"name": "computer",
|
||||
"journal": {
|
||||
"from_directory": "./publications/26.4.0",
|
||||
"build_mode": "flat",
|
||||
"build_js_script": false
|
||||
},
|
||||
"pdf": {
|
||||
"generate_index": true,
|
||||
"use_qpdf": {
|
||||
"enabled": true,
|
||||
"options": "--linearize"
|
||||
},
|
||||
"signing": {
|
||||
"enabled": false,
|
||||
"key_path": "~/keys/signing-key.asc",
|
||||
"output_path": "./outputs/computer.pdf.sig"
|
||||
}
|
||||
},
|
||||
"playwright": {
|
||||
"path": "./outputs/computer.pdf",
|
||||
"format": "A4",
|
||||
"printBackground": true,
|
||||
"displayHeaderFooter": true,
|
||||
"margin": {
|
||||
"top": "20mm",
|
||||
"bottom": "20mm"
|
||||
}
|
||||
},
|
||||
"md": {
|
||||
"path": "./outputs/computer.md"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
主要字段:
|
||||
|
||||
| 字段 | 作用 |
|
||||
| ---------------------------- | ------------------------------------------------- |
|
||||
| `name` | 配置名称;用于 `--name` 选择 PDF 配置 |
|
||||
| `journal.from_directory` | 文章源目录 |
|
||||
| `journal.build_mode` | `flat` 或 `detached` |
|
||||
| `journal.template_directory` | `detached` 模式的模板目录 |
|
||||
| `journal.build_js_script` | 构建前执行的 JS 文件路径;设为 `false` 禁用 |
|
||||
| `pdf.generate_index` | 是否生成并插入目录 |
|
||||
| `pdf.use_qpdf.enabled` | 是否使用 qpdf 线性化 PDF |
|
||||
| `pdf.signing` | OpenPGP 签名配置 |
|
||||
| `playwright.path` | PDF 输出路径;其他 Playwright PDF 选项会原样传递 |
|
||||
| `md.path` | Markdown 输出路径,也是 `generate txt` 的基础路径 |
|
||||
|
||||
路径相对于运行命令时的当前工作目录解析。`~/` 会在输入目录和签名密钥路径中展开为用户主目录。
|
||||
|
||||
## HTML 样式钩子
|
||||
|
||||
生成的 HTML 会为内容添加以下 class,模板可以据此覆盖样式:
|
||||
|
||||
- `global`:全局样式
|
||||
- `c1`、`c2` 等:对应栏目样式
|
||||
- `passages`:文章内容容器
|
||||
- `c_title`:栏目标题
|
||||
- `ch1`:栏目标题使用的自定义标签
|
||||
|
||||
`style.html` 应包含 CSS;字体声明可以放在单独的 HTML 模板中。Playwright 的 `headerTemplate` 和 `footerTemplate` 可使用 Chromium 提供的 `pageNumber`、`totalPages`、`title` 等占位符。
|
||||
|
||||
## 开发
|
||||
|
||||
```bash
|
||||
# 运行测试
|
||||
deno test -A
|
||||
|
||||
# 启动监听模式
|
||||
deno task dev
|
||||
|
||||
# 检查类型和格式
|
||||
deno check main.ts pdf_pipeline.ts
|
||||
deno fmt --check
|
||||
```
|
||||
|
||||
## 常见问题
|
||||
|
||||
### 找不到 Chromium
|
||||
|
||||
确认 `CHROMIUM_PATH` 指向 Chromium 或 Chrome 的可执行文件,并检查文件可执行:
|
||||
|
||||
```bash
|
||||
echo "$CHROMIUM_PATH"
|
||||
test -x "$CHROMIUM_PATH"
|
||||
```
|
||||
|
||||
### qpdf 失败
|
||||
|
||||
确认 qpdf 在 `PATH` 中,且 `pdf.use_qpdf.options` 是 qpdf 参数字符串。若不需要线性化,将 `enabled` 设为 `false`。
|
||||
|
||||
### 签名失败
|
||||
|
||||
确认 `key_path` 指向可读取的私钥文件,并在需要时通过运行环境提供签名密码。签名输出写入 `pdf.signing.output_path`。
|
||||
@@ -0,0 +1,12 @@
|
||||
# TODOS
|
||||
|
||||
- [x] HTML注入
|
||||
- [x] 自动生成目录
|
||||
<!--- [ ] PDF大小优化(基于外置程序)
|
||||
- [ ] 图片优化-->
|
||||
- [x] 加入js注入机制,可以便携的编译前修改dom,实现复杂功能
|
||||
<!--- [ ] 自动缓存图片-->
|
||||
- [x] 修改索引算法为按照索引表的顺序建立索引
|
||||
- [ ] 加入索引为可点击后跳转
|
||||
- [x] 加入模板与源码分离模式
|
||||
- [x] 加入通过文件系统区别专栏模式
|
||||
@@ -0,0 +1,248 @@
|
||||
//import TurndownService from "turndown";
|
||||
import { args, cfg } from "../main.ts";
|
||||
import { OpenPGPSigner } from "../pdf_builder/utils.ts";
|
||||
import { DocuBuilder } from "../pdf_builder/docu_builder.ts";
|
||||
import { IndexBuilder } from "../pdf_builder/index_builder.ts";
|
||||
import { createTemplateVariables } from "../template_engine.ts";
|
||||
export async function generate_pdf(options: Record<string, any> = {}) {
|
||||
const maxWorkers = Math.max(1, navigator.hardwareConcurrency || 1);
|
||||
const queue = [...cfg.settings];
|
||||
const workers = new Set<Promise<void>>();
|
||||
|
||||
while (queue.length > 0 || workers.size > 0) {
|
||||
while (queue.length > 0 && workers.size < maxWorkers) {
|
||||
const config = queue.shift();
|
||||
if (!config) {
|
||||
break;
|
||||
}
|
||||
if (config.name) {
|
||||
if (args.name != null && args.name !== "" && args.name !== undefined) {
|
||||
if (config.name !== args.name) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
const workerPromise = runPdfWorker(config, options)
|
||||
.finally(() => {
|
||||
workers.delete(workerPromise);
|
||||
});
|
||||
workers.add(workerPromise);
|
||||
}
|
||||
|
||||
if (workers.size > 0) {
|
||||
await Promise.race(workers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function runPdfWorker(
|
||||
config: (typeof cfg.settings)[number],
|
||||
options: Record<string, any>,
|
||||
): Promise<void> {
|
||||
return createTemplateVariables(args, config).then((variables) =>
|
||||
new Promise<void>((resolve, reject) => {
|
||||
const worker = new Worker(
|
||||
new URL("../pdf_worker.ts", import.meta.url).href,
|
||||
{
|
||||
type: "module",
|
||||
},
|
||||
);
|
||||
|
||||
worker.onmessage = (
|
||||
event: MessageEvent<
|
||||
{ id: number; ok: true } | { id: number; ok: false; error: string }
|
||||
>,
|
||||
) => {
|
||||
if (event.data.ok) {
|
||||
worker.terminate();
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
worker.terminate();
|
||||
reject(new Error(event.data.error));
|
||||
};
|
||||
|
||||
worker.onerror = (event) => {
|
||||
worker.terminate();
|
||||
reject(event.error ?? new Error(event.message));
|
||||
};
|
||||
|
||||
worker.postMessage({
|
||||
id: Date.now(),
|
||||
config,
|
||||
options: {
|
||||
addIndex: options.add_index,
|
||||
useQpdf: options.use_qpdf,
|
||||
signPdf: options.sign_pdf,
|
||||
signPassphrase: options.sign_passphrase ?? options.passphrase,
|
||||
keepIndexPdf: options.keep_index_pdf ?? options.keepIndexPdf ??
|
||||
options["keep-index-pdf"] ?? false,
|
||||
variables,
|
||||
},
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
export async function generate_md() {
|
||||
try {
|
||||
for (const config of cfg.settings) {
|
||||
const builder = new DocuBuilder(
|
||||
config,
|
||||
await createTemplateVariables(args, config),
|
||||
);
|
||||
|
||||
console.debug(`Processing config: ${JSON.stringify(config)}`);
|
||||
builder.with_files_sync(config.journal.from_directory);
|
||||
await builder.as_markdown();
|
||||
const markdownPath = config.md?.path ?? config.markdown_output;
|
||||
if (!markdownPath) {
|
||||
throw new Error("Missing markdown output path in config. Use md.path.");
|
||||
}
|
||||
await builder.build_as_raw(markdownPath);
|
||||
}
|
||||
} finally {
|
||||
// No browser to close in this function
|
||||
}
|
||||
}
|
||||
|
||||
export async function generate_txt() {
|
||||
try {
|
||||
for (const config of cfg.settings) {
|
||||
const builder = new DocuBuilder(
|
||||
config,
|
||||
await createTemplateVariables(args, config),
|
||||
);
|
||||
|
||||
console.debug(`Processing config: ${JSON.stringify(config)}`);
|
||||
builder.with_files_sync(config.journal.from_directory);
|
||||
await builder.as_txt();
|
||||
const markdownPath = config.md?.path ?? config.markdown_output;
|
||||
if (!markdownPath) {
|
||||
throw new Error("Missing txt output path in config. Use md.path.");
|
||||
}
|
||||
const txtPath = markdownPath.replace("md", "txt");
|
||||
|
||||
await builder.build_as_raw(txtPath);
|
||||
}
|
||||
} finally {
|
||||
// No browser to close in this function
|
||||
}
|
||||
}
|
||||
|
||||
export async function add_index_to_pdf(insert_index_after_page: number = 1) {
|
||||
const config = cfg;
|
||||
for (const cfg of config.settings) {
|
||||
console.log(`Adding index to PDF ${cfg.playwright.path}...`);
|
||||
|
||||
const indexBuilder = new IndexBuilder(
|
||||
cfg.playwright.path,
|
||||
cfg,
|
||||
);
|
||||
await indexBuilder.build_index();
|
||||
const _html = indexBuilder.as_html_page();
|
||||
//console.log(html);
|
||||
const tempDir = await makePdfTempDir(cfg.playwright.path);
|
||||
const tempIndexPdfPath = `${tempDir}/index.pdf`;
|
||||
await indexBuilder.html2pdf({
|
||||
"path": tempIndexPdfPath,
|
||||
"format": "A4",
|
||||
"headerTemplate":
|
||||
'<div style="width:100%; font-size:10px; text-align:center; color:#666;"><span class="title"></span></div>',
|
||||
"footerTemplate":
|
||||
'<div style="width:100%; font-size:10px; text-align:center; color:#666;"><span class="title"></span></div>',
|
||||
"margin": {
|
||||
"top": "20mm",
|
||||
"bottom": "20mm",
|
||||
},
|
||||
"printBackground": true,
|
||||
});
|
||||
//console.log(indexBuilder.indexed_map);
|
||||
const insertedIndexPages = await indexBuilder
|
||||
.combine_index_pdf_to_main_pdf(
|
||||
tempIndexPdfPath,
|
||||
insert_index_after_page,
|
||||
);
|
||||
await indexBuilder.add_pdf_outline({
|
||||
inserted_index_pages: insertedIndexPages,
|
||||
});
|
||||
|
||||
try {
|
||||
await Deno.remove(tempIndexPdfPath);
|
||||
await Deno.remove(tempDir);
|
||||
} catch (_error) {
|
||||
// Ignore temp cleanup failures.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function makePdfTempDir(outputPath: string) {
|
||||
await Deno.mkdir("./tmps", { recursive: true });
|
||||
const safeStem = outputPath.split("/").pop()?.replace(/\.pdf$/i, "") ?? "pdf";
|
||||
return await Deno.makeTempDir({
|
||||
dir: "./tmps",
|
||||
prefix: `${safeStem}-index-`,
|
||||
});
|
||||
}
|
||||
|
||||
export async function use_qpdf() {
|
||||
const config = cfg;
|
||||
for (const cfg of config.settings) {
|
||||
if (cfg.pdf.use_qpdf?.enabled) {
|
||||
console.log(`Using qpdf to linearize PDF ${cfg.playwright.path}...`);
|
||||
const outputPath = cfg.playwright.path.replace(
|
||||
/\.pdf$/,
|
||||
"_linearized.pdf",
|
||||
);
|
||||
|
||||
const qpdfArgs = [
|
||||
cfg.playwright.path,
|
||||
cfg.pdf.use_qpdf.options,
|
||||
outputPath,
|
||||
];
|
||||
|
||||
const cmd = new Deno.Command(
|
||||
"qpdf",
|
||||
{
|
||||
args: qpdfArgs,
|
||||
stdout: "piped",
|
||||
stderr: "piped",
|
||||
},
|
||||
);
|
||||
|
||||
const child = cmd.spawn();
|
||||
|
||||
for await (const chunk of child.stdout) {
|
||||
console.log(new TextDecoder().decode(chunk));
|
||||
}
|
||||
|
||||
const status = await child.status;
|
||||
console.log(`Status: ${status.code}`);
|
||||
if (status.code === 0) {
|
||||
await Deno.remove(cfg.playwright.path);
|
||||
await Deno.rename(outputPath, cfg.playwright.path);
|
||||
console.log(`Successfully linearized PDF: ${cfg.playwright.path}`);
|
||||
} else {
|
||||
console.error(`Failed to linearize PDF: ${cfg.playwright.path}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function sign_pdf(passphrase?: string) {
|
||||
const config = cfg;
|
||||
for (const cfg of config.settings) {
|
||||
if (cfg.pdf.signing?.enabled) {
|
||||
console.log(`Signing PDF ${cfg.playwright.path}...`);
|
||||
const signer = new OpenPGPSigner(
|
||||
cfg.playwright.path,
|
||||
cfg.pdf.signing.key_path,
|
||||
cfg.pdf.signing.output_path,
|
||||
passphrase,
|
||||
);
|
||||
await signer.sign();
|
||||
console.log(`Successfully signed PDF: ${cfg.pdf.signing.output_path}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { generate_md, generate_pdf, generate_txt } from "./handlers.ts";
|
||||
|
||||
export async function match_sub_command_to_function(
|
||||
sub_command: Array<string>,
|
||||
options: Record<string, any>,
|
||||
) {
|
||||
switch (sub_command[0]) {
|
||||
case "generate":
|
||||
switch (sub_command[1]) {
|
||||
case "pdf":
|
||||
//deno-lint-ignore no-await-in-loop
|
||||
await generate_pdf(options);
|
||||
break;
|
||||
|
||||
case "md":
|
||||
await generate_md();
|
||||
break;
|
||||
case "txt":
|
||||
await generate_txt();
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown sub-command: ${sub_command[1]}`);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown sub-command: ${sub_command[0]}`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
{
|
||||
"settings": [
|
||||
{
|
||||
"name": "mobile",
|
||||
"journal": {
|
||||
"from_directory": "../../publications/26.11.0",
|
||||
"build_js_script": false,
|
||||
"build_mode": "detached",
|
||||
"template_directory": "../../templates/mobile_template",
|
||||
"folder_mode": "flat"
|
||||
},
|
||||
"pdf": {
|
||||
"generate_index": true,
|
||||
"use_qpdf": {
|
||||
"enabled": true,
|
||||
"options": ["--linearize"]
|
||||
},
|
||||
"signing": {
|
||||
"enabled": true,
|
||||
"key_path": "~/keys/中国马列毛主义统一战线_0x874AD0D3_SECRET.asc",
|
||||
"output_path": "./outputs/工农解放报RSF续刊第二期-适合手机阅读.pdf.sig"
|
||||
}
|
||||
},
|
||||
|
||||
"playwright": {
|
||||
"path": "./outputs/工农解放报RSF续刊第二期-适合手机阅读.pdf",
|
||||
"format": "A4",
|
||||
"printBackground": true,
|
||||
"displayHeaderFooter": true,
|
||||
"margin": {
|
||||
"bottom": "20mm",
|
||||
"top": "20mm"
|
||||
},
|
||||
"footerTemplate": "<div style=\"width:100%; font-size:10px; text-align:center; color:#666;\"><span class=\"pageNumber\"></span> / <span class=\"totalPages\"></span></div>",
|
||||
"headerTemplate": "<div style=\"width:100%; font-size:10px; text-align:center; color:#666;\"><span class=\"title\"></span></div>"
|
||||
},
|
||||
"md": {
|
||||
"path": "./outputs/工农解放报RSF续刊第二期-适合手机阅读.md"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "computer",
|
||||
"journal": {
|
||||
"from_directory": "../../publications/26.11.0",
|
||||
"build_js_script": false,
|
||||
"build_mode": "detached",
|
||||
"template_directory": "../../templates/computer_template",
|
||||
"folder_mode": "flat"
|
||||
},
|
||||
"pdf": {
|
||||
"generate_index": true,
|
||||
"use_qpdf": {
|
||||
"enabled": true,
|
||||
"options": ["--linearize"]
|
||||
},
|
||||
"signing": {
|
||||
"enabled": true,
|
||||
"key_path": "~/keys/中国马列毛主义统一战线_0x874AD0D3_SECRET.asc",
|
||||
"output_path": "./outputs/工农解放报RSF续刊第二期-适合电脑阅读.pdf.sig"
|
||||
}
|
||||
},
|
||||
|
||||
"playwright": {
|
||||
"path": "./outputs/工农解放报RSF续刊第二期-适合电脑阅读.pdf",
|
||||
"format": "A4",
|
||||
"printBackground": true,
|
||||
"displayHeaderFooter": true,
|
||||
"margin": {
|
||||
"bottom": "20mm",
|
||||
"top": "20mm"
|
||||
},
|
||||
|
||||
"footerTemplate": "<div style=\"width:100%; font-size:10px; text-align:center; color:#666;\"><span class=\"pageNumber\"></span> / <span class=\"totalPages\"></span></div>",
|
||||
"headerTemplate": "<div style=\"width:100%; font-size:10px; text-align:center; color:#666;\"><span class=\"title\"></span></div>"
|
||||
},
|
||||
"md": {
|
||||
"path": "./outputs/工农解放报RSF续刊第二期-适合电脑阅读.md"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "printable",
|
||||
"journal": {
|
||||
"from_directory": "../../publications/26.11.0",
|
||||
"build_mode": "detached",
|
||||
"template_directory": "../../templates/printable_template",
|
||||
"folder_mode": "flat",
|
||||
"build_js_script": "../../templates/printable_template/build.js"
|
||||
},
|
||||
"pdf": {
|
||||
"generate_index": true,
|
||||
"use_qpdf": {
|
||||
"enabled": true,
|
||||
"options": [""]
|
||||
},
|
||||
"signing": {
|
||||
"enabled": true,
|
||||
"key_path": "~/keys/中国马列毛主义统一战线_0x874AD0D3_SECRET.asc",
|
||||
"output_path": "./outputs/工农解放报RSF续刊第二期-适合纸质打印.pdf.sig"
|
||||
}
|
||||
},
|
||||
|
||||
"playwright": {
|
||||
"path": "./outputs/工农解放报RSF续刊第二期-适合纸质打印.pdf",
|
||||
"format": "A4",
|
||||
"printBackground": true,
|
||||
"displayHeaderFooter": true,
|
||||
"margin": {
|
||||
"bottom": "20mm",
|
||||
"top": "20mm"
|
||||
},
|
||||
|
||||
"footerTemplate": "<div style=\"width:100%; font-size:10px; text-align:center; color:#666;\"><span class=\"pageNumber\"></span> / <span class=\"totalPages\"></span></div>",
|
||||
"headerTemplate": "<div style=\"width:100%; font-size:10px; text-align:center; color:#666;\"><span class=\"title\"></span></div>"
|
||||
},
|
||||
"md": {
|
||||
"path": "./outputs/工农解放报RSF续刊第二期-适合纸质打印.md"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
asset_base = "../../assets"
|
||||
|
||||
[[settings]]
|
||||
name = "mobile"
|
||||
|
||||
[settings.journal]
|
||||
from_directory = "../../publications/26.11.0"
|
||||
build_js_script = false
|
||||
build_mode = "detached"
|
||||
template_directory = "../../templates/mobile_template"
|
||||
folder_mode = "flat"
|
||||
|
||||
[settings.pdf]
|
||||
generate_index = true
|
||||
|
||||
[settings.pdf.use_qpdf]
|
||||
enabled = true
|
||||
options = ["--linearize"]
|
||||
|
||||
[settings.pdf.signing]
|
||||
enabled = true
|
||||
key_path = "~/keys/中国马列毛主义统一战线_0x874AD0D3_SECRET.asc"
|
||||
output_path = "./outputs/工农解放报RSF续刊第二期-适合手机阅读.pdf.sig"
|
||||
|
||||
[settings.playwright]
|
||||
path = "./outputs/工农解放报RSF续刊第二期-适合手机阅读.pdf"
|
||||
format = "A4"
|
||||
printBackground = true
|
||||
displayHeaderFooter = true
|
||||
footerTemplate = '<div style="width:100%; font-size:10px; text-align:center; color:#666;"><span class="pageNumber"></span> / <span class="totalPages"></span></div>'
|
||||
headerTemplate = '<div style="width:100%; font-size:10px; text-align:center; color:#666;"><span class="title"></span></div>'
|
||||
|
||||
[settings.playwright.margin]
|
||||
bottom = "20mm"
|
||||
top = "20mm"
|
||||
|
||||
[settings.md]
|
||||
path = "./outputs/工农解放报RSF续刊第二期-适合手机阅读.md"
|
||||
|
||||
[settings.epub]
|
||||
path = "./outputs/工农解放报RSF续刊第二期-适合手机阅读.epub"
|
||||
title = "工农解放报RSF续刊第二期"
|
||||
language = "zh-CN"
|
||||
|
||||
[[settings]]
|
||||
name = "computer"
|
||||
|
||||
[settings.journal]
|
||||
from_directory = "../../publications/26.11.0"
|
||||
build_js_script = false
|
||||
build_mode = "detached"
|
||||
template_directory = "../../templates/computer_template"
|
||||
folder_mode = "flat"
|
||||
|
||||
[settings.pdf]
|
||||
generate_index = true
|
||||
|
||||
[settings.pdf.use_qpdf]
|
||||
enabled = true
|
||||
options = ["--linearize"]
|
||||
|
||||
[settings.pdf.signing]
|
||||
enabled = true
|
||||
key_path = "~/keys/中国马列毛主义统一战线_0x874AD0D3_SECRET.asc"
|
||||
output_path = "./outputs/工农解放报RSF续刊第二期-适合电脑阅读.pdf.sig"
|
||||
|
||||
[settings.playwright]
|
||||
path = "./outputs/工农解放报RSF续刊第二期-适合电脑阅读.pdf"
|
||||
format = "A4"
|
||||
printBackground = true
|
||||
displayHeaderFooter = true
|
||||
footerTemplate = '<div style="width:100%; font-size:10px; text-align:center; color:#666;"><span class="pageNumber"></span> / <span class="totalPages"></span></div>'
|
||||
headerTemplate = '<div style="width:100%; font-size:10px; text-align:center; color:#666;"><span class="title"></span></div>'
|
||||
|
||||
[settings.playwright.margin]
|
||||
bottom = "20mm"
|
||||
top = "20mm"
|
||||
|
||||
[settings.md]
|
||||
path = "./outputs/工农解放报RSF续刊第二期-适合电脑阅读.md"
|
||||
|
||||
[settings.epub]
|
||||
path = "./outputs/工农解放报RSF续刊第二期-适合电脑阅读.epub"
|
||||
title = "工农解放报RSF续刊第二期"
|
||||
language = "zh-CN"
|
||||
|
||||
[[settings]]
|
||||
name = "printable"
|
||||
|
||||
[settings.journal]
|
||||
from_directory = "../../publications/26.11.0"
|
||||
build_mode = "detached"
|
||||
template_directory = "../../templates/printable_template"
|
||||
folder_mode = "flat"
|
||||
build_js_script = "../../templates/printable_template/build.js"
|
||||
|
||||
[settings.pdf]
|
||||
generate_index = true
|
||||
|
||||
[settings.pdf.use_qpdf]
|
||||
enabled = true
|
||||
options = [""]
|
||||
|
||||
[settings.pdf.signing]
|
||||
enabled = true
|
||||
key_path = "~/keys/中国马列毛主义统一战线_0x874AD0D3_SECRET.asc"
|
||||
output_path = "./outputs/工农解放报RSF续刊第二期-适合纸质打印.pdf.sig"
|
||||
|
||||
[settings.playwright]
|
||||
path = "./outputs/工农解放报RSF续刊第二期-适合纸质打印.pdf"
|
||||
format = "A4"
|
||||
printBackground = true
|
||||
displayHeaderFooter = true
|
||||
footerTemplate = '<div style="width:100%; font-size:10px; text-align:center; color:#666;"><span class="pageNumber"></span> / <span class="totalPages"></span></div>'
|
||||
headerTemplate = '<div style="width:100%; font-size:10px; text-align:center; color:#666;"><span class="title"></span></div>'
|
||||
|
||||
[settings.playwright.margin]
|
||||
bottom = "20mm"
|
||||
top = "20mm"
|
||||
|
||||
[settings.md]
|
||||
path = "./outputs/工农解放报RSF续刊第二期-适合纸质打印.md"
|
||||
|
||||
[settings.epub]
|
||||
path = "./outputs/工农解放报RSF续刊第二期-适合纸质打印.epub"
|
||||
title = "工农解放报RSF续刊第二期"
|
||||
language = "zh-CN"
|
||||
|
||||
[vars]
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"nodeModulesDir": "auto",
|
||||
"tasks": {
|
||||
"dev": "deno run --watch main.ts"
|
||||
},
|
||||
"imports": {
|
||||
"@mdit/plugin-abbr": "npm:@mdit/plugin-abbr@^0.23.2",
|
||||
"@mdit/plugin-alert": "npm:@mdit/plugin-alert@^0.23.2",
|
||||
"@mdit/plugin-align": "npm:@mdit/plugin-align@^0.24.2",
|
||||
"@mdit/plugin-attrs": "npm:@mdit/plugin-attrs@^0.25.2",
|
||||
"@mdit/plugin-container": "npm:@mdit/plugin-container@^0.23.2",
|
||||
"@mdit/plugin-demo": "npm:@mdit/plugin-demo@^0.23.2",
|
||||
"@mdit/plugin-dl": "npm:@mdit/plugin-dl@^0.23.2",
|
||||
"@mdit/plugin-embed": "npm:@mdit/plugin-embed@^0.25.2",
|
||||
"@mdit/plugin-emoji": "npm:@mdit/plugin-emoji@^0.2.2",
|
||||
"@mdit/plugin-field": "npm:@mdit/plugin-field@^0.24.2",
|
||||
"@mdit/plugin-figure": "npm:@mdit/plugin-figure@^0.23.2",
|
||||
"@mdit/plugin-footnote": "npm:@mdit/plugin-footnote@^0.23.2",
|
||||
"@mdit/plugin-icon": "npm:@mdit/plugin-icon@^0.24.2",
|
||||
"@mdit/plugin-img-lazyload": "npm:@mdit/plugin-img-lazyload@^0.23.2",
|
||||
"@mdit/plugin-img-mark": "npm:@mdit/plugin-img-mark@^0.23.2",
|
||||
"@mdit/plugin-img-size": "npm:@mdit/plugin-img-size@^0.23.2",
|
||||
"@mdit/plugin-include": "npm:@mdit/plugin-include@^0.23.2",
|
||||
"@mdit/plugin-ins": "npm:@mdit/plugin-ins@^0.23.2",
|
||||
"@mdit/plugin-katex": "npm:@mdit/plugin-katex@^0.25.2",
|
||||
"@mdit/plugin-layout": "npm:@mdit/plugin-layout@^0.2.2",
|
||||
"@mdit/plugin-mark": "npm:@mdit/plugin-mark@^0.23.2",
|
||||
"@mdit/plugin-plantuml": "npm:@mdit/plugin-plantuml@^0.24.2",
|
||||
"@mdit/plugin-ruby": "npm:@mdit/plugin-ruby@^0.23.2",
|
||||
"@mdit/plugin-snippet": "npm:@mdit/plugin-snippet@^0.23.2",
|
||||
"@mdit/plugin-spoiler": "npm:@mdit/plugin-spoiler@^0.23.2",
|
||||
"@mdit/plugin-stylize": "npm:@mdit/plugin-stylize@^0.23.2",
|
||||
"@mdit/plugin-sub": "npm:@mdit/plugin-sub@^0.24.2",
|
||||
"@mdit/plugin-sup": "npm:@mdit/plugin-sup@^0.24.2",
|
||||
"@mdit/plugin-tab": "npm:@mdit/plugin-tab@^0.24.2",
|
||||
"@mdit/plugin-tasklist": "npm:@mdit/plugin-tasklist@^0.23.2",
|
||||
"@mdit/plugin-tex": "npm:@mdit/plugin-tex@^0.24.2",
|
||||
"@mdit/plugin-uml": "npm:@mdit/plugin-uml@^0.24.2",
|
||||
"@std/assert": "jsr:@std/assert@1",
|
||||
"@std/toml": "jsr:@std/toml@^1.0.11",
|
||||
"fs": "npm:fs@^0.0.1-security",
|
||||
"markdown-it": "npm:markdown-it@^14.1.1",
|
||||
"nunjucks": "npm:nunjucks@^3.2.4",
|
||||
"openpgp": "npm:openpgp@^6.3.0",
|
||||
"pdf-lib": "npm:pdf-lib@^1.17.1",
|
||||
"pdf-parse": "npm:pdf-parse@^2.4.5",
|
||||
"playwright": "npm:playwright@^1.59.1",
|
||||
"ripgrep": "npm:ripgrep@^0.3.1",
|
||||
"turndown": "npm:turndown@^7.2.4"
|
||||
},
|
||||
"allowScripts": ["npm:[email protected]"]
|
||||
}
|
||||
Generated
+817
@@ -0,0 +1,817 @@
|
||||
{
|
||||
"version": "5",
|
||||
"specifiers": {
|
||||
"jsr:@std/assert@1": "1.0.19",
|
||||
"jsr:@std/collections@^1.1.3": "1.1.6",
|
||||
"jsr:@std/internal@^1.0.12": "1.0.12",
|
||||
"jsr:@std/toml@^1.0.11": "1.0.11",
|
||||
"npm:@mdit/plugin-abbr@*": "[email protected]",
|
||||
"npm:@mdit/plugin-abbr@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-alert@*": "[email protected]",
|
||||
"npm:@mdit/plugin-alert@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-align@*": "[email protected]",
|
||||
"npm:@mdit/plugin-align@~0.24.2": "[email protected]",
|
||||
"npm:@mdit/plugin-attrs@*": "[email protected]",
|
||||
"npm:@mdit/plugin-attrs@~0.25.2": "[email protected]",
|
||||
"npm:@mdit/plugin-container@*": "[email protected]",
|
||||
"npm:@mdit/plugin-container@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-demo@*": "[email protected]",
|
||||
"npm:@mdit/plugin-demo@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-dl@*": "[email protected]",
|
||||
"npm:@mdit/plugin-dl@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-embed@*": "[email protected]",
|
||||
"npm:@mdit/plugin-embed@~0.25.2": "[email protected]",
|
||||
"npm:@mdit/plugin-emoji@*": "[email protected]",
|
||||
"npm:@mdit/plugin-emoji@~0.2.2": "[email protected]",
|
||||
"npm:@mdit/plugin-field@*": "[email protected]",
|
||||
"npm:@mdit/plugin-field@~0.24.2": "[email protected]",
|
||||
"npm:@mdit/plugin-figure@*": "[email protected]",
|
||||
"npm:@mdit/plugin-figure@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-footnote@*": "[email protected]",
|
||||
"npm:@mdit/plugin-footnote@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-icon@*": "[email protected]",
|
||||
"npm:@mdit/plugin-icon@~0.24.2": "[email protected]",
|
||||
"npm:@mdit/plugin-img-lazyload@*": "[email protected]",
|
||||
"npm:@mdit/plugin-img-lazyload@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-img-mark@*": "[email protected]",
|
||||
"npm:@mdit/plugin-img-mark@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-img-size@*": "[email protected]",
|
||||
"npm:@mdit/plugin-img-size@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-include@*": "[email protected]",
|
||||
"npm:@mdit/plugin-include@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-ins@*": "[email protected]",
|
||||
"npm:@mdit/plugin-ins@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-katex@*": "[email protected]",
|
||||
"npm:@mdit/plugin-katex@~0.25.2": "[email protected]",
|
||||
"npm:@mdit/plugin-layout@*": "[email protected]",
|
||||
"npm:@mdit/plugin-layout@~0.2.2": "[email protected]",
|
||||
"npm:@mdit/plugin-mark@*": "[email protected]",
|
||||
"npm:@mdit/plugin-mark@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-plantuml@*": "[email protected]",
|
||||
"npm:@mdit/plugin-plantuml@~0.24.2": "[email protected]",
|
||||
"npm:@mdit/plugin-ruby@*": "[email protected]",
|
||||
"npm:@mdit/plugin-ruby@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-snippet@*": "[email protected]",
|
||||
"npm:@mdit/plugin-snippet@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-spoiler@*": "[email protected]",
|
||||
"npm:@mdit/plugin-spoiler@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-stylize@*": "[email protected]",
|
||||
"npm:@mdit/plugin-stylize@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-sub@*": "[email protected]",
|
||||
"npm:@mdit/plugin-sub@~0.24.2": "[email protected]",
|
||||
"npm:@mdit/plugin-sup@*": "[email protected]",
|
||||
"npm:@mdit/plugin-sup@~0.24.2": "[email protected]",
|
||||
"npm:@mdit/plugin-tab@*": "[email protected]",
|
||||
"npm:@mdit/plugin-tab@~0.24.2": "[email protected]",
|
||||
"npm:@mdit/plugin-tasklist@*": "[email protected]",
|
||||
"npm:@mdit/plugin-tasklist@~0.23.2": "[email protected]",
|
||||
"npm:@mdit/plugin-tex@*": "[email protected]",
|
||||
"npm:@mdit/plugin-tex@~0.24.2": "[email protected]",
|
||||
"npm:@mdit/plugin-uml@*": "[email protected]",
|
||||
"npm:@mdit/plugin-uml@~0.24.2": "[email protected]",
|
||||
"npm:fs@^0.0.1-security": "0.0.1-security",
|
||||
"npm:markdown-it@^14.1.1": "14.1.1",
|
||||
"npm:nunjucks@^3.2.4": "3.2.4",
|
||||
"npm:openpgp@^6.3.0": "6.3.0",
|
||||
"npm:pdf-lib@^1.17.1": "1.17.1",
|
||||
"npm:pdf-parse@^2.4.5": "2.4.5",
|
||||
"npm:playwright@^1.59.1": "1.59.1",
|
||||
"npm:ripgrep@~0.3.1": "0.3.1",
|
||||
"npm:turndown@^7.2.4": "7.2.4"
|
||||
},
|
||||
"jsr": {
|
||||
"@std/[email protected]": {
|
||||
"integrity": "eaada96ee120cb980bc47e040f82814d786fe8162ecc53c91d8df60b8755991e",
|
||||
"dependencies": [
|
||||
"jsr:@std/internal"
|
||||
]
|
||||
},
|
||||
"@std/[email protected]": {
|
||||
"integrity": "b458160ce65ea5ad35da05d0a5cbee4b583677c8b443a10d7beb0c4ac63f2baa"
|
||||
},
|
||||
"@std/[email protected]": {
|
||||
"integrity": "972a634fd5bc34b242024402972cd5143eac68d8dffaca5eaa4dba30ce17b027"
|
||||
},
|
||||
"@std/[email protected]": {
|
||||
"integrity": "e084988b872ca4bad6aedfb7350f6eeed0e8ba88e9ee5e1590621c5b5bb8f715",
|
||||
"dependencies": [
|
||||
"jsr:@std/collections"
|
||||
]
|
||||
}
|
||||
},
|
||||
"npm": {
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-w4oja7kZYnkSiodfn4Neg1gmlIkvQtmCBJTLvLFOaET7xt8KomDNPQeumpGobQ9dWkXFqBKHlxjTYgroPH+CvA==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-l6W4hZX2tm/lg7Xv82xDVnhQRzwINhEa7mj6n9ea3SpzOlJLUJ7II4VozobkbYRsRGc/sSVvgm1VJqBsgSn5Eg==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-pXIil0FLy9ilhvT6d324A4X+mt5i/zG8ml0VIpZwiUYh2k1Wi6VnZhFHfsnONTRu6dPL2EwQBIhQgQ+269f7LA==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-vx0I0LPirTMefIPjUHlRfM/hW7+OKZQSBgiPsxr5pIjPHiXs0ZV+0Tg7zDrnqZNI4QhaWjePRiSF7JkLg9gS/w==",
|
||||
"dependencies": [
|
||||
"@mdit/plugin-container",
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-/R1BzkCWY8OvjDek9y/0/hpxZKWlwef0Gq/jtee9+ZbX0J9ffXfJl+Isgh3Ecur01R6Bv+1XNJtaBGNgUm/w6Q==",
|
||||
"dependencies": [
|
||||
"@mdit/helper",
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-rXlFg37YuQDNcVKCaPtaJ2oCbfxTIguzf0Uklt65PK6J3kqB82+IE0+p87GIObWxdm1ajfbMUSLfvfrHoiqq4Q==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-GBsdFI1HF3ZsYf7oXtLinv2pgXkEw2Cj4+Au/aCAsdXZ+T/X7KPQQNA9MwKrWS8fQpVipys/SSK4R+IsbmVWiQ==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-yU8RbAEJLpp4JegMfH607vxW1LB+cW0fSpGVb4jSRZcE1tnvXokzTS5XMlbXF2AdTGuVOs+CyTBwwRuOw0MS3w==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-a1LSR9jizBuslmuzBwhOCfmbkhS8me3oaUPpwBofTLj0orRTEZzGpWU34zFnEq2Ewil/1l3tIttOiwSNj81Ekw==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-ZeOxsAAD7v0SWlg8ROAU3ld4kmF/VCgI/Q5FhFDs/GP/koaLdFeHjP5CbuI6IGUVYpD6mRxa7XYrYxiD0gqxGQ==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-nwYHJg1OvPe+rAVjsCvWffcet5uQdtGP2n2UwQMSe5L6aPhM6eGZHAz3ysDC0XM5Tu7sBdftj5HqBHZS2LsUrA==",
|
||||
"dependencies": [
|
||||
"@mdit/helper",
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-PK4G29p29cZJiA2uQ0gv6faW65ilTxPH+MssyAj/WBobIrhVDhcAg+tVN/in3/FhQ31bzKoUtCPBjzYWmj73tA==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-zE2jAx1KX1ZLuF0v4t2VwgrsfSYHRr23n5viRcxyF2tnbBKLJA38Pmk7jrKfKK9akZVD32zRzZWGrRF39TPXqw==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-20VVIIEH9RItrIaNfTruIbrWL/qDoeEdcDxzFHFULJFjdDpdDOUdfTiC5/u6T7FmbngMLfe1M7PoVW1apet1Gw==",
|
||||
"dependencies": [
|
||||
"@mdit/helper",
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-ChmBzqd9ovp6sUplb388on8NphfW0JBMmaDLf4lXd0IvMX3+dYlPAtPKxUJr3QwmEK5rAnfRFeJG5cvC+CsHSg==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-1yvG+kcec8s8hXaCRnbagNJogh5yE6ioS588NcMedBjA2bZ0Q/4xexXF1phU3e3T740ACPqwN+amwj+Cf/GlIA==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-WsMBjy32leLRwTVvZj/88+QqvoKU5ZM1znx7kLnaUJUYjw6fqd82RTC3P3wmQa0/dxKk3m17oFQPlDshzXhEiA==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-wU+b1AITt3iCb70d9GpY8/BsEkf18XPeO3vdcU6pmAOrFo1GyWAf21KTE0+g/Zh7n3DdyqdjpPCjEJbW73xzzg==",
|
||||
"dependencies": [
|
||||
"@mdit/helper",
|
||||
"@types/markdown-it",
|
||||
"markdown-it",
|
||||
"upath"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-+w8ORGQ08zgY61Vz/9xHKwpMitCV7pdI80MOq03tlZQRUANUQRaM3mnA6/B51bzubJvnB8NPQdRAJ2Mwt6ZILg==",
|
||||
"dependencies": [
|
||||
"@mdit/helper",
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-XcnSJwfA782TP80sAjtd4AvaHytUiPsYETaSFHh+L/fXdYtuyEHxaL1gyX3+m3+x7UlMPfG2O/9/oSKFEJjEOQ==",
|
||||
"dependencies": [
|
||||
"@mdit/plugin-inline-rule",
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-r7nKvngZP2XXVGsYIXZt4UNxhTAxwSbLSXQtW445nJGhcp0ZrWmdPoz3AFZAX5x51inARab/lnZhD3uq01V5Yg==",
|
||||
"dependencies": [
|
||||
"@mdit/helper",
|
||||
"@mdit/plugin-tex",
|
||||
"@types/markdown-it",
|
||||
"katex",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-lPeJULVt1s9rEA2aU5pKRRsqGpJVmmcLE08GKeuPb7xgJuJvsPnDHNqA4eVSHUR9WARMolygfTBT1yAQd715HA==",
|
||||
"dependencies": [
|
||||
"@mdit/helper",
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-j/icOo3K55IkO2TbK26PpumNFzJ1+iSNGc4r29E1iamO8pA6iouVLdzawTAwQ4uQPrQW//JovgoUjWycnoBGKQ==",
|
||||
"dependencies": [
|
||||
"@mdit/plugin-inline-rule",
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-UKv2X2p/BHN3uHP//SF6l2Rdp91Nk/6RlaPrmvHz/RSMRI4YzuNL+IAg/kJAQmT4tWyInsR4Bwcw8R0qGHCk0A==",
|
||||
"dependencies": [
|
||||
"@mdit/plugin-uml",
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-dj2IMJg/WifTZaWq9hXQohc66pCiSeaBJH/PFcxaELzVCtq/BC8F7lp39oU7lgNUPP8XMozduQ6EJide5QJnqw==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-57f0r1uswwpVvy9pp6p7SybWKrnDj01WJhvr1uVf+izDkH9zbDNqcHSt4qOP1aIWcz+ldiZBDIjwkLjnqn71gA==",
|
||||
"dependencies": [
|
||||
"@mdit/helper",
|
||||
"@types/markdown-it",
|
||||
"markdown-it",
|
||||
"upath"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-rCUGTp7WqxK40tYQYseR0RuLOS001fMOn55bgj1Evrf2oI6RydEeOtlbeh48bZK9na/swmUtwV3yYC4wZi6kNQ==",
|
||||
"dependencies": [
|
||||
"@mdit/plugin-inline-rule",
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-q62eRLz/41AoodZIwx5NHoSuHyX1CuFaVjG13j6kbuo5gWmLF3JcyIY9BG+BRgSM+00LvB9DCZWAf/ZdN+vOVg==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-E4wNJ5mDIoJbjvGj9D/GTlhWhUmR94UQjEtPCEQf/oy9nZMhetA0qFjCCFnGpJQHpHcBEkxWc5hEVdMiWhQBFA==",
|
||||
"dependencies": [
|
||||
"@mdit/plugin-inline-rule",
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-tMi63tSz6we8cjfdjLmhbTr/B+wX96PtsBwTKKKWn6UWmJzv9Kljq2AOHvV8phwpXz+Jz3yPP/qyrXqvZajdzg==",
|
||||
"dependencies": [
|
||||
"@mdit/plugin-inline-rule",
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-9rN23SP4beO0shBOuSGLGR+Ia7fminVSH6xl5Rb6rh6rRYQ6R3NR2KkIfLZvoMCRiN2uDwhXT/R9LyXHOdRMUQ==",
|
||||
"dependencies": [
|
||||
"@mdit/helper",
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-9vpH3ZG2JmB3SqYfXmRXk9mI5Q6U+KO30quNH1PN5lp5gQtW4kceWhfAPeQtSMemNV4KuCyns+6PRX8zD9Sajw==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-nVKIJHQJHvgDByKMpCgFT6gdeEZUyzZby24BjCjxP2N10bkgK8IEwZIBu7G5n5WBw2D0kmFD4Top+YA2mjeiQQ==",
|
||||
"dependencies": [
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mdit/[email protected][email protected]": {
|
||||
"integrity": "sha512-GZB2x2hCb5qLCZFx5NaqugoVNF164vOYi5PWHk8vTqIsIMLVXt5b6ODFSngrjH6t3k3c7GDDcnr8QwOUSkjNQQ==",
|
||||
"dependencies": [
|
||||
"@mdit/helper",
|
||||
"@types/markdown-it",
|
||||
"markdown-it"
|
||||
],
|
||||
"optionalPeers": [
|
||||
"markdown-it"
|
||||
]
|
||||
},
|
||||
"@mixmark-io/[email protected]": {
|
||||
"integrity": "sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw=="
|
||||
},
|
||||
"@napi-rs/[email protected]": {
|
||||
"integrity": "sha512-sk7xhN/MoXeuExlggf91pNziBxLPVUqF2CAVnB57KLG/pz7+U5TKG8eXdc3pm0d7Od0WreB6ZKLj37sX9muGOQ==",
|
||||
"os": ["android"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@napi-rs/[email protected]": {
|
||||
"integrity": "sha512-O64APRTXRUiAz0P8gErkfEr3lipLJgM6pjATwavZ22ebhjYl/SUbpgM0xcWPQBNMP1n29afAC/Us5PX1vg+JNQ==",
|
||||
"os": ["darwin"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@napi-rs/[email protected]": {
|
||||
"integrity": "sha512-FqqSU7qFce0Cp3pwnTjVkKjjOtxMqRe6lmINxpIZYaZNnVI0H5FtsaraZJ36SiTHNjZlUB69/HhxNDT1Aaa9vA==",
|
||||
"os": ["darwin"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@napi-rs/[email protected]": {
|
||||
"integrity": "sha512-eyWz0ddBDQc7/JbAtY4OtZ5SpK8tR4JsCYEZjCE3dI8pqoWUC8oMwYSBGCYfsx2w47cQgQCgMVRVTFiiO38hHQ==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["arm"]
|
||||
},
|
||||
"@napi-rs/[email protected]": {
|
||||
"integrity": "sha512-qwA63t8A86bnxhuA/GwOkK3jvb+XTQaTiVML0vAWoHyoZYTjNs7BzoOONDgTnNtr8/yHrq64XXzUoLqDzU+Uuw==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@napi-rs/[email protected]": {
|
||||
"integrity": "sha512-1XbCOz/ymhj24lFaIXtWnwv/6eFHXDrjP0jYkc6iHQ9q8oXKzUX1Lc6bu+wuGiLhGh2GS/2JlfORC5ZcXimRcg==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["arm64"]
|
||||
},
|
||||
"@napi-rs/[email protected]": {
|
||||
"integrity": "sha512-XTzR125w5ZMs0lJcxRlS1K3P5RaZ9RmUsPtd1uGt+EfDyYMu4c6SEROYsxyatbbu/2+lPe7MPHOO/0a0x7L/gw==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["riscv64"]
|
||||
},
|
||||
"@napi-rs/[email protected]": {
|
||||
"integrity": "sha512-BeXAmhKg1kX3UCrJsYbdQd3hIMDH/K6HnP/pG2LuITaXhXBiNdh//TVVVVCBbJzVQaV5gK/4ZOCMrQW9mvuTqA==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@napi-rs/[email protected]": {
|
||||
"integrity": "sha512-x0XvZWdHbkgdgucJsRxprX/4o4sEed7qo9rCQA9ugiS9qE2QvP0RIiEugtZhfLH3cyI+jIRFJHV4Fuz+1BHHMg==",
|
||||
"os": ["linux"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@napi-rs/[email protected]": {
|
||||
"integrity": "sha512-Z8jPsM6df5V8B1HrCHB05+bDiCxjE9QA//3YrkKIdVDEwn5RKaqOxCJDRJkl48cJbylcrJbW4HxZbTte8juuPg==",
|
||||
"os": ["win32"],
|
||||
"cpu": ["x64"]
|
||||
},
|
||||
"@napi-rs/[email protected]": {
|
||||
"integrity": "sha512-DxuT1ClnIPts1kQx8FBmkk4BQDTfI5kIzywAaMjQSXfNnra5UFU9PwurXrl+Je3bJ6BGsp/zmshVVFbCmyI+ww==",
|
||||
"optionalDependencies": [
|
||||
"@napi-rs/canvas-android-arm64",
|
||||
"@napi-rs/canvas-darwin-arm64",
|
||||
"@napi-rs/canvas-darwin-x64",
|
||||
"@napi-rs/canvas-linux-arm-gnueabihf",
|
||||
"@napi-rs/canvas-linux-arm64-gnu",
|
||||
"@napi-rs/canvas-linux-arm64-musl",
|
||||
"@napi-rs/canvas-linux-riscv64-gnu",
|
||||
"@napi-rs/canvas-linux-x64-gnu",
|
||||
"@napi-rs/canvas-linux-x64-musl",
|
||||
"@napi-rs/canvas-win32-x64-msvc"
|
||||
]
|
||||
},
|
||||
"@pdf-lib/[email protected]": {
|
||||
"integrity": "sha512-hU30BK9IUN/su0Mn9VdlVKsWBS6GyhVfqjwl1FjZN4TxP6cCw0jP2w7V3Hf5uX7M0AZJ16vey9yE0ny7Sa59ZA==",
|
||||
"dependencies": [
|
||||
"pako"
|
||||
]
|
||||
},
|
||||
"@pdf-lib/[email protected]": {
|
||||
"integrity": "sha512-dQK2FUMQtowVP00mtIksrlZhdFXQZPC+taih1q4CvPZ5vqdxR/LKBaFg0oAfzd1GlHZXXSPdQfzQnt+ViGvEIQ==",
|
||||
"dependencies": [
|
||||
"pako"
|
||||
]
|
||||
},
|
||||
"@types/[email protected]": {
|
||||
"integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q=="
|
||||
},
|
||||
"@types/[email protected]": {
|
||||
"integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==",
|
||||
"dependencies": [
|
||||
"@types/linkify-it",
|
||||
"@types/mdurl"
|
||||
]
|
||||
},
|
||||
"@types/[email protected]": {
|
||||
"integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg=="
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA=="
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA=="
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg=="
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww=="
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||
"os": ["darwin"],
|
||||
"scripts": true
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-Eeo8Ys1doU1z+x8AZsPpQu+p/QcZBI5PeOo7QGQdy2x2m0MU/hYagBbGOmXwr5KVbEfVuWv9LpnQWeehogurjg==",
|
||||
"dependencies": [
|
||||
"[email protected]"
|
||||
],
|
||||
"bin": true
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==",
|
||||
"dependencies": [
|
||||
"uc.micro"
|
||||
]
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA==",
|
||||
"dependencies": [
|
||||
"argparse",
|
||||
"entities",
|
||||
"linkify-it",
|
||||
"mdurl",
|
||||
"punycode.js",
|
||||
"uc.micro"
|
||||
],
|
||||
"bin": true
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w=="
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-26XRV6BhkgK0VOxfbU5cQI+ICFUtMLixv1noZn1tGU38kQH5A5nmmbk/O45xdyBhD1esk47nKrY0mvQpZIhRjQ==",
|
||||
"dependencies": [
|
||||
"a-sync-waterfall",
|
||||
"asap",
|
||||
"[email protected]"
|
||||
],
|
||||
"bin": true
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-pLzCU8IgyKXPSO11eeharQkQ4GzOKNWhXq79pQarIRZEMt1/ssyr+MIuWBv1mNoenJLg04gvPx+fi4gcKZ4bag=="
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-V/mpyJAoTsN4cnP31vc0wfNA1+p20evqqnap0KLoRUN0Yk/p3wN52DOEsL4oBFcLdb76hlpKPtzJIgo67j/XLw==",
|
||||
"dependencies": [
|
||||
"@pdf-lib/standard-fonts",
|
||||
"@pdf-lib/upng",
|
||||
"pako",
|
||||
"tslib"
|
||||
]
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-mHU89HGh7v+4u2ubfnevJ03lmPgQ5WU4CxAVmTSh/sxVTEDYd1er/dKS/A6vg77NX47KTEoihq8jZBLr8Cxuwg==",
|
||||
"dependencies": [
|
||||
"@napi-rs/canvas",
|
||||
"pdfjs-dist"
|
||||
],
|
||||
"bin": true
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-DlOzet0HO7OEnmUmB6wWGJrrdvbyJKftI1bhMitK7O2N8W2gc757yyYBbINy9IDafXAV9wmKr9t7xsTaNKRG5Q==",
|
||||
"optionalDependencies": [
|
||||
"@napi-rs/canvas"
|
||||
]
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-HBV/RJg81z5BiiZ9yPzIiClYV/QMsDCKUyogwH9p3MCP6IYjUFu/MActgYAvK0oWyV9NlwM3GLBjADyWgydVyg==",
|
||||
"bin": true
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-C8oWjPR3F81yljW9o5OxcWzfh6avkVwDD2VYdwIGqTkl+OGFISgypqzfu7dOe4QNLL2aqcWBmI3PMtLIK233lw==",
|
||||
"dependencies": [
|
||||
"playwright-core"
|
||||
],
|
||||
"optionalDependencies": [
|
||||
"fsevents"
|
||||
],
|
||||
"bin": true
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA=="
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-6bDtNIBh1qPviVIU685/4uv0Ap5t8eS4wiJhy/tR2LdIeIey9CVasENlGS+ul3HnTmGANIp7AjnfsztsRmALfQ==",
|
||||
"bin": true
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-I8yFsfRzmzK0WV1pNNOA4A7y4RDfFxPRxb3t+e3ui14qSGOxGtiSP6GjeX+Y6CHb7HYaFj7ECUD7VE5kQMZWGQ==",
|
||||
"dependencies": [
|
||||
"@mixmark-io/domino"
|
||||
]
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A=="
|
||||
},
|
||||
"[email protected]": {
|
||||
"integrity": "sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w=="
|
||||
}
|
||||
},
|
||||
"redirects": {
|
||||
"https://deno.land/x/deno_dom/deno-dom-wasm.ts": "https://deno.land/x/[email protected]/deno-dom-wasm.ts"
|
||||
},
|
||||
"remote": {
|
||||
"https://deno.land/[email protected]/assert/assert.ts": "9a97dad6d98c238938e7540736b826440ad8c1c1e54430ca4c4e623e585607ee",
|
||||
"https://deno.land/[email protected]/assert/assertion_error.ts": "4d0bde9b374dfbcbe8ac23f54f567b77024fb67dbb1906a852d67fe050d42f56",
|
||||
"https://deno.land/[email protected]/flags/mod.ts": "a5ac18af6583404f21ea03771f8816669d901e0ff4374020870334d6f61d73d5",
|
||||
"https://deno.land/[email protected]/assert/assert.ts": "9a97dad6d98c238938e7540736b826440ad8c1c1e54430ca4c4e623e585607ee",
|
||||
"https://deno.land/[email protected]/assert/assertion_error.ts": "4d0bde9b374dfbcbe8ac23f54f567b77024fb67dbb1906a852d67fe050d42f56",
|
||||
"https://deno.land/[email protected]/fs/_util.ts": "fbf57dcdc9f7bc8128d60301eece608246971a7836a3bb1e78da75314f08b978",
|
||||
"https://deno.land/[email protected]/fs/copy.ts": "23cc1c465babe5ca4d69778821e2f8addc44593e30a5ca0b902b3784eed75bb6",
|
||||
"https://deno.land/[email protected]/fs/empty_dir.ts": "2e52cd4674d18e2e007175c80449fc3d263786a1361e858d9dfa9360a6581b47",
|
||||
"https://deno.land/[email protected]/fs/ensure_dir.ts": "dc64c4c75c64721d4e3fb681f1382f803ff3d2868f08563ff923fdd20d071c40",
|
||||
"https://deno.land/[email protected]/fs/ensure_file.ts": "39ac83cc283a20ec2735e956adf5de3e8a3334e0b6820547b5772f71c49ae083",
|
||||
"https://deno.land/[email protected]/fs/ensure_link.ts": "c15e69c48556d78aae31b83e0c0ece04b7b8bc0951412f5b759aceb6fde7f0ac",
|
||||
"https://deno.land/[email protected]/fs/ensure_symlink.ts": "b389c8568f0656d145ac7ece472afe710815cccbb2ebfd19da7978379ae143fe",
|
||||
"https://deno.land/[email protected]/fs/eol.ts": "f1f2eb348a750c34500741987b21d65607f352cf7205f48f4319d417fff42842",
|
||||
"https://deno.land/[email protected]/fs/exists.ts": "cb59a853d84871d87acab0e7936a4dac11282957f8e195102c5a7acb42546bb8",
|
||||
"https://deno.land/[email protected]/fs/expand_glob.ts": "52b8b6f5b1fa585c348250da1c80ce5d820746cb4a75d874b3599646f677d3a7",
|
||||
"https://deno.land/[email protected]/fs/mod.ts": "bc3d0acd488cc7b42627044caf47d72019846d459279544e1934418955ba4898",
|
||||
"https://deno.land/[email protected]/fs/move.ts": "b4f8f46730b40c32ea3c0bc8eb0fd0e8139249a698883c7b3756424cf19785c9",
|
||||
"https://deno.land/[email protected]/fs/walk.ts": "a16146724a6aaf9efdb92023a74e9805195c3469900744ce5de4113b07b29779",
|
||||
"https://deno.land/[email protected]/path/_basename.ts": "057d420c9049821f983f784fd87fa73ac471901fb628920b67972b0f44319343",
|
||||
"https://deno.land/[email protected]/path/_constants.ts": "e49961f6f4f48039c0dfed3c3f93e963ca3d92791c9d478ac5b43183413136e0",
|
||||
"https://deno.land/[email protected]/path/_dirname.ts": "355e297236b2218600aee7a5301b937204c62e12da9db4b0b044993d9e658395",
|
||||
"https://deno.land/[email protected]/path/_extname.ts": "eaaa5aae1acf1f03254d681bd6a8ce42a9cb5b7ff2213a9d4740e8ab31283664",
|
||||
"https://deno.land/[email protected]/path/_format.ts": "4a99270d6810f082e614309164fad75d6f1a483b68eed97c830a506cc589f8b4",
|
||||
"https://deno.land/[email protected]/path/_from_file_url.ts": "6eadfae2e6f63ad9ee46b26db4a1b16583055c0392acedfb50ed2fc694b6f581",
|
||||
"https://deno.land/[email protected]/path/_interface.ts": "6471159dfbbc357e03882c2266d21ef9afdb1e4aa771b0545e90db58a0ba314b",
|
||||
"https://deno.land/[email protected]/path/_is_absolute.ts": "05dac10b5e93c63198b92e3687baa2be178df5321c527dc555266c0f4f51558c",
|
||||
"https://deno.land/[email protected]/path/_join.ts": "815f5e85b042285175b1492dd5781240ce126c23bd97bad6b8211fe7129c538e",
|
||||
"https://deno.land/[email protected]/path/_normalize.ts": "a19ec8706b2707f9dd974662a5cd89fad438e62ab1857e08b314a8eb49a34d81",
|
||||
"https://deno.land/[email protected]/path/_os.ts": "d932f56d41e4f6a6093d56044e29ce637f8dcc43c5a90af43504a889cf1775e3",
|
||||
"https://deno.land/[email protected]/path/_parse.ts": "0f9b0ff43682dd9964eb1c4398610c4e165d8db9d3ac9d594220217adf480cfa",
|
||||
"https://deno.land/[email protected]/path/_relative.ts": "27bdeffb5311a47d85be26d37ad1969979359f7636c5cd9fcf05dcd0d5099dc5",
|
||||
"https://deno.land/[email protected]/path/_resolve.ts": "7a3616f1093735ed327e758313b79c3c04ea921808ca5f19ddf240cb68d0adf6",
|
||||
"https://deno.land/[email protected]/path/_to_file_url.ts": "a141e4a525303e1a3a0c0571fd024552b5f3553a2af7d75d1ff3a503dcbb66d8",
|
||||
"https://deno.land/[email protected]/path/_to_namespaced_path.ts": "0d5f4caa2ed98ef7a8786286df6af804b50e38859ae897b5b5b4c8c5930a75c8",
|
||||
"https://deno.land/[email protected]/path/_util.ts": "4e191b1bac6b3bf0c31aab42e5ca2e01a86ab5a0d2e08b75acf8585047a86221",
|
||||
"https://deno.land/[email protected]/path/basename.ts": "bdfa5a624c6a45564dc6758ef2077f2822978a6dbe77b0a3514f7d1f81362930",
|
||||
"https://deno.land/[email protected]/path/common.ts": "ee7505ab01fd22de3963b64e46cff31f40de34f9f8de1fff6a1bd2fe79380000",
|
||||
"https://deno.land/[email protected]/path/dirname.ts": "b6533f4ee4174a526dec50c279534df5345836dfdc15318400b08c62a62a39dd",
|
||||
"https://deno.land/[email protected]/path/extname.ts": "62c4b376300795342fe1e4746c0de518b4dc9c4b0b4617bfee62a2973a9555cf",
|
||||
"https://deno.land/[email protected]/path/format.ts": "110270b238514dd68455a4c54956215a1aff7e37e22e4427b7771cefe1920aa5",
|
||||
"https://deno.land/[email protected]/path/from_file_url.ts": "9f5cb58d58be14c775ec2e57fc70029ac8b17ed3bd7fe93e475b07280adde0ac",
|
||||
"https://deno.land/[email protected]/path/glob.ts": "593e2c3573883225c25c5a21aaa8e9382a696b8e175ea20a3b6a1471ad17aaed",
|
||||
"https://deno.land/[email protected]/path/is_absolute.ts": "0b92eb35a0a8780e9f16f16bb23655b67dace6a8e0d92d42039e518ee38103c1",
|
||||
"https://deno.land/[email protected]/path/join.ts": "31c5419f23d91655b08ec7aec403f4e4cd1a63d39e28f6e42642ea207c2734f8",
|
||||
"https://deno.land/[email protected]/path/mod.ts": "6e1efb0b13121463aedb53ea51dabf5639a3172ab58c89900bbb72b486872532",
|
||||
"https://deno.land/[email protected]/path/normalize.ts": "6ea523e0040979dd7ae2f1be5bf2083941881a252554c0f32566a18b03021955",
|
||||
"https://deno.land/[email protected]/path/parse.ts": "be8de342bb9e1924d78dc4d93c45215c152db7bf738ec32475560424b119b394",
|
||||
"https://deno.land/[email protected]/path/posix.ts": "0a1c1952d132323a88736d03e92bd236f3ed5f9f079e5823fae07c8d978ee61b",
|
||||
"https://deno.land/[email protected]/path/relative.ts": "8bedac226afd360afc45d451a6c29fabceaf32978526bcb38e0c852661f66c61",
|
||||
"https://deno.land/[email protected]/path/resolve.ts": "133161e4949fc97f9ca67988d51376b0f5eef8968a6372325ab84d39d30b80dc",
|
||||
"https://deno.land/[email protected]/path/separator.ts": "40a3e9a4ad10bef23bc2cd6c610291b6c502a06237c2c4cd034a15ca78dedc1f",
|
||||
"https://deno.land/[email protected]/path/to_file_url.ts": "00e6322373dd51ad109956b775e4e72e5f9fa68ce2c6b04e4af2a6eed3825d31",
|
||||
"https://deno.land/[email protected]/path/to_namespaced_path.ts": "1b1db3055c343ab389901adfbda34e82b7386bcd1c744d54f9c1496ee0fd0c3d",
|
||||
"https://deno.land/[email protected]/path/win32.ts": "8b3f80ef7a462511d5e8020ff490edcaa0a0d118f1b1e9da50e2916bdd73f9dd",
|
||||
"https://deno.land/x/[email protected]/build/deno-wasm/deno-wasm-dynamic.js": "fd05e83a855aa68b09396dc47a7638ef526c39917971715ac37e0fc3227db886",
|
||||
"https://deno.land/x/[email protected]/build/deno-wasm/deno-wasm.js": "ccde5219e42040b8f7a8b653acc6c8cca197c29f98d6b75f74c48111e34bcbea",
|
||||
"https://deno.land/x/[email protected]/build/deno-wasm/deno-wasm_bg-wasm.js": "52c57905a74047d1574f0b96e301ef1d5974cd962705615555b5e46b5ac420e4",
|
||||
"https://deno.land/x/[email protected]/build/deno-wasm/deno-wasm_bg.wasm": "b5fbd7ede316f7c13e4a7b927a053a35b475a9acce7c7cae864e91d9b8dd24c7",
|
||||
"https://deno.land/x/[email protected]/build/deno-wasm/env.js": "17da784c11b192c591dbf7df21ec6f65f63f45ca9a713e4ca100f3c886b4023f",
|
||||
"https://deno.land/x/[email protected]/build/deno-wasm/wbg.js": "b5b6de12bc010fa23438c8a8276067b9044a405da516d0bbe4ae61b7c6d61a22",
|
||||
"https://deno.land/x/[email protected]/deno-dom-wasm.ts": "34f0654b452568fbd95b8d1b2a493de19710ac9ceeb6b82f541d09c29613572d",
|
||||
"https://deno.land/x/[email protected]/src/api.ts": "0ff5790f0a3eeecb4e00b7d8fbfa319b165962cf6d0182a65ba90f158d74f7d7",
|
||||
"https://deno.land/x/[email protected]/src/constructor-lock.ts": "0e7b297e8b9cf921a3b0d3a692ec5fb462c5afc47ec554292e20090b9e16b40a",
|
||||
"https://deno.land/x/[email protected]/src/deserialize.ts": "514953418b7ae558ed7361ad9be21013f46cba2f58bd7f4acc90cf1e89f9c8cf",
|
||||
"https://deno.land/x/[email protected]/src/dom/document-fragment.ts": "0b915d094830d43b330dc2fb8012b990f2c815773c6cdcd4a9fdff99fe47412e",
|
||||
"https://deno.land/x/[email protected]/src/dom/document.ts": "ad584ac4ce6dce03f0ff6ef4b7db86fd598f9c7824da1387f7f2acd7d6948e4a",
|
||||
"https://deno.land/x/[email protected]/src/dom/dom-parser.ts": "ab5e8382700bc3936ac67e8d11b7bb9c6999a994ac8b070b7cae94e2d2ecee5a",
|
||||
"https://deno.land/x/[email protected]/src/dom/element.ts": "9726ebf139b97ae96671d38da720988cfd6481ff9068ba13f3b0d00e72f0c8c0",
|
||||
"https://deno.land/x/[email protected]/src/dom/elements/html-template-element.ts": "1707dfb4cbb145f3bcb94426d7cdedbaa336620d0afed30e99f50fe87ba24a98",
|
||||
"https://deno.land/x/[email protected]/src/dom/html-collection.ts": "dcf328e883877f7748d3e20fb6319e739f297a6e24f4b00ec5b1a2f390cfa3c6",
|
||||
"https://deno.land/x/[email protected]/src/dom/node-list.ts": "be9793475d82539da8b97a17b6b5538cc723538c10cc5820a23e5e4b2248845d",
|
||||
"https://deno.land/x/[email protected]/src/dom/node.ts": "53ada9e4b2ae21f10f5941ff257ed4585920ae392020544648f349c05d15d30c",
|
||||
"https://deno.land/x/[email protected]/src/dom/selectors/custom-api.ts": "852696bd58e534bc41bd3be9e2250b60b67cd95fd28ed16b1deff1d548531a71",
|
||||
"https://deno.land/x/[email protected]/src/dom/selectors/nwsapi-types.ts": "c43b36c36acc5d32caabaa54fda8c9d239b2b0fcbce9a28efb93c84aa1021698",
|
||||
"https://deno.land/x/[email protected]/src/dom/selectors/nwsapi.js": "985d7d8fc1eabbb88946b47a1c44c1b2d4aa79ff23c21424219f1528fa27a2ff",
|
||||
"https://deno.land/x/[email protected]/src/dom/selectors/selectors.ts": "83eab57be2290fb48e3130533448c93c6c61239f2a2f3b85f1917f80ca0fdc75",
|
||||
"https://deno.land/x/[email protected]/src/dom/selectors/sizzle-types.ts": "78149e2502409989ce861ed636b813b059e16bc267bb543e7c2b26ef43e4798b",
|
||||
"https://deno.land/x/[email protected]/src/dom/selectors/sizzle.js": "c3aed60c1045a106d8e546ac2f85cc82e65f62d9af2f8f515210b9212286682a",
|
||||
"https://deno.land/x/[email protected]/src/dom/string-cache.ts": "8e935804f7bac244cc70cec90a28c9f6d30fea14c61c2c4ea48fca274376d786",
|
||||
"https://deno.land/x/[email protected]/src/dom/utils-types.ts": "96db30e3e4a75b194201bb9fa30988215da7f91b380fca6a5143e51ece2a8436",
|
||||
"https://deno.land/x/[email protected]/src/dom/utils.ts": "bc429635e9204051ba1ecc1b212031b5ee7c6bcd95120c91bef696804aa67e74",
|
||||
"https://deno.land/x/[email protected]/src/parser.ts": "e06b2300d693e6ae7564e53dfa5c9a9e97fdb8c044c39c52c8b93b5d60860be3"
|
||||
},
|
||||
"workspace": {
|
||||
"dependencies": [
|
||||
"jsr:@std/assert@1",
|
||||
"jsr:@std/toml@^1.0.11",
|
||||
"npm:@mdit/plugin-abbr@~0.23.2",
|
||||
"npm:@mdit/plugin-alert@~0.23.2",
|
||||
"npm:@mdit/plugin-align@~0.24.2",
|
||||
"npm:@mdit/plugin-attrs@~0.25.2",
|
||||
"npm:@mdit/plugin-container@~0.23.2",
|
||||
"npm:@mdit/plugin-demo@~0.23.2",
|
||||
"npm:@mdit/plugin-dl@~0.23.2",
|
||||
"npm:@mdit/plugin-embed@~0.25.2",
|
||||
"npm:@mdit/plugin-emoji@~0.2.2",
|
||||
"npm:@mdit/plugin-field@~0.24.2",
|
||||
"npm:@mdit/plugin-figure@~0.23.2",
|
||||
"npm:@mdit/plugin-footnote@~0.23.2",
|
||||
"npm:@mdit/plugin-icon@~0.24.2",
|
||||
"npm:@mdit/plugin-img-lazyload@~0.23.2",
|
||||
"npm:@mdit/plugin-img-mark@~0.23.2",
|
||||
"npm:@mdit/plugin-img-size@~0.23.2",
|
||||
"npm:@mdit/plugin-include@~0.23.2",
|
||||
"npm:@mdit/plugin-ins@~0.23.2",
|
||||
"npm:@mdit/plugin-katex@~0.25.2",
|
||||
"npm:@mdit/plugin-layout@~0.2.2",
|
||||
"npm:@mdit/plugin-mark@~0.23.2",
|
||||
"npm:@mdit/plugin-plantuml@~0.24.2",
|
||||
"npm:@mdit/plugin-ruby@~0.23.2",
|
||||
"npm:@mdit/plugin-snippet@~0.23.2",
|
||||
"npm:@mdit/plugin-spoiler@~0.23.2",
|
||||
"npm:@mdit/plugin-stylize@~0.23.2",
|
||||
"npm:@mdit/plugin-sub@~0.24.2",
|
||||
"npm:@mdit/plugin-sup@~0.24.2",
|
||||
"npm:@mdit/plugin-tab@~0.24.2",
|
||||
"npm:@mdit/plugin-tasklist@~0.23.2",
|
||||
"npm:@mdit/plugin-tex@~0.24.2",
|
||||
"npm:@mdit/plugin-uml@~0.24.2",
|
||||
"npm:fs@^0.0.1-security",
|
||||
"npm:markdown-it@^14.1.1",
|
||||
"npm:nunjucks@^3.2.4",
|
||||
"npm:openpgp@^6.3.0",
|
||||
"npm:pdf-lib@^1.17.1",
|
||||
"npm:pdf-parse@^2.4.5",
|
||||
"npm:playwright@^1.59.1",
|
||||
"npm:ripgrep@~0.3.1",
|
||||
"npm:turndown@^7.2.4"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,379 @@
|
||||
import { strToU8, unzipSync, type Zippable, zipSync } from "fflate";
|
||||
import { dirname, extname, relative, resolve, sep } from "node:path";
|
||||
import { PFiles } from "./file.ts";
|
||||
import { md } from "./mdit/md.ts";
|
||||
import { renderTemplate, type TemplateVariables } from "./template_engine.ts";
|
||||
|
||||
type EpubConfig = {
|
||||
journal: {
|
||||
build_mode?: "detached" | "flat";
|
||||
from_directory: string;
|
||||
template_directory: string;
|
||||
title?: string;
|
||||
author?: string;
|
||||
language?: string;
|
||||
identifier?: string;
|
||||
};
|
||||
vars?: Record<string, unknown>;
|
||||
epub?: { path?: string; title?: string; author?: string; language?: string };
|
||||
md?: { path?: string };
|
||||
markdown_output?: string;
|
||||
asset_base?: string;
|
||||
};
|
||||
|
||||
type EpubChapter = {
|
||||
id: string;
|
||||
href: string;
|
||||
title: string;
|
||||
html: string;
|
||||
sourcePath: string;
|
||||
column: string;
|
||||
};
|
||||
|
||||
function mediaType(extension: string): string {
|
||||
return ({
|
||||
".avif": "image/avif",
|
||||
".gif": "image/gif",
|
||||
".jpeg": "image/jpeg",
|
||||
".jpg": "image/jpeg",
|
||||
".png": "image/png",
|
||||
".svg": "image/svg+xml",
|
||||
".webp": "image/webp",
|
||||
".css": "text/css",
|
||||
".woff": "font/woff",
|
||||
".woff2": "font/woff2",
|
||||
".ttf": "font/ttf",
|
||||
".otf": "font/otf",
|
||||
".html": "application/xhtml+xml",
|
||||
".htm": "application/xhtml+xml",
|
||||
".js": "text/javascript",
|
||||
".mp3": "audio/mpeg",
|
||||
".mp4": "video/mp4",
|
||||
".pdf": "application/pdf",
|
||||
} as Record<string, string>)[extension] ?? "application/octet-stream";
|
||||
}
|
||||
|
||||
function escapeXml(value: string): string {
|
||||
return value.replace(/[&<>"']/g, (char) => ({
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
'"': """,
|
||||
"'": "'",
|
||||
}[char]!));
|
||||
}
|
||||
|
||||
function normalizeHeadingText(value: string): string {
|
||||
return value
|
||||
.replace(/<[^>]*>/g, "")
|
||||
.replace(
|
||||
/&(#x[\da-f]+|#\d+|amp|lt|gt|quot|apos);/gi,
|
||||
(entity, code: string) => {
|
||||
if (code[0] === "#") {
|
||||
const hex = code[1]?.toLowerCase() === "x";
|
||||
const number = Number.parseInt(
|
||||
code.slice(hex ? 2 : 1),
|
||||
hex ? 16 : 10,
|
||||
);
|
||||
return Number.isFinite(number)
|
||||
? String.fromCodePoint(number)
|
||||
: entity;
|
||||
}
|
||||
return ({ amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" } as Record<
|
||||
string,
|
||||
string
|
||||
>)[code.toLowerCase()] ?? entity;
|
||||
},
|
||||
)
|
||||
.normalize("NFKC")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
}
|
||||
|
||||
function removeRepeatedLeadingTitle(html: string, title: string): string {
|
||||
const heading = html.match(/^\s*<h1\b[^>]*>([\s\S]*?)<\/h1>\s*/i);
|
||||
if (
|
||||
!heading || normalizeHeadingText(heading[1]) !== normalizeHeadingText(title)
|
||||
) {
|
||||
return html;
|
||||
}
|
||||
return html.slice(heading[0].length);
|
||||
}
|
||||
|
||||
function slug(value: string, index: number): string {
|
||||
const normalized = value.normalize("NFKD").toLowerCase()
|
||||
.replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-|-$/g, "");
|
||||
return `${String(index).padStart(4, "0")}-${normalized || "chapter"}`;
|
||||
}
|
||||
|
||||
function navXhtml(chapters: EpubChapter[], title: string): string {
|
||||
let previousColumn = "";
|
||||
let links = "";
|
||||
for (const chapter of chapters) {
|
||||
if (chapter.column !== previousColumn) {
|
||||
if (previousColumn) links += "</ol></li>";
|
||||
previousColumn = chapter.column;
|
||||
links += `<li><span>${escapeXml(chapter.column)}</span><ol>`;
|
||||
}
|
||||
links += `<li><a href="${chapter.href}">${
|
||||
escapeXml(chapter.title)
|
||||
}</a></li>`;
|
||||
}
|
||||
if (previousColumn) links += "</ol></li>";
|
||||
return `<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="zh" xml:lang="zh">
|
||||
<head><title>${escapeXml(title)}</title><meta charset="utf-8" /></head>
|
||||
<body><nav epub:type="toc" id="toc"><h1>目录</h1><ol>${links}</ol></nav></body>
|
||||
</html>`;
|
||||
}
|
||||
|
||||
function packageOpf(
|
||||
chapters: EpubChapter[],
|
||||
media: Map<string, string>,
|
||||
title: string,
|
||||
author: string,
|
||||
language: string,
|
||||
identifier: string,
|
||||
): string {
|
||||
const manifest = [
|
||||
`<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/>`,
|
||||
...chapters.map((chapter) =>
|
||||
`<item id="${chapter.id}" href="${chapter.href}" media-type="application/xhtml+xml"/>`
|
||||
),
|
||||
...[...media.entries()].map(([href, mime], index) =>
|
||||
`<item id="media-${index + 1}" href="${href}" media-type="${mime}"/>`
|
||||
),
|
||||
].join("\n ");
|
||||
const spine = chapters.map((chapter) => `<itemref idref="${chapter.id}"/>`)
|
||||
.join("\n ");
|
||||
return `<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="book-id" xml:lang="${
|
||||
escapeXml(language)
|
||||
}">
|
||||
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<dc:identifier id="book-id">${escapeXml(identifier)}</dc:identifier>
|
||||
<dc:title>${escapeXml(title)}</dc:title>
|
||||
<dc:language>${escapeXml(language)}</dc:language>
|
||||
<dc:creator>${escapeXml(author)}</dc:creator>
|
||||
<meta property="dcterms:modified">${
|
||||
new Date().toISOString().replace(/\.\d{3}Z$/, "Z")
|
||||
}</meta>
|
||||
</metadata>
|
||||
<manifest>
|
||||
${manifest}
|
||||
</manifest>
|
||||
<spine>
|
||||
${spine}
|
||||
</spine>
|
||||
</package>`;
|
||||
}
|
||||
|
||||
export class EpubBuilder {
|
||||
private readonly config: EpubConfig;
|
||||
private readonly variables: TemplateVariables;
|
||||
private pfiles?: PFiles;
|
||||
|
||||
constructor(config: EpubConfig, variables: TemplateVariables = {}) {
|
||||
this.config = config;
|
||||
this.variables = variables;
|
||||
}
|
||||
|
||||
with_files_sync(directory = this.config.journal.from_directory): this {
|
||||
this.pfiles = new PFiles(
|
||||
this.config.journal.build_mode ?? "flat",
|
||||
directory,
|
||||
this.config,
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
async build(path = this.outputPath()): Promise<void> {
|
||||
if (!this.pfiles) this.with_files_sync();
|
||||
const chapters: EpubChapter[] = [];
|
||||
const mediaManifest = new Map<string, string>();
|
||||
const epubMedia = new Map<string, Uint8Array>();
|
||||
const allFiles = this.pfiles!;
|
||||
let index = 0;
|
||||
const sourceToHref = new Map<string, string>();
|
||||
for (const column of allFiles.pcolumes) {
|
||||
for (const pfile of column.pfiles) {
|
||||
index += 1;
|
||||
sourceToHref.set(
|
||||
resolve(pfile.full_name),
|
||||
`text/${slug(pfile.meta.title, index)}.xhtml`,
|
||||
);
|
||||
}
|
||||
}
|
||||
index = 0;
|
||||
for (const column of allFiles.pcolumes) {
|
||||
for (const pfile of column.pfiles) {
|
||||
index += 1;
|
||||
const id = `chapter-${index}`;
|
||||
const href = `text/${slug(pfile.meta.title, index)}.xhtml`;
|
||||
let html = md.render(renderTemplate(pfile.content, {
|
||||
...this.variables,
|
||||
document: {
|
||||
title: pfile.meta.title,
|
||||
index: pfile.meta.index,
|
||||
file: pfile.full_name,
|
||||
},
|
||||
column: { name: column.name, index: column.index },
|
||||
}));
|
||||
html = removeRepeatedLeadingTitle(html, pfile.meta.title);
|
||||
const targetDir = dirname(resolve(href));
|
||||
const sourceDir = dirname(resolve(pfile.full_name));
|
||||
const media: Array<{ href: string; bytes: Uint8Array; mime: string }> =
|
||||
[];
|
||||
const mediaBySource = new Map<string, string>();
|
||||
const knownTargets = new Set(sourceToHref.keys());
|
||||
const assetReferences = [
|
||||
...html.matchAll(/\b(src|href)=(['"])([^'"]+)\2/gi),
|
||||
];
|
||||
for (const reference of assetReferences) {
|
||||
const sourceUrl = reference[3];
|
||||
if (sourceUrl.split(/[?#]/, 1)[0].toLowerCase().endsWith(".md")) {
|
||||
continue;
|
||||
}
|
||||
if (/^(?:[a-z][a-z0-9+.-]*:|#|\/\/)/i.test(sourceUrl)) continue;
|
||||
const sourceAsset = resolve(
|
||||
sourceDir,
|
||||
decodeURIComponent(sourceUrl.split(/[?#]/, 1)[0]),
|
||||
);
|
||||
if (knownTargets.has(sourceAsset)) continue;
|
||||
if (
|
||||
!sourceAsset.startsWith(
|
||||
`${resolve(this.config.journal.from_directory)}${sep}`,
|
||||
)
|
||||
) continue;
|
||||
try {
|
||||
const info = await Deno.stat(sourceAsset);
|
||||
if (!info.isFile) continue;
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
const destination = mediaBySource.get(sourceAsset) ??
|
||||
`media/${index}/${media.length + 1}${
|
||||
extname(sourceAsset).toLowerCase()
|
||||
}`;
|
||||
if (!mediaBySource.has(sourceAsset)) {
|
||||
mediaBySource.set(sourceAsset, destination);
|
||||
const ext = extname(sourceAsset).toLowerCase();
|
||||
media.push({
|
||||
href: destination,
|
||||
bytes: await Deno.readFile(sourceAsset),
|
||||
mime: mediaType(ext),
|
||||
});
|
||||
}
|
||||
const escapedUrl = reference[0];
|
||||
const replacement = `${reference[1]}=${reference[2]}${
|
||||
relative(targetDir, resolve(destination)).split(sep).join("/")
|
||||
}${reference[2]}`;
|
||||
html = html.replace(escapedUrl, replacement);
|
||||
}
|
||||
// Resolve authored links that point to another Markdown chapter inside this EPUB.
|
||||
html = html.replace(
|
||||
/\b(href)=(['"])([^'"]+\.md(?:#[^'"]*)?)\2/gi,
|
||||
(match, attr: string, quote: string, target: string) => {
|
||||
const [filePart, fragment] = target.split("#", 2);
|
||||
const targetPath = resolve(sourceDir, decodeURIComponent(filePart));
|
||||
const chapterHref = sourceToHref.get(targetPath);
|
||||
return chapterHref
|
||||
? `${attr}=${quote}${
|
||||
relative(targetDir, resolve(chapterHref)).split(sep).join("/")
|
||||
}${fragment ? `#${fragment}` : ""}${quote}`
|
||||
: match;
|
||||
},
|
||||
);
|
||||
chapters.push({
|
||||
id,
|
||||
href,
|
||||
title: pfile.meta.title,
|
||||
html,
|
||||
sourcePath: pfile.full_name,
|
||||
column: column.name,
|
||||
});
|
||||
for (const asset of media) {
|
||||
epubMedia.set(asset.href, asset.bytes);
|
||||
mediaManifest.set(asset.href, asset.mime);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (chapters.length === 0) {
|
||||
throw new Error("No Markdown articles found for EPUB");
|
||||
}
|
||||
|
||||
const epub = this.config.epub ?? {};
|
||||
const title = epub.title ?? this.config.journal.title ?? "未命名出版物";
|
||||
const author = epub.author ?? this.config.journal.author ?? "未知作者";
|
||||
const language = epub.language ?? this.config.journal.language ?? "zh-CN";
|
||||
const identifier = this.config.journal.identifier ??
|
||||
`urn:uuid:${await this.contentIdentifier(chapters)}`;
|
||||
const files: Record<string, Uint8Array> = {
|
||||
mimetype: strToU8("application/epub+zip"),
|
||||
"META-INF/container.xml": strToU8(
|
||||
`<?xml version="1.0" encoding="UTF-8"?>\n<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"><rootfiles><rootfile full-path="EPUB/content.opf" media-type="application/oebps-package+xml"/></rootfiles></container>`,
|
||||
),
|
||||
"EPUB/nav.xhtml": strToU8(navXhtml(chapters, title)),
|
||||
"EPUB/content.opf": strToU8(
|
||||
packageOpf(
|
||||
chapters,
|
||||
mediaManifest,
|
||||
title,
|
||||
author,
|
||||
language,
|
||||
identifier,
|
||||
),
|
||||
),
|
||||
};
|
||||
for (const [href, bytes] of epubMedia) files[`EPUB/${href}`] = bytes;
|
||||
chapters.forEach((chapter) => {
|
||||
files[`EPUB/${chapter.href}`] = strToU8(
|
||||
`<?xml version="1.0" encoding="utf-8"?>\n<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" lang="${
|
||||
escapeXml(language)
|
||||
}" xml:lang="${
|
||||
escapeXml(language)
|
||||
}"><head><meta charset="utf-8"/><title>${
|
||||
escapeXml(chapter.title)
|
||||
}</title></head><body><h1>${
|
||||
escapeXml(chapter.title)
|
||||
}</h1>${chapter.html}</body></html>`,
|
||||
);
|
||||
});
|
||||
const orderedEntries: Zippable = {
|
||||
mimetype: [files.mimetype, { level: 0 }],
|
||||
};
|
||||
for (const [name, bytes] of Object.entries(files)) {
|
||||
if (name !== "mimetype") orderedEntries[name] = bytes;
|
||||
}
|
||||
const archive = zipSync(orderedEntries, {
|
||||
level: 6,
|
||||
mtime: new Date("2020-01-01T00:00:00Z"),
|
||||
});
|
||||
await Deno.mkdir(path.replace(/[/\\][^/\\]*$/, ""), { recursive: true });
|
||||
await Deno.writeFile(path, archive);
|
||||
}
|
||||
|
||||
outputPath(): string {
|
||||
if (this.config.epub?.path) return this.config.epub.path;
|
||||
const sourcePath = this.config.md?.path ?? this.config.markdown_output;
|
||||
if (!sourcePath) return "./outputs/book.epub";
|
||||
return sourcePath.replace(/\.md$/i, ".epub");
|
||||
}
|
||||
|
||||
private async contentIdentifier(chapters: EpubChapter[]): Promise<string> {
|
||||
const digestInput = new TextEncoder().encode(
|
||||
`${this.config.journal.from_directory}\n${
|
||||
chapters.map((chapter) => chapter.sourcePath).join("\n")
|
||||
}`,
|
||||
);
|
||||
const digest = await crypto.subtle.digest("SHA-256", digestInput);
|
||||
return [...new Uint8Array(digest)].map((byte) =>
|
||||
byte.toString(16).padStart(2, "0")
|
||||
).join("");
|
||||
}
|
||||
}
|
||||
|
||||
export function inspectEpub(bytes: Uint8Array): Record<string, Uint8Array> {
|
||||
return unzipSync(bytes);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import { assertEquals, assertStringIncludes } from "@std/assert";
|
||||
import { EpubBuilder, inspectEpub } from "./epub_builder.ts";
|
||||
|
||||
Deno.test("generates EPUB 3 with a linked table of contents and spine", async () => {
|
||||
const root = await Deno.makeTempDir();
|
||||
const publication = `${root}/publication`;
|
||||
const templates = `${root}/templates`;
|
||||
const output = `${root}/book.epub`;
|
||||
await Deno.mkdir(`${publication}/1::专栏`, { recursive: true });
|
||||
await Deno.mkdir(templates, { recursive: true });
|
||||
await Deno.writeTextFile(
|
||||
`${publication}/1::专栏/1::第一篇.md`,
|
||||
"正文甲",
|
||||
);
|
||||
await Deno.writeTextFile(
|
||||
`${publication}/1::专栏/2::第二篇.md`,
|
||||
"# 第二篇\n\n第二段\n\n\n\n[转到第一篇](1::第一篇.md)",
|
||||
);
|
||||
await Deno.mkdir(`${publication}/1::专栏/assets`, { recursive: true });
|
||||
await Deno.writeFile(
|
||||
`${publication}/1::专栏/assets/pixel.png`,
|
||||
new Uint8Array([1, 2, 3]),
|
||||
);
|
||||
const builder = new EpubBuilder({
|
||||
journal: {
|
||||
build_mode: "detached",
|
||||
from_directory: publication,
|
||||
template_directory: templates,
|
||||
identifier: "urn:test:book",
|
||||
},
|
||||
epub: { path: output, title: "测试书", author: "作者甲" },
|
||||
}).with_files_sync();
|
||||
|
||||
try {
|
||||
await builder.build();
|
||||
const archiveBytes = await Deno.readFile(output);
|
||||
const zip = inspectEpub(archiveBytes);
|
||||
const mimetype = new TextDecoder().decode(zip.mimetype);
|
||||
assertEquals(mimetype, "application/epub+zip");
|
||||
const archiveView = new DataView(
|
||||
archiveBytes.buffer,
|
||||
archiveBytes.byteOffset,
|
||||
archiveBytes.byteLength,
|
||||
);
|
||||
// Local-file-header fields: compression method is the uint16 at offset 8.
|
||||
assertEquals(archiveView.getUint16(8, true), 0);
|
||||
assertEquals(
|
||||
new TextDecoder().decode(archiveBytes.slice(30, 38)),
|
||||
"mimetype",
|
||||
);
|
||||
|
||||
const nav = new TextDecoder().decode(zip["EPUB/nav.xhtml"]);
|
||||
assertStringIncludes(nav, 'epub:type="toc"');
|
||||
assertStringIncludes(nav, "text/0001-第一篇.xhtml");
|
||||
assertStringIncludes(nav, "text/0002-第二篇.xhtml");
|
||||
const opf = new TextDecoder().decode(zip["EPUB/content.opf"]);
|
||||
assertStringIncludes(opf, "<spine>");
|
||||
assertStringIncludes(opf, '<itemref idref="chapter-1"/>');
|
||||
assertStringIncludes(
|
||||
new TextDecoder().decode(zip["EPUB/text/0001-第一篇.xhtml"]),
|
||||
"正文甲",
|
||||
);
|
||||
const secondChapter = new TextDecoder().decode(
|
||||
zip["EPUB/text/0002-第二篇.xhtml"],
|
||||
);
|
||||
assertEquals((secondChapter.match(/<h1\b/g) ?? []).length, 1);
|
||||
assertStringIncludes(secondChapter, "第二篇</h1>");
|
||||
assertStringIncludes(secondChapter, "../media/2/1.png");
|
||||
assertStringIncludes(secondChapter, "0001-第一篇.xhtml");
|
||||
assertEquals(zip["EPUB/media/2/1.png"].length, 3);
|
||||
} finally {
|
||||
await Deno.remove(root, { recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
Deno.test("uses EPUB output path or a stable default", () => {
|
||||
const builder = new EpubBuilder({
|
||||
journal: { from_directory: "publication", template_directory: "templates" },
|
||||
});
|
||||
assertEquals(builder.outputPath(), "./outputs/book.epub");
|
||||
});
|
||||
@@ -0,0 +1,161 @@
|
||||
// deno-lint-ignore-file
|
||||
import { readdir, readdirSync, readFileSync } from "node:fs";
|
||||
import { join, resolve } from "node:path";
|
||||
|
||||
export class PFiles {
|
||||
cover_html: string | undefined;
|
||||
end_html: string | undefined;
|
||||
style_html: string | undefined;
|
||||
other_htmls: Array<string> = [];
|
||||
pcolumes: Array<PColume> = [];
|
||||
cfg: any;
|
||||
constructor(mode: "detached" | "flat", dir: string, cfg: any) {
|
||||
this.cfg = cfg;
|
||||
//const fs = require("fs");
|
||||
//const files = readdirSync(dir);
|
||||
let files = null;
|
||||
switch (mode) {
|
||||
case "detached":
|
||||
files = this.load_file_detached(dir, cfg.journal.template_directory);
|
||||
this.read_files(files, dir);
|
||||
break;
|
||||
case "flat":
|
||||
files = this.load_file_flat(dir);
|
||||
this.read_files(files, dir);
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown build mode: ${cfg.journal.build_mode}`);
|
||||
}
|
||||
}
|
||||
|
||||
private read_files(files: string[], dir: string) {
|
||||
// console.debug(`Reading files from directory: ${dir}`);
|
||||
// console.debug(`Files found: ${files.join(", ")}`);
|
||||
for (const file of files) {
|
||||
// Process each file
|
||||
let file_name = file.split("/").slice(-1)[0];
|
||||
|
||||
switch (file_name) {
|
||||
case "cover_page.html":
|
||||
this.cover_html = readFileSync(
|
||||
file,
|
||||
"utf-8",
|
||||
);
|
||||
break;
|
||||
case "end_page.html":
|
||||
this.end_html = readFileSync(
|
||||
file,
|
||||
"utf-8",
|
||||
);
|
||||
break;
|
||||
case "style.html":
|
||||
this.style_html = readFileSync(file, "utf-8");
|
||||
break;
|
||||
default:
|
||||
if (file.endsWith(".html")) {
|
||||
this.other_htmls.push(
|
||||
readFileSync(file, "utf-8"),
|
||||
);
|
||||
break;
|
||||
}
|
||||
if ((file.endsWith(".md"))) {
|
||||
const meta = new PFileMetadata(file, this.cfg.journal.build_mode);
|
||||
const path = file;
|
||||
const content = readFileSync(path, "utf-8");
|
||||
const pfile = new PFile(file, meta, content);
|
||||
if (this.pcolumes.some((v) => v.name === meta.colume)) {
|
||||
const volume = this.pcolumes.find((v) => v.name === meta.colume);
|
||||
volume?.pfiles.push(pfile);
|
||||
|
||||
//保证每个专栏内的文件按照index排序,每个专栏之间也按照index排序
|
||||
volume?.pfiles.sort((a, b) => a.meta.index - b.meta.index);
|
||||
this.pcolumes.sort((a, b) => a.index - b.index);
|
||||
} else {
|
||||
this.pcolumes.push(new PColume(meta.colume, [pfile]));
|
||||
//保证每个专栏内的文件按照index排序,每个专栏之间也按照index排序
|
||||
|
||||
this.pcolumes[this.pcolumes.length - 1].pfiles.sort((a, b) =>
|
||||
a.meta.index - b.meta.index
|
||||
);
|
||||
this.pcolumes.sort((a, b) => a.index - b.index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
load_file_detached(passage_dir: string, template_dir: string): Array<string> {
|
||||
const passage_files: string[] = [];
|
||||
const columns = readdirSync(passage_dir);
|
||||
for (const column of columns) {
|
||||
const columnPath = join(passage_dir, column);
|
||||
try {
|
||||
if (Deno.statSync(columnPath).isDirectory) {
|
||||
const files = readdirSync(columnPath);
|
||||
for (const file of files) {
|
||||
passage_files.push(join(columnPath, file));
|
||||
}
|
||||
}
|
||||
} catch (_e) {
|
||||
// Skip files at the top level of passage_dir if they are not directories
|
||||
// or if they are but can't be read.
|
||||
}
|
||||
}
|
||||
const template_files = readdirSync(template_dir).map((f) =>
|
||||
join(template_dir, f)
|
||||
);
|
||||
return [...passage_files, ...template_files];
|
||||
}
|
||||
|
||||
load_file_flat(dir: string): Array<string> {
|
||||
return readdirSync(dir).map((f) => join(dir, f));
|
||||
}
|
||||
}
|
||||
|
||||
export class PColume {
|
||||
name: string;
|
||||
index: number;
|
||||
pfiles: Array<PFile> = [];
|
||||
constructor(name: string, pfiles: Array<PFile>) {
|
||||
this.name = name;
|
||||
this.pfiles = pfiles;
|
||||
this.index = pfiles[0].meta.c_index;
|
||||
}
|
||||
}
|
||||
|
||||
export class PFile {
|
||||
full_name: string;
|
||||
meta: PFileMetadata;
|
||||
content: string;
|
||||
|
||||
constructor(full_name: string, meta: PFileMetadata, content: string) {
|
||||
this.full_name = full_name;
|
||||
this.meta = meta;
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
|
||||
export class PFileMetadata {
|
||||
title: string;
|
||||
index: number;
|
||||
colume: string;
|
||||
c_index: number;
|
||||
constructor(filename: string, build_mode: "detached" | "flat" = "detached") {
|
||||
let [c_index, colume, index, title] = ["0", "default", "0", filename];
|
||||
if (build_mode == "flat") {
|
||||
[c_index, colume, index, title] = filename.split("::");
|
||||
} else if (build_mode == "detached") {
|
||||
const current_folder_name = filename.split("/").slice(-2)[0];
|
||||
[c_index, colume] = current_folder_name.split("::");
|
||||
index = filename.split("/").slice(-1)[0].split("::")[0] ?? "0";
|
||||
title = filename.split("/").slice(-1)[0].split("::")[1] ?? filename;
|
||||
} else {
|
||||
throw new Error(`Unknown build mode: ${build_mode}`);
|
||||
}
|
||||
title = title.replace(".md", "");
|
||||
this.c_index = parseInt(c_index);
|
||||
this.title = title;
|
||||
this.index = parseInt(index);
|
||||
this.colume = colume;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { comparePColumes, PColume, PFile, PFileMetadata } from "./file.ts";
|
||||
|
||||
function column(name: string, order: number): PColume {
|
||||
const meta = new PFileMetadata(`${order}::${name}/1::sample.md`);
|
||||
return new PColume(name, [new PFile(`${name}/1::sample.md`, meta, "")]);
|
||||
}
|
||||
|
||||
Deno.test("orders explicitly numbered columns before unnumbered columns", () => {
|
||||
const columns = [column("乙", Number.NaN), column("丙", 2), column("甲", 1)];
|
||||
columns.sort(comparePColumes);
|
||||
assertEquals(columns.map((item) => item.name), ["甲", "丙", "乙"]);
|
||||
});
|
||||
|
||||
Deno.test("orders unnumbered columns by their first Chinese character", () => {
|
||||
const columns = [
|
||||
column("丙栏目", Number.NaN),
|
||||
column("阿栏目", Number.NaN),
|
||||
column("乙栏目", Number.NaN),
|
||||
];
|
||||
columns.sort(comparePColumes);
|
||||
assertEquals(columns.map((item) => item.name), [
|
||||
"阿栏目",
|
||||
"丙栏目",
|
||||
"乙栏目",
|
||||
]);
|
||||
});
|
||||
|
||||
Deno.test("parses detached column folders without an order prefix", () => {
|
||||
const meta = new PFileMetadata("/publication/专栏名称/1::文章标题.md");
|
||||
assertEquals(meta.colume, "专栏名称");
|
||||
assertEquals(Number.isNaN(meta.c_index), true);
|
||||
});
|
||||
|
||||
Deno.test("parses finite JavaScript numbers as detached column order", () => {
|
||||
for (const [prefix, expected] of [
|
||||
["-2.5", -2.5],
|
||||
["+3.25", 3.25],
|
||||
["1e3", 1000],
|
||||
["0x10", 16],
|
||||
]) {
|
||||
const meta = new PFileMetadata(`/publication/${prefix}::专栏/1::文章.md`);
|
||||
assertEquals(meta.colume, "专栏");
|
||||
assertEquals(meta.c_index, expected);
|
||||
}
|
||||
});
|
||||
|
||||
Deno.test("sorts negative, fractional, and large numeric order values", () => {
|
||||
const columns = [
|
||||
column("大数", Number.MAX_VALUE),
|
||||
column("小数", 0.25),
|
||||
column("负数", -10),
|
||||
column("非数字", Number.NaN),
|
||||
column("负小数", -0.5),
|
||||
];
|
||||
columns.sort(comparePColumes);
|
||||
assertEquals(columns.map((item) => item.name), [
|
||||
"负数",
|
||||
"负小数",
|
||||
"小数",
|
||||
"大数",
|
||||
"非数字",
|
||||
]);
|
||||
});
|
||||
|
||||
Deno.test("does not treat non-finite numeric strings as explicit order", () => {
|
||||
const nanMeta = new PFileMetadata("/publication/NaN::专栏/1::文章.md");
|
||||
assertEquals(nanMeta.colume, "NaN::专栏");
|
||||
assertEquals(Number.isNaN(nanMeta.c_index), true);
|
||||
|
||||
const columns = [
|
||||
column("正无穷", Number.POSITIVE_INFINITY),
|
||||
column("负无穷", Number.NEGATIVE_INFINITY),
|
||||
column("有限数", 1),
|
||||
column("NaN", Number.NaN),
|
||||
];
|
||||
columns.sort(comparePColumes);
|
||||
assertEquals(columns.map((item) => item.name), [
|
||||
"负无穷",
|
||||
"有限数",
|
||||
"正无穷",
|
||||
"NaN",
|
||||
]);
|
||||
});
|
||||
Generated
+61
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1776169885,
|
||||
"narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
description = "GP markdown to PDF toolchain (Deno + Playwright + Chromium)";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
}:
|
||||
flake-utils.lib.eachSystem
|
||||
[
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
]
|
||||
(
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
lib = pkgs.lib;
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = [
|
||||
pkgs.deno
|
||||
pkgs.nodejs_22
|
||||
pkgs.qpdf
|
||||
pkgs.ripgrep
|
||||
]
|
||||
++ lib.optionals pkgs.stdenv.isLinux [
|
||||
pkgs.chromium
|
||||
pkgs.noto-fonts-cjk-sans
|
||||
];
|
||||
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1";
|
||||
|
||||
shellHook = ''
|
||||
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
||||
|
||||
if [ -z "$CHROMIUM_PATH" ]; then
|
||||
if command -v chromium >/dev/null 2>&1; then
|
||||
export CHROMIUM_PATH="$(command -v chromium)"
|
||||
elif command -v chromium-browser >/dev/null 2>&1; then
|
||||
export CHROMIUM_PATH="$(command -v chromium-browser)"
|
||||
elif [ -x "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
|
||||
export CHROMIUM_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=$PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD"
|
||||
if [ -n "$CHROMIUM_PATH" ]; then
|
||||
echo "CHROMIUM_PATH=$CHROMIUM_PATH"
|
||||
else
|
||||
echo "CHROMIUM_PATH is not set."
|
||||
echo "Linux: add nixpkgs#chromium or install chromium system-wide."
|
||||
echo "macOS: install Google Chrome/Chromium and set CHROMIUM_PATH."
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
import { dirname, extname, join, resolve } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { parse as parseToml, stringify as stringifyToml } from "@std/toml";
|
||||
|
||||
export type CacheMap = Record<string, string>;
|
||||
|
||||
const RESOURCE_REFERENCE_RE =
|
||||
/(?<prefix><link\b[^>]*?\bhref\s*=\s*["']|\bsrc\s*=\s*["']|\bhref\s*=\s*["']|url\(\s*["']?|@import\s+["']|!\[[^\]]*\]\(\s*["']?|\bcontent\s*=\s*["'][^"']*\burl\s*=\s*["']?)(?<url>https?:\/\/[^\s"'<>()[\]{}]+)(?<suffix>["']?\s*\)?)/gi;
|
||||
const ASSET_EXTENSIONS = new Set([
|
||||
".avif",
|
||||
".css",
|
||||
".gif",
|
||||
".htm",
|
||||
".html",
|
||||
".jpeg",
|
||||
".jpg",
|
||||
".js",
|
||||
".mjs",
|
||||
".otf",
|
||||
".png",
|
||||
".svg",
|
||||
".ttf",
|
||||
".webp",
|
||||
".woff",
|
||||
".woff2",
|
||||
]);
|
||||
|
||||
function isLocalUrl(url: string): boolean {
|
||||
return /^(?:data:|blob:|file:|\.\.?\/|\/|#)/i.test(url);
|
||||
}
|
||||
|
||||
function isHttpUrl(url: string): boolean {
|
||||
return /^https?:\/\//i.test(url);
|
||||
}
|
||||
|
||||
function isAssetUrl(
|
||||
url: string,
|
||||
prefix: string,
|
||||
sourceExtension: string,
|
||||
): boolean {
|
||||
if (isLocalUrl(url)) return false;
|
||||
let parsed: URL;
|
||||
try {
|
||||
parsed = new URL(url);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
if (!/^https?:$/.test(parsed.protocol)) return false;
|
||||
const extension = extname(parsed.pathname).toLowerCase();
|
||||
if (ASSET_EXTENSIONS.has(extension)) return true;
|
||||
if (/\.(?:css|html?)$/i.test(sourceExtension)) {
|
||||
return /^(?:src|url\(|@import|!\[)/i.test(prefix.trim());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isResourceReference(prefix: string, url: string): boolean {
|
||||
const extension = extname(new URL(url).pathname).toLowerCase();
|
||||
if (prefix.toLowerCase().startsWith("<link")) {
|
||||
return ASSET_EXTENSIONS.has(extension);
|
||||
}
|
||||
if (prefix.toLowerCase().startsWith("href")) return extension === ".css";
|
||||
if (prefix.toLowerCase().startsWith("content")) {
|
||||
return /\.(?:png|jpe?g|gif|webp|avif|svg)$/i.test(extension);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function sourceFiles(dir: string): string[] {
|
||||
const result: string[] = [];
|
||||
if (!existsSync(dir)) return result;
|
||||
for (const entry of Deno.readDirSync(dir)) {
|
||||
const path = join(dir, entry.name);
|
||||
if (entry.isDirectory) {
|
||||
if (entry.name !== ".local-cache") result.push(...sourceFiles(path));
|
||||
} else if (entry.isFile && /\.(?:css|html?|js|mjs|md)$/i.test(entry.name)) {
|
||||
result.push(path);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function existsSync(path: string): boolean {
|
||||
try {
|
||||
return Deno.statSync(path).isDirectory;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function cacheFileName(url: string): Promise<string> {
|
||||
const parsed = new URL(url);
|
||||
const name = parsed.pathname.split("/").filter(Boolean).pop() || "asset";
|
||||
const digest = await crypto.subtle.digest(
|
||||
"SHA-256",
|
||||
new TextEncoder().encode(url),
|
||||
);
|
||||
const hash = Array.from(new Uint8Array(digest)).slice(0, 12).map((byte) =>
|
||||
byte.toString(16).padStart(2, "0")
|
||||
).join("");
|
||||
return `${hash}-${name.replace(/[^\p{L}\p{N}._-]/gu, "_")}`;
|
||||
}
|
||||
|
||||
async function readCache(path: string): Promise<CacheMap> {
|
||||
try {
|
||||
return parseToml(await Deno.readTextFile(path)) as CacheMap;
|
||||
} catch (error) {
|
||||
if (error instanceof Deno.errors.NotFound) return {};
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function prepareLocalCache(
|
||||
publicationDir: string,
|
||||
templateDir?: string,
|
||||
): Promise<number> {
|
||||
const pubDir = resolve(publicationDir);
|
||||
if (!existsSync(pubDir)) {
|
||||
throw new Error(`Publication directory does not exist: ${pubDir}`);
|
||||
}
|
||||
const cacheToml = join(pubDir, ".cache.toml");
|
||||
const cacheDir = join(pubDir, ".local-cache");
|
||||
const map = await readCache(cacheToml);
|
||||
const initialCachedCount = Object.keys(map).length;
|
||||
const files = new Set(sourceFiles(pubDir));
|
||||
if (templateDir) {
|
||||
for (const file of sourceFiles(resolve(templateDir))) files.add(file);
|
||||
}
|
||||
|
||||
const urls = new Set<string>(Object.keys(map));
|
||||
for (const file of files) {
|
||||
const content = await Deno.readTextFile(file);
|
||||
for (const match of content.matchAll(RESOURCE_REFERENCE_RE)) {
|
||||
const url = match.groups?.url;
|
||||
const prefix = match.groups?.prefix ?? "";
|
||||
if (
|
||||
url && isAssetUrl(url, prefix, extname(file).toLowerCase()) &&
|
||||
isResourceReference(prefix, url)
|
||||
) {
|
||||
urls.add(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await Deno.mkdir(cacheDir, { recursive: true });
|
||||
const pending = [...urls];
|
||||
const processed = new Set<string>();
|
||||
while (pending.length > 0) {
|
||||
const url = pending.shift()!;
|
||||
if (processed.has(url)) continue;
|
||||
processed.add(url);
|
||||
const fileName = map[url]?.replace(/^\.local-cache\//, "") ??
|
||||
await cacheFileName(url);
|
||||
const target = join(cacheDir, fileName);
|
||||
if (!(await exists(target))) {
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to cache ${url}: HTTP ${response.status}`);
|
||||
}
|
||||
const bytes = new Uint8Array(await response.arrayBuffer());
|
||||
await Deno.writeFile(target, bytes);
|
||||
}
|
||||
map[url] = `.local-cache/${fileName}`;
|
||||
}
|
||||
|
||||
await Deno.writeTextFile(cacheToml, stringifyToml(map));
|
||||
for (const file of files) await rewriteFile(file, pubDir, map);
|
||||
const inspected = new Set<string>();
|
||||
for (const url of [...urls]) {
|
||||
if (/\.(?:css|html?)$/i.test(new URL(url).pathname)) {
|
||||
const localFile = resolve(pubDir, map[url]);
|
||||
if (await exists(localFile)) {
|
||||
await scanDownloadedReferences(url, pubDir, map, inspected);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Object.keys(map).length - initialCachedCount;
|
||||
}
|
||||
|
||||
async function scanDownloadedReferences(
|
||||
sourceUrl: string,
|
||||
pubDir: string,
|
||||
map: CacheMap,
|
||||
processed: Set<string>,
|
||||
): Promise<void> {
|
||||
const file = resolve(pubDir, map[sourceUrl]);
|
||||
if (processed.has(sourceUrl)) return;
|
||||
processed.add(sourceUrl);
|
||||
const content = await Deno.readTextFile(file);
|
||||
const sourceExtension = extname(new URL(sourceUrl).pathname).toLowerCase();
|
||||
for (const match of content.matchAll(RESOURCE_REFERENCE_RE)) {
|
||||
const prefix = match.groups?.prefix ?? "";
|
||||
const reference = match.groups?.url;
|
||||
if (
|
||||
!reference ||
|
||||
!isAssetUrl(reference, prefix, sourceExtension) ||
|
||||
!isResourceReference(prefix, reference)
|
||||
) continue;
|
||||
let dependency: string;
|
||||
try {
|
||||
dependency = new URL(reference, sourceUrl).href;
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
if (!isHttpUrl(dependency) || !isResourceReference(prefix, dependency)) {
|
||||
continue;
|
||||
}
|
||||
if (!map[dependency] || !(await exists(resolve(pubDir, map[dependency])))) {
|
||||
const response = await fetch(dependency);
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
`Failed to cache ${dependency}: HTTP ${response.status}`,
|
||||
);
|
||||
}
|
||||
const bytes = new Uint8Array(await response.arrayBuffer());
|
||||
const fileName = await cacheFileName(dependency);
|
||||
await Deno.writeFile(join(pubDir, ".local-cache", fileName), bytes);
|
||||
map[dependency] = `.local-cache/${fileName}`;
|
||||
}
|
||||
processed.add(dependency);
|
||||
if (/\.(?:css|html?)$/i.test(new URL(dependency).pathname)) {
|
||||
await scanDownloadedReferences(dependency, pubDir, map, processed);
|
||||
}
|
||||
}
|
||||
await rewriteFile(file, pubDir, map, sourceUrl);
|
||||
await Deno.writeTextFile(join(pubDir, ".cache.toml"), stringifyToml(map));
|
||||
}
|
||||
|
||||
async function rewriteFile(
|
||||
file: string,
|
||||
pubDir: string,
|
||||
map: CacheMap,
|
||||
sourceUrl?: string,
|
||||
): Promise<void> {
|
||||
const original = await Deno.readTextFile(file);
|
||||
const rewritten = original.replace(
|
||||
RESOURCE_REFERENCE_RE,
|
||||
(whole, prefix: string, url: string) => {
|
||||
let resolvedUrl = url;
|
||||
try {
|
||||
if (sourceUrl) resolvedUrl = new URL(url, sourceUrl).href;
|
||||
} catch {
|
||||
return whole;
|
||||
}
|
||||
const localPath = map[resolvedUrl] ?? map[url];
|
||||
if (
|
||||
!localPath || !isHttpUrl(resolvedUrl) ||
|
||||
!isResourceReference(prefix, resolvedUrl)
|
||||
) return whole;
|
||||
return whole.replace(
|
||||
url,
|
||||
pathToFileURL(resolve(pubDir, localPath)).href,
|
||||
);
|
||||
},
|
||||
);
|
||||
if (rewritten !== original) await Deno.writeTextFile(file, rewritten);
|
||||
}
|
||||
|
||||
async function exists(path: string): Promise<boolean> {
|
||||
try {
|
||||
await Deno.stat(path);
|
||||
return true;
|
||||
} catch (error) {
|
||||
if (error instanceof Deno.errors.NotFound) return false;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
import { assert, assertEquals, assertStringIncludes } from "@std/assert";
|
||||
import { prepareLocalCache } from "./local_cache.ts";
|
||||
|
||||
Deno.test("local cache downloads resource references and preserves reader links", async () => {
|
||||
const root = await Deno.makeTempDir();
|
||||
const publication = `${root}/publication`;
|
||||
const templates = `${root}/templates`;
|
||||
await Deno.mkdir(publication, { recursive: true });
|
||||
await Deno.mkdir(templates, { recursive: true });
|
||||
const assetUrl = "https://cdn.example.test/asset.png";
|
||||
const cssUrl = "https://cdn.example.test/theme.css";
|
||||
const fontUrl = "https://cdn.example.test/font.woff2";
|
||||
const htmlUrl = "https://cdn.example.test/widget.html";
|
||||
const nestedImageUrl = "https://cdn.example.test/widget.png";
|
||||
await Deno.writeTextFile(
|
||||
`${publication}/article.md`,
|
||||
`\n\n[reader link](${assetUrl})`,
|
||||
);
|
||||
await Deno.writeTextFile(
|
||||
`${templates}/cover.html`,
|
||||
`<img src="${assetUrl}"><iframe src="${htmlUrl}"></iframe><link href="${cssUrl}"><a href="https://example.com/page.png">reader</a>`,
|
||||
);
|
||||
|
||||
const originalFetch = globalThis.fetch;
|
||||
const fetched: string[] = [];
|
||||
globalThis.fetch = async (input) => {
|
||||
const url = String(input);
|
||||
fetched.push(url);
|
||||
assert(
|
||||
url === assetUrl || url === cssUrl || url === fontUrl ||
|
||||
url === htmlUrl || url === nestedImageUrl,
|
||||
);
|
||||
if (url === cssUrl) {
|
||||
return new Response(`@font-face { src: url("${fontUrl}"); }`, {
|
||||
headers: { "content-type": "text/css" },
|
||||
});
|
||||
}
|
||||
if (url === htmlUrl) {
|
||||
return new Response(
|
||||
`<img src="https://cdn.example.test/widget.png"><a href="https://reader.example.test/story.png">story</a>`,
|
||||
{ headers: { "content-type": "text/html" } },
|
||||
);
|
||||
}
|
||||
if (url === fontUrl) {
|
||||
return new Response(new Uint8Array([1, 2, 3]), {
|
||||
headers: { "content-type": "font/woff2" },
|
||||
});
|
||||
}
|
||||
return new Response(new Uint8Array([1, 2, 3]), {
|
||||
headers: { "content-type": "image/png" },
|
||||
});
|
||||
};
|
||||
try {
|
||||
assertEquals(await prepareLocalCache(publication, templates), 5);
|
||||
const rewrittenMd = await Deno.readTextFile(`${publication}/article.md`);
|
||||
const rewrittenHtml = await Deno.readTextFile(`${templates}/cover.html`);
|
||||
assertStringIncludes(rewrittenMd, "file://");
|
||||
assertStringIncludes(rewrittenMd, `[reader link](${assetUrl})`);
|
||||
assertStringIncludes(rewrittenHtml, "file://");
|
||||
assertStringIncludes(rewrittenHtml, 'iframe src="file://');
|
||||
assertStringIncludes(rewrittenHtml, "https://example.com/page.png");
|
||||
assertEquals(
|
||||
fetched.sort(),
|
||||
[assetUrl, cssUrl, fontUrl, htmlUrl, nestedImageUrl].sort(),
|
||||
);
|
||||
|
||||
const cache = await Deno.readTextFile(`${publication}/.cache.toml`);
|
||||
assertStringIncludes(cache, assetUrl);
|
||||
assertEquals(await prepareLocalCache(publication, templates), 0);
|
||||
assertEquals(fetched.length, 5);
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
await Deno.remove(root, { recursive: true });
|
||||
}
|
||||
assert(true);
|
||||
});
|
||||
@@ -0,0 +1,55 @@
|
||||
// deno-lint-ignore no-import-prefix
|
||||
import { parse } from "https://deno.land/[email protected]/flags/mod.ts";
|
||||
import { match_sub_command_to_function } from "./cli/match.ts";
|
||||
|
||||
export const args = parse(Deno.args, {
|
||||
string: ["config", "vars-file", "from"],
|
||||
boolean: [],
|
||||
alias: { v: "vars-file" },
|
||||
});
|
||||
export const cfg = await Deno.readTextFile(args.config ?? "./config.json").then(
|
||||
(text) => JSON.parse(text),
|
||||
);
|
||||
if (args.config) {
|
||||
console.debug(`Using config file: ${args.config}`);
|
||||
} else {
|
||||
console.debug(`Using default config file: ./config.json`);
|
||||
}
|
||||
|
||||
const homeDir = Deno.env.get("HOME") || Deno.env.get("USERPROFILE");
|
||||
for (const config of cfg.settings) {
|
||||
if (typeof args.from === "string" && args.from.length > 0) {
|
||||
const directPath = args.from;
|
||||
const publicationPath = `../../publications/${args.from}`;
|
||||
let directIsDirectory = false;
|
||||
try {
|
||||
directIsDirectory = (await Deno.stat(directPath)).isDirectory;
|
||||
} catch {
|
||||
// Treat non-path input as a publication version.
|
||||
}
|
||||
config.journal.from_directory = directIsDirectory
|
||||
? directPath
|
||||
: publicationPath;
|
||||
}
|
||||
if (config.journal.from_directory.startsWith("~/")) {
|
||||
config.journal.from_directory = config.journal.from_directory.replace(
|
||||
"~",
|
||||
homeDir || "",
|
||||
);
|
||||
}
|
||||
if (config.pdf.signing.enabled) {
|
||||
if (config.pdf.signing.key_path.startsWith("~/")) {
|
||||
config.pdf.signing.key_path = config.pdf.signing.key_path.replace(
|
||||
"~",
|
||||
homeDir || "",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.main) {
|
||||
await match_sub_command_to_function(
|
||||
args._ as Array<string>,
|
||||
args,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import { PFile, PFiles } from "./file.ts";
|
||||
import { DocuBuilder } from "./pdf_builder/docu_builder.ts";
|
||||
import { IndexBuilder } from "./pdf_builder/index_builder.ts";
|
||||
import { PDFParse } from "pdf-parse";
|
||||
|
||||
// Deno.test("PFiles initialization", () => {
|
||||
// const pfiles = new PFiles("./mobile_src");
|
||||
// console.log(pfiles);
|
||||
// });
|
||||
|
||||
// Deno.test("PDF generate", async () => {
|
||||
// const builder = new DocuBuilder();
|
||||
// try {
|
||||
// await builder.with_browser();
|
||||
|
||||
// const cfg = JSON.parse(await Deno.readTextFile("config.json"));
|
||||
// for (const config of cfg.settings) {
|
||||
// console.debug(`Processing config: ${JSON.stringify(config)}`);
|
||||
// builder.with_files_sync(config.journal.from_directory);
|
||||
// builder.as_html_page();
|
||||
// await builder.build_as_pdf(config.playwright);
|
||||
// }
|
||||
// } finally {
|
||||
// await builder.close_browser();
|
||||
// }
|
||||
// });
|
||||
|
||||
// Deno.test({
|
||||
// name: "IndexBuilder test",
|
||||
// sanitizeOps: false,
|
||||
// sanitizeResources: false,
|
||||
// async fn() {
|
||||
// },
|
||||
// });
|
||||
import { ripgrep } from "ripgrep";
|
||||
Deno.test("ripgrep test", async () => {
|
||||
let pattern = "NULL ";
|
||||
const cmd = new Deno.Command("rg", {
|
||||
args: ["-q", "-F", pattern],
|
||||
|
||||
stdin: "piped",
|
||||
stdout: "piped",
|
||||
stderr: "piped",
|
||||
});
|
||||
const child = cmd.spawn();
|
||||
const writer = child.stdin.getWriter();
|
||||
await writer.write(
|
||||
new TextEncoder().encode("This is a test string with NULL in it."),
|
||||
);
|
||||
writer.releaseLock();
|
||||
const { code, stdout, stderr } = await child.output();
|
||||
console.log(`Exit code: ${code}`);
|
||||
console.log(`stdout: ${new TextDecoder().decode(stdout)}`);
|
||||
console.log(`stderr: ${new TextDecoder().decode(stderr)}`);
|
||||
});
|
||||
@@ -0,0 +1,85 @@
|
||||
import MarkdownIt from "markdown-it";
|
||||
|
||||
import { alert } from "npm:@mdit/plugin-alert";
|
||||
import { attrs } from "npm:@mdit/plugin-attrs";
|
||||
import { abbr } from "npm:@mdit/plugin-abbr";
|
||||
import { align } from "npm:@mdit/plugin-align";
|
||||
import { container } from "npm:@mdit/plugin-container";
|
||||
import { demo } from "npm:@mdit/plugin-demo";
|
||||
import { dl } from "npm:@mdit/plugin-dl";
|
||||
import { embed } from "npm:@mdit/plugin-embed";
|
||||
import { fullEmoji } from "npm:@mdit/plugin-emoji";
|
||||
import { field } from "npm:@mdit/plugin-field";
|
||||
import { figure } from "npm:@mdit/plugin-figure";
|
||||
import { footnote } from "npm:@mdit/plugin-footnote";
|
||||
import { icon } from "npm:@mdit/plugin-icon";
|
||||
import { imgLazyload } from "npm:@mdit/plugin-img-lazyload";
|
||||
import { imgMark } from "npm:@mdit/plugin-img-mark";
|
||||
import { imgSize } from "npm:@mdit/plugin-img-size";
|
||||
import { include } from "npm:@mdit/plugin-include";
|
||||
import { ins } from "npm:@mdit/plugin-ins";
|
||||
import { katex } from "npm:@mdit/plugin-katex";
|
||||
import { layout } from "npm:@mdit/plugin-layout";
|
||||
import { mark } from "npm:@mdit/plugin-mark";
|
||||
import { plantuml } from "npm:@mdit/plugin-plantuml";
|
||||
import { ruby } from "npm:@mdit/plugin-ruby";
|
||||
import { snippet } from "npm:@mdit/plugin-snippet";
|
||||
import { spoiler } from "npm:@mdit/plugin-spoiler";
|
||||
import { stylize } from "npm:@mdit/plugin-stylize";
|
||||
import { sub } from "npm:@mdit/plugin-sub";
|
||||
import { sup } from "npm:@mdit/plugin-sup";
|
||||
import { tab } from "npm:@mdit/plugin-tab";
|
||||
import { tasklist } from "npm:@mdit/plugin-tasklist";
|
||||
import { tex } from "npm:@mdit/plugin-tex";
|
||||
import { uml } from "npm:@mdit/plugin-uml";
|
||||
|
||||
export const md = MarkdownIt({
|
||||
html: true,
|
||||
linkify: true,
|
||||
typographer: true,
|
||||
})
|
||||
.use(alert)
|
||||
.use(attrs)
|
||||
.use(abbr)
|
||||
.use(align)
|
||||
.use(container, { name: "warning", validate: () => true })
|
||||
.use(demo)
|
||||
.use(dl)
|
||||
.use(embed, {
|
||||
config: [
|
||||
{
|
||||
name: "youtube",
|
||||
setup: (id: string) =>
|
||||
`<iframe width="560" height="315" src="https://www.youtube.com/embed/${id}" frameborder="0" allowfullscreen></iframe>`,
|
||||
},
|
||||
{
|
||||
name: "icon",
|
||||
allowInline: true,
|
||||
setup: (name: string) => `<i class="icon icon-${name}"></i>`,
|
||||
},
|
||||
],
|
||||
})
|
||||
.use(fullEmoji)
|
||||
.use(field)
|
||||
.use(figure)
|
||||
.use(footnote)
|
||||
.use(icon)
|
||||
.use(imgLazyload)
|
||||
.use(imgMark)
|
||||
.use(imgSize)
|
||||
//.use(include)
|
||||
.use(ins)
|
||||
.use(katex)
|
||||
.use(layout)
|
||||
.use(mark)
|
||||
.use(plantuml)
|
||||
.use(ruby)
|
||||
//.use(snippet)
|
||||
.use(spoiler)
|
||||
.use(stylize)
|
||||
.use(sub)
|
||||
.use(sup)
|
||||
.use(tab)
|
||||
.use(tasklist)
|
||||
//.use(tex)
|
||||
.use(uml);
|
||||
@@ -0,0 +1,26 @@
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { DocuBuilder } from "./docu_builder.ts";
|
||||
|
||||
Deno.test("PDF rendering loads relative assets from configured file base", async () => {
|
||||
const chromiumPath = Deno.env.get("CHROMIUM_PATH");
|
||||
if (!chromiumPath) {
|
||||
console.warn("Skipping Chromium asset test: CHROMIUM_PATH is unset");
|
||||
return;
|
||||
}
|
||||
|
||||
const builder = new DocuBuilder({
|
||||
asset_base: "../../assets",
|
||||
journal: { build_js_script: false },
|
||||
});
|
||||
const pdfPath = await Deno.makeTempFile({ suffix: ".pdf" });
|
||||
await builder.with_browser();
|
||||
try {
|
||||
await builder.build_as_pdf({ path: pdfPath, format: "A4" }, [
|
||||
'<img src="pictures/rsf.png" alt="Asset">',
|
||||
]);
|
||||
} finally {
|
||||
await builder.close_browser();
|
||||
}
|
||||
assertEquals((await Deno.stat(pdfPath)).size > 0, true);
|
||||
await Deno.remove(pdfPath);
|
||||
});
|
||||
@@ -0,0 +1,245 @@
|
||||
import { Browser } from "playwright";
|
||||
import { PFiles } from "../file.ts";
|
||||
import { md } from "../mdit/md.ts";
|
||||
import TurndownService from "turndown";
|
||||
|
||||
import "openpgp";
|
||||
|
||||
import { resolveChromiumPath } from "./utils.ts";
|
||||
import { renderTemplate, type TemplateVariables } from "../template_engine.ts";
|
||||
|
||||
//原文->中间体(html)->目标格式(pdf/md/...)
|
||||
//生成pdf的流程:原文->中间体(html)->playwright渲染->pdf
|
||||
//生成md的流程:原文->中间体(html)->turndown转换->md
|
||||
export class DocuBuilder {
|
||||
pages: Array<string>;
|
||||
// deno-lint-ignore no-explicit-any
|
||||
cfg: any;
|
||||
browser: Browser | null;
|
||||
pfiles: PFiles | null = null;
|
||||
// deno-lint-ignore no-explicit-any
|
||||
variables: TemplateVariables;
|
||||
constructor(cfg: any, variables: TemplateVariables = {}) {
|
||||
this.cfg = cfg;
|
||||
this.variables = variables;
|
||||
this.pages = [];
|
||||
this.browser = null;
|
||||
}
|
||||
async with_browser() {
|
||||
const { chromium } = await import("playwright");
|
||||
const browser = await chromium.launch({
|
||||
executablePath: resolveChromiumPath(),
|
||||
headless: true,
|
||||
args: ["--no-sandbox", "--disable-dev-shm-usage"],
|
||||
});
|
||||
this.browser = browser;
|
||||
}
|
||||
|
||||
with_files_sync(dir: string) {
|
||||
this.pfiles = new PFiles(
|
||||
this.cfg.journal.build_mode ?? "flat",
|
||||
dir,
|
||||
this.cfg,
|
||||
);
|
||||
}
|
||||
|
||||
private strip_markdown_symbols(markdown: string): string {
|
||||
return markdown
|
||||
.replace(/^\s{0,3}#{1,6}\s*/gm, "")
|
||||
.replace(/^(.+)\n={3,}\s*$/gm, "$1")
|
||||
.replace(/^(.+)\n-{3,}\s*$/gm, "$1")
|
||||
.replace(/^\s{0,3}>\s?/gm, "")
|
||||
.replace(/^\s{0,3}(?:[-*+]|\d+\.)\s+/gm, "")
|
||||
.replace(/^\s{0,3}(?:---|\*\*\*|___)\s*$/gm, "")
|
||||
.replace(/!\[([^\]]*)\]\((.*?)\)/g, "$1")
|
||||
.replace(/\[([^\]]+)\]\((.*?)\)/g, "$1")
|
||||
.replace(/\[([^\]]+)\]\[[^\]]*\]/g, "$1")
|
||||
.replace(/!\[([^\]]*)\]\[[^\]]*\]/g, "$1")
|
||||
.replace(/(`{1,3})([^`]+?)\1/g, "$2")
|
||||
.replace(/(\*\*|__)(.*?)\1/g, "$2")
|
||||
.replace(/(\*|_)(.*?)\1/g, "$2")
|
||||
.replace(/\\([\\`*_{}\[\]()#+\-.!>])/g, "$1")
|
||||
.replace(/<[^>]+>/g, "")
|
||||
.replace(/\n{3,}/g, "\n\n")
|
||||
.trim();
|
||||
}
|
||||
|
||||
async as_markdown() {
|
||||
const turndownService = new TurndownService();
|
||||
const html_page = await this.as_html_page();
|
||||
const cleaned_html = html_page.replace(
|
||||
/<[^>]*class="[^"]*\bc_title\b[^"]*"[^>]*>([\s\S]*?)<\/[^>]+>/gi,
|
||||
"# $1",
|
||||
).replace(
|
||||
/<script\b[^>]*>[\s\S]*?<\/script>|<style\b[^>]*>[\s\S]*?<\/style>/gi,
|
||||
"",
|
||||
);
|
||||
const md_page = turndownService.turndown(cleaned_html);
|
||||
this.pages = [md_page];
|
||||
}
|
||||
|
||||
async as_txt(remove_links = true) {
|
||||
const turndownService = new TurndownService();
|
||||
const html_page = await this.as_html_page();
|
||||
const cleaned_html = html_page.replace(
|
||||
/<[^>]*class="[^"]*\bc_title\b[^"]*"[^>]*>([\s\S]*?)<\/[^>]+>/gi,
|
||||
"# $1",
|
||||
).replace(
|
||||
/<script\b[^>]*>[\s\S]*?<\/script>|<style\b[^>]*>[\s\S]*?<\/style>/gi,
|
||||
"",
|
||||
).replaceAll("#", ""); // Remove markdown symbols for plain text
|
||||
const md_page = turndownService.turndown(cleaned_html);
|
||||
this.pages = [this.strip_markdown_symbols(md_page)];
|
||||
}
|
||||
|
||||
async as_html_page(): Promise<string> {
|
||||
this.pages = [];
|
||||
|
||||
this.pages.push(this.render(this.pfiles?.cover_html ?? ""));
|
||||
this.pages.push(this.render(this.pfiles?.style_html ?? ""));
|
||||
this.pages.push(this.render(this.pfiles?.other_htmls.join("\n") ?? ""));
|
||||
|
||||
if (this.pfiles != null) {
|
||||
let id = 1;
|
||||
this.pfiles.pcolumes.forEach((colume) => {
|
||||
let c_id = 1;
|
||||
this.pages.push(
|
||||
`<ch1 class="global c_title">${colume.name}</ch1>`,
|
||||
);
|
||||
colume.pfiles.forEach((pfile) => {
|
||||
const html = md.render(this.render(pfile.content, {
|
||||
document: {
|
||||
title: pfile.meta.title,
|
||||
index: pfile.meta.index,
|
||||
file: pfile.full_name,
|
||||
},
|
||||
column: {
|
||||
name: colume.name,
|
||||
index: colume.index,
|
||||
},
|
||||
}));
|
||||
this.pages.push(
|
||||
`<div style='page-break-after: always;' class="global c${c_id++} passages" id="page-${id++}">${html}</div>`,
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
this.pages.push(this.render(this.pfiles?.end_html ?? ""));
|
||||
if (this.cfg.journal.build_js_script != false) {
|
||||
const f = Deno.readTextFileSync(`${this.cfg.journal.build_js_script}`);
|
||||
const html = this.pages.join("\n");
|
||||
|
||||
// Ensure a DOMParser is available; if not, try to load deno_dom dynamically.
|
||||
let domParserCtor: {
|
||||
new (): {
|
||||
parseFromString: (
|
||||
html: string,
|
||||
mimeType: string,
|
||||
) => { documentElement?: { outerHTML: string } } | null;
|
||||
};
|
||||
} | undefined = (globalThis as { DOMParser?: unknown }).DOMParser as
|
||||
| {
|
||||
new (): {
|
||||
parseFromString: (
|
||||
html: string,
|
||||
mimeType: string,
|
||||
) => { documentElement?: { outerHTML: string } } | null;
|
||||
};
|
||||
}
|
||||
| undefined;
|
||||
|
||||
if (domParserCtor == null) {
|
||||
try {
|
||||
const denoDom = await import(
|
||||
// deno-lint-ignore no-import-prefix
|
||||
"https://deno.land/x/deno_dom/deno-dom-wasm.ts"
|
||||
);
|
||||
if (denoDom && denoDom.DOMParser) {
|
||||
// deno-lint-ignore no-explicit-any
|
||||
(globalThis as any).DOMParser = denoDom.DOMParser;
|
||||
// Cast via unknown to satisfy TypeScript when converting between incompatible constructor types
|
||||
domParserCtor = denoDom
|
||||
.DOMParser as unknown as typeof domParserCtor;
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore; will throw below with helpful message
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (domParserCtor == null) {
|
||||
throw new Error(
|
||||
"DOMParser is not available in this runtime. Install deno_dom or run in a runtime that provides DOMParser.\n" +
|
||||
"Suggested: import 'https://deno.land/x/deno_dom/deno-dom-wasm.ts' or run with a JS DOM-enabled environment.",
|
||||
);
|
||||
}
|
||||
|
||||
const document = new domParserCtor().parseFromString(html, "text/html");
|
||||
const runBuildScript = new Function(
|
||||
"html",
|
||||
"document",
|
||||
"pages",
|
||||
"cfg",
|
||||
`${f}
|
||||
return document?.documentElement?.outerHTML ?? html;`,
|
||||
) as (
|
||||
html: string,
|
||||
document: { documentElement?: { outerHTML: string } } | null,
|
||||
pages: Array<string>,
|
||||
cfg: unknown,
|
||||
) => string;
|
||||
const builtHtml = runBuildScript(
|
||||
html,
|
||||
document,
|
||||
[...this.pages],
|
||||
this.cfg,
|
||||
);
|
||||
this.pages = [builtHtml];
|
||||
}
|
||||
//console.debug(structuredClone(this.pages).join("\n"));
|
||||
return this.pages.join("\n");
|
||||
}
|
||||
private render(source: string, extra: TemplateVariables = {}) {
|
||||
return renderTemplate(source, { ...this.variables, ...extra });
|
||||
}
|
||||
async build_as_raw(file_name: string) {
|
||||
await Deno.writeFile(
|
||||
file_name,
|
||||
new TextEncoder().encode(this.pages.join("\n")),
|
||||
);
|
||||
}
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
async build_as_pdf(pw_config: any, pages = this.pages) {
|
||||
if (this.browser == null) {
|
||||
throw new Error("Browser is not initialized. Call with_browser() first.");
|
||||
}
|
||||
if (this.pfiles != null && pages.length === 0) {
|
||||
await this.as_html_page();
|
||||
}
|
||||
const page = await this.browser.newPage();
|
||||
try {
|
||||
// const setContentTimeout = pw_config?.setContent_timeout_ms ?? 120000;
|
||||
// const setContentWaitUntil = pw_config?.setContent_wait_until ??
|
||||
// "domcontentloaded";
|
||||
await page.setContent(pages.join("\n"), {
|
||||
timeout: 120000,
|
||||
// waitUntil: setContentWaitUntil,
|
||||
});
|
||||
|
||||
await page.pdf(
|
||||
pw_config,
|
||||
);
|
||||
} finally {
|
||||
await page.close();
|
||||
}
|
||||
}
|
||||
|
||||
async close_browser() {
|
||||
if (this.browser == null) {
|
||||
return;
|
||||
}
|
||||
await this.browser.close();
|
||||
this.browser = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,565 @@
|
||||
import { PFiles } from "../file.ts";
|
||||
import { PDFParse } from "pdf-parse";
|
||||
import {
|
||||
PDFArray,
|
||||
PDFDocument,
|
||||
PDFHexString,
|
||||
PDFName,
|
||||
PDFNumber,
|
||||
} from "pdf-lib";
|
||||
import "openpgp";
|
||||
import { resolveChromiumPath } from "./utils.ts";
|
||||
import { DocuBuilder } from "./docu_builder.ts";
|
||||
|
||||
type IndexItemLayout = {
|
||||
pageIndex: number;
|
||||
left: number;
|
||||
top: number;
|
||||
width: number;
|
||||
height: number;
|
||||
fontSize: number;
|
||||
};
|
||||
|
||||
const PDF_PAGE_HEIGHT_PT = 842;
|
||||
const PDF_VIEWPORT_WIDTH_PX = 794;
|
||||
const CSS_PX_TO_PT = 72 / 96;
|
||||
|
||||
export function normalizePdfText(text: string): string {
|
||||
return text.replace(/[\s\u00a0]+/g, "");
|
||||
}
|
||||
|
||||
export function findTitlePage(
|
||||
title: string,
|
||||
pageTexts: string[],
|
||||
): number | undefined {
|
||||
const normalizedTitle = normalizePdfText(title);
|
||||
if (!normalizedTitle) return undefined;
|
||||
const pageIndex = pageTexts.findIndex((text) =>
|
||||
normalizePdfText(text).includes(normalizedTitle)
|
||||
);
|
||||
return pageIndex < 0 ? undefined : pageIndex + 1;
|
||||
}
|
||||
|
||||
export class IndexBuilder {
|
||||
indexed_map = new Map<
|
||||
string,
|
||||
{
|
||||
page: number;
|
||||
passage_index: number;
|
||||
column_name: string;
|
||||
}
|
||||
>();
|
||||
total_pages: number = 0;
|
||||
template_dir: string = "";
|
||||
passage_dir: string = "";
|
||||
file_path: string = "";
|
||||
cfg: any;
|
||||
constructor(file_path: string, cfg: any) {
|
||||
if (cfg.journal.build_mode == "flat") {
|
||||
this.template_dir = cfg.journal.from_directory;
|
||||
this.passage_dir = cfg.journal.from_directory;
|
||||
} else {
|
||||
this.template_dir = cfg.journal.template_directory;
|
||||
this.passage_dir = cfg.journal.from_directory;
|
||||
}
|
||||
this.file_path = file_path;
|
||||
this.cfg = cfg;
|
||||
}
|
||||
|
||||
get_index_titles_from_file_name(mode: "detached" | "flat"): {
|
||||
titles: Array<string>;
|
||||
passages_index: Map<string, number>;
|
||||
passages_column_name: Map<string, string>;
|
||||
} {
|
||||
const pfiles = new PFiles(mode, this.passage_dir, this.cfg);
|
||||
const titles: Array<string> = [];
|
||||
const passages_index: Map<string, number> = new Map();
|
||||
const passages_column_name: Map<string, string> = new Map();
|
||||
pfiles.pcolumes.forEach((colume) => {
|
||||
colume.pfiles.forEach((pfile) => {
|
||||
titles.push(pfile.meta.title);
|
||||
passages_index.set(pfile.meta.title, pfile.meta.index);
|
||||
passages_column_name.set(pfile.meta.title, pfile.meta.colume);
|
||||
});
|
||||
});
|
||||
return { titles, passages_index, passages_column_name };
|
||||
}
|
||||
|
||||
async read_pdf() {
|
||||
const parser = new PDFParse({ url: this.file_path });
|
||||
try {
|
||||
const pdfText = await parser.getText();
|
||||
this.total_pages = pdfText.total;
|
||||
return pdfText;
|
||||
} finally {
|
||||
await parser.destroy();
|
||||
}
|
||||
}
|
||||
//修改实现为在每页文本中查找目录标题,支持目录标题跨行的情况。通过维护一个标题游标,逐页扫描PDF文本,尝试匹配当前标题。每页文本被拆分成行,并进行规范化(去除空格和换行)。对于每个标题,尝试将连续的行合并起来进行匹配,如果找到匹配则记录该标题对应的页码和章节索引,并移动到下一个标题。这样可以更准确地处理目录标题在PDF中被拆分成多行的情况。
|
||||
async build_index() {
|
||||
const pdf_obj = await this.read_pdf();
|
||||
const { titles, passages_index, passages_column_name } = this
|
||||
.get_index_titles_from_file_name(
|
||||
this.cfg.journal.build_mode ?? "flat",
|
||||
);
|
||||
// Normalize titles (remove spaces/newlines) and require exact equality.
|
||||
// Matching supports title text split across multiple PDF lines.
|
||||
const normalizedTitles = titles.map((t) => ({
|
||||
orig: t,
|
||||
norm: t.replaceAll("\n", "").replaceAll(" ", ""),
|
||||
}));
|
||||
|
||||
const pageTexts = Array.from(
|
||||
{ length: this.total_pages },
|
||||
(_, index) => pdf_obj.getPageText(index + 1),
|
||||
);
|
||||
|
||||
for (const title of normalizedTitles) {
|
||||
const page = findTitlePage(title.orig, pageTexts);
|
||||
if (page !== undefined && !this.indexed_map.has(title.orig)) {
|
||||
this.indexed_map.set(title.orig, {
|
||||
page,
|
||||
passage_index: passages_index.get(title.orig)?.valueOf() ?? 0,
|
||||
column_name: passages_column_name.get(title.orig) ?? "",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private get_sorted_index_entries() {
|
||||
return [...this.indexed_map.entries()].sort((a, b) => {
|
||||
const pageA = a[1].page;
|
||||
const pageB = b[1].page;
|
||||
if (pageA !== pageB) {
|
||||
return pageA - pageB;
|
||||
}
|
||||
|
||||
const indexA = a[1].passage_index;
|
||||
const indexB = b[1].passage_index;
|
||||
if (indexA !== indexB) {
|
||||
return indexA - indexB;
|
||||
}
|
||||
|
||||
return a[0].localeCompare(b[0], "zh-Hans-CN");
|
||||
});
|
||||
}
|
||||
|
||||
as_html_page(): string {
|
||||
const styles = Deno.readTextFileSync(`${this.template_dir}/style.html`);
|
||||
const fonts = Deno.readTextFileSync(`${this.template_dir}/fonts.html`);
|
||||
const debugIndexLayout = Deno.env.get("INDEX_DEBUG_LAYOUT") === "1";
|
||||
const debugStyles = debugIndexLayout
|
||||
? `<style>
|
||||
index li { outline: 1px solid rgba(255, 0, 0, 0.45); }
|
||||
index li a { outline: 1px solid rgba(0, 128, 255, 0.45); }
|
||||
index li page_title { outline: 1px solid rgba(0, 180, 0, 0.45); background: rgba(0, 180, 0, 0.06); }
|
||||
index li page_column { outline: 1px solid rgba(255, 140, 0, 0.45); background: rgba(255, 140, 0, 0.06); }
|
||||
index li page_num { outline: 1px solid rgba(128, 0, 255, 0.45); background: rgba(128, 0, 255, 0.06); }
|
||||
</style>`
|
||||
: "";
|
||||
const pageStyles = `<style>
|
||||
@page {
|
||||
size: A4;
|
||||
margin: 20mm 0 20mm 0;
|
||||
}
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
index {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
</style>`;
|
||||
const html =
|
||||
`<html><head>${styles}${fonts}${pageStyles}${debugStyles}</head><body><index><h1>目录</h1><ul>${
|
||||
this.get_sorted_index_entries().map((
|
||||
[title, { page, column_name }],
|
||||
) =>
|
||||
`<li class="index-item"><a href="#page-${page}"><page_column>${column_name}</page_column> <page_title>${title}</page_title> <page_num>${page}</page_num></a></li>`
|
||||
).join("\n")
|
||||
}</ul></index></body></html>`;
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
private getPdfMarginTopPt(): number {
|
||||
const topMargin = this.cfg?.playwright?.margin?.top ?? "20mm";
|
||||
const match = /^([0-9.]+)\s*mm$/i.exec(String(topMargin).trim());
|
||||
if (match) {
|
||||
return Number(match[1]) / 25.4 * 72;
|
||||
}
|
||||
return (20 / 25.4) * 72;
|
||||
}
|
||||
|
||||
private getPdfMarginBottomPt(): number {
|
||||
const bottomMargin = this.cfg?.playwright?.margin?.bottom ?? "20mm";
|
||||
const match = /^([0-9.]+)\s*mm$/i.exec(String(bottomMargin).trim());
|
||||
if (match) {
|
||||
return Number(match[1]) / 25.4 * 72;
|
||||
}
|
||||
return (20 / 25.4) * 72;
|
||||
}
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
async html2pdf(cfg: any) {
|
||||
const builder = new DocuBuilder(cfg);
|
||||
try {
|
||||
await builder.with_browser();
|
||||
builder.pages = [await this.as_html_page()];
|
||||
await builder.build_as_pdf(cfg);
|
||||
} finally {
|
||||
await builder.close_browser();
|
||||
}
|
||||
}
|
||||
|
||||
private async get_index_item_layouts(index_html: string): Promise<
|
||||
Array<IndexItemLayout>
|
||||
> {
|
||||
const { chromium } = await import("playwright");
|
||||
const browser = await chromium.launch({
|
||||
executablePath: resolveChromiumPath(),
|
||||
headless: true,
|
||||
args: ["--no-sandbox", "--disable-dev-shm-usage"],
|
||||
});
|
||||
const page = await browser.newPage({
|
||||
viewport: {
|
||||
width: PDF_VIEWPORT_WIDTH_PX,
|
||||
height: 1123,
|
||||
},
|
||||
});
|
||||
try {
|
||||
await page.setContent(index_html, { timeout: 120000 });
|
||||
await page.emulateMedia({ media: "print" });
|
||||
return await page.evaluate(
|
||||
({ printableHeightPx }: { printableHeightPx: number }) => {
|
||||
// Browser-side DOM types are not available in Deno's type checker.
|
||||
const doc = (globalThis as any).document as any;
|
||||
const browserGlobal = globalThis as any;
|
||||
const items = Array.from(
|
||||
doc.querySelectorAll("li.index-item"),
|
||||
) as any[];
|
||||
return items.map((item) => {
|
||||
const titleEl = item.querySelector("page_title") as any;
|
||||
const itemRect = item.getBoundingClientRect();
|
||||
const titleClientRects = titleEl?.getClientRects?.();
|
||||
const itemClientRects = item.getClientRects?.();
|
||||
const titleRect = titleClientRects?.length
|
||||
? titleClientRects[0]
|
||||
: titleEl?.getBoundingClientRect() ?? itemRect;
|
||||
const anchorRect = itemClientRects?.length
|
||||
? itemClientRects[0]
|
||||
: titleRect;
|
||||
const computedStyle = titleEl
|
||||
? browserGlobal.getComputedStyle(titleEl)
|
||||
: null;
|
||||
const fontSizePx = computedStyle
|
||||
? Number.parseFloat(computedStyle.fontSize || "0")
|
||||
: 0;
|
||||
const pageIndex = Math.floor(
|
||||
Math.max(anchorRect.top, 0) / printableHeightPx,
|
||||
);
|
||||
const pageTopPx = pageIndex * printableHeightPx;
|
||||
return {
|
||||
pageIndex,
|
||||
left: titleRect.left,
|
||||
width: titleRect.width,
|
||||
top: anchorRect.top - pageTopPx,
|
||||
height: titleRect.height,
|
||||
fontSize: fontSizePx,
|
||||
};
|
||||
});
|
||||
},
|
||||
{
|
||||
printableHeightPx: (PDF_PAGE_HEIGHT_PT - this.getPdfMarginTopPt() -
|
||||
this.getPdfMarginBottomPt()) / CSS_PX_TO_PT,
|
||||
},
|
||||
);
|
||||
} finally {
|
||||
await page.close();
|
||||
await browser.close();
|
||||
}
|
||||
}
|
||||
|
||||
async combine_index_pdf_to_main_pdf(
|
||||
index_pdf_path: string = "./tmps/index.pdf",
|
||||
insert_index_after_page = 1,
|
||||
) {
|
||||
const combinedPdf = await PDFDocument.create();
|
||||
const index_html = this.as_html_page();
|
||||
const indexPdfBytes = await Deno.readFile(index_pdf_path);
|
||||
const mainPdfBytes = await Deno.readFile(this.file_path);
|
||||
|
||||
const indexPdf = await PDFDocument.load(indexPdfBytes);
|
||||
const mainPdf = await PDFDocument.load(mainPdfBytes);
|
||||
|
||||
const indexPages = await combinedPdf.copyPages(
|
||||
indexPdf,
|
||||
indexPdf.getPageIndices(),
|
||||
);
|
||||
const mainPages = await combinedPdf.copyPages(
|
||||
mainPdf,
|
||||
mainPdf.getPageIndices(),
|
||||
);
|
||||
//插入index页到指定位置,默认插入到第一页后面
|
||||
if (mainPages.length > 0) {
|
||||
mainPages.slice(0, insert_index_after_page).forEach((page: any) =>
|
||||
combinedPdf.addPage(page)
|
||||
);
|
||||
indexPages.forEach((page: any) => combinedPdf.addPage(page));
|
||||
mainPages.slice(insert_index_after_page).forEach((page: any) =>
|
||||
combinedPdf.addPage(page)
|
||||
);
|
||||
} else {
|
||||
indexPages.forEach((page: any) => combinedPdf.addPage(page));
|
||||
}
|
||||
|
||||
await this.add_index_link_annotations_to_pdf(
|
||||
combinedPdf,
|
||||
this.get_sorted_index_entries(),
|
||||
indexPages.length,
|
||||
insert_index_after_page,
|
||||
index_html,
|
||||
);
|
||||
|
||||
const combinedPdfBytes = await combinedPdf.save();
|
||||
await Deno.writeFile(this.file_path, combinedPdfBytes);
|
||||
return indexPages.length;
|
||||
}
|
||||
|
||||
private remap_page_after_index_insert(
|
||||
page: number,
|
||||
inserted_index_pages: number,
|
||||
insert_index_after_page: number,
|
||||
): number {
|
||||
if (inserted_index_pages <= 0) {
|
||||
return page;
|
||||
}
|
||||
if (page <= insert_index_after_page) {
|
||||
return page;
|
||||
}
|
||||
return page + inserted_index_pages;
|
||||
}
|
||||
|
||||
private add_link_annotation(
|
||||
page: any,
|
||||
ctx: any,
|
||||
rect: [number, number, number, number],
|
||||
destPageRef: any,
|
||||
destPageHeight: number,
|
||||
) {
|
||||
const annotation = ctx.obj({
|
||||
Type: PDFName.of("Annot"),
|
||||
Subtype: PDFName.of("Link"),
|
||||
Rect: PDFArray.withContext(ctx),
|
||||
Border: PDFArray.withContext(ctx),
|
||||
Dest: PDFArray.withContext(ctx),
|
||||
});
|
||||
|
||||
const rectArray = annotation.lookup(PDFName.of("Rect"), PDFArray);
|
||||
rect.forEach((value) => rectArray.push(PDFNumber.of(value)));
|
||||
|
||||
const borderArray = annotation.lookup(PDFName.of("Border"), PDFArray);
|
||||
borderArray.push(PDFNumber.of(0));
|
||||
borderArray.push(PDFNumber.of(0));
|
||||
borderArray.push(PDFNumber.of(0));
|
||||
|
||||
const destArray = annotation.lookup(PDFName.of("Dest"), PDFArray);
|
||||
destArray.push(destPageRef);
|
||||
destArray.push(PDFName.of("FitH"));
|
||||
destArray.push(PDFNumber.of(destPageHeight));
|
||||
|
||||
const annotationRef = ctx.register(annotation);
|
||||
const annots = page.node.Annots();
|
||||
if (annots) {
|
||||
annots.push(annotationRef);
|
||||
} else {
|
||||
page.node.set(PDFName.of("Annots"), ctx.obj([annotationRef]));
|
||||
}
|
||||
}
|
||||
|
||||
private add_index_link_annotations(
|
||||
pdfDoc: PDFDocument,
|
||||
sorted_entries: Array<
|
||||
[
|
||||
string,
|
||||
{ page: number; column_name: string },
|
||||
]
|
||||
>,
|
||||
index_item_layouts: Array<{
|
||||
pageIndex: number;
|
||||
top: number;
|
||||
left: number;
|
||||
width: number;
|
||||
height: number;
|
||||
fontSize: number;
|
||||
}>,
|
||||
inserted_index_pages: number,
|
||||
insert_index_after_page: number,
|
||||
) {
|
||||
if (
|
||||
inserted_index_pages <= 0 || sorted_entries.length === 0 ||
|
||||
index_item_layouts.length === 0
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pages = pdfDoc.getPages();
|
||||
const indexPages = pages.slice(
|
||||
insert_index_after_page,
|
||||
insert_index_after_page + inserted_index_pages,
|
||||
);
|
||||
if (indexPages.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const ctx = pdfDoc.context;
|
||||
const pageHeight = indexPages[0].getSize().height;
|
||||
const pageWidth = indexPages[0].getSize().width;
|
||||
const marginTop = this.getPdfMarginTopPt();
|
||||
const minRectHeight = 12;
|
||||
|
||||
sorted_entries.forEach((entry, index) => {
|
||||
const layout = index_item_layouts[index];
|
||||
if (!layout) {
|
||||
return;
|
||||
}
|
||||
const layoutLeftPt = layout.left * CSS_PX_TO_PT;
|
||||
const layoutWidthPt = layout.width * CSS_PX_TO_PT;
|
||||
const layoutHeightPt = layout.height * CSS_PX_TO_PT;
|
||||
const xLeft = Math.max(layoutLeftPt, 0);
|
||||
const xRight = Math.min(layoutLeftPt + layoutWidthPt, pageWidth);
|
||||
const mappedPage = this.remap_page_after_index_insert(
|
||||
entry[1].page,
|
||||
inserted_index_pages,
|
||||
insert_index_after_page,
|
||||
);
|
||||
const destPageIndex = Math.min(
|
||||
Math.max(mappedPage - 1, 0),
|
||||
pages.length - 1,
|
||||
);
|
||||
const destPage = pages[destPageIndex];
|
||||
const destPageRef = (destPage as any).ref;
|
||||
const destPageHeight = destPage.getSize().height;
|
||||
const totalHeight = Math.max(layoutHeightPt, minRectHeight);
|
||||
const targetPage = indexPages[
|
||||
Math.min(
|
||||
Math.max(layout.pageIndex, 0),
|
||||
indexPages.length - 1,
|
||||
)
|
||||
];
|
||||
if (!targetPage) {
|
||||
return;
|
||||
}
|
||||
const localTopPt = layout.top * CSS_PX_TO_PT;
|
||||
const yTop = pageHeight - marginTop - localTopPt;
|
||||
const yBottom = yTop - totalHeight;
|
||||
this.add_link_annotation(
|
||||
targetPage as any,
|
||||
ctx,
|
||||
[xLeft, yBottom, xRight, yTop],
|
||||
destPageRef,
|
||||
destPageHeight,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
private async add_index_link_annotations_to_pdf(
|
||||
pdfDoc: PDFDocument,
|
||||
sorted_entries: Array<
|
||||
[
|
||||
string,
|
||||
{ page: number; column_name: string },
|
||||
]
|
||||
>,
|
||||
inserted_index_pages: number,
|
||||
insert_index_after_page: number,
|
||||
index_html: string,
|
||||
) {
|
||||
const index_item_layouts = await this.get_index_item_layouts(index_html);
|
||||
this.add_index_link_annotations(
|
||||
pdfDoc,
|
||||
sorted_entries,
|
||||
index_item_layouts,
|
||||
inserted_index_pages,
|
||||
insert_index_after_page,
|
||||
);
|
||||
}
|
||||
|
||||
async add_pdf_outline(options?: {
|
||||
inserted_index_pages?: number;
|
||||
insert_index_after_page?: number;
|
||||
open_outline_by_default?: boolean;
|
||||
}) {
|
||||
const inserted_index_pages = options?.inserted_index_pages ?? 0;
|
||||
const insert_index_after_page = options?.insert_index_after_page ?? 1;
|
||||
const open_outline_by_default = options?.open_outline_by_default ?? true;
|
||||
|
||||
const pdfBytes = await Deno.readFile(this.file_path);
|
||||
const pdfDoc = await PDFDocument.load(pdfBytes);
|
||||
const pages = pdfDoc.getPages();
|
||||
|
||||
if (pages.length === 0 || this.indexed_map.size === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sorted_entries = this.get_sorted_index_entries();
|
||||
|
||||
const ctx = pdfDoc.context;
|
||||
// deno-lint-ignore no-explicit-any
|
||||
const itemNodes: Array<{ ref: any; dict: any }> = [];
|
||||
|
||||
for (const [title, { page }] of sorted_entries) {
|
||||
const mappedPage = this.remap_page_after_index_insert(
|
||||
page,
|
||||
inserted_index_pages,
|
||||
insert_index_after_page,
|
||||
);
|
||||
const targetPageIndex = Math.min(
|
||||
Math.max(mappedPage - 1, 0),
|
||||
pages.length - 1,
|
||||
);
|
||||
// deno-lint-ignore no-explicit-any
|
||||
const pageRef = (pages[targetPageIndex] as any).ref;
|
||||
const targetPageHeight = pages[targetPageIndex].getSize().height;
|
||||
const dict = ctx.obj({
|
||||
Title: PDFHexString.fromText(title),
|
||||
Dest: [
|
||||
pageRef,
|
||||
PDFName.of("FitH"),
|
||||
PDFNumber.of(targetPageHeight),
|
||||
],
|
||||
});
|
||||
const ref = ctx.register(dict);
|
||||
itemNodes.push({ ref, dict });
|
||||
}
|
||||
|
||||
const outlinesDict = ctx.obj({
|
||||
Type: PDFName.of("Outlines"),
|
||||
Count: itemNodes.length,
|
||||
First: itemNodes[0].ref,
|
||||
Last: itemNodes[itemNodes.length - 1].ref,
|
||||
});
|
||||
const outlinesRef = ctx.register(outlinesDict);
|
||||
|
||||
itemNodes.forEach((node, index) => {
|
||||
node.dict.set(PDFName.of("Parent"), outlinesRef);
|
||||
if (index > 0) {
|
||||
node.dict.set(PDFName.of("Prev"), itemNodes[index - 1].ref);
|
||||
}
|
||||
if (index < itemNodes.length - 1) {
|
||||
node.dict.set(PDFName.of("Next"), itemNodes[index + 1].ref);
|
||||
}
|
||||
});
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
const catalog = (pdfDoc.catalog as any).dict;
|
||||
catalog.set(PDFName.of("Outlines"), outlinesRef);
|
||||
if (open_outline_by_default) {
|
||||
catalog.set(PDFName.of("PageMode"), PDFName.of("UseOutlines"));
|
||||
}
|
||||
|
||||
const outlinedPdfBytes = await pdfDoc.save();
|
||||
await Deno.writeFile(this.file_path, outlinedPdfBytes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { findTitlePage, normalizePdfText } from "./index_builder.ts";
|
||||
|
||||
Deno.test("normalizes title whitespace and line breaks", () => {
|
||||
assertEquals(normalizePdfText("工人\n 解放 报"), "工人解放报");
|
||||
});
|
||||
|
||||
Deno.test("finds multiple titles on the same printable page", () => {
|
||||
const pages = ["封面", "文章甲正文 文章乙正文", "文章丙正文"];
|
||||
assertEquals(findTitlePage("文章甲", pages), 2);
|
||||
assertEquals(findTitlePage("文章乙", pages), 2);
|
||||
assertEquals(findTitlePage("文章丙", pages), 3);
|
||||
assertEquals(findTitlePage("不存在", pages), undefined);
|
||||
});
|
||||
@@ -0,0 +1,61 @@
|
||||
import "openpgp";
|
||||
import * as openpgp from "openpgp";
|
||||
import { PathLike } from "node:fs";
|
||||
export function resolveChromiumPath(): string {
|
||||
const chromiumPath = Deno.env.get("CHROMIUM_PATH");
|
||||
if (chromiumPath) {
|
||||
return chromiumPath;
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
[
|
||||
"CHROMIUM_PATH is not set.",
|
||||
"Use the provided flake shell or set CHROMIUM_PATH manually.",
|
||||
'Example: export CHROMIUM_PATH="$(command -v chromium)"',
|
||||
].join("\n"),
|
||||
);
|
||||
}
|
||||
export class OpenPGPSigner {
|
||||
file_path: PathLike;
|
||||
output_path: PathLike;
|
||||
pri_key: Promise<openpgp.PrivateKey>;
|
||||
pri_passphrase?: string;
|
||||
|
||||
constructor(
|
||||
file: PathLike,
|
||||
pri_key: PathLike,
|
||||
output_path: PathLike,
|
||||
pri_passphrase?: string,
|
||||
) {
|
||||
this.file_path = file;
|
||||
this.output_path = output_path;
|
||||
this.pri_passphrase = pri_passphrase;
|
||||
this.pri_key = openpgp.readPrivateKey({
|
||||
armoredKey: Deno.readTextFileSync(pri_key as string),
|
||||
});
|
||||
}
|
||||
|
||||
private async getDecryptedPrivateKey(): Promise<openpgp.PrivateKey> {
|
||||
let privateKey = await this.pri_key;
|
||||
if (this.pri_passphrase) {
|
||||
privateKey = await openpgp.decryptKey({
|
||||
privateKey,
|
||||
passphrase: this.pri_passphrase,
|
||||
});
|
||||
}
|
||||
return privateKey;
|
||||
}
|
||||
|
||||
async sign() {
|
||||
const file_bytes = await Deno.readFile(this.file_path as string);
|
||||
const message = await openpgp.createMessage({ binary: file_bytes });
|
||||
const signingKey = await this.getDecryptedPrivateKey();
|
||||
const signature = await openpgp.sign({
|
||||
message,
|
||||
signingKeys: signingKey,
|
||||
format: "armored",
|
||||
detached: true,
|
||||
});
|
||||
await Deno.writeTextFile(this.output_path as string, signature);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
import { OpenPGPSigner } from "./pdf_builder/utils.ts";
|
||||
import { DocuBuilder } from "./pdf_builder/docu_builder.ts";
|
||||
import { IndexBuilder } from "./pdf_builder/index_builder.ts";
|
||||
import type { TemplateVariables } from "./template_engine.ts";
|
||||
|
||||
export type GPConfig = {
|
||||
journal: {
|
||||
from_directory: string;
|
||||
template_directory?: string;
|
||||
build_mode?: "detached" | "flat";
|
||||
build_js_script?: string | false;
|
||||
};
|
||||
pdf: {
|
||||
generate_index?: boolean;
|
||||
use_qpdf?: {
|
||||
enabled?: boolean;
|
||||
options?: string;
|
||||
};
|
||||
signing?: {
|
||||
enabled?: boolean;
|
||||
key_path: string;
|
||||
output_path: string;
|
||||
};
|
||||
};
|
||||
playwright: Record<string, unknown> & { path: string };
|
||||
md?: {
|
||||
path?: string;
|
||||
};
|
||||
markdown_output?: string;
|
||||
};
|
||||
|
||||
export type PDFPipelineOptions = {
|
||||
addIndex?: boolean | number;
|
||||
useQpdf?: boolean;
|
||||
signPdf?: boolean;
|
||||
signPassphrase?: string;
|
||||
keepIndexPdf?: boolean;
|
||||
variables?: TemplateVariables;
|
||||
};
|
||||
|
||||
export async function processPdfConfig(
|
||||
config: GPConfig,
|
||||
options: PDFPipelineOptions = {},
|
||||
) {
|
||||
const builder = new DocuBuilder(config, options.variables);
|
||||
|
||||
try {
|
||||
await builder.with_browser();
|
||||
console.debug(`Processing config: ${JSON.stringify(config)}`);
|
||||
builder.with_files_sync(config.journal.from_directory);
|
||||
await builder.as_html_page();
|
||||
await builder.build_as_pdf(config.playwright);
|
||||
} finally {
|
||||
await builder.close_browser();
|
||||
}
|
||||
|
||||
const shouldAddIndex = options.addIndex ?? config.pdf.generate_index;
|
||||
if (shouldAddIndex) {
|
||||
const insertIndexAfterPage = typeof shouldAddIndex === "number"
|
||||
? shouldAddIndex
|
||||
: 1;
|
||||
await addIndexToPdf(
|
||||
config,
|
||||
insertIndexAfterPage,
|
||||
options.keepIndexPdf ?? false,
|
||||
);
|
||||
}
|
||||
|
||||
if (options.useQpdf ?? config.pdf.use_qpdf?.enabled) {
|
||||
await runQpdf(config);
|
||||
}
|
||||
|
||||
if (options.signPdf ?? config.pdf.signing?.enabled) {
|
||||
await signPdf(config, options.signPassphrase);
|
||||
}
|
||||
}
|
||||
|
||||
async function addIndexToPdf(
|
||||
config: GPConfig,
|
||||
insertIndexAfterPage = 1,
|
||||
keepIndexPdf = false,
|
||||
) {
|
||||
console.log(`Adding index to PDF ${config.playwright.path}...`);
|
||||
|
||||
const indexBuilder = new IndexBuilder(config.playwright.path, config);
|
||||
await indexBuilder.build_index();
|
||||
const tempDir = await makePdfTempDir(config.playwright.path);
|
||||
const tempIndexPdfPath = `${tempDir}/index.pdf`;
|
||||
await indexBuilder.html2pdf({
|
||||
path: tempIndexPdfPath,
|
||||
format: "A4",
|
||||
headerTemplate:
|
||||
'<div style="width:100%; font-size:10px; text-align:center; color:#666;"><span class="title"></span></div>',
|
||||
footerTemplate:
|
||||
'<div style="width:100%; font-size:10px; text-align:center; color:#666;"><span class="title"></span></div>',
|
||||
margin: {
|
||||
top: "20mm",
|
||||
bottom: "20mm",
|
||||
},
|
||||
printBackground: true,
|
||||
});
|
||||
const insertedIndexPages = await indexBuilder.combine_index_pdf_to_main_pdf(
|
||||
tempIndexPdfPath,
|
||||
insertIndexAfterPage,
|
||||
);
|
||||
await indexBuilder.add_pdf_outline({
|
||||
inserted_index_pages: insertedIndexPages,
|
||||
});
|
||||
|
||||
if (keepIndexPdf) {
|
||||
console.log(`Kept index PDF for debugging: ${tempIndexPdfPath}`);
|
||||
} else {
|
||||
try {
|
||||
await Deno.remove(tempIndexPdfPath);
|
||||
await Deno.remove(tempDir);
|
||||
} catch (_error) {
|
||||
// temp file may already be gone if the pipeline aborted late
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function makePdfTempDir(outputPath: string) {
|
||||
await Deno.mkdir("./tmps", { recursive: true });
|
||||
const safeStem = outputPath.split("/").pop()?.replace(/\.pdf$/i, "") ?? "pdf";
|
||||
return await Deno.makeTempDir({
|
||||
dir: "./tmps",
|
||||
prefix: `${safeStem}-index-`,
|
||||
});
|
||||
}
|
||||
|
||||
async function runQpdf(config: GPConfig) {
|
||||
if (!config.pdf.use_qpdf?.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Using qpdf to linearize PDF ${config.playwright.path}...`);
|
||||
const outputPath = config.playwright.path.replace(
|
||||
/\.pdf$/,
|
||||
"_linearized.pdf",
|
||||
);
|
||||
const qpdfArgs = [
|
||||
config.playwright.path,
|
||||
config.pdf.use_qpdf.options ?? "",
|
||||
outputPath,
|
||||
].filter((arg) => arg.length > 0);
|
||||
|
||||
const cmd = new Deno.Command("qpdf", {
|
||||
args: qpdfArgs,
|
||||
stdout: "piped",
|
||||
stderr: "piped",
|
||||
});
|
||||
|
||||
const child = cmd.spawn();
|
||||
|
||||
for await (const chunk of child.stdout) {
|
||||
console.log(new TextDecoder().decode(chunk));
|
||||
}
|
||||
|
||||
const status = await child.status;
|
||||
console.log(`Status: ${status.code}`);
|
||||
if (status.code === 0) {
|
||||
await Deno.remove(config.playwright.path);
|
||||
await Deno.rename(outputPath, config.playwright.path);
|
||||
console.log(`Successfully linearized PDF: ${config.playwright.path}`);
|
||||
} else {
|
||||
console.error(`Failed to linearize PDF: ${config.playwright.path}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function signPdf(config: GPConfig, passphrase?: string) {
|
||||
if (!config.pdf.signing?.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Signing PDF ${config.playwright.path}...`);
|
||||
const signer = new OpenPGPSigner(
|
||||
config.playwright.path,
|
||||
config.pdf.signing.key_path,
|
||||
config.pdf.signing.output_path,
|
||||
passphrase,
|
||||
);
|
||||
await signer.sign();
|
||||
console.log(`Successfully signed PDF: ${config.pdf.signing.output_path}`);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { type GPConfig, processPdfConfig } from "./pdf_pipeline.ts";
|
||||
import type { TemplateVariables } from "./template_engine.ts";
|
||||
|
||||
type WorkerRequest = {
|
||||
id: number;
|
||||
config: GPConfig;
|
||||
options: {
|
||||
addIndex?: boolean | number;
|
||||
useQpdf?: boolean;
|
||||
signPdf?: boolean;
|
||||
signPassphrase?: string;
|
||||
keepIndexPdf?: boolean;
|
||||
variables?: TemplateVariables;
|
||||
};
|
||||
};
|
||||
|
||||
type WorkerResponse =
|
||||
| { id: number; ok: true }
|
||||
| { id: number; ok: false; error: string };
|
||||
|
||||
const workerGlobal = self as unknown as {
|
||||
onmessage: ((event: MessageEvent<WorkerRequest>) => void) | null;
|
||||
postMessage: (message: WorkerResponse) => void;
|
||||
};
|
||||
|
||||
workerGlobal.onmessage = async (event: MessageEvent<WorkerRequest>) => {
|
||||
const { id, config, options } = event.data;
|
||||
try {
|
||||
await processPdfConfig(config, options);
|
||||
workerGlobal.postMessage({ id, ok: true } satisfies WorkerResponse);
|
||||
} catch (error) {
|
||||
workerGlobal.postMessage(
|
||||
{
|
||||
id,
|
||||
ok: false,
|
||||
error: error instanceof Error ? error.stack ?? error.message : String(
|
||||
error,
|
||||
),
|
||||
} satisfies WorkerResponse,
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,101 @@
|
||||
import { parse as parseToml } from "@std/toml";
|
||||
import nunjucks from "nunjucks";
|
||||
|
||||
export type TemplateVariables = Record<string, unknown>;
|
||||
|
||||
const engine = new nunjucks.Environment(undefined, {
|
||||
autoescape: false,
|
||||
throwOnUndefined: false,
|
||||
});
|
||||
|
||||
function valueFromCli(value: unknown): unknown {
|
||||
if (typeof value !== "string") return value;
|
||||
if (value === "true") return true;
|
||||
if (value === "false") return false;
|
||||
if (value === "null") return null;
|
||||
if (value.trim() !== "" && Number.isFinite(Number(value))) {
|
||||
return Number(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function mergeObjects(...values: Array<unknown>): TemplateVariables {
|
||||
const result: TemplateVariables = {};
|
||||
for (const value of values) {
|
||||
if (value && typeof value === "object" && !Array.isArray(value)) {
|
||||
Object.assign(result, value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function cliVariables(args: Record<string, unknown>): TemplateVariables {
|
||||
const reserved = new Set([
|
||||
"_",
|
||||
"config",
|
||||
"name",
|
||||
"vars-file",
|
||||
"vars_file",
|
||||
"v",
|
||||
"from",
|
||||
]);
|
||||
const variables: TemplateVariables = {};
|
||||
for (const [key, value] of Object.entries(args)) {
|
||||
if (!reserved.has(key) && !key.startsWith("_")) {
|
||||
variables[key] = valueFromCli(value);
|
||||
}
|
||||
}
|
||||
return variables;
|
||||
}
|
||||
|
||||
async function readVariablesFile(path: string): Promise<TemplateVariables> {
|
||||
const text = await Deno.readTextFile(path);
|
||||
const parsed = parseToml(text);
|
||||
return mergeObjects(parsed);
|
||||
}
|
||||
|
||||
function builtinVariables(config: Record<string, unknown>): TemplateVariables {
|
||||
const now = new Date();
|
||||
const iso = now.toISOString();
|
||||
return {
|
||||
now: iso,
|
||||
currentTime: iso,
|
||||
currentDate: iso.slice(0, 10),
|
||||
year: now.getFullYear(),
|
||||
month: now.getMonth() + 1,
|
||||
day: now.getDate(),
|
||||
weekday: now.toLocaleDateString("en-US", { weekday: "long" }),
|
||||
timestamp: now.getTime(),
|
||||
unixTimestamp: Math.floor(now.getTime() / 1000),
|
||||
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||
locale: Intl.DateTimeFormat().resolvedOptions().locale,
|
||||
platform: Deno.build.os,
|
||||
architecture: Deno.build.arch,
|
||||
runtime: `Deno ${Deno.version.deno}`,
|
||||
config,
|
||||
};
|
||||
}
|
||||
|
||||
export async function createTemplateVariables(
|
||||
args: Record<string, unknown> = {},
|
||||
config: Record<string, unknown> = {},
|
||||
): Promise<TemplateVariables> {
|
||||
const journal = (config.journal ?? {}) as Record<string, unknown>;
|
||||
const varsFile = args["vars-file"] ?? args.vars_file ?? args.v;
|
||||
const fromFile = typeof varsFile === "string"
|
||||
? await readVariablesFile(varsFile)
|
||||
: {};
|
||||
return mergeObjects(
|
||||
builtinVariables(config),
|
||||
journal.variables,
|
||||
fromFile,
|
||||
cliVariables(args),
|
||||
);
|
||||
}
|
||||
|
||||
export function renderTemplate(
|
||||
source: string,
|
||||
variables: TemplateVariables,
|
||||
): string {
|
||||
return engine.renderString(source, variables);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { createTemplateVariables, renderTemplate } from "./template_engine.ts";
|
||||
|
||||
Deno.test("renders Nunjucks variables, conditionals, loops, and constants", () => {
|
||||
const result = renderTemplate(
|
||||
`{% set color = "red" %}{% if enabled %}{% for item in items %}{{ item }}:{{ color }};{% endfor %}{% endif %}`,
|
||||
{ enabled: true, items: ["a", "b"] },
|
||||
);
|
||||
assertEquals(result, "a:red;b:red;");
|
||||
});
|
||||
|
||||
Deno.test("parses TOML variables and applies CLI overrides", async () => {
|
||||
const path = await Deno.makeTempFile({ suffix: ".toml" });
|
||||
try {
|
||||
await Deno.writeTextFile(path, `title = "From TOML"\ncount = 2\n`);
|
||||
const variables = await createTemplateVariables({
|
||||
"vars-file": path,
|
||||
title: "From CLI",
|
||||
enabled: "false",
|
||||
}, { journal: { variables: { fallback: true } } });
|
||||
assertEquals(variables.title, "From CLI");
|
||||
assertEquals(variables.count, 2);
|
||||
assertEquals(variables.enabled, false);
|
||||
assertEquals(variables.fallback, true);
|
||||
assertEquals(typeof variables.currentDate, "string");
|
||||
} finally {
|
||||
await Deno.remove(path);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,307 @@
|
||||
import { basename, dirname, join, relative, resolve } from "node:path";
|
||||
import { cfg } from "./main.ts";
|
||||
|
||||
type WebDavOptions = Record<string, unknown>;
|
||||
type WebDavConfig = {
|
||||
baseUrl: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
remoteDir: string;
|
||||
};
|
||||
|
||||
async function readDotEnv(): Promise<Record<string, string>> {
|
||||
const result: Record<string, string> = {};
|
||||
try {
|
||||
for (const line of (await Deno.readTextFile(".env")).split(/\r?\n/)) {
|
||||
const match = line.match(
|
||||
/^\s*(?:export\s+)?([A-Za-z_][\w]*)\s*=\s*(.*)\s*$/,
|
||||
);
|
||||
if (!match) continue;
|
||||
result[match[1]] = match[2].replace(/^(["'])(.*)\1$/, "$2");
|
||||
}
|
||||
} catch (error) {
|
||||
if (!(error instanceof Deno.errors.NotFound)) throw error;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
async function webDavConfig(options: WebDavOptions): Promise<WebDavConfig> {
|
||||
const env = await readDotEnv();
|
||||
const envValue = (...keys: string[]) => {
|
||||
for (const key of keys) {
|
||||
const value = env[key] ?? Deno.env.get(key);
|
||||
if (value) return value;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
const baseUrl = String(
|
||||
options.url ?? envValue("WEBDAV_URL", "WEBDAV_BASE_URL") ?? "",
|
||||
);
|
||||
if (!baseUrl) {
|
||||
throw new Error("WebDAV URL required: --url or WEBDAV_URL in .env");
|
||||
}
|
||||
const parsedBaseUrl = new URL(baseUrl);
|
||||
if (!/^https?:$/.test(parsedBaseUrl.protocol)) {
|
||||
throw new Error("WebDAV URL must use HTTP or HTTPS");
|
||||
}
|
||||
const remoteDir = String(
|
||||
options["remote-dir"] ?? envValue("WEBDAV_REMOTE_DIR") ?? "gp_upload",
|
||||
).replace(/^\/+|\/+$/g, "");
|
||||
if (remoteDir.split("/").some((part) => part === "." || part === "..")) {
|
||||
throw new Error("WebDAV remote directory cannot contain dot segments");
|
||||
}
|
||||
return {
|
||||
baseUrl: baseUrl.replace(/\/+$/, ""),
|
||||
username: String(
|
||||
options.user ?? envValue("WEBDAV_USERNAME", "WEBDAV_USER") ?? "",
|
||||
) || undefined,
|
||||
password: String(options.password ?? envValue("WEBDAV_PASSWORD") ?? "") ||
|
||||
undefined,
|
||||
remoteDir,
|
||||
};
|
||||
}
|
||||
|
||||
function authHeaders(config: WebDavConfig): HeadersInit {
|
||||
if (!config.username && !config.password) return {};
|
||||
const token = btoa(`${config.username ?? ""}:${config.password ?? ""}`);
|
||||
return { authorization: `Basic ${token}` };
|
||||
}
|
||||
|
||||
function remoteUrl(config: WebDavConfig, path: string): string {
|
||||
const base = new URL(`${config.baseUrl}/`);
|
||||
const suffix = [config.remoteDir, path].filter(Boolean).join("/");
|
||||
return new URL(suffix.split("/").map(encodeURIComponent).join("/"), base)
|
||||
.href;
|
||||
}
|
||||
|
||||
async function ensureCollection(
|
||||
config: WebDavConfig,
|
||||
path: string,
|
||||
): Promise<void> {
|
||||
const url = remoteUrl(config, path);
|
||||
const response = await fetch(url, {
|
||||
method: "MKCOL",
|
||||
headers: authHeaders(config),
|
||||
});
|
||||
if (
|
||||
response.ok || response.status === 405 || response.status === 301 ||
|
||||
response.status === 302
|
||||
) return;
|
||||
if (response.status === 409) {
|
||||
const parent = dirname(path);
|
||||
if (parent !== "." && parent !== path) {
|
||||
await ensureCollection(config, parent);
|
||||
}
|
||||
const retry = await fetch(url, {
|
||||
method: "MKCOL",
|
||||
headers: authHeaders(config),
|
||||
});
|
||||
if (retry.ok || retry.status === 405) return;
|
||||
throw new Error(`WebDAV MKCOL ${path} failed: HTTP ${retry.status}`);
|
||||
}
|
||||
throw new Error(`WebDAV MKCOL ${path} failed: HTTP ${response.status}`);
|
||||
}
|
||||
|
||||
async function walkFiles(root: string): Promise<string[]> {
|
||||
const files: string[] = [];
|
||||
for (const entry of Deno.readDirSync(root)) {
|
||||
const path = join(root, entry.name);
|
||||
if (entry.isDirectory) files.push(...await walkFiles(path));
|
||||
else if (entry.isFile) files.push(path);
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
function roots(
|
||||
options: WebDavOptions,
|
||||
): Array<{ local: string; remote: string }> {
|
||||
const type = String(options.type ?? "all");
|
||||
if (!new Set(["all", "assets", "cache"]).has(type)) {
|
||||
throw new Error("--type must be all, cache, or assets");
|
||||
}
|
||||
const injectedRoots = options.localRoots;
|
||||
if (Array.isArray(injectedRoots)) {
|
||||
return injectedRoots.filter((
|
||||
root,
|
||||
): root is { local: string; remote: string } =>
|
||||
root && typeof root.local === "string" &&
|
||||
typeof root.remote === "string" &&
|
||||
((type === "all" &&
|
||||
(root.remote === "assets" || root.remote.startsWith("cache/"))) ||
|
||||
(type === "assets" && root.remote === "assets") ||
|
||||
(type === "cache" && root.remote.startsWith("cache/")))
|
||||
);
|
||||
}
|
||||
const roots: Array<{ local: string; remote: string }> = [];
|
||||
if (type === "all" || type === "assets") {
|
||||
roots.push({ local: resolve("../../assets"), remote: "assets" });
|
||||
}
|
||||
if (type === "all" || type === "cache") {
|
||||
for (const setting of cfg.settings) {
|
||||
const publication = resolve(setting.journal.from_directory);
|
||||
roots.push({
|
||||
local: publication,
|
||||
remote: `cache/${basename(publication)}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
return roots;
|
||||
}
|
||||
|
||||
export async function upload_webdav(options: WebDavOptions): Promise<void> {
|
||||
const config = await webDavConfig(options);
|
||||
await ensureCollection(config, "");
|
||||
for (const root of roots(options)) {
|
||||
try {
|
||||
await Deno.stat(root.local);
|
||||
} catch (error) {
|
||||
if (error instanceof Deno.errors.NotFound) continue;
|
||||
throw error;
|
||||
}
|
||||
await ensureCollection(config, root.remote);
|
||||
for (const file of await walkFiles(root.local)) {
|
||||
const path = relative(root.local, file).split("\\").join("/");
|
||||
if (
|
||||
root.remote.startsWith("cache/") && path !== ".cache.toml" &&
|
||||
!path.startsWith(".local-cache/")
|
||||
) continue;
|
||||
const parent = dirname(path);
|
||||
if (parent !== ".") {
|
||||
await ensureCollection(config, `${root.remote}/${parent}`);
|
||||
}
|
||||
const response = await fetch(
|
||||
remoteUrl(config, `${root.remote}/${path}`),
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
...authHeaders(config),
|
||||
"content-type": "application/octet-stream",
|
||||
},
|
||||
body: await Deno.readFile(file),
|
||||
},
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error(`WebDAV PUT ${path} failed: HTTP ${response.status}`);
|
||||
}
|
||||
console.log(`Uploaded ${file}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function sync_webdav(options: WebDavOptions): Promise<void> {
|
||||
const config = await webDavConfig(options);
|
||||
for (const root of roots(options)) {
|
||||
await Deno.mkdir(root.local, { recursive: true });
|
||||
await downloadCollection(config, root.remote, root.local);
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadCollection(
|
||||
config: WebDavConfig,
|
||||
remotePath: string,
|
||||
localPath: string,
|
||||
): Promise<void> {
|
||||
const response = await fetch(remoteUrl(config, remotePath), {
|
||||
method: "PROPFIND",
|
||||
headers: { ...authHeaders(config), Depth: "1" },
|
||||
});
|
||||
if (response.status === 404) return;
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
`WebDAV PROPFIND ${remotePath} failed: HTTP ${response.status}`,
|
||||
);
|
||||
}
|
||||
const xml = await response.text();
|
||||
const requestUrl = new URL(remoteUrl(config, remotePath));
|
||||
const basePath = requestUrl.pathname.replace(/\/+$/, "");
|
||||
const responses = [
|
||||
...xml.matchAll(/<[^>]*response\b[^>]*>([\s\S]*?)<\/[^>]*response>/gi),
|
||||
];
|
||||
for (const [, responseXml] of responses) {
|
||||
const hrefMatch = responseXml.match(/<[^>]*href[^>]*>(.*?)<\/[^>]*href>/i);
|
||||
if (!hrefMatch) continue;
|
||||
const href = decodeXmlText(hrefMatch[1].trim());
|
||||
let parsed: URL;
|
||||
try {
|
||||
parsed = new URL(href, config.baseUrl);
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
if (parsed.origin !== requestUrl.origin) continue;
|
||||
const entry = parsed.pathname.replace(/\/+$/, "");
|
||||
if (entry === basePath || !entry.startsWith(`${basePath}/`)) continue;
|
||||
const relativePath = entry.slice(basePath.length + 1);
|
||||
let name: string;
|
||||
try {
|
||||
name = decodeURIComponent(relativePath);
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
if (name.includes("/")) continue;
|
||||
if (!name || name === "." || name === ".." || name.includes("\\")) {
|
||||
continue;
|
||||
}
|
||||
const isDirectory = /<[^>]*collection\b/i.test(responseXml);
|
||||
if (isDirectory) {
|
||||
await Deno.mkdir(join(localPath, name), { recursive: true });
|
||||
await downloadCollection(
|
||||
config,
|
||||
`${remotePath}/${name}`,
|
||||
join(localPath, name),
|
||||
);
|
||||
} else {
|
||||
const fileResponse = await fetch(new URL(href, config.baseUrl), {
|
||||
headers: authHeaders(config),
|
||||
});
|
||||
if (!fileResponse.ok) {
|
||||
throw new Error(
|
||||
`WebDAV GET ${name} failed: HTTP ${fileResponse.status}`,
|
||||
);
|
||||
}
|
||||
await Deno.writeFile(
|
||||
join(localPath, name),
|
||||
new Uint8Array(await fileResponse.arrayBuffer()),
|
||||
);
|
||||
console.log(`Downloaded ${join(localPath, name)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function decodeXmlText(text: string): string {
|
||||
return text.replace(/&(?:amp|lt|gt|quot|apos);/g, (entity) => ({
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
""": '"',
|
||||
"'": "'",
|
||||
}[entity] ?? entity));
|
||||
}
|
||||
|
||||
export async function clean_local_files(options: WebDavOptions): Promise<void> {
|
||||
const type = String(options.type ?? "all");
|
||||
if (!new Set(["all", "cache", "assets"]).has(type)) {
|
||||
throw new Error("clean --type must be all, cache, or assets");
|
||||
}
|
||||
const targets: string[] = [];
|
||||
if (type === "all" || type === "assets") {
|
||||
targets.push(resolve("../../assets"));
|
||||
}
|
||||
if (type === "all" || type === "cache") {
|
||||
for (const setting of cfg.settings) {
|
||||
targets.push(
|
||||
join(resolve(setting.journal.from_directory), ".local-cache"),
|
||||
);
|
||||
targets.push(
|
||||
join(resolve(setting.journal.from_directory), ".cache.toml"),
|
||||
);
|
||||
}
|
||||
}
|
||||
for (const target of new Set(targets)) {
|
||||
try {
|
||||
await Deno.remove(target, { recursive: true });
|
||||
console.log(`Removed ${target}`);
|
||||
} catch (error) {
|
||||
if (!(error instanceof Deno.errors.NotFound)) throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
import { assert, assertEquals, assertRejects } from "@std/assert";
|
||||
import { clean_local_files, sync_webdav, upload_webdav } from "./webdav.ts";
|
||||
|
||||
function propfindResponse(
|
||||
entries: Array<{
|
||||
href: string;
|
||||
collection?: boolean;
|
||||
}>,
|
||||
): Response {
|
||||
const responses = entries.map(({ href, collection }) =>
|
||||
`<d:response><d:href>${href}</d:href><d:propstat><d:prop>$
|
||||
${collection ? "<d:resourcetype><d:collection/></d:resourcetype>" : ""}
|
||||
</d:prop></d:propstat></d:response>`
|
||||
).join("");
|
||||
return new Response(
|
||||
`<?xml version="1.0"?><d:multistatus xmlns:d="DAV:">${responses}</d:multistatus>`,
|
||||
{ status: 207 },
|
||||
);
|
||||
}
|
||||
|
||||
Deno.test("WebDAV sync maps assets and cache into their local roots", async () => {
|
||||
const base = "https://dav.example.test/remote.php/dav/files/user";
|
||||
const root = await Deno.makeTempDir();
|
||||
const assetsRoot = `${root}/assets`;
|
||||
const cacheRoot = `${root}/publication`;
|
||||
const seen: string[] = [];
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = async (input, init) => {
|
||||
const url = String(input);
|
||||
const method = (init as RequestInit | undefined)?.method ?? "GET";
|
||||
seen.push(`${method} ${url}`);
|
||||
if (method === "PROPFIND" && url.endsWith("/gp_upload/assets")) {
|
||||
return propfindResponse([
|
||||
{ href: `${base}/gp_upload/assets/` },
|
||||
{ href: `${base}/gp_upload/assets/pictures/`, collection: true },
|
||||
{
|
||||
href:
|
||||
"https://evil.example.test/remote.php/dav/files/user/gp_upload/assets/outside.png",
|
||||
},
|
||||
]);
|
||||
}
|
||||
if (method === "PROPFIND" && url.endsWith("/gp_upload/cache/26.11.0")) {
|
||||
return propfindResponse([
|
||||
{ href: `${base}/gp_upload/cache/26.11.0/` },
|
||||
{ href: `${base}/gp_upload/cache/26.11.0/.cache.toml` },
|
||||
{
|
||||
href: `${base}/gp_upload/cache/26.11.0/.local-cache/`,
|
||||
collection: true,
|
||||
},
|
||||
]);
|
||||
}
|
||||
if (method === "PROPFIND" && url.endsWith("/gp_upload/cache")) {
|
||||
return propfindResponse([
|
||||
{ href: `${base}/gp_upload/cache/` },
|
||||
{ href: `${base}/gp_upload/cache/26.11.0/`, collection: true },
|
||||
]);
|
||||
}
|
||||
if (method === "PROPFIND" && url.endsWith("/assets/pictures")) {
|
||||
return propfindResponse([
|
||||
{ href: `${base}/gp_upload/assets/pictures/` },
|
||||
{ href: `${base}/gp_upload/assets/pictures/rsf.png` },
|
||||
]);
|
||||
}
|
||||
if (method === "PROPFIND" && url.endsWith("/.local-cache")) {
|
||||
return propfindResponse([
|
||||
{ href: `${base}/gp_upload/cache/26.11.0/.local-cache/` },
|
||||
{
|
||||
href: `${base}/gp_upload/cache/26.11.0/.local-cache/a.png`,
|
||||
},
|
||||
]);
|
||||
}
|
||||
if (method === "GET") return new Response("ok");
|
||||
throw new Error(`Unexpected WebDAV request: ${method} ${url}`);
|
||||
};
|
||||
try {
|
||||
await sync_webdav({
|
||||
url: base,
|
||||
"remote-dir": "gp_upload",
|
||||
type: "all",
|
||||
localRoots: [
|
||||
{ local: assetsRoot, remote: "assets" },
|
||||
{ local: cacheRoot, remote: "cache/26.11.0" },
|
||||
],
|
||||
});
|
||||
assertEquals(
|
||||
await Deno.readTextFile(`${assetsRoot}/pictures/rsf.png`),
|
||||
"ok",
|
||||
);
|
||||
assertEquals(await Deno.readTextFile(`${cacheRoot}/.cache.toml`), "ok");
|
||||
assertEquals(
|
||||
await Deno.readTextFile(`${cacheRoot}/.local-cache/a.png`),
|
||||
"ok",
|
||||
);
|
||||
assertEquals(
|
||||
seen.some((request) => request.includes("outside.png")),
|
||||
false,
|
||||
);
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
await Deno.remove(root, { recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
Deno.test("WebDAV upload creates remote collections and uploads only cache files", async () => {
|
||||
const root = await Deno.makeTempDir();
|
||||
const publication = `${root}/publication`;
|
||||
await Deno.mkdir(`${publication}/.local-cache`, { recursive: true });
|
||||
await Deno.writeTextFile(`${publication}/.cache.toml`, '"a" = "b"');
|
||||
await Deno.writeTextFile(`${publication}/.local-cache/a.png`, "data");
|
||||
await Deno.writeTextFile(`${publication}/article.md`, "must not upload");
|
||||
const methods: string[] = [];
|
||||
const uploads: string[] = [];
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = async (input, init) => {
|
||||
const method = (init as RequestInit | undefined)?.method ?? "GET";
|
||||
methods.push(method);
|
||||
if (method === "PUT") uploads.push(String(input));
|
||||
return new Response(null, { status: 201 });
|
||||
};
|
||||
try {
|
||||
await upload_webdav({
|
||||
url: "https://dav.example.test/root",
|
||||
type: "cache",
|
||||
localRoots: [
|
||||
{ local: publication, remote: "cache/test-publication" },
|
||||
],
|
||||
});
|
||||
assert(methods.includes("MKCOL"));
|
||||
assert(methods.includes("PUT"));
|
||||
assertEquals(uploads.length, 2);
|
||||
assertEquals(uploads.some((url) => url.endsWith("article.md")), false);
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
await Deno.remove(root, { recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
Deno.test("WebDAV commands reject invalid types and unsafe remote roots", async () => {
|
||||
await assertRejects(
|
||||
() => sync_webdav({ url: "https://dav.example.test", type: "other" }),
|
||||
Error,
|
||||
"--type must be all, cache, or assets",
|
||||
);
|
||||
await assertRejects(
|
||||
() => clean_local_files({ type: "invalid" }),
|
||||
Error,
|
||||
"clean --type must be all, cache, or assets",
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user