Skip to content

Commit

Permalink
chore: jupyter增加无编辑器的导出,避免集成方webpack配置需要调整
Browse files Browse the repository at this point in the history
  • Loading branch information
xunhe.lzy authored and zhanba committed Oct 17, 2024
1 parent bc14969 commit 18a7678
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/libro-jupyter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"typings": "./es/index.d.ts",
"default": "./es/index.js"
},
"./noeditor": {
"typings": "./es/index-noeditor.d.ts",
"default": "./es/index-noeditor.js"
},
"./mock": {
"typings": "./es/mock/index.d.ts",
"default": "./es/mock/index.js"
Expand Down
33 changes: 33 additions & 0 deletions packages/libro-jupyter/src/index-noeditor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export * from '@difizen/libro-code-cell';
export * from '@difizen/libro-code-editor';
export * from '@difizen/libro-common';
export * from '@difizen/libro-core';
export * from '@difizen/libro-kernel';
export * from '@difizen/libro-l10n';
export * from '@difizen/libro-lsp';
export * from '@difizen/libro-markdown-cell';
export * from '@difizen/libro-output';
export * from '@difizen/libro-raw-cell';
export * from '@difizen/libro-rendermime';
export * from '@difizen/libro-search';
export * from '@difizen/libro-search-code-cell';
export * from './add-between-cell/index.js';
export * from './cell/index.js';
export * from './command/index.js';
export * from './components/index.js';
export * from './config/index.js';
export * from './contents/index.js';
export * from './keybind-instructions/index.js';
export * from './libro-jupyter-file-service.js';
export * from './libro-jupyter-model.js';
export * from './libro-jupyter-protocol.js';
export * from './libro-jupyter-server-launch-manager.js';
export * from './module-noeditor.js';
export * from './output/index.js';
export * from './rendermime/index.js';
export * from './theme/index.js';
export * from './toolbar/index.js';
export * from './file/index.js';
export * from './libro-jupyter-view.js';
export * from './config/index.js';
export * from './widget/index.js';
116 changes: 116 additions & 0 deletions packages/libro-jupyter/src/module-noeditor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import {
CodeCellModule,
LibroCodeCellModel,
LibroCodeCellView,
} from '@difizen/libro-code-cell';
import {
CellExecutionTimeProvider,
CellOutputBottomBlankProvider,
LibroAddCellModule,
LibroKeybindRegistry,
LibroModel,
LibroModule,
LibroToolbarModule,
} from '@difizen/libro-core';
import { LibroKernelManageModule } from '@difizen/libro-kernel';
import { MarkdownCellModule } from '@difizen/libro-markdown-cell';
import {
DisplayDataOutputModule,
ErrorOutputModule,
StreamOutputModule,
} from '@difizen/libro-output';
import { RawCellModule } from '@difizen/libro-raw-cell';
import { LibroSearchModule } from '@difizen/libro-search';
import { SearchCodeCellModule } from '@difizen/libro-search-code-cell';
import { ManaModule } from '@difizen/mana-app';

import { LibroBetweenCellModule } from './add-between-cell/index.js';
import { JupyterCodeCellModel, JupyterCodeCellView } from './cell/index.js';
import {
LibroJupyterCommandContribution,
LibroJupyterKeybindingContribution,
} from './command/index.js';
import { CellOutputBottomBlank } from './components/cell-output-bottom-blank.js';
import { CellExecutionTip } from './components/index.js';
import {
ConfigAppContribution,
LibroJupyterSettingContribution,
} from './config/index.js';
import { LibroJupyterContentContribution } from './contents/index.js';
import { LibroJupyterContentSaveContribution } from './contents/save-content-contribution.js';
import { LibroJupyterFileModule } from './file/index.js';
import { KeybindInstructionsModule } from './keybind-instructions/index.js';
import { LibroJupyterFileService } from './libro-jupyter-file-service.js';
import { LibroJupyterModel } from './libro-jupyter-model.js';
import { KernelStatusAndSelectorProvider } from './libro-jupyter-protocol.js';
import { JupyterServerLaunchManager } from './libro-jupyter-server-launch-manager.js';
import { LibroJupyterView } from './libro-jupyter-view.js';
import { LibroJupyterOutputArea } from './output/index.js';
import { PlotlyModule } from './rendermime/index.js';
import { LibroJupyterColorContribution } from './theme/index.js';
import {
KernelStatusSelector,
LibroJupyterToolbarContribution,
SaveFileErrorContribution,
} from './toolbar/index.js';
import { WidgetModule } from './widget/index.js';

/**
* 去除editor和lsp依赖的jupyter module,在opensumi场景使用
*/
export const LibroJupyterNoEditorModule = ManaModule.create()
.register(
LibroJupyterFileService,
LibroJupyterCommandContribution,
LibroJupyterKeybindingContribution,
LibroJupyterToolbarContribution,
ConfigAppContribution,
SaveFileErrorContribution,
LibroKeybindRegistry,
LibroJupyterContentContribution,
LibroJupyterContentSaveContribution,
LibroJupyterOutputArea,
LibroJupyterColorContribution,
LibroJupyterSettingContribution,
JupyterServerLaunchManager,
LibroJupyterView,
{
token: CellExecutionTimeProvider,
useValue: CellExecutionTip,
},
{
token: CellOutputBottomBlankProvider,
useValue: CellOutputBottomBlank,
},
{
token: KernelStatusAndSelectorProvider,
useValue: KernelStatusSelector,
},
{
token: LibroModel,
useClass: LibroJupyterModel,
},
{ token: LibroCodeCellModel, useClass: JupyterCodeCellModel },
{ token: LibroCodeCellView, useClass: JupyterCodeCellView },
)
.dependOn(
LibroModule,
CodeCellModule,
MarkdownCellModule,
RawCellModule,
StreamOutputModule,
ErrorOutputModule,
DisplayDataOutputModule,
LibroToolbarModule,
LibroKernelManageModule,
LibroSearchModule,
SearchCodeCellModule,
LibroAddCellModule,

// custom module
LibroBetweenCellModule,
KeybindInstructionsModule,
PlotlyModule,
LibroJupyterFileModule,
WidgetModule,
);
3 changes: 2 additions & 1 deletion packages/libro-jupyter/src/toolbar/run-selector.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PlayCircleOutlined } from '@ant-design/icons';
import type { LibroToolbarArags, LibroView } from '@difizen/libro-core';
import { NotebookCommands, ExecutableCellModel } from '@difizen/libro-core';
import { ServerManager } from '@difizen/libro-kernel';
import {
useInject,
ToolbarInstance,
Expand All @@ -15,7 +16,7 @@ import { Menu, Dropdown, Tooltip } from 'antd';
import type { MenuProps } from 'antd';
import { useEffect, useState } from 'react';

import { LibroJupyterConfiguration, ServerManager } from '../index.js';
import { LibroJupyterConfiguration } from '../config/config.js';
import type { LibroJupyterModel } from '../libro-jupyter-model.js';
import { kernelPrepared } from '../utils/index.js';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { l10n } from '@difizen/mana-l10n';
import { Popover, Tooltip } from 'antd';
import { useEffect, useState } from 'react';

import { LibroJupyterConfiguration } from '../index.js';
import { LibroJupyterConfiguration } from '../config/index.js';
import type { LibroJupyterModel } from '../libro-jupyter-model.js';
import { kernelPrepared } from '../utils/index.js';

Expand Down

0 comments on commit 18a7678

Please sign in to comment.