Skip to content

Commit

Permalink
feat: use assign to update context
Browse files Browse the repository at this point in the history
  • Loading branch information
caohuilin committed Feb 25, 2025
1 parent 2de8811 commit 331f9e9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .changeset/early-bats-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@modern-js/plugin-v2': patch
---

feat: use assign to update context

feat: 使用 assign 函数更新 context 信息
5 changes: 2 additions & 3 deletions packages/toolkit/plugin-v2/src/cli/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { merge } from '@modern-js/utils/lodash';
import { modifyBundlerChain } from '@rsbuild/core/dist-types/configChain';
import { assign } from '@modern-js/utils/lodash';
import type { PluginHook } from '../types';
import type {
AllKeysForCLIPluginExtendsAPI,
Expand Down Expand Up @@ -76,7 +75,7 @@ export function initPluginAPI<Extends extends CLIPluginExtends>({
}

function updateAppContext(updateContext: DeepPartial<AppContext<Extends>>) {
context = merge(context, updateContext);
context = assign(context, updateContext);
}

const pluginAPI = {
Expand Down
4 changes: 2 additions & 2 deletions packages/toolkit/plugin-v2/src/runtime/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { merge } from '@modern-js/runtime-utils/merge';
import { assign } from '@modern-js/runtime-utils/merge';
import type { PluginHook } from '../types';
import type { PluginManager } from '../types/plugin';
import type {
Expand Down Expand Up @@ -40,7 +40,7 @@ export function initPluginAPI<Extends extends RuntimePluginExtends>({
function updateRuntimeContext(
updateContext: DeepPartial<RuntimeContext & Extends['extendContext']>,
) {
context = merge(context, updateContext);
context = assign(context, updateContext);
}

function getHooks() {
Expand Down

0 comments on commit 331f9e9

Please sign in to comment.