Skip to content

Commit

Permalink
Merge branch 'dev' into fix/editing-event
Browse files Browse the repository at this point in the history
  • Loading branch information
weird94 authored Feb 13, 2025
2 parents 6022e97 + 3ff69f1 commit f93fbbf
Show file tree
Hide file tree
Showing 109 changed files with 566 additions and 443 deletions.
4 changes: 3 additions & 1 deletion common/shared/eslint/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const jsdoc = require('eslint-plugin-jsdoc');
const eslintPluginReadableTailwind = require('eslint-plugin-readable-tailwind');
const noExternalImportsInFacade = require('./plugins/no-external-imports-in-facade');
const noFacadeImportsOutsideFacade = require('./plugins/no-facade-imports-outside-facade');
const noSelfPackageImports = require('./plugins/no-self-package-imports');

exports.baseRules = {
Expand Down Expand Up @@ -146,6 +147,7 @@ exports.typescriptPreset = () => {
rules: {
'no-external-imports-in-facade': noExternalImportsInFacade,
'no-self-package-imports': noSelfPackageImports,
'no-facade-imports-outside-facade': noFacadeImportsOutsideFacade,
},
},
},
Expand Down Expand Up @@ -186,6 +188,7 @@ exports.univerSourcePreset = () => {
],
rules: {
'univer/no-self-package-imports': 'error',
'univer/no-facade-imports-outside-facade': 'error',
},
languageOptions: {
parser: require('@typescript-eslint/parser'),
Expand All @@ -197,7 +200,6 @@ exports.facadePreset = () => {
return {
files: ['**/src/facade/**/*.ts'],
ignores: [
'**/core/src/**/*.ts',
'**/__tests__/**/*',
'**/*.spec.ts',
'**/*.test.ts',
Expand Down
82 changes: 82 additions & 0 deletions common/shared/eslint/plugins/no-facade-imports-outside-facade.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// no-facade-imports-outside-facade.js
const path = require('node:path');

const rule = {
meta: {
type: 'problem',
docs: {
description: 'Disallow imports containing facade in non-facade files',
},
messages: {
noFacadeImports: 'Imports containing "facade" are not allowed in non-facade files: "{{importPath}}"',
},
},

create(context) {
const filename = context.getFilename();
const normalizedPath = filename.split(path.sep).join('/');

const isInPackages = normalizedPath.includes('/packages/');
const isInFacade = normalizedPath.includes('/facade/');

if (!isInPackages || isInFacade) {
return {};
}

// get parent dir
const parentDirMatch = normalizedPath.match(/\/([^/]+)\/packages\//);
if (!parentDirMatch) {
return {};
}

const parentDir = parentDirMatch[1];
const packagePrefix = parentDir === 'univer'
? '@univerjs/' :
parentDir === 'univer-pro'
? '@univerjs-pro/' :
null;

if (!packagePrefix) {
return {};
}

return {
ImportDeclaration(node) {
const importPath = node.source.value;

// Check if the import path contains 'facade'
if (importPath.includes('facade')) {
context.report({
node,
messageId: 'noFacadeImports',
data: { importPath },
});
}
},
ExportNamedDeclaration(node) {
if (node.source) {
const exportPath = node.source.value;
if (exportPath.includes('facade')) {
context.report({
node,
messageId: 'noFacadeImports',
data: { importPath: exportPath },
});
}
}
},
ExportAllDeclaration(node) {
const exportPath = node.source.value;
if (exportPath.includes('facade')) {
context.report({
node,
messageId: 'noFacadeImports',
data: { importPath: exportPath },
});
}
},
};
},
};

module.exports = rule;
4 changes: 2 additions & 2 deletions common/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
},
"devDependencies": {
"@types/fs-extra": "^11.0.4",
"@univerjs/icons": "^0.2.14",
"@univerjs/icons-svg": "^0.2.14",
"@univerjs/icons": "^0.2.15",
"@univerjs/icons-svg": "^0.2.15",
"@univerjs/protocol": "0.1.43"
}
}
10 changes: 10 additions & 0 deletions common/shared/vite/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ export const peerDepsMap = {
name: 'rxjs',
version: 'rxjs',
},
'@wendellhu/redi': {
global: '@wendellhu/redi',
name: '@wendellhu/redi',
version: '0.17.1',
},
'@wendellhu/redi/react-bindings': {
global: '@wendellhu/redi/react-bindings',
name: '@wendellhu/redi',
version: '@wendellhu/redi',
},
vue: {
global: 'Vue',
name: 'vue',
Expand Down
2 changes: 1 addition & 1 deletion common/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@types/fs-extra": "^11.0.4",
"@univerjs-infra/shared": "workspace:*",
"fs-extra": "^11.3.0",
"postcss": "^8.5.1",
"postcss": "^8.5.2",
"tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7"
}
Expand Down
3 changes: 2 additions & 1 deletion examples-node/src/cases/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*/

import process from 'node:process';
import { awaitTime, FUniver } from '@univerjs/core';
import { awaitTime } from '@univerjs/core';
import { FUniver } from '@univerjs/core/facade';
import { createUniverOnNode } from '../sdk';

// From now on, Univer is a full-stack SDK.
Expand Down
2 changes: 1 addition & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"fs-extra": "^11.3.0",
"less": "^4.2.2",
"minimist": "^1.2.8",
"postcss": "^8.5.1",
"postcss": "^8.5.2",
"tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7",
"typescript": "^5.7.3"
Expand Down
3 changes: 2 additions & 1 deletion examples/src/docs/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* limitations under the License.
*/

import { FUniver, LocaleType, LogLevel, Univer, UniverInstanceType, UserManagerService } from '@univerjs/core';
import { LocaleType, LogLevel, Univer, UniverInstanceType, UserManagerService } from '@univerjs/core';
import { FUniver } from '@univerjs/core/facade';
import { UniverDebuggerPlugin } from '@univerjs/debugger';
import { defaultTheme } from '@univerjs/design';
import { UniverDocsPlugin } from '@univerjs/docs';
Expand Down
2 changes: 1 addition & 1 deletion examples/src/mobile-s/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import type { FUniver } from '@univerjs/core';
import type { FUniver } from '@univerjs/core/facade';
import { LocaleType, LogLevel, Univer, UniverInstanceType, UserManagerService } from '@univerjs/core';
import { defaultTheme } from '@univerjs/design';
import { UniverDocsPlugin } from '@univerjs/docs';
Expand Down
3 changes: 2 additions & 1 deletion examples/src/sheets/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* limitations under the License.
*/

import { FUniver, ILogService, LocaleType, LogLevel, Univer, UniverInstanceType, UserManagerService } from '@univerjs/core';
import { ILogService, LocaleType, LogLevel, Univer, UniverInstanceType, UserManagerService } from '@univerjs/core';
import { FUniver } from '@univerjs/core/facade';
import { UniverDebuggerPlugin } from '@univerjs/debugger';
import { defaultTheme } from '@univerjs/design';
import { UniverDocsPlugin } from '@univerjs/docs';
Expand Down
3 changes: 2 additions & 1 deletion examples/src/uni/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* limitations under the License.
*/

import { FUniver, Injector, LocaleType, LogLevel, Univer, UniverInstanceType } from '@univerjs/core';
import { Injector, LocaleType, LogLevel, Univer, UniverInstanceType } from '@univerjs/core';
import { FUniver } from '@univerjs/core/facade';
import { UniverDebuggerPlugin } from '@univerjs/debugger';
import { defaultTheme } from '@univerjs/design';
import { UniverDocsPlugin } from '@univerjs/docs';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"eslint-plugin-react-hooks": "5.1.0",
"eslint-plugin-react-refresh": "^0.4.19",
"husky": "^9.1.7",
"lint-staged": "^15.4.2",
"lint-staged": "^15.4.3",
"react": "19.0.0",
"react-dom": "19.0.0",
"release-it": "^17.11.0",
Expand Down
2 changes: 1 addition & 1 deletion packages-experimental/action-recorder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"dependencies": {
"@univerjs/core": "workspace:*",
"@univerjs/design": "workspace:*",
"@univerjs/icons": "^0.2.14",
"@univerjs/icons": "^0.2.15",
"@univerjs/sheets": "workspace:*",
"@univerjs/sheets-filter": "workspace:*",
"@univerjs/sheets-ui": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions packages-experimental/debugger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@univerjs/design": "workspace:*",
"@univerjs/docs-ui": "workspace:*",
"@univerjs/engine-render": "workspace:*",
"@univerjs/icons": "^0.2.14",
"@univerjs/icons": "^0.2.15",
"@univerjs/mockdata": "workspace:*",
"@univerjs/sheets": "workspace:*",
"@univerjs/sheets-drawing-ui": "workspace:*",
Expand All @@ -74,7 +74,7 @@
},
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"postcss": "^8.5.1",
"postcss": "^8.5.2",
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* limitations under the License.
*/

import type { FUniver, ICommand, IWorkbookData, Univer, Workbook } from '@univerjs/core';
import type { ICommand, IWorkbookData, Univer, Workbook } from '@univerjs/core';
import type { FUniver } from '@univerjs/core/facade';
import { CommandType, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
import { ILocalFileService } from '@univerjs/ui';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { FEnum } from '@univerjs/core';
import { FEnum } from '@univerjs/core/facade';
import { BindModeEnum, DataBindingNodeTypeEnum } from '@univerjs/sheets-source-binding';

/**
Expand Down Expand Up @@ -42,7 +42,7 @@ class FSourceBindingEnum extends FEnum implements ISourceBindingEnumMixin {

FEnum.extend(FSourceBindingEnum);

declare module '@univerjs/core' {
declare module '@univerjs/core/facade' {
// eslint-disable-next-line ts/naming-convention
interface FEnum extends ISourceBindingEnumMixin { }
}
2 changes: 1 addition & 1 deletion packages-experimental/uni-docs-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
},
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"postcss": "^8.5.1",
"postcss": "^8.5.2",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
Expand Down
4 changes: 2 additions & 2 deletions packages-experimental/uni-formula-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@univerjs/docs": "workspace:*",
"@univerjs/docs-ui": "workspace:*",
"@univerjs/engine-render": "workspace:*",
"@univerjs/icons": "^0.2.14",
"@univerjs/icons": "^0.2.15",
"@univerjs/rpc": "workspace:*",
"@univerjs/sheets-formula": "workspace:*",
"@univerjs/sheets-formula-ui": "workspace:*",
Expand All @@ -81,7 +81,7 @@
},
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"postcss": "^8.5.1",
"postcss": "^8.5.2",
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
Expand Down
4 changes: 2 additions & 2 deletions packages-experimental/uni-sheets-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@univerjs/design": "workspace:*",
"@univerjs/docs": "workspace:*",
"@univerjs/docs-ui": "workspace:*",
"@univerjs/icons": "^0.2.14",
"@univerjs/icons": "^0.2.15",
"@univerjs/sheets": "workspace:*",
"@univerjs/sheets-drawing-ui": "workspace:*",
"@univerjs/sheets-ui": "workspace:*",
Expand All @@ -74,7 +74,7 @@
},
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"postcss": "^8.5.1",
"postcss": "^8.5.2",
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
Expand Down
4 changes: 2 additions & 2 deletions packages-experimental/uni-slides-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"dependencies": {
"@univerjs/core": "workspace:*",
"@univerjs/engine-render": "workspace:*",
"@univerjs/icons": "^0.2.14",
"@univerjs/icons": "^0.2.15",
"@univerjs/slides-ui": "workspace:*",
"@univerjs/ui": "workspace:*",
"@univerjs/uniui": "workspace:*",
Expand All @@ -70,7 +70,7 @@
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"less": "^4.2.2",
"postcss": "^8.5.1",
"postcss": "^8.5.2",
"react": "18.3.1",
"rxjs": "^7.8.1",
"tailwindcss": "^3.4.17",
Expand Down
4 changes: 2 additions & 2 deletions packages-experimental/uniui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@univerjs/core": "workspace:*",
"@univerjs/design": "workspace:*",
"@univerjs/engine-render": "workspace:*",
"@univerjs/icons": "^0.2.14",
"@univerjs/icons": "^0.2.15",
"@univerjs/sheets": "workspace:*",
"@univerjs/sheets-ui": "workspace:*",
"@univerjs/ui": "workspace:*",
Expand All @@ -76,7 +76,7 @@
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
"less": "^4.2.2",
"postcss": "^8.5.1",
"postcss": "^8.5.2",
"react": "18.3.1",
"react-dom": "18.3.1",
"rxjs": "^7.8.1",
Expand Down
9 changes: 8 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
],
"exports": {
".": "./src/index.ts",
"./*": "./src/*"
"./*": "./src/*",
"./facade": "./src/facade/index.ts"
},
"main": "./src/index.ts",
"types": "./lib/types/index.d.ts",
Expand All @@ -41,6 +42,11 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
"./facade": {
"import": "./lib/es/facade.js",
"require": "./lib/cjs/facade.js",
"types": "./lib/types/facade/index.d.ts"
},
"./lib/*": "./lib/*"
}
},
Expand All @@ -58,6 +64,7 @@
"build": "univer-cli build"
},
"peerDependencies": {
"@wendellhu/redi": "0.17.1",
"rxjs": ">=7.0.0"
},
"dependencies": {
Expand Down
Loading

0 comments on commit f93fbbf

Please sign in to comment.