From a07a86be25326404a54860806bc5de5b1522f1b7 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 24 Jun 2026 13:31:56 +0200 Subject: [PATCH] Fix DEP0169 url.parse() deprecation warning by patching tailwindcss dependencies --- package.json | 1 + scripts/patch-url-parse.mjs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 scripts/patch-url-parse.mjs diff --git a/package.json b/package.json index 4270baf..aacc5f0 100755 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "check": "yarn lint:all && yarn format:check", "check:php": "php -l app/ && php -l routes/ && php -l database/ && php -l resources/", "check:security": "composer audit && npm audit", + "postinstall": "node scripts/patch-url-parse.mjs", "check:deps": "npm outdated --long --json || true", "clean": "rm -rf .vite-cache node_modules/.vite", "rebuild": "yarn clean && yarn install && yarn build" diff --git a/scripts/patch-url-parse.mjs b/scripts/patch-url-parse.mjs new file mode 100644 index 0000000..e1759c6 --- /dev/null +++ b/scripts/patch-url-parse.mjs @@ -0,0 +1,31 @@ +import { readFileSync, writeFileSync, existsSync } from 'fs'; + +let files = [ + 'node_modules/blade-formatter/node_modules/tailwindcss/src/lib/setupContextUtils.js', + 'node_modules/@shufo/tailwindcss-class-sorter/node_modules/tailwindcss/src/lib/setupContextUtils.js', +]; + +for (let file of files) { + if (!existsSync(file)) { + console.log(` Skipped (not found): ${file}`); + continue; + } + let content = readFileSync(file, 'utf8'); + let original = content; + + content = content.replace("import url from 'url'\n", ''); + content = content.replace( + ` let parsed = url.parse(file) + let pathname = parsed.hash ? parsed.href.replace(parsed.hash, '') : parsed.href + pathname = parsed.search ? pathname.replace(parsed.search, '') : pathname`, + ` let pathname = file.includes('#') ? file.split('#')[0] : file + pathname = pathname.includes('?') ? pathname.split('?')[0] : pathname` + ); + + if (content !== original) { + writeFileSync(file, content, 'utf8'); + console.log(` Patched: ${file}`); + } else { + console.log(` No changes needed: ${file}`); + } +}