logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git
commit: ca60bf6117ae8c49f72019b9514c9f51aa681f1f
parent f71f8bc2167a51790920e6900df546a9f1ca02c5
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu, 16 Nov 2023 03:43:06 +0100

dev-nodejs/kuroshiro-analyzer-mecab: Fix CommonJS require and exports

Diffstat:

Mdev-nodejs/kuroshiro-analyzer-mecab/kuroshiro-analyzer-mecab-1.0.0.ebuild12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/dev-nodejs/kuroshiro-analyzer-mecab/kuroshiro-analyzer-mecab-1.0.0.ebuild b/dev-nodejs/kuroshiro-analyzer-mecab/kuroshiro-analyzer-mecab-1.0.0.ebuild @@ -18,6 +18,18 @@ RDEPEND="dev-nodejs/mecab-async" RESTRICT="test" # Uses jest +src_prepare() { + default + #sed -i '/"module":/a"type": "module",' package.json || die + + # Can't import node:child_process, only require() + sed -i \ + -e 's;^import Mecab from "mecab-async";const Mecab = require("mecab-async");' \ + -e 's;export default ;module.exports = ;' \ + src/index.js || die +} + + src_compile() { # Uses babel by default, let's use esbuild for now instead to create a similar result esbuild --bundle src/index.js --outdir=lib --minify --sourcemap --platform=node || die