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: rename mana-syringe as ioc #376

Merged
merged 1 commit into from
Feb 7, 2025
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
6 changes: 3 additions & 3 deletions packages/libro-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"typings": "./es/l10n/index.js",
"default": "./es/l10n/index.js"
},
"./mana-syringe": {
"typings": "./es/mana-syringe/index.js",
"default": "./es/mana-syringe/index.js"
"./ioc": {
"typings": "./es/ioc/index.js",
"default": "./es/ioc/index.js"
},
"./mana-observable": {
"typings": "./es/mana-observable/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import { Container as InversifyContainer } from 'inversify';
import type { Disposable } from '../common/index.js';
import { DisposableCollection, Emitter } from '../common/index.js';

import { ContainerAPI } from './container-api';
import { Syringe } from './core';
import { Utils } from './core';
import { ContainerAPI } from './container-api.js';
import { Syringe } from './core.js';
import { Utils } from './core.js';
import {
GlobalContainer as InversifyGlobalContainer,
namedToIdentifier,
tokenToIdentifier,
} from './inversify-api';
import type { InversifyContext } from './inversify-api/inversify-protocol';
import { isSyringeModule } from './module';
import { Register } from './register';
} from './inversify-api/index.js';
import type { InversifyContext } from './inversify-api/inversify-protocol.js';
import { isSyringeModule } from './module/index.js';
import { Register } from './register.js';

export const ContainerMeta = Symbol('ContainerMeta');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Event } from '../../common/index.js';
import { Syringe } from '../core';
import { Syringe } from '../core.js';

export type Option = {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { Disposable } from '../../common/index.js';
import { Emitter } from '../../common/index.js';
import { DisposableCollection } from '../../common/index.js';
import type { Syringe } from '../core';
import type { Syringe } from '../core.js';

import {
ContributionOptionConfig,
type Option,
type Provider,
} from './contribution-protocol';
} from './contribution-protocol.js';

export class DefaultContributionProvider<T extends Record<string, any>>
implements Provider<T>, Disposable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import assert from 'assert';

import { GlobalContainer } from '../container';
import { register } from '../container';
import { Contribution, contrib } from '../contribution/index';
import { Contribution, contrib } from './index';
import { Syringe } from '../core';
import { inject, singleton } from '../decorator';
import { Module } from '../module/index';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Newable } from '../../common/index.js';
import { Syringe } from '../core';
import { transient } from '../decorator';
import { registerSideOption } from '../side-option';
import { Syringe } from '../core.js';
import { transient } from '../decorator.js';
import { registerSideOption } from '../side-option.js';

export const AutoFactoryOption = Syringe.defineToken('AutoFactoryOption');
export const AutoFactoryMeta = Syringe.defineToken('AutoFactoryMeta', {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Priority } from '../../common/index.js';
import type { Newable } from '../../common/index.js';
import type { Contribution } from '../contribution/index';
import { Syringe } from '../core';
import { singleton } from '../decorator';
import { registerSideOption } from '../side-option';
import { Syringe } from '../core.js';
import { singleton } from '../decorator.js';
import { registerSideOption } from '../side-option.js';

export interface PrioritizedContribution<O = any, T = any> {
canHandle: (option: O) => number;
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApplicationContribution, localStorageService } from '../mana-core/index.js';
import { inject, singleton } from '../mana-syringe/index.js';
import { inject, singleton } from '../ioc/index.js';

import { NotificationService } from './notification/service';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { Emitter } from '../../common/index.js';
import type { URI } from '../../common/index.js';
import { singleton } from '../../mana-syringe/index.js';
import { singleton } from '../../ioc/index.js';

import type {
CopyFileOptions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { URI } from '../../common/index.js';
import { singleton, inject } from '../../mana-syringe/index.js';
import { singleton, inject } from '../../ioc/index.js';

import type { DidChangeLabelEvent } from '../label';
import { LabelProvider, LabelProviderContribution, URIIconReference } from '../label';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// import { Modal } from 'antd';
import { Deferred } from '../../common/index.js';
import { URI } from '../../common/index.js';
import { inject, postConstruct, singleton } from '../../mana-syringe/index.js';
import { inject, postConstruct, singleton } from '../../ioc/index.js';

import { LabelProvider } from '../label';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ManaModule, SelectionService, view } from '../../mana-core/index.js';
import { ViewInstance } from '../../mana-core/index.js';
import type { MenuPath } from '../../mana-core/index.js';
import { useInject } from '../../mana-observable/index.js';
import { singleton, inject } from '../../mana-syringe/index.js';
import { singleton, inject } from '../../ioc/index.js';
import { LabelProvider } from '../label';
import { TreeModel } from '../tree';
import { CompositeTreeNode, TreeNode } from '../tree/tree';
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/file-tree/file-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-use-before-define */
import type { URI } from '../../common/index.js';
import { getOrigin } from '../../mana-observable/index.js';
import { inject, singleton } from '../../mana-syringe/index.js';
import { inject, singleton } from '../../ioc/index.js';

import type { TreeNode, CompositeTreeNode } from '../tree/tree';
import { Tree } from '../tree/tree';
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const ManaAppPreset = ManaModule.create()
NotificationModule,
);

export * from '../mana-syringe/index.js';
export * from '../ioc/index.js';
export * from '../mana-observable/index.js';
export * from '../common/index.js';
export * from '../mana-core/index.js';
9 changes: 2 additions & 7 deletions packages/libro-common/src/mana-app/label/label-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ import type { Event } from '../../common/index.js';
import { URI, Priority } from '../../common/index.js';
import { Emitter, Disposable } from '../../common/index.js';
import { ApplicationContribution } from '../../mana-core/index.js';
import type { Contribution } from '../../mana-syringe/index.js';
import {
contrib,
postConstruct,
singleton,
Syringe,
} from '../../mana-syringe/index.js';
import type { Contribution } from '../../ioc/index.js';
import { contrib, postConstruct, singleton, Syringe } from '../../ioc/index.js';
import fileIcons from 'file-icons-js';

export type ResourceLabelFormatter = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ColorRegistry } from '../../mana-core/index.js';
import { Color } from '../../mana-core/index.js';
import { ColorContribution } from '../../mana-core/index.js';
import { singleton } from '../../mana-syringe/index.js';
import { singleton } from '../../ioc/index.js';

@singleton({ contrib: ColorContribution })
export class MenuColorRegistry implements ColorContribution {
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/menu/menu-render.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { MenuPath } from '../../mana-core/index.js';
import { useInject, ObservableContext } from '../../mana-observable/index.js';
import type { Syringe } from '../../mana-syringe/index.js';
import type { Syringe } from '../../ioc/index.js';
import type { FC } from 'react';
import { memo, useEffect, useState, useContext, useMemo } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { MenuItem } from '../../mana-core/index.js';
import { CommandRegistry, MenuRegistry } from '../../mana-core/index.js';
import { prop } from '../../mana-observable/index.js';
import { Menu as MenuComponent } from '../../react/index.js';
import { inject, transient } from '../../mana-syringe/index.js';
import { inject, transient } from '../../ioc/index.js';

import { MenuItemRender } from './menu-item-render';
import type { MenuData, MenuItemState } from './menu-protocol';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApplicationContribution } from '../../mana-core/index.js';
import { inject } from '../../mana-syringe/index.js';
import { singleton } from '../../mana-syringe/index.js';
import { inject } from '../../ioc/index.js';
import { singleton } from '../../ioc/index.js';

import { ModalService } from './modal-service';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Syringe } from '../../mana-syringe/index.js';
import { Syringe } from '../../ioc/index.js';

export interface ModalItemProps<T> {
modalItem: ModalItem<T>;
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/modal/modal-render.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BaseView, view } from '../../mana-core/index.js';
import { useInject } from '../../mana-observable/index.js';
import { singleton } from '../../mana-syringe/index.js';
import { singleton } from '../../ioc/index.js';
import React from 'react';

import { ModalService } from './modal-service';
Expand Down
4 changes: 2 additions & 2 deletions packages/libro-common/src/mana-app/modal/modal-service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Disposable } from '../../common/index.js';
import { prop } from '../../mana-observable/index.js';
import type { Contribution } from '../../mana-syringe/index.js';
import { contrib, singleton } from '../../mana-syringe/index.js';
import type { Contribution } from '../../ioc/index.js';
import { contrib, singleton } from '../../ioc/index.js';

import type { ModalItem, ModalItemProps } from './modal-protocol';
import { renderModal, ModalContribution } from './modal-protocol';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { notification } from '../../react/index.js';
import { v1 } from 'uuid';

import { Disposable } from '../../common/index.js';
import { singleton } from '../../mana-syringe/index.js';
import { singleton } from '../../ioc/index.js';

import type { NotificationConfig, NotificationAction } from './protocol';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-use-before-define */
import { ToolbarRegistry, ToolbarInstance, useUnmount } from '../../mana-core/index.js';
import { useInject, ObservableContext } from '../../mana-observable/index.js';
import type { Syringe } from '../../mana-syringe/index.js';
import type { Syringe } from '../../ioc/index.js';
import { useEffect, memo, useState, useContext, useMemo } from 'react';

import type { Toolbar } from './toolbar';
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/toolbar/toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '../../mana-core/index.js';
import { l10n } from '../../l10n/index.js';
import { getOrigin, prop } from '../../mana-observable/index.js';
import { inject, transient } from '../../mana-syringe/index.js';
import { inject, transient } from '../../ioc/index.js';

import { ToolbarItemRender } from './toolbar-item-render';
import type { ToolbarItemState } from './toolbar-protocol';
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/tree/tree-decorator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Event, Disposable, MaybePromise } from '../../common/index.js';
import { Emitter, DisposableCollection } from '../../common/index.js';
import { singleton } from '../../mana-syringe/index.js';
import { singleton } from '../../ioc/index.js';

import type { Tree, TreeNode } from './tree';
import type { TreeViewDecorationData } from './tree-view-decoration';
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/tree/tree-expansion.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Event, Disposable } from '../../common/index.js';
import { Emitter } from '../../common/index.js';
import { singleton, inject, postConstruct } from '../../mana-syringe/index.js';
import { singleton, inject, postConstruct } from '../../ioc/index.js';

import type { TreeNode } from './tree';
import { CompositeTreeNode, Tree } from './tree';
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/tree/tree-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { timeout } from '../../common/index.js';
import { CancellationTokenSource } from '../../common/index.js';
import { DisposableCollection } from '../../common/index.js';
import { Emitter, WaitUntilEvent } from '../../common/index.js';
import { singleton } from '../../mana-syringe/index.js';
import { singleton } from '../../ioc/index.js';

import type { TreeNode } from './tree';
import { Tree, CompositeTreeNode } from './tree';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { singleton } from '../../mana-syringe/index.js';
import { singleton } from '../../ioc/index.js';

import { LabelProviderContribution } from '../label/label-provider';

Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/tree/tree-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { Event, WaitUntilEvent, CancellationToken } from '../../common/index.js';
import { Emitter, DisposableCollection } from '../../common/index.js';
import type { SelectionProvider } from '../../mana-core/index.js';
import { inject, singleton, postConstruct } from '../../mana-syringe/index.js';
import { inject, singleton, postConstruct } from '../../ioc/index.js';

import type { TreeNode } from './tree';
import { Tree, CompositeTreeNode } from './tree';
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/tree/tree-navigation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { singleton } from '../../mana-syringe/index.js';
import { singleton } from '../../ioc/index.js';

import type { TreeNode } from './tree';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Event } from '../../common/index.js';
import { Emitter } from '../../common/index.js';
import { singleton, inject, postConstruct } from '../../mana-syringe/index.js';
import { singleton, inject, postConstruct } from '../../ioc/index.js';

import type { TreeNode } from './tree';
import { Tree } from './tree';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import debounce from 'lodash.debounce';
import type { Disposable } from '../../../common/index.js';
import { DisposableCollection } from '../../../common/index.js';
import { notEmpty } from '../../../common/index.js';
import { inject, postConstruct, singleton } from '../../../mana-syringe/index.js';
import { inject, postConstruct, singleton } from '../../../ioc/index.js';
import type { TreeNode } from '../tree';
import { DecoratedTreeNode, TreeDecoratorService } from '../tree-decorator';
import { TreeModel } from '../tree-model';
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/tree/view/tree-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from '../../../mana-core/index.js';
import { getOrigin, prop, useInject } from '../../../mana-observable/index.js';
import { Dropdown } from '../../../react/index.js';
import { inject, postConstruct, singleton } from '../../../mana-syringe/index.js';
import { inject, postConstruct, singleton } from '../../../ioc/index.js';
import { LabelProvider } from '../../label';
import { MenuRender } from '../../menu';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/view/box/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ViewInstance } from '../../../mana-core/index.js';
import type { SlotViewOption } from '../../../mana-core/index.js';
import { prop, useInject } from '../../../mana-observable/index.js';
import { BoxPanel } from '../../../react/index.js';
import { inject, transient } from '../../../mana-syringe/index.js';
import { inject, transient } from '../../../ioc/index.js';
import React from 'react';

type Direction = 'left-to-right' | 'right-to-left' | 'top-to-bottom' | 'bottom-to-top';
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/view/flex/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { ViewInstance } from '../../../mana-core/index.js';
import type { SlotViewOption } from '../../../mana-core/index.js';
import { prop, useInject } from '../../../mana-observable/index.js';
import { inject, transient } from '../../../mana-syringe/index.js';
import { inject, transient } from '../../../ioc/index.js';
import cls from 'classnames';
import React from 'react';
import './index.less';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DefaultSlotView, view, Slot } from '../../../mana-core/index.js';
import { BoxPanel } from '../../../react/index.js';
import { singleton } from '../../../mana-syringe/index.js';
import { singleton } from '../../../ioc/index.js';
import * as React from 'react';
import './index.less';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { view, ViewManager, ViewOption } from '../../../mana-core/index.js';
import type { TabsProps } from '../../../react/index.js';
import { inject, transient } from '../../../mana-syringe/index.js';
import { inject, transient } from '../../../ioc/index.js';
import cls from 'classnames';

import type { TabOption } from './tab-view';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ViewManager } from '../../../mana-core/index.js';
import { view, ViewOption, ViewContext } from '../../../mana-core/index.js';
import { equals, prop } from '../../../mana-observable/index.js';
import type { TabsProps } from '../../../react/index.js';
import { inject, transient } from '../../../mana-syringe/index.js';
import { inject, transient } from '../../../ioc/index.js';
import cls from 'classnames';

import { ToolbarRender } from '../../toolbar/toolbar-render';
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/view/tab/tab-menu.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Command } from '../../../mana-core/index.js';
import { CommandContribution, CommandRegistry } from '../../../mana-core/index.js';
import { l10n } from '../../../l10n/index.js'; /* eslint-disable max-len, @typescript-eslint/indent */
import { inject, singleton } from '../../../mana-syringe/index.js';
import { inject, singleton } from '../../../ioc/index.js';

export const CLOSE_TAB: Command = {
id: 'tab.close',
Expand Down
2 changes: 1 addition & 1 deletion packages/libro-common/src/mana-app/view/tab/tab-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useInject } from '../../../mana-observable/index.js';
import { prop } from '../../../mana-observable/index.js';
import { Tabs, Dropdown } from '../../../react/index.js';
import type { TabPaneProps, TabsProps } from '../../../react/index.js';
import { inject, transient } from '../../../mana-syringe/index.js';
import { inject, transient } from '../../../ioc/index.js';
import classnames from 'classnames';
import type { ReactNode } from 'react';
import { forwardRef } from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Event } from '../../common/index.js';
import { Emitter, Deferred } from '../../common/index.js';
import { prop } from '../../mana-observable/index.js';
import { inject, singleton } from '../../mana-syringe/index.js';
import { inject, singleton } from '../../ioc/index.js';
import { DebugService } from '../common/debug';

export enum ApplicationState {
Expand Down
Loading
Loading