-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(devtools): merge mountpoint into client package
- Loading branch information
Showing
95 changed files
with
132 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { parseQuery } from 'ufo'; | ||
import routesManifest from '../dist/routes-manifest.json'; | ||
|
||
/** | ||
* @param {import('@modern-js/devtools-kit').SetupClientOptions} options | ||
*/ | ||
const mountDevTools = options => { | ||
const container = document.createElement('div'); | ||
container.className = '_modern_js_devtools_container'; | ||
document.body.appendChild(container); | ||
|
||
const shadow = container.attachShadow({ mode: 'closed' }); | ||
|
||
for (const asset of routesManifest.routeAssets.mount.assets) { | ||
if (asset.endsWith('.js')) { | ||
const el = document.createElement('script'); | ||
el.src = asset; | ||
shadow.appendChild(el); | ||
} else if (asset.endsWith('.css')) { | ||
const el = document.createElement('link'); | ||
el.href = asset; | ||
el.rel = 'stylesheet'; | ||
shadow.appendChild(el); | ||
} | ||
} | ||
|
||
const app = document.createElement('div'); | ||
app.className = '_modern_js_devtools_mountpoint theme-register'; | ||
const appGlobalExport = `_modern_js_devtools_app`; | ||
window[appGlobalExport] = { | ||
container: app, | ||
options, | ||
}; | ||
shadow.appendChild(app); | ||
}; | ||
|
||
try { | ||
// eslint-disable-next-line no-undef | ||
const opts = parseQuery(__resourceQuery); | ||
mountDevTools(opts); | ||
} catch (err) { | ||
const e = new Error('Failed to execute mount point of DevTools.'); | ||
e.cause = err; | ||
console.error(e); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...c/routes/config/[toolkit].[type]/page.tsx → ...t/routes/config/[toolkit].[type]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...lient/src/routes/context/builder/page.tsx → ...rc/client/routes/context/builder/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ent/src/routes/context/framework/page.tsx → .../client/routes/context/framework/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ient/src/routes/context/layout.config.tsx → ...c/client/routes/context/layout.config.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ools/client/src/routes/layout.module.scss → ...ient/src/client/routes/layout.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/devtools/client/src/rpc/index.ts → ...s/devtools/client/src/client/rpc/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
|
||
button { | ||
cursor: pointer; | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/// <reference types='@modern-js/app-tools/types' /> | ||
/// <reference types='@modern-js/runtime/types' /> | ||
/// <reference types='@modern-js/runtime/types/router' /> | ||
|
||
declare let __resourceQuery: string; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { createRoot } from 'react-dom/client'; | ||
import DevtoolsAction from './components/Devtools/Action'; | ||
|
||
// @ts-expect-error | ||
const { container, options } = window._modern_js_devtools_app; | ||
const root = createRoot(container); | ||
root.render(<DevtoolsAction {...options} />); |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import type { ClientDefinition } from './client'; | ||
|
||
export interface MountPointFunctions { | ||
getLocation: () => string; | ||
} | ||
|
||
export interface SetupClientOptions extends Record<string, any> { | ||
endpoint?: string; | ||
dataSource?: string; | ||
def?: ClientDefinition; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.