Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: update codeblitz module #53

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"description": "codeblitzjs",
"main": "index.js",
"engines": {
"opensumi": "2.27.1"
"opensumi": "2.27.3-next-1709815848.0"
},
"scripts": {
"prepare": "husky install",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"@codeblitzjs/ide-common": "1.1.0",
"@opensumi/ide-extension": "2.27.1",
"@opensumi/ide-extension": "2.27.3-next-1709815848.0",
"async-retry": "^1.3.1",
"await-event": "^2.1.0",
"commander": "^7.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const install = async (
} else {
const extensionConfig = await getExtensionFromPackage();
if (!extensionConfig.length && !options?.silent) {
log.warn(`当前未配置 ${EXTENSION_FIELD} npx alex ext -h 查看帮助`);
log.warn(`当前未配置 ${EXTENSION_FIELD} npx codeblitz ext -h 查看帮助`);
return;
}
checkExtensionConfig(extensionConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
},
"packageJSON": {
"name": "css-language-features-worker",
"publisher": "alex",
"publisher": "codeblitz",
"version": "1.53.0-patch.1",
"displayName": "%displayName%",
"description": "%description%",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/extensions/codeblitz.gitlens.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
"name": "gitlens",
"publisher": "codeblitz",
"version": "10.2.4",
"description": "gitlens for alex",
"description": "gitlens for codeblitz",
"icon": "images/gitlens-icon.png",
"activationEvents": [
"*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
},
"packageJSON": {
"name": "html-language-features-worker",
"publisher": "alex",
"publisher": "codeblitz",
"version": "1.53.0-patch.1",
"displayName": "%displayName%",
"description": "%description%",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
},
"packageJSON": {
"name": "json-language-features-worker",
"publisher": "alex",
"publisher": "codeblitz",
"version": "1.53.0-patch.2",
"displayName": "%displayName%",
"description": "%description%",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
},
"packageJSON": {
"name": "markdown-language-features-worker",
"publisher": "alex",
"publisher": "codeblitz",
"version": "1.53.0-patch.2",
"displayName": "%displayName%",
"description": "%description%",
Expand Down
2 changes: 0 additions & 2 deletions packages/core/extensions/codeblitz.odc-theme.d.ts

This file was deleted.

35 changes: 0 additions & 35 deletions packages/core/extensions/codeblitz.odc-theme.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
},
"packageJSON": {
"name": "typescript-language-features-worker",
"publisher": "alex",
"publisher": "codeblitz",
"version": "1.53.0-patch.3",
"displayName": "%displayName%",
"description": "%description%",
Expand Down
92 changes: 46 additions & 46 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "@codeblitzjs/ide-core",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"unpkg": "bundle/alex.global.js",
"unpkg": "bundle/codeblitz.global.js",
"files": [
"lib",
"bin",
Expand Down Expand Up @@ -33,56 +33,56 @@
"@codeblitzjs/ide-plugin": "1.1.0",
"@codeblitzjs/ide-registry": "1.1.0",
"@codeblitzjs/ide-sumi-core": "1.1.0",
"@opensumi/ide-addons": "2.27.1",
"@opensumi/ide-comments": "2.27.1",
"@opensumi/ide-core-browser": "2.27.1",
"@opensumi/ide-core-common": "2.27.1",
"@opensumi/ide-debug": "2.27.1",
"@opensumi/ide-decoration": "2.27.1",
"@opensumi/ide-editor": "2.27.1",
"@opensumi/ide-explorer": "2.27.1",
"@opensumi/ide-express-file-server": "2.27.1",
"@opensumi/ide-extension": "2.27.1",
"@opensumi/ide-extension-storage": "2.27.1",
"@opensumi/ide-file-scheme": "2.27.1",
"@opensumi/ide-file-service": "2.27.1",
"@opensumi/ide-file-tree-next": "2.27.1",
"@opensumi/ide-i18n": "2.27.1",
"@opensumi/ide-keymaps": "2.27.1",
"@opensumi/ide-logs": "2.27.1",
"@opensumi/ide-main-layout": "2.27.1",
"@opensumi/ide-markdown": "2.27.1",
"@opensumi/ide-markers": "2.27.1",
"@opensumi/ide-menu-bar": "2.27.1",
"@opensumi/ide-monaco": "2.27.1",
"@opensumi/ide-monaco-enhance": "2.27.1",
"@opensumi/ide-opened-editor": "2.27.1",
"@opensumi/ide-outline": "2.27.1",
"@opensumi/ide-output": "2.27.1",
"@opensumi/ide-overlay": "2.27.1",
"@opensumi/ide-preferences": "2.27.1",
"@opensumi/ide-quick-open": "2.27.1",
"@opensumi/ide-scm": "2.27.1",
"@opensumi/ide-search": "2.27.1",
"@opensumi/ide-static-resource": "2.27.1",
"@opensumi/ide-status-bar": "2.27.1",
"@opensumi/ide-storage": "2.27.1",
"@opensumi/ide-testing": "2.27.1",
"@opensumi/ide-theme": "2.27.1",
"@opensumi/ide-toolbar": "2.27.1",
"@opensumi/ide-variable": "2.27.1",
"@opensumi/ide-webview": "2.27.1",
"@opensumi/ide-workspace": "2.27.1",
"@opensumi/ide-workspace-edit": "2.27.1",
"@opensumi/ide-addons": "2.27.3-next-1709815848.0",
"@opensumi/ide-comments": "2.27.3-next-1709815848.0",
"@opensumi/ide-core-browser": "2.27.3-next-1709815848.0",
"@opensumi/ide-core-common": "2.27.3-next-1709815848.0",
"@opensumi/ide-debug": "2.27.3-next-1709815848.0",
"@opensumi/ide-decoration": "2.27.3-next-1709815848.0",
"@opensumi/ide-editor": "2.27.3-next-1709815848.0",
"@opensumi/ide-explorer": "2.27.3-next-1709815848.0",
"@opensumi/ide-express-file-server": "2.27.3-next-1709815848.0",
"@opensumi/ide-extension": "2.27.3-next-1709815848.0",
"@opensumi/ide-extension-storage": "2.27.3-next-1709815848.0",
"@opensumi/ide-file-scheme": "2.27.3-next-1709815848.0",
"@opensumi/ide-file-service": "2.27.3-next-1709815848.0",
"@opensumi/ide-file-tree-next": "2.27.3-next-1709815848.0",
"@opensumi/ide-i18n": "2.27.3-next-1709815848.0",
"@opensumi/ide-keymaps": "2.27.3-next-1709815848.0",
"@opensumi/ide-logs": "2.27.3-next-1709815848.0",
"@opensumi/ide-main-layout": "2.27.3-next-1709815848.0",
"@opensumi/ide-markdown": "2.27.3-next-1709815848.0",
"@opensumi/ide-markers": "2.27.3-next-1709815848.0",
"@opensumi/ide-menu-bar": "2.27.3-next-1709815848.0",
"@opensumi/ide-monaco": "2.27.3-next-1709815848.0",
"@opensumi/ide-monaco-enhance": "2.27.3-next-1709815848.0",
"@opensumi/ide-opened-editor": "2.27.3-next-1709815848.0",
"@opensumi/ide-outline": "2.27.3-next-1709815848.0",
"@opensumi/ide-output": "2.27.3-next-1709815848.0",
"@opensumi/ide-overlay": "2.27.3-next-1709815848.0",
"@opensumi/ide-preferences": "2.27.3-next-1709815848.0",
"@opensumi/ide-quick-open": "2.27.3-next-1709815848.0",
"@opensumi/ide-scm": "2.27.3-next-1709815848.0",
"@opensumi/ide-search": "2.27.3-next-1709815848.0",
"@opensumi/ide-static-resource": "2.27.3-next-1709815848.0",
"@opensumi/ide-status-bar": "2.27.3-next-1709815848.0",
"@opensumi/ide-storage": "2.27.3-next-1709815848.0",
"@opensumi/ide-testing": "2.27.3-next-1709815848.0",
"@opensumi/ide-theme": "2.27.3-next-1709815848.0",
"@opensumi/ide-toolbar": "2.27.3-next-1709815848.0",
"@opensumi/ide-variable": "2.27.3-next-1709815848.0",
"@opensumi/ide-webview": "2.27.3-next-1709815848.0",
"@opensumi/ide-workspace": "2.27.3-next-1709815848.0",
"@opensumi/ide-workspace-edit": "2.27.3-next-1709815848.0",
"@opensumi/textmate-languages": "^2.7.0",
"tslib": "^2.2.0"
},
"devDependencies": {
"@types/react": "^16.14.0",
"@types/react-dom": "^16.9.9"
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0"
},
"peerDependencies": {
"react": "^16.14.0",
"react-dom": "^16.14.0"
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
}
26 changes: 11 additions & 15 deletions packages/core/src/api/renderApp.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useRef, useMemo } from 'react';
import ReactDOM from 'react-dom';
import ReactDOMClient from 'react-dom/client';
import { IReporterService, localize, getDebugLogger } from '@opensumi/ide-core-common';
import { REPORT_NAME, RuntimeConfig } from '@codeblitzjs/ide-sumi-core';
import { createApp } from './createApp';
Expand All @@ -20,34 +20,30 @@ export const renderApp = (domElement: HTMLElement, props: IAppRendererProps) =>
const themeType = app.currentThemeType;
const className = opts.runtimeConfig.hideEditorTab ? styles['hide-editor-tab'] : '';

ReactDOM.render(
<Root status="loading" theme={themeType} Landing={Landing} className={className} />,
domElement
ReactDOMClient.createRoot(domElement).render(
<Root status="loading" theme={themeType} Landing={Landing} className={className} />
);

app
.start((appElement) => {
return new Promise((resolve) => {
ReactDOM.render(
return new Promise(() => {
ReactDOMClient.createRoot(domElement).render(
<Root status="success" theme={themeType} className={className}>
{appElement}
</Root>,
domElement,
resolve
{appElement(domElement)}
</Root>
);
});
})
.then(() => {
onLoad?.(app);
})
.catch((err: Error) => {
ReactDOM.render(
ReactDOMClient.createRoot(domElement).render(
<Root status="error" error={err?.message || localize('error.unknown')} theme={themeType} />,
domElement
);

(app.injector.get(IReporterService) as IReporterService).point(
REPORT_NAME.ALEX_APP_START_ERROR,
REPORT_NAME.CODEBLITZ_APP_START_ERROR,
err?.message,
{ error: err }
);
Expand Down Expand Up @@ -80,7 +76,7 @@ export const AppRenderer: React.FC<IAppRendererProps> = ({ onLoad, Landing, ...o
useEffect(() => {
app
.start((appElement) => {
appElementRef.current = appElement;
appElementRef.current = appElement({});
setState({ status: 'success' });
return Promise.resolve();
})
Expand All @@ -91,7 +87,7 @@ export const AppRenderer: React.FC<IAppRendererProps> = ({ onLoad, Landing, ...o
setState({ error: err?.message || localize('error.unknown'), status: 'error' });

(app.injector.get(IReporterService) as IReporterService).point(
REPORT_NAME.ALEX_APP_START_ERROR,
REPORT_NAME.CODEBLITZ_APP_START_ERROR,
err?.message,
{
error: err,
Expand Down
28 changes: 12 additions & 16 deletions packages/core/src/api/renderEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useRef, useMemo } from 'react';
import ReactDOM from 'react-dom';
import ReactDOMClient from 'react-dom/client';
import { IReporterService, localize, getDebugLogger } from '@opensumi/ide-core-common';
import { REPORT_NAME } from '@codeblitzjs/ide-sumi-core';
import { createEditor } from './createEditor';
Expand All @@ -19,39 +19,35 @@ interface IEditorRendererProps extends IConfig, EditorProps {
export const renderEditor = (domElement: HTMLElement, props: IEditorRendererProps) => {
const { onLoad, Landing, ...opts } = props;
const app = createEditor(opts);
const className = `codeblitz-editor ${
opts.runtimeConfig.hideEditorTab ? styles['hide-editor-tab'] : ''
}`;
const className = `codeblitz-editor ${opts.runtimeConfig.hideEditorTab ? styles['hide-editor-tab'] : ''
}`;

ReactDOM.render(<Root status="loading" Landing={Landing} className={className} />, domElement);
ReactDOMClient.createRoot(domElement).render(<Root status="loading" Landing={Landing} className={className} />);

app
.start((appElement) => {
return new Promise((resolve) => {
ReactDOM.render(
ReactDOMClient.createRoot(domElement).render(
<Root status="success" className={className}>
{appElement}
</Root>,
domElement,
resolve
{appElement(domElement)}
</Root>
);
});
})
.then(() => {
onLoad?.(app);
})
.catch((err: Error) => {
ReactDOM.render(
ReactDOMClient.createRoot(domElement).render(
<Root
status="error"
error={err?.message || localize('error.unknown')}
className={className}
/>,
domElement
);

(app.injector.get(IReporterService) as IReporterService).point(
REPORT_NAME.ALEX_APP_START_ERROR,
REPORT_NAME.CODEBLITZ_APP_START_ERROR,
err?.message,
{ error: err }
);
Expand Down Expand Up @@ -86,7 +82,7 @@ export const EditorRenderer: React.FC<IEditorRendererProps> = ({ onLoad, Landing

app
.start((appElement) => {
appElementRef.current = appElement;
appElementRef.current = appElement({});
setState({ status: 'success' });
return Promise.resolve();
})
Expand All @@ -97,7 +93,7 @@ export const EditorRenderer: React.FC<IEditorRendererProps> = ({ onLoad, Landing
setState({ error: err?.message || localize('error.unknown'), status: 'error' });

(app.injector.get(IReporterService) as IReporterService).point(
REPORT_NAME.ALEX_APP_START_ERROR,
REPORT_NAME.CODEBLITZ_APP_START_ERROR,
err?.message,
{
error: err,
Expand All @@ -120,7 +116,7 @@ export const EditorRenderer: React.FC<IEditorRendererProps> = ({ onLoad, Landing
);

return (
<Root {...state} Landing={Landing} className={`alex-editor ${rootClassName}`}>
<Root {...state} Landing={Landing} className={`codeblitz-editor ${rootClassName}`}>
{appElementRef.current}
</Root>
);
Expand Down
Loading
Loading