From 52dbecffa122afe5717169da90a735c4c3087f6a Mon Sep 17 00:00:00 2001 From: Ayideyia <150233177+Ayideyia@users.noreply.github.com> Date: Sun, 19 Apr 2026 14:47:00 +0800 Subject: [PATCH] feat: add proxy utils esm bundle --- .github/workflows/main.yml | 1 + backend/bundle-esbuild.js | 19 +++++++++++++++++++ backend/src/products/proxy-utils.esm.js | 5 +++++ 3 files changed, 25 insertions(+) create mode 100644 backend/src/products/proxy-utils.esm.js diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0a1c9055..7be07cf1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -96,6 +96,7 @@ jobs: ./backend/dist/sub-store-1.min.js ./backend/dist/sub-store-parser.loon.min.js ./backend/dist/cron-sync-artifacts.min.js + ./backend/dist/proxy-utils.esm.mjs ./backend/dist/sub-store.bundle.js - name: Git push assets to "release" branch run: | diff --git a/backend/bundle-esbuild.js b/backend/bundle-esbuild.js index 05d6bd66..aab76b70 100644 --- a/backend/bundle-esbuild.js +++ b/backend/bundle-esbuild.js @@ -34,6 +34,25 @@ const { build } = require('esbuild'); }); } + const browserEsmArtifacts = [ + { + src: 'src/products/proxy-utils.esm.js', + dest: 'dist/proxy-utils.esm.mjs', + }, + ]; + + for await (const artifact of browserEsmArtifacts) { + await build({ + entryPoints: [artifact.src], + bundle: true, + minify: true, + sourcemap: false, + platform: 'browser', + format: 'esm', + outfile: artifact.dest, + }); + } + let content = fs.readFileSync(path.join(__dirname, 'sub-store.min.js'), { encoding: 'utf8', }); diff --git a/backend/src/products/proxy-utils.esm.js b/backend/src/products/proxy-utils.esm.js new file mode 100644 index 00000000..68034b63 --- /dev/null +++ b/backend/src/products/proxy-utils.esm.js @@ -0,0 +1,5 @@ +import { ProxyUtils } from '@/core/proxy-utils'; + +const { parse, produce } = ProxyUtils; + +export { parse, produce };