From 24a7188665d1bb420993e0601c9ef135599a140c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Mon, 30 Dec 2024 09:32:25 +0800 Subject: [PATCH 1/3] fix(esbuild): pass original build for custom esbuild setup backport 4abab22a2c231543543eb3f7ba11f66c73b85df1 --- src/esbuild/index.ts | 10 +++++----- src/types.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/esbuild/index.ts b/src/esbuild/index.ts index b2a63cc3..f4fa0748 100644 --- a/src/esbuild/index.ts +++ b/src/esbuild/index.ts @@ -71,7 +71,7 @@ export function getEsbuildPlugin>( loader.options ||= _options loader.onTransformCb = callback }, - } as EsbuildPluginBuild) + } as EsbuildPluginBuild, build) // skip if no load & transform hooks if (loader.onLoadCb || loader.onTransformCb) @@ -140,9 +140,9 @@ export function getEsbuildPlugin>( } function buildSetup(meta: UnpluginContextMeta & { framework: 'esbuild' }) { - return (plugin: UnpluginOptions): EsbuildPlugin['setup'] => { - return (_build) => { - const build = meta.build = _build as EsbuildPluginBuild + return (plugin: UnpluginOptions) => { + return (build: EsbuildPluginBuild, rawBuild: PluginBuild) => { + meta.build = build const context = createBuildContext(build) const { onStart, onEnd, onResolve, onLoad, onTransform, initialOptions } = build @@ -306,7 +306,7 @@ function buildSetup(meta: UnpluginContextMeta & { framework: 'esbuild' }) { } if (plugin.esbuild?.setup) - return plugin.esbuild.setup(meta.build) + return plugin.esbuild.setup(rawBuild) } } } diff --git a/src/types.ts b/src/types.ts index 1e4fd1e3..180e6c59 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,6 +1,6 @@ import type { CompilationContext as FarmCompilationContext, JsPlugin as FarmPlugin } from '@farmfe/core' import type { Compilation as RspackCompilation, Compiler as RspackCompiler, LoaderContext as RspackLoaderContext, RspackPluginInstance } from '@rspack/core' -import type { BuildOptions, Plugin as EsbuildPlugin, Loader } from 'esbuild' +import type { BuildOptions, Plugin as EsbuildPlugin, Loader, PluginBuild } from 'esbuild' import type { Plugin as RolldownPlugin } from 'rolldown' import type { AstNode, EmittedAsset, PluginContextMeta as RollupContextMeta, Plugin as RollupPlugin, SourceMapInput } from 'rollup' import type { Plugin as VitePlugin } from 'vite' @@ -90,7 +90,7 @@ export interface UnpluginOptions { // using regexp in esbuild improves performance onResolveFilter?: RegExp onLoadFilter?: RegExp - setup?: (build: EsbuildPluginBuild) => void | Promise + setup?: (build: PluginBuild) => void | Promise loader?: Loader | ((code: string, id: string) => Loader) config?: (options: BuildOptions) => void } From 4de055761f83f26d91720b841c31eab06be3a85c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Wed, 8 Jan 2025 13:11:28 +0800 Subject: [PATCH 2/3] ci: run unit test on v1 branch --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9b1ed33..d1615b0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,9 +4,11 @@ on: push: branches: - main + - 'v*' pull_request: branches: - main + - 'v*' jobs: lint: From a16256bf6b5fb0d2e51019756ea38a513db85057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Wed, 8 Jan 2025 13:17:25 +0800 Subject: [PATCH 3/3] chore: release v1.16.1 --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 162eb2a2..67873b89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [1.16.1](https://github.com/unjs/unplugin/compare/v1.16.0...v1.16.1) (2025-01-08) + + +### Bug Fixes + +* **esbuild:** pass original build for custom esbuild setup ([24a7188](https://github.com/unjs/unplugin/commit/24a7188665d1bb420993e0601c9ef135599a140c)) + + + # [1.16.0](https://github.com/unjs/unplugin/compare/v1.15.0...v1.16.0) (2024-11-14) diff --git a/package.json b/package.json index c0fa6cee..533f52c5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "unplugin", "type": "commonjs", - "version": "1.16.0", + "version": "1.16.1", "packageManager": "pnpm@8.15.9", "description": "Unified plugin system for build tools", "license": "MIT", pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy