Skip to content

Commit

Permalink
feat: the runtime path use the meta alias in garfish provider (#5949)
Browse files Browse the repository at this point in the history
  • Loading branch information
caohuilin authored Jul 15, 2024
1 parent 1e85b76 commit 3912bdc
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .changeset/curvy-mangos-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@modern-js/plugin-router-v5': patch
'@modern-js/plugin-garfish': patch
---

feat: the runtime path use the meta alias in garfish provider

feat: 在 garfish provider 函数中使用 runtime 别名路径
2 changes: 2 additions & 0 deletions packages/runtime/plugin-garfish/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ export const garfishPlugin = (): CliPlugin<
source: {
alias: {
[`@${metaName}/runtime/garfish`]: `@${metaName}/plugin-garfish/runtime`,
'@meta/runtime/browser': '@modern-js/runtime/browser',
'@meta/runtime/react': '@modern-js/runtime/react',
},
},
tools: {
Expand Down
8 changes: 8 additions & 0 deletions packages/runtime/plugin-garfish/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
/// <reference types="@modern-js/types" />

declare module '@meta/runtime/react' {
export * from '@modern-js/runtime/react';
}

declare module '@meta/runtime/browser' {
export * from '@modern-js/runtime/browser';
}
2 changes: 1 addition & 1 deletion packages/runtime/plugin-garfish/src/runtime/provider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createRoot } from '@modern-js/runtime/react';
import { createRoot } from '@meta/runtime/react';
import type { Root } from 'react-dom/client';
import { createPortal, unmountComponentAtNode } from 'react-dom';
import { garfishRender } from './render';
Expand Down
4 changes: 2 additions & 2 deletions packages/runtime/plugin-garfish/src/runtime/render.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render } from '@modern-js/runtime/browser';
import { createRoot } from '@modern-js/runtime/react';
import { render } from '@meta/runtime/browser';
import { createRoot } from '@meta/runtime/react';

declare const __GARFISH_EXPORTS__: string;

Expand Down
3 changes: 2 additions & 1 deletion packages/runtime/plugin-router-v5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
},
"peerDependencies": {
"react": ">=17",
"react-dom": ">=17"
"react-dom": ">=17",
"@modern-js/runtime": "workspace:^2.55.0"
},
"devDependencies": {
"@modern-js/app-tools": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/garfish/app-dashboard/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const sleep = () =>

export default (_App: React.ComponentType, bootstrap: () => void) => {
// do something before bootstrap...
sleep().then(() => {
bootstrap();
return sleep().then(() => {
return bootstrap();
});
};

0 comments on commit 3912bdc

Please sign in to comment.