Comparing version 1.8.3 to 1.9.0
@@ -5,2 +5,5 @@ import * as _rspack_core_dist_config_zod from '@rspack/core/dist/config/zod'; | ||
export { Compiler as WebpackCompiler, WebpackPluginInstance } from 'webpack'; | ||
import * as _rolldown_node from '@rolldown/node'; | ||
import { Plugin as Plugin$2 } from '@rolldown/node'; | ||
export { Plugin as RolldownPlugin } from '@rolldown/node'; | ||
import * as vite from 'vite'; | ||
@@ -13,3 +16,3 @@ import { Plugin as Plugin$1 } from 'vite'; | ||
import * as esbuild from 'esbuild'; | ||
import { PluginBuild, OnLoadResult, Loader, BuildOptions, Plugin as Plugin$2 } from 'esbuild'; | ||
import { PluginBuild, OnLoadResult, Loader, BuildOptions, Plugin as Plugin$3 } from 'esbuild'; | ||
export { Plugin as EsbuildPlugin } from 'esbuild'; | ||
@@ -89,2 +92,3 @@ import { Compiler as Compiler$1, RspackPluginInstance } from '@rspack/core'; | ||
vite?: Partial<Plugin$1>; | ||
rolldown?: Partial<Plugin$2>; | ||
esbuild?: { | ||
@@ -108,9 +112,10 @@ onResolveFilter?: RegExp; | ||
vite: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<Plugin$1> : Plugin$1>; | ||
rolldown: UnpluginFactoryOutput<UserOptions, Nested extends true ? Array<Plugin$2> : Plugin$2>; | ||
webpack: UnpluginFactoryOutput<UserOptions, WebpackPluginInstance>; | ||
rspack: UnpluginFactoryOutput<UserOptions, RspackPluginInstance>; | ||
esbuild: UnpluginFactoryOutput<UserOptions, Plugin$2>; | ||
esbuild: UnpluginFactoryOutput<UserOptions, Plugin$3>; | ||
raw: UnpluginFactory<UserOptions, Nested>; | ||
} | ||
type UnpluginContextMeta = Partial<PluginContextMeta> & ({ | ||
framework: 'rollup' | 'vite'; | ||
framework: 'rollup' | 'vite' | 'rolldown'; | ||
} | { | ||
@@ -166,5 +171,8 @@ framework: 'webpack'; | ||
declare function createVitePlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, Nested extends true ? vite.Plugin<any>[] : vite.Plugin<any>>; | ||
/** @experimental do not use it in production */ | ||
declare function createRolldownPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, Nested extends true ? _rolldown_node.Plugin[] : _rolldown_node.Plugin>; | ||
declare function createWebpackPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, webpack.WebpackPluginInstance>; | ||
/** @experimental do not use it in production */ | ||
declare function createRspackPlugin<UserOptions, Nested extends boolean = boolean>(factory: UnpluginFactory<UserOptions, Nested>): UnpluginFactoryOutput<UserOptions, _rspack_core_dist_config_zod.RspackPluginInstance>; | ||
export { type ExternalIdResult, type ResolvedUnpluginOptions, type SourceMapCompact, type Thenable, type TransformResult, type UnpluginBuildContext, type UnpluginContext, type UnpluginContextMeta, type UnpluginFactory, type UnpluginFactoryOutput, type UnpluginInstance, type UnpluginMessage, type UnpluginOptions, createEsbuildPlugin, createRollupPlugin, createRspackPlugin, createUnplugin, createVitePlugin, createWebpackPlugin }; | ||
export { type ExternalIdResult, type ResolvedUnpluginOptions, type SourceMapCompact, type Thenable, type TransformResult, type UnpluginBuildContext, type UnpluginContext, type UnpluginContextMeta, type UnpluginFactory, type UnpluginFactoryOutput, type UnpluginInstance, type UnpluginMessage, type UnpluginOptions, createEsbuildPlugin, createRolldownPlugin, createRollupPlugin, createRspackPlugin, createUnplugin, createVitePlugin, createWebpackPlugin }; |
@@ -34,2 +34,3 @@ "use strict"; | ||
createEsbuildPlugin: () => createEsbuildPlugin, | ||
createRolldownPlugin: () => createRolldownPlugin, | ||
createRollupPlugin: () => createRollupPlugin, | ||
@@ -1241,2 +1242,19 @@ createRspackPlugin: () => createRspackPlugin, | ||
// src/rolldown/index.ts | ||
function getRolldownPlugin(factory) { | ||
return (userOptions) => { | ||
const meta = { | ||
framework: "rolldown" | ||
}; | ||
const rawPlugins = toArray(factory(userOptions, meta)); | ||
const plugins = rawPlugins.map((rawPlugin) => { | ||
const plugin = toRollupPlugin(rawPlugin, false); | ||
if (rawPlugin.rolldown) | ||
Object.assign(plugin, rawPlugin.rolldown); | ||
return plugin; | ||
}); | ||
return plugins.length === 1 ? plugins[0] : plugins; | ||
}; | ||
} | ||
// src/rspack/index.ts | ||
@@ -1632,2 +1650,6 @@ var import_path4 = require("path"); | ||
}, | ||
/** @experimental do not use it in production */ | ||
get rolldown() { | ||
return getRolldownPlugin(factory); | ||
}, | ||
get webpack() { | ||
@@ -1654,2 +1676,5 @@ return getWebpackPlugin(factory); | ||
} | ||
function createRolldownPlugin(factory) { | ||
return getRolldownPlugin(factory); | ||
} | ||
function createWebpackPlugin(factory) { | ||
@@ -1664,2 +1689,3 @@ return getWebpackPlugin(factory); | ||
createEsbuildPlugin, | ||
createRolldownPlugin, | ||
createRollupPlugin, | ||
@@ -1666,0 +1692,0 @@ createRspackPlugin, |
{ | ||
"name": "unplugin", | ||
"version": "1.8.3", | ||
"version": "1.9.0", | ||
"packageManager": "pnpm@8.15.4", | ||
@@ -30,13 +30,2 @@ "description": "Unified plugin system for build tools", | ||
}, | ||
"scripts": { | ||
"build": "tsup", | ||
"dev": "tsup --watch src", | ||
"lint": "eslint --cache .", | ||
"lint:fix": "nr lint --fix", | ||
"typecheck": "tsc --noEmit", | ||
"prepublishOnly": "nr build", | ||
"release": "bumpp --all -x 'npx conventional-changelog -p angular -i CHANGELOG.md -s' && npm publish", | ||
"test": "nr test:build && vitest run --pool=forks", | ||
"test:build": "jiti scripts/buildFixtures.ts" | ||
}, | ||
"dependencies": { | ||
@@ -52,2 +41,3 @@ "acorn": "^8.11.3", | ||
"@antfu/ni": "^0.21.12", | ||
"@rolldown/node": "^0.0.5", | ||
"@rspack/cli": "^0.5.6", | ||
@@ -82,3 +72,13 @@ "@rspack/core": "^0.5.6", | ||
"*": "eslint --fix" | ||
}, | ||
"scripts": { | ||
"build": "tsup", | ||
"dev": "tsup --watch src", | ||
"lint": "eslint --cache .", | ||
"lint:fix": "nr lint --fix", | ||
"typecheck": "tsc --noEmit", | ||
"release": "bumpp --all -x 'npx conventional-changelog -p angular -i CHANGELOG.md -s' && npm publish", | ||
"test": "nr test:build && vitest run --pool=forks", | ||
"test:build": "jiti scripts/buildFixtures.ts" | ||
} | ||
} | ||
} |
@@ -16,2 +16,3 @@ # Unplugin | ||
- [Rspack](https://www.rspack.dev/) (⚠️ experimental) | ||
- [Rolldown](https://rolldown.rs/) (⚠️ experimental) | ||
- And every framework built on top of them. | ||
@@ -18,0 +19,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
156200
4315
35
27