Skip to content

Commit

Permalink
feat: migrate garfish plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
caohuilin committed Dec 18, 2024
1 parent 5c95f72 commit e3ca27e
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 203 deletions.
2 changes: 1 addition & 1 deletion packages/runtime/plugin-garfish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"test": "jest --passWithNoTests"
},
"dependencies": {
"@modern-js/plugin": "workspace:*",
"@modern-js/plugin-v2": "workspace:*",
"@modern-js/runtime-utils": "workspace:*",
"@modern-js/utils": "workspace:*",
"@swc/helpers": "0.5.13",
Expand Down
10 changes: 5 additions & 5 deletions packages/runtime/plugin-garfish/src/cli/code.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import path from 'path';
import type {
AppTools,
IAppContext,
AppToolsContext,
AppToolsFeatureHooks,
NormalizedConfig,
} from '@modern-js/app-tools';
import type { MaybeAsync } from '@modern-js/plugin';
import type { Entrypoint } from '@modern-js/types';
import { fs } from '@modern-js/utils';
import * as template from './template';
Expand All @@ -15,9 +15,9 @@ export const ENTRY_BOOTSTRAP_FILE_NAME = 'bootstrap.jsx';

export const generateCode = async (
entrypoints: Entrypoint[],
appContext: IAppContext,
appContext: AppToolsContext<'shared'>,
config: NormalizedConfig<AppTools>,
appendEntryCode: (input: { entrypoint: Entrypoint }) => MaybeAsync<string[]>,
hooks: AppToolsFeatureHooks<'shared'>,
) => {
const { mountId } = config.html;
const { enableAsyncEntry } = config.source;
Expand All @@ -27,7 +27,7 @@ export const generateCode = async (
entrypoints.map(async entrypoint => {
const { entryName, isAutoMount, entry, customEntry, customBootstrap } =
entrypoint;
const appendCode = await appendEntryCode({ entrypoint });
const appendCode = await hooks.appendEntryCode.call({ entrypoint });

if (isAutoMount) {
// index.jsx
Expand Down
Loading

0 comments on commit e3ca27e

Please sign in to comment.