diff --git a/.eslintrc.json b/.eslintrc.json index 041a1babc..4beed01db 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -11,15 +11,14 @@ ], "parserOptions": { "project": [ - "./tsconfig.serve.json" + // "./tsconfig.serve.json" ], "createDefaultProgram": true }, - "extends": [ - ], + "extends": [], "rules": { "prefer-arrow/prefer-arrow-functions": 0, - "@angular-eslint/directive-selector": 0, + "@angular-eslint/directive-selector": 0, "@angular-eslint/component-selector": [ "error", { @@ -34,10 +33,8 @@ "files": [ "*.html" ], - "extends": [ - ], - "rules": { - } + "extends": [], + "rules": {} } ] -} \ No newline at end of file +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 8d825a88b..28c8754d6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,5 @@ { + "typescript.preferences.importModuleSpecifier": "non-relative", "eslint.workingDirectories": [ { "mode": "auto" @@ -6,9 +7,8 @@ ], "files.exclude": { "**/*.js": { - "when": "$(basename).ts" + "when": "$(basename).ts" }, "**/*.js.map": true, } } - diff --git a/package-lock.json b/package-lock.json index 07e504bf4..ced1a01f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -93,7 +93,7 @@ }, "@electron/universal": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.2.1.tgz", + "resolved": "https://registry.npmmirror.com/@electron/universal/-/universal-1.2.1.tgz", "integrity": "sha512-7323HyMh7KBAl/nPDppdLsC87G6RwRU02dy5FPeGB1eS7rUePh55+WNWiDPLhFQqqVPHzh77M69uhmoT8XnwMQ==", "dev": true, "requires": { @@ -604,7 +604,7 @@ }, "app-builder-lib": { "version": "23.0.9", - "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-23.0.9.tgz", + "resolved": "https://registry.npmmirror.com/app-builder-lib/-/app-builder-lib-23.0.9.tgz", "integrity": "sha512-2JboeCVrL+PksZ7IHp2teXbMUBnlucc3LhKGV+irxEA0l36bHs939AVtcaiATqyGnJcZkRdaB6TDd7SZfu+pxQ==", "dev": true, "requires": { @@ -638,7 +638,7 @@ "dependencies": { "builder-util-runtime": { "version": "9.0.2", - "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.0.2.tgz", + "resolved": "https://registry.npmmirror.com/builder-util-runtime/-/builder-util-runtime-9.0.2.tgz", "integrity": "sha512-xF55W/8mgfT6+sMbX0TeiJkTusA5GMOzckM4rajN4KirFcUIuLTH8oEaTYmM86YwVCZaTwa/7GyFhauXaEICwA==", "dev": true, "requires": { @@ -712,7 +712,7 @@ }, "astral-regex": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "resolved": "https://registry.npmmirror.com/astral-regex/-/astral-regex-2.0.0.tgz", "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true, "optional": true @@ -885,7 +885,7 @@ }, "builder-util": { "version": "23.0.9", - "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-23.0.9.tgz", + "resolved": "https://registry.npmmirror.com/builder-util/-/builder-util-23.0.9.tgz", "integrity": "sha512-ccPFwI1Sex4yLt8R3LI+H07p2jHICKwEWtxkFkb6jiU/g/VJnF1wazW7I1oMcCFcPTEl30GhqoRv9rfDD9VAiQ==", "dev": true, "requires": { @@ -910,7 +910,7 @@ "dependencies": { "builder-util-runtime": { "version": "9.0.2", - "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.0.2.tgz", + "resolved": "https://registry.npmmirror.com/builder-util-runtime/-/builder-util-runtime-9.0.2.tgz", "integrity": "sha512-xF55W/8mgfT6+sMbX0TeiJkTusA5GMOzckM4rajN4KirFcUIuLTH8oEaTYmM86YwVCZaTwa/7GyFhauXaEICwA==", "dev": true, "requires": { @@ -1011,7 +1011,7 @@ }, "chownr": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "resolved": "https://registry.npmmirror.com/chownr/-/chownr-2.0.0.tgz", "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", "dev": true }, @@ -1023,7 +1023,7 @@ }, "ci-info": { "version": "3.3.1", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.1.tgz", + "resolved": "https://registry.npmmirror.com/ci-info/-/ci-info-3.3.1.tgz", "integrity": "sha512-SXgeMX9VwDe7iFFaEWkA5AstuER9YKqy4EhHqr4DVqkwmD9rpVimkMKWHdjn30Ja45txyjhSn63lVX69eVCckg==", "dev": true }, @@ -1035,7 +1035,7 @@ }, "cli-truncate": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", + "resolved": "https://registry.npmmirror.com/cli-truncate/-/cli-truncate-2.1.0.tgz", "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", "dev": true, "optional": true, @@ -1321,7 +1321,7 @@ }, "dmg-builder": { "version": "23.0.9", - "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-23.0.9.tgz", + "resolved": "https://registry.npmmirror.com/dmg-builder/-/dmg-builder-23.0.9.tgz", "integrity": "sha512-a9mq85K31czOjso+T0aN9pWlmydzhehapU+ussFMD5FwD3l3JCK2ILlRfXuR3penbZT6LKCHuQFDIaZvsusY1w==", "dev": true, "requires": { @@ -1336,7 +1336,7 @@ "dependencies": { "builder-util-runtime": { "version": "9.0.2", - "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.0.2.tgz", + "resolved": "https://registry.npmmirror.com/builder-util-runtime/-/builder-util-runtime-9.0.2.tgz", "integrity": "sha512-xF55W/8mgfT6+sMbX0TeiJkTusA5GMOzckM4rajN4KirFcUIuLTH8oEaTYmM86YwVCZaTwa/7GyFhauXaEICwA==", "dev": true, "requires": { @@ -1401,7 +1401,7 @@ }, "ejs": { "version": "3.1.8", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz", + "resolved": "https://registry.npmmirror.com/ejs/-/ejs-3.1.8.tgz", "integrity": "sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==", "dev": true, "requires": { @@ -1429,7 +1429,7 @@ }, "electron-builder": { "version": "23.0.9", - "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-23.0.9.tgz", + "resolved": "https://registry.npmmirror.com/electron-builder/-/electron-builder-23.0.9.tgz", "integrity": "sha512-qeAbUfgVOBMjrDfGaTDsM2wuiPsISbADKLaMM27HAeVTjs6o4UuUFl+DzDVPal3v61W6nAB9kvBTeU9RZ/jH7g==", "dev": true, "requires": { @@ -1449,7 +1449,7 @@ "dependencies": { "builder-util-runtime": { "version": "9.0.2", - "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.0.2.tgz", + "resolved": "https://registry.npmmirror.com/builder-util-runtime/-/builder-util-runtime-9.0.2.tgz", "integrity": "sha512-xF55W/8mgfT6+sMbX0TeiJkTusA5GMOzckM4rajN4KirFcUIuLTH8oEaTYmM86YwVCZaTwa/7GyFhauXaEICwA==", "dev": true, "requires": { @@ -1466,7 +1466,7 @@ }, "electron-notarize": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/electron-notarize/-/electron-notarize-1.2.1.tgz", + "resolved": "https://registry.npmmirror.com/electron-notarize/-/electron-notarize-1.2.1.tgz", "integrity": "sha512-u/ECWhIrhkSQpZM4cJzVZ5TsmkaqrRo5LDC/KMbGF0sPkm53Ng59+M0zp8QVaql0obfJy9vlVT+4iOkAi2UDlA==", "dev": true, "requires": { @@ -1476,7 +1476,7 @@ "dependencies": { "fs-extra": { "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-9.1.0.tgz", "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "dev": true, "requires": { @@ -1530,7 +1530,7 @@ }, "electron-publish": { "version": "23.0.9", - "resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-23.0.9.tgz", + "resolved": "https://registry.npmmirror.com/electron-publish/-/electron-publish-23.0.9.tgz", "integrity": "sha512-afr2z6L07/elgDX+6I/G/0vzXOP6xYUd/aXx9tnTPSVZ/3AuvCegHrKiuh8sKYHmzoAcNGXe3ikISYIu961IfA==", "dev": true, "requires": { @@ -1545,7 +1545,7 @@ "dependencies": { "builder-util-runtime": { "version": "9.0.2", - "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.0.2.tgz", + "resolved": "https://registry.npmmirror.com/builder-util-runtime/-/builder-util-runtime-9.0.2.tgz", "integrity": "sha512-xF55W/8mgfT6+sMbX0TeiJkTusA5GMOzckM4rajN4KirFcUIuLTH8oEaTYmM86YwVCZaTwa/7GyFhauXaEICwA==", "dev": true, "requires": { @@ -2125,7 +2125,7 @@ }, "filelist": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", + "resolved": "https://registry.npmmirror.com/filelist/-/filelist-1.0.4.tgz", "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", "dev": true, "requires": { @@ -2143,7 +2143,7 @@ }, "minimatch": { "version": "5.1.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-5.1.0.tgz", "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", "dev": true, "requires": { @@ -2222,7 +2222,7 @@ }, "fs-minipass": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "resolved": "https://registry.npmmirror.com/fs-minipass/-/fs-minipass-2.1.0.tgz", "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", "dev": true, "requires": { @@ -3095,7 +3095,7 @@ }, "minipass": { "version": "3.1.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.6.tgz", + "resolved": "https://registry.npmmirror.com/minipass/-/minipass-3.1.6.tgz", "integrity": "sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ==", "dev": true, "requires": { @@ -3104,7 +3104,7 @@ }, "minizlib": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "resolved": "https://registry.npmmirror.com/minizlib/-/minizlib-2.1.2.tgz", "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", "dev": true, "requires": { @@ -3140,7 +3140,7 @@ }, "node-addon-api": { "version": "1.7.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", + "resolved": "https://registry.npmmirror.com/node-addon-api/-/node-addon-api-1.7.2.tgz", "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==", "dev": true, "optional": true @@ -3943,7 +3943,7 @@ }, "slice-ansi": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", + "resolved": "https://registry.npmmirror.com/slice-ansi/-/slice-ansi-3.0.0.tgz", "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", "dev": true, "optional": true, @@ -4131,7 +4131,7 @@ }, "tar": { "version": "6.1.11", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", + "resolved": "https://registry.npmmirror.com/tar/-/tar-6.1.11.tgz", "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", "dev": true, "requires": { @@ -4145,7 +4145,7 @@ "dependencies": { "mkdirp": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "resolved": "https://registry.npmmirror.com/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true } @@ -4568,7 +4568,7 @@ }, "yargs": { "version": "17.5.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz", + "resolved": "https://registry.npmmirror.com/yargs/-/yargs-17.5.1.tgz", "integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==", "dev": true, "requires": { diff --git a/package.json b/package.json index a8779cf69..f050769ce 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "electron:tsc": "tsc -p tsconfig.json" }, "dependencies": { + "@bqy/node-module-alias": "^1.0.1", "@electron/remote": "2.0.8", "content-disposition": "^0.5.4", "cross-spawn": "^7.0.3", @@ -33,13 +34,13 @@ "dexie": "3.2.2", "electron-log": "^4.4.7", "electron-updater": "^5.0.1", + "fix-path": "3.0.0", "form-data": "^4.0.0", "iconv-lite": "^0.6.3", "ky": "0.30.0", "resolve": "^1.22.0", "rxjs": "7.5.5", - "xml2js": "^0.4.23", - "fix-path": "3.0.0" + "xml2js": "^0.4.23" }, "devDependencies": { "@types/cross-spawn": "6.0.2", @@ -54,10 +55,14 @@ "eslint-plugin-import": "2.26.0", "eslint-plugin-jsdoc": "39.2.9", "eslint-plugin-prefer-arrow": "1.2.3", + "module-alias": "2.2.2", "npm-run-all": "4.1.5", "ts-node": "10.7.0", "typescript": "~4.6.4", "wait-on": "6.0.1" }, - "__npminstall_done": false + "__npminstall_done": false, + "node-module-alias": { + "eo": "./src" + } } diff --git a/src/app/electron-browser/IndexedDB/src/index.ts b/src/app/electron-browser/IndexedDB/src/index.ts index 64f9c68ff..29d84885e 100644 --- a/src/app/electron-browser/IndexedDB/src/index.ts +++ b/src/app/electron-browser/IndexedDB/src/index.ts @@ -1,9 +1,15 @@ import { ipcRenderer, app } from 'electron'; +import { isNotEmpty } from 'eo/shared/common/common'; import * as fs from 'fs'; import * as path from 'path'; -import { StorageHandleResult, StorageHandleStatus, StorageHandleArgs, StorageProcessType } from '../../../../platform/browser/IndexedDB'; -import { Storage} from '../../../../platform/browser/IndexedDB/lib'; -import { isNotEmpty } from '../../../../shared/common/common'; +import { + StorageHandleResult, + StorageHandleStatus, + StorageHandleArgs, + StorageProcessType, +} from 'eo/platform/browser/IndexedDB'; +import { Storage } from 'eo/platform/browser/IndexedDB/lib'; + class StorageService { private ipcRenderer: typeof ipcRenderer; private app: typeof app; @@ -11,50 +17,53 @@ class StorageService { private path: typeof path; constructor() { this.ipcRenderer = window.require('electron').ipcRenderer; - this.app= window.require('electron').app; + this.app = window.require('electron').app; this.fs = window.require('fs'); - this.path= window.require('path'); + this.path = window.require('path'); this.storageListen(); } /** * 存储监听处理 - * @param args + * @param args */ private storageListenHandle(args: StorageHandleArgs): void { const action: string = args.action || undefined; const handleResult: StorageHandleResult = { status: StorageHandleStatus.invalid, data: undefined, - callback: args.callback || null + callback: args.callback || null, }; if (Storage && Storage[action] && typeof Storage[action] === 'function') { - Storage[action](...args.params).subscribe((result: any) => { - handleResult.data = result; - if (isNotEmpty(result)) { - handleResult.status = StorageHandleStatus.success; - } else { - handleResult.status = StorageHandleStatus.empty; + Storage[action](...args.params).subscribe( + (result: any) => { + handleResult.data = result; + if (isNotEmpty(result)) { + handleResult.status = StorageHandleStatus.success; + } else { + handleResult.status = StorageHandleStatus.empty; + } + this.storageListenHandleNotify(args.type, handleResult); + }, + (error: any) => { + handleResult.status = StorageHandleStatus.error; + this.storageListenHandleNotify(args.type, handleResult); } - this.storageListenHandleNotify(args.type, handleResult); - }, (error: any) => { - handleResult.status = StorageHandleStatus.error; - this.storageListenHandleNotify(args.type, handleResult); - }); + ); } else { this.storageListenHandleNotify(args.type, handleResult); } } /** - * 数据存储监听通知返回 - * @param type - * @param result + * 数据存储监听通知返回 + * @param type + * @param result */ private storageListenHandleNotify(type: string, result: StorageHandleResult): void { try { if (StorageProcessType.default === type) { - this.ipcRenderer.send('eo-storage', {type: 'result', result: result}); + this.ipcRenderer.send('eo-storage', { type: 'result', result: result }); } else if (StorageProcessType.sync === type) { const storageTemp = this.path.join(this.app.getPath('home'), '.eo', 'tmp.storage'); this.fs.writeFileSync(storageTemp, JSON.stringify(result)); @@ -65,14 +74,14 @@ class StorageService { console.log(e); } } - + /** * 开启数据存储监听 - * @returns + * @returns */ private storageListen(): void { this.ipcRenderer.on('eo-storage', (event, args: StorageHandleArgs) => this.storageListenHandle(args)); - } + } isElectron(): boolean { return !!(window && window.process && window.process.type); diff --git a/src/app/electron-main/appView.ts b/src/app/electron-main/appView.ts index b2c91849a..41307db78 100644 --- a/src/app/electron-main/appView.ts +++ b/src/app/electron-main/appView.ts @@ -1,9 +1,9 @@ -import { ModuleInfo, ModuleType } from '../../platform/node/extension-manager/types'; -import { getViewBounds, SidePosition, ViewBounds, ViewZone } from '../../shared/common/bounds'; +import { ModuleInfo, ModuleType } from 'eo/platform/node/extension-manager/types'; +import { getViewBounds, SidePosition, ViewBounds, ViewZone } from 'eo/shared/common/bounds'; import { BrowserView, BrowserWindow } from 'electron'; import * as path from 'path'; -import { BrowserViewInstance } from '../../platform/electron-main/browserView/browserView'; -import { processEnv } from '../../platform/node/constant'; +import { BrowserViewInstance } from 'eo/platform/electron-main/browserView/browserView'; +import { processEnv } from 'eo/platform/node/constant'; export class AppViews { mainModuleID: string; view: BrowserView; diff --git a/src/app/electron-main/coreView.ts b/src/app/electron-main/coreView.ts index 5964dbfdb..f42564cb4 100644 --- a/src/app/electron-main/coreView.ts +++ b/src/app/electron-main/coreView.ts @@ -1,8 +1,7 @@ -import { BrowserView, screen, BrowserWindow, session, ipcMain } from 'electron'; -import { BrowserViewInstance } from '../../platform/electron-main/browserView/browserView'; +import { BrowserView, BrowserWindow, ipcMain } from 'electron'; +import { BrowserViewInstance } from 'eo/platform/electron-main/browserView/browserView'; import * as path from 'path'; -import { subView } from './main'; -import { processEnv } from '../../platform/node/constant'; +import { processEnv } from 'eo/platform/node/constant'; export class CoreViews { moduleID: string; view: BrowserView; diff --git a/src/app/electron-main/main.ts b/src/app/electron-main/main.ts index 96e137904..10345cce6 100644 --- a/src/app/electron-main/main.ts +++ b/src/app/electron-main/main.ts @@ -1,16 +1,17 @@ +require('@bqy/node-module-alias/register'); import { app, BrowserWindow, ipcMain, screen } from 'electron'; import { EoUpdater } from './updater'; import * as path from 'path'; import * as os from 'os'; -import ModuleManager from '../../platform/node/extension-manager/lib/manager'; -import { ModuleManagerInterface } from '../../platform/node/extension-manager'; -import { StorageHandleStatus, StorageProcessType } from '../../platform/browser/IndexedDB'; -import { processEnv } from '../../platform/node/constant'; -import { proxyOpenExternal } from '../../shared/common/browserView'; -import { deleteFile, readJson } from '../../shared/node/file'; -import { STORAGE_TEMP as storageTemp } from '../../shared/common/constant'; -import { UnitWorkerModule } from '../../workbench/node/unitWorker'; -import Configuration from '../../platform/node/configuration/lib'; +import ModuleManager from 'eo/platform/node/extension-manager/lib/manager'; +import { ModuleManagerInterface } from 'eo/platform/node/extension-manager'; +import { StorageHandleStatus, StorageProcessType } from 'eo/platform/browser/IndexedDB'; +import { processEnv } from 'eo/platform/node/constant'; +import { proxyOpenExternal } from 'eo/shared/common/browserView'; +import { deleteFile, readJson } from 'eo/shared/node/file'; +import { STORAGE_TEMP as storageTemp } from 'eo/shared/common/constant'; +import { UnitWorkerModule } from 'eo/workbench/node/unitWorker'; +import Configuration from 'eo/platform/node/configuration/lib'; import { ConfigurationInterface } from 'src/platform/node/configuration'; let win: BrowserWindow = null; export const subView = { diff --git a/src/platform/electron-main/browserView/browserView.ts b/src/platform/electron-main/browserView/browserView.ts index adb9b6831..3e7992c24 100644 --- a/src/platform/electron-main/browserView/browserView.ts +++ b/src/platform/electron-main/browserView/browserView.ts @@ -1,7 +1,7 @@ import { throws } from 'assert'; import { BrowserWindow, BrowserView, session, BrowserViewConstructorOptions } from 'electron'; -import { ViewBounds } from '../../../shared/common/bounds'; -import { proxyOpenExternal } from '../../../shared/common/browserView'; +import { ViewBounds } from 'eo/shared/common/bounds'; +import { proxyOpenExternal } from 'eo/shared/common/browserView'; import { BrowserViewOpts } from './browserView.type'; export class BrowserViewInstance { bounds: ViewBounds; diff --git a/src/platform/electron-main/browserView/browserView.type.ts b/src/platform/electron-main/browserView/browserView.type.ts index 48cbcb04e..9bc377702 100644 --- a/src/platform/electron-main/browserView/browserView.type.ts +++ b/src/platform/electron-main/browserView/browserView.type.ts @@ -1,9 +1,9 @@ -import { ViewBounds } from "../../../shared/common/bounds"; +import { ViewBounds } from 'eo/shared/common/bounds'; export interface BrowserViewOpts { - bounds: ViewBounds, - partition?: string, - preloadPath?: string, - viewPath: string; - preload?: string; -} \ No newline at end of file + bounds: ViewBounds; + partition?: string; + preloadPath?: string; + viewPath: string; + preload?: string; +} diff --git a/src/platform/node/configuration/lib/index.ts b/src/platform/node/configuration/lib/index.ts index dc93c75a6..40ea8aeeb 100644 --- a/src/platform/node/configuration/lib/index.ts +++ b/src/platform/node/configuration/lib/index.ts @@ -1,7 +1,7 @@ -import { DATA_DIR as dataDir } from '../../../../shared/common/constant'; +import { DATA_DIR as dataDir } from 'eo/shared/common/constant'; import { ConfigurationInterface, ConfigurationValueInterface } from '../types'; import * as path from 'path'; -import { fileExists, readJson, writeJson } from '../../../../shared/node/file'; +import { fileExists, readJson, writeJson } from 'eo/shared/node/file'; export class Configuration implements ConfigurationInterface { /** diff --git a/src/platform/node/extension-manager/lib/core.ts b/src/platform/node/extension-manager/lib/core.ts index b8aa82899..b50bcd5b3 100644 --- a/src/platform/node/extension-manager/lib/core.ts +++ b/src/platform/node/extension-manager/lib/core.ts @@ -1,7 +1,7 @@ import * as path from 'path'; import { ModuleHandlerOptions, ModuleInfo } from '../types'; -import { fileExists, readJson } from '../../../../shared/node/file'; -import { isNotEmpty } from '../../../../shared/common/common'; +import { fileExists, readJson } from 'eo/shared/node/file'; +import { isNotEmpty } from 'eo/shared/common/common'; /** * 核心模块管理器 diff --git a/src/platform/node/extension-manager/lib/handler.ts b/src/platform/node/extension-manager/lib/handler.ts index 0ebcd2359..5027143ac 100644 --- a/src/platform/node/extension-manager/lib/handler.ts +++ b/src/platform/node/extension-manager/lib/handler.ts @@ -1,7 +1,7 @@ -let fixPath=require('fix-path'); +let fixPath = require('fix-path'); import * as path from 'path'; import { ModuleHandlerOptions, ModuleHandlerResult } from '../types'; -import { fileExists, writeJson } from '../../../../shared/node/file'; +import { fileExists, writeJson } from 'eo/shared/node/file'; import { CoreHandler } from './core'; import * as spawn from 'cross-spawn'; /** diff --git a/src/platform/node/extension-manager/lib/manager.ts b/src/platform/node/extension-manager/lib/manager.ts index e12b58132..1798afcfe 100644 --- a/src/platform/node/extension-manager/lib/manager.ts +++ b/src/platform/node/extension-manager/lib/manager.ts @@ -1,7 +1,7 @@ -import { MODULE_DIR as baseDir } from '../../../../shared/common/constant'; +import { MODULE_DIR as baseDir } from 'eo/shared/common/constant'; import { ModuleHandler } from './handler'; import { ModuleHandlerResult, ModuleInfo, ModuleManagerInfo, ModuleManagerInterface, ModuleType } from '../types'; -import { isNotEmpty } from '../../../../shared/common/common'; +import { isNotEmpty } from 'eo/shared/common/common'; import { processEnv } from '../../constant'; export class ModuleManager implements ModuleManagerInterface { @@ -82,8 +82,8 @@ export class ModuleManager implements ModuleManagerInterface { const modules: Map = this.moduleBelongs(); modules?.forEach((module: ModuleInfo) => { if (module.isApp) { - module.main= processEnv === 'development' && module.main_debug ? module.main_debug : module.main, - output.push(module); + (module.main = processEnv === 'development' && module.main_debug ? module.main_debug : module.main), + output.push(module); } }); return output; diff --git a/src/platform/node/extension-manager/types/manager.ts b/src/platform/node/extension-manager/types/manager.ts index d49f3bf64..75c06b7e0 100644 --- a/src/platform/node/extension-manager/types/manager.ts +++ b/src/platform/node/extension-manager/types/manager.ts @@ -1,4 +1,4 @@ -import { SidePosition } from '../../../../shared/common/bounds'; +import { SidePosition } from 'eo/shared/common/bounds'; import { ModuleHandlerResult } from './handler'; /** diff --git a/src/workbench/browser/.eslintrc.json b/src/workbench/browser/.eslintrc.json index d843327e4..1ab571e4d 100644 --- a/src/workbench/browser/.eslintrc.json +++ b/src/workbench/browser/.eslintrc.json @@ -11,10 +11,10 @@ ], "parserOptions": { "project": [ - "./tsconfig.serve.json", + // "./tsconfig.serve.json", "./src/tsconfig.app.json", "./src/tsconfig.spec.json", - "./e2e/tsconfig.e2e.json" + // "./e2e/tsconfig.e2e.json" ], "createDefaultProgram": true }, @@ -25,7 +25,7 @@ ], "rules": { "prefer-arrow/prefer-arrow-functions": 0, - "@angular-eslint/directive-selector": 0, + "@angular-eslint/directive-selector": 0, "@angular-eslint/component-selector": [ "error", { @@ -43,8 +43,7 @@ "extends": [ "plugin:@angular-eslint/template/recommended" ], - "rules": { - } + "rules": {} } ] -} \ No newline at end of file +} diff --git a/src/workbench/browser/src/app/pages/api/api.service.ts b/src/workbench/browser/src/app/pages/api/api.service.ts index de61fb192..b6a8312f0 100644 --- a/src/workbench/browser/src/app/pages/api/api.service.ts +++ b/src/workbench/browser/src/app/pages/api/api.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { NzModalService } from 'ng-zorro-antd/modal'; -import { ApiData, StorageHandleResult, StorageHandleStatus } from '../../../../../../platform/browser/IndexedDB'; +import { ApiData, StorageHandleResult, StorageHandleStatus } from 'eo/platform/browser/IndexedDB'; import { MessageService } from '../../shared/services/message'; import { StorageService } from '../../shared/services/storage'; @Injectable() diff --git a/src/workbench/browser/src/app/pages/api/detail/api-detail.component.ts b/src/workbench/browser/src/app/pages/api/detail/api-detail.component.ts index 4b41ef22c..16f8defba 100644 --- a/src/workbench/browser/src/app/pages/api/detail/api-detail.component.ts +++ b/src/workbench/browser/src/app/pages/api/detail/api-detail.component.ts @@ -1,6 +1,12 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import { ApiData, ApiBodyType, JsonRootType, StorageHandleResult, StorageHandleStatus } from '../../../../../../../platform/browser/IndexedDB'; +import { + ApiData, + ApiBodyType, + JsonRootType, + StorageHandleResult, + StorageHandleStatus, +} from 'eo/platform/browser/IndexedDB'; import { treeToListHasLevel } from '../../../utils/tree/tree.utils'; import { reverseObj } from '../../../utils'; import { StorageService } from '../../../shared/services/storage'; @@ -24,10 +30,9 @@ export class ApiDetailComponent implements OnInit { apiData: ApiData | any = {}; CONST = { BODY_TYPE: reverseObj(ApiBodyType), - JSON_ROOT_TYPE: reverseObj(JsonRootType) + JSON_ROOT_TYPE: reverseObj(JsonRootType), }; - constructor(private route: ActivatedRoute, private storage: StorageService) { - } + constructor(private route: ActivatedRoute, private storage: StorageService) {} ngOnInit(): void { this.route.queryParams.subscribe((params) => { if (params.uuid) { diff --git a/src/workbench/browser/src/app/pages/api/detail/body/api-detail-body.component.ts b/src/workbench/browser/src/app/pages/api/detail/body/api-detail-body.component.ts index 9efdeda5b..d1bb2247c 100644 --- a/src/workbench/browser/src/app/pages/api/detail/body/api-detail-body.component.ts +++ b/src/workbench/browser/src/app/pages/api/detail/body/api-detail-body.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, Input, OnChanges, OnDestroy } from '@angular/core'; import { Subject } from 'rxjs'; -import { ApiEditBody, ApiBodyType, JsonRootType } from '../../../../../../../../platform/browser/IndexedDB'; +import { ApiEditBody, ApiBodyType, JsonRootType } from 'eo/platform/browser/IndexedDB'; import { ApiDetailService } from '../api-detail.service'; @Component({ selector: 'eo-api-detail-body', @@ -30,8 +30,7 @@ export class ApiDetailBodyComponent implements OnInit, OnChanges, OnDestroy { } beforeChangeBodyByType(type) { switch (type) { - case ApiBodyType.Raw: // case ApiBodyType.Binary: - { + case ApiBodyType.Raw: { // case ApiBodyType.Binary: this.cache[type] = this.model || ''; break; } diff --git a/src/workbench/browser/src/app/pages/api/detail/header/api-detail-header.component.ts b/src/workbench/browser/src/app/pages/api/detail/header/api-detail-header.component.ts index a15028031..d0043a02e 100644 --- a/src/workbench/browser/src/app/pages/api/detail/header/api-detail-header.component.ts +++ b/src/workbench/browser/src/app/pages/api/detail/header/api-detail-header.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, Input, OnChanges } from '@angular/core'; -import { ApiEditHeaders } from '../../../../../../../../platform/browser/IndexedDB'; +import { ApiEditHeaders } from 'eo/platform/browser/IndexedDB'; import { ApiDetailService } from '../api-detail.service'; @Component({ selector: 'eo-api-detail-header', @@ -23,7 +23,7 @@ export class ApiDetailHeaderComponent implements OnInit, OnChanges { this.listConf = this.detailService.initListConf({ dragCacheVar: 'DRAG_VAR_API_EDIT_HEADER', title: '头部', - nameTitle: '标签' + nameTitle: '标签', }); } } diff --git a/src/workbench/browser/src/app/pages/api/detail/query/api-detail-query.component.ts b/src/workbench/browser/src/app/pages/api/detail/query/api-detail-query.component.ts index 4f9098950..77878d3b0 100644 --- a/src/workbench/browser/src/app/pages/api/detail/query/api-detail-query.component.ts +++ b/src/workbench/browser/src/app/pages/api/detail/query/api-detail-query.component.ts @@ -1,11 +1,11 @@ -import { Component, OnInit, Input} from '@angular/core'; -import { ApiEditQuery } from '../../../../../../../../platform/browser/IndexedDB'; +import { Component, OnInit, Input } from '@angular/core'; +import { ApiEditQuery } from 'eo/platform/browser/IndexedDB'; import { ApiDetailService } from '../api-detail.service'; @Component({ selector: 'eo-api-detail-query', templateUrl: './api-detail-query.component.html', - styleUrls: ['./api-detail-query.component.scss'] + styleUrls: ['./api-detail-query.component.scss'], }) export class ApiDetailQueryComponent implements OnInit { @Input() model: ApiEditQuery[]; @@ -16,8 +16,8 @@ export class ApiDetailQueryComponent implements OnInit { this.initListConf(); } private initListConf() { - this.listConf =this.detailService.initListConf({ - dragCacheVar:'DRAG_VAR_API_EDIT_QUERY' + this.listConf = this.detailService.initListConf({ + dragCacheVar: 'DRAG_VAR_API_EDIT_QUERY', }); } } diff --git a/src/workbench/browser/src/app/pages/api/detail/rest/api-detail-rest.component.ts b/src/workbench/browser/src/app/pages/api/detail/rest/api-detail-rest.component.ts index 4f67a4f9f..d3136ef52 100644 --- a/src/workbench/browser/src/app/pages/api/detail/rest/api-detail-rest.component.ts +++ b/src/workbench/browser/src/app/pages/api/detail/rest/api-detail-rest.component.ts @@ -1,5 +1,5 @@ -import { Component, OnInit, Input} from '@angular/core'; -import { ApiEditRest } from '../../../../../../../../platform/browser/IndexedDB'; +import { Component, OnInit, Input } from '@angular/core'; +import { ApiEditRest } from 'eo/platform/browser/IndexedDB'; import { ApiDetailService } from '../api-detail.service'; @Component({ selector: 'eo-api-detail-rest', diff --git a/src/workbench/browser/src/app/pages/api/edit/api-edit.component.ts b/src/workbench/browser/src/app/pages/api/edit/api-edit.component.ts index 6289ec617..3356014b3 100644 --- a/src/workbench/browser/src/app/pages/api/edit/api-edit.component.ts +++ b/src/workbench/browser/src/app/pages/api/edit/api-edit.component.ts @@ -18,7 +18,7 @@ import { ApiEditRest, StorageHandleResult, StorageHandleStatus, -} from '../../../../../../../platform/browser/IndexedDB'; +} from 'eo/platform/browser/IndexedDB'; import { ApiTabService } from '../tab/api-tab.service'; import { objectToArray } from '../../../utils'; diff --git a/src/workbench/browser/src/app/pages/api/edit/body/api-edit-body.component.ts b/src/workbench/browser/src/app/pages/api/edit/body/api-edit-body.component.ts index 17dd4b423..06989d0b2 100644 --- a/src/workbench/browser/src/app/pages/api/edit/body/api-edit-body.component.ts +++ b/src/workbench/browser/src/app/pages/api/edit/body/api-edit-body.component.ts @@ -1,17 +1,14 @@ -import { - Component, - OnInit, - Input, - ChangeDetectorRef, - Output, - EventEmitter, - OnChanges, - OnDestroy, -} from '@angular/core'; +import { Component, OnInit, Input, ChangeDetectorRef, Output, EventEmitter, OnChanges, OnDestroy } from '@angular/core'; import { Subject } from 'rxjs'; import { pairwise, takeUntil, debounceTime } from 'rxjs/operators'; -import { ApiParamsTypeFormData, ApiParamsTypeJsonOrXml, ApiEditBody, ApiBodyType, JsonRootType } from '../../../../../../../../platform/browser/IndexedDB'; +import { + ApiParamsTypeFormData, + ApiParamsTypeJsonOrXml, + ApiEditBody, + ApiBodyType, + JsonRootType, +} from 'eo/platform/browser/IndexedDB'; import { ApiEditService } from '../api-edit.service'; @Component({ selector: 'eo-api-edit-body', @@ -53,7 +50,8 @@ export class ApiEditBodyComponent implements OnInit, OnChanges, OnDestroy { } beforeChangeBodyByType(type) { switch (type) { - case ApiBodyType.Raw: { // case ApiBodyType.Binary: + case ApiBodyType.Raw: { + // case ApiBodyType.Binary: if (typeof this.model !== 'string') return; this.cache[type] = this.model || ''; break; @@ -72,7 +70,7 @@ export class ApiEditBodyComponent implements OnInit, OnChanges, OnDestroy { this.bodyTypeChange.emit(this.bodyType); this.setListConf(); this.setModel(); - if(type==='init') return; + if (type === 'init') return; this.modelChange.emit(this.model); } ngOnInit(): void { @@ -85,7 +83,10 @@ export class ApiEditBodyComponent implements OnInit, OnChanges, OnDestroy { this.destroy$.complete(); } ngOnChanges(changes) { - if ((changes.model && !changes.model.previousValue && changes.model.currentValue) || changes.model.currentValue?.length===0) { + if ( + (changes.model && !changes.model.previousValue && changes.model.currentValue) || + changes.model.currentValue?.length === 0 + ) { this.beforeChangeBodyByType(this.bodyType); this.changeBodyType('init'); } diff --git a/src/workbench/browser/src/app/pages/api/edit/extra-setting/api-params-extra-setting.component.ts b/src/workbench/browser/src/app/pages/api/edit/extra-setting/api-params-extra-setting.component.ts index 257c81d04..0826b0731 100644 --- a/src/workbench/browser/src/app/pages/api/edit/extra-setting/api-params-extra-setting.component.ts +++ b/src/workbench/browser/src/app/pages/api/edit/extra-setting/api-params-extra-setting.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, Input } from '@angular/core'; -import { ApiParamsTypeJsonOrXml, ParamsEnum, BasiApiEditParams } from '../../../../../../../../platform/browser/IndexedDB'; +import { ApiParamsTypeJsonOrXml, ParamsEnum, BasiApiEditParams } from 'eo/platform/browser/IndexedDB'; @Component({ selector: 'eo-api-edit-params-extra-setting', diff --git a/src/workbench/browser/src/app/pages/api/edit/header/api-edit-header.component.ts b/src/workbench/browser/src/app/pages/api/edit/header/api-edit-header.component.ts index c42f943c8..6e7f32191 100644 --- a/src/workbench/browser/src/app/pages/api/edit/header/api-edit-header.component.ts +++ b/src/workbench/browser/src/app/pages/api/edit/header/api-edit-header.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, Input, ChangeDetectorRef, AfterViewChecked, OnChanges } from '@angular/core'; -import { ApiEditHeaders } from '../../../../../../../../platform/browser/IndexedDB'; +import { ApiEditHeaders } from 'eo/platform/browser/IndexedDB'; import { ApiEditService } from '../api-edit.service'; @Component({ selector: 'eo-api-edit-header', @@ -25,7 +25,7 @@ export class ApiEditHeaderComponent implements OnInit, OnChanges, AfterViewCheck this.cdRef.detectChanges(); } ngOnChanges(changes) { - if (changes.model&&!changes.model.previousValue&&changes.model.currentValue) { + if (changes.model && !changes.model.previousValue && changes.model.currentValue) { this.model.push(Object.assign({}, this.itemStructure)); } } diff --git a/src/workbench/browser/src/app/pages/api/edit/query/api-edit-query.component.ts b/src/workbench/browser/src/app/pages/api/edit/query/api-edit-query.component.ts index 7d77ba44f..42dc1dd6d 100644 --- a/src/workbench/browser/src/app/pages/api/edit/query/api-edit-query.component.ts +++ b/src/workbench/browser/src/app/pages/api/edit/query/api-edit-query.component.ts @@ -1,13 +1,13 @@ -import { Component, OnInit, Input, ChangeDetectorRef,AfterViewChecked,OnChanges } from '@angular/core'; -import { ApiEditQuery } from '../../../../../../../../platform/browser/IndexedDB'; +import { Component, OnInit, Input, ChangeDetectorRef, AfterViewChecked, OnChanges } from '@angular/core'; +import { ApiEditQuery } from 'eo/platform/browser/IndexedDB'; import { ApiEditService } from '../api-edit.service'; @Component({ selector: 'eo-api-edit-query', templateUrl: './api-edit-query.component.html', - styleUrls: ['./api-edit-query.component.scss'] + styleUrls: ['./api-edit-query.component.scss'], }) -export class ApiEditQueryComponent implements OnInit,OnChanges,AfterViewChecked { +export class ApiEditQueryComponent implements OnInit, OnChanges, AfterViewChecked { @Input() model: object[]; listConf: object = {}; private itemStructure: ApiEditQuery = { @@ -16,7 +16,7 @@ export class ApiEditQueryComponent implements OnInit,OnChanges,AfterViewChecked example: '', description: '', }; - constructor(private editService: ApiEditService,private cdRef: ChangeDetectorRef) {} + constructor(private editService: ApiEditService, private cdRef: ChangeDetectorRef) {} ngOnInit(): void { this.initListConf(); @@ -26,17 +26,17 @@ export class ApiEditQueryComponent implements OnInit,OnChanges,AfterViewChecked this.cdRef.detectChanges(); } ngOnChanges(changes) { - if (changes.model&&!changes.model.previousValue&&changes.model.currentValue) { + if (changes.model && !changes.model.previousValue && changes.model.currentValue) { this.model.push(Object.assign({}, this.itemStructure)); } } private initListConf() { - this.listConf =this.editService.initListConf({ - dragCacheVar:'DRAG_VAR_API_EDIT_QUERY', - itemStructure:this.itemStructure, + this.listConf = this.editService.initListConf({ + dragCacheVar: 'DRAG_VAR_API_EDIT_QUERY', + itemStructure: this.itemStructure, nzOnOkMoreSetting: (inputArg) => { this.model[inputArg.$index] = inputArg.item; - } + }, }); } } diff --git a/src/workbench/browser/src/app/pages/api/edit/rest/api-edit-rest.component.ts b/src/workbench/browser/src/app/pages/api/edit/rest/api-edit-rest.component.ts index 16fe5166c..e0fbac593 100644 --- a/src/workbench/browser/src/app/pages/api/edit/rest/api-edit-rest.component.ts +++ b/src/workbench/browser/src/app/pages/api/edit/rest/api-edit-rest.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, Input, ChangeDetectorRef, AfterViewChecked, OnChanges } from '@angular/core'; -import { ApiEditRest } from '../../../../../../../../platform/browser/IndexedDB'; +import { ApiEditRest } from 'eo/platform/browser/IndexedDB'; import { ApiEditService } from '../api-edit.service'; @Component({ selector: 'eo-api-edit-rest', @@ -24,7 +24,7 @@ export class ApiEditRestComponent implements OnInit, OnChanges, AfterViewChecked this.cdRef.detectChanges(); } ngOnChanges(changes) { - if (changes.model&&!changes.model.previousValue&&changes.model.currentValue) { + if (changes.model && !changes.model.previousValue && changes.model.currentValue) { this.model.push(Object.assign({}, this.itemStructure)); } } @@ -34,7 +34,7 @@ export class ApiEditRestComponent implements OnInit, OnChanges, AfterViewChecked itemStructure: this.itemStructure, nzOnOkMoreSetting: (inputArg) => { this.model[inputArg.$index] = inputArg.item; - } + }, }); } } diff --git a/src/workbench/browser/src/app/pages/api/group/edit/api-group-edit.component.ts b/src/workbench/browser/src/app/pages/api/group/edit/api-group-edit.component.ts index d743e43e6..f1951f918 100644 --- a/src/workbench/browser/src/app/pages/api/group/edit/api-group-edit.component.ts +++ b/src/workbench/browser/src/app/pages/api/group/edit/api-group-edit.component.ts @@ -1,5 +1,5 @@ import { Component, Input, OnInit } from '@angular/core'; -import { Group, StorageHandleResult, StorageHandleStatus } from '../../../../../../../../platform/browser/IndexedDB'; +import { Group, StorageHandleResult, StorageHandleStatus } from 'eo/platform/browser/IndexedDB'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { NzModalRef } from 'ng-zorro-antd/modal'; import { MessageService } from '../../../../shared/services/message'; @@ -24,7 +24,7 @@ export class ApiGroupEditComponent implements OnInit { private messageService: MessageService, private modalRef: NzModalRef, private storage: StorageService - ) { } + ) {} ngOnInit(): void { this.isDelete = this.action === 'delete'; diff --git a/src/workbench/browser/src/app/pages/api/group/tree/api-group-tree.component.ts b/src/workbench/browser/src/app/pages/api/group/tree/api-group-tree.component.ts index 6b40cde85..a96ada862 100644 --- a/src/workbench/browser/src/app/pages/api/group/tree/api-group-tree.component.ts +++ b/src/workbench/browser/src/app/pages/api/group/tree/api-group-tree.component.ts @@ -1,12 +1,7 @@ import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; import { Router, NavigationEnd, ActivatedRoute } from '@angular/router'; import { GroupTreeItem, GroupApiDataModel } from '../../../../shared/models'; -import { - Group, - ApiData, - StorageHandleResult, - StorageHandleStatus, -} from '../../../../../../../../platform/browser/IndexedDB'; +import { Group, ApiData, StorageHandleResult, StorageHandleStatus } from 'eo/platform/browser/IndexedDB'; import { Message } from '../../../../shared/services/message/message.model'; import { NzModalRef } from 'ng-zorro-antd/modal'; import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd/tree'; @@ -338,7 +333,7 @@ export class ApiGroupTreeComponent implements OnInit, OnDestroy { } private setSelectedKeys() { - console.log('setSelectedKeys',this.route.snapshot.queryParams.uuid,this.nzSelectedKeys) + console.log('setSelectedKeys', this.route.snapshot.queryParams.uuid, this.nzSelectedKeys); if (this.route.snapshot.queryParams.uuid) { this.nzSelectedKeys = [this.route.snapshot.queryParams.uuid]; } else { diff --git a/src/workbench/browser/src/app/pages/api/tab/api-tab.component.ts b/src/workbench/browser/src/app/pages/api/tab/api-tab.component.ts index f0ba16071..7ade39ec6 100644 --- a/src/workbench/browser/src/app/pages/api/tab/api-tab.component.ts +++ b/src/workbench/browser/src/app/pages/api/tab/api-tab.component.ts @@ -1,14 +1,14 @@ import { Component, OnInit, OnDestroy } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { TabItem } from './tab.model'; -import { ApiData } from '../../../../../../../platform/browser/IndexedDB'; +import { ApiData } from 'eo/platform/browser/IndexedDB'; import { ApiTabService } from './api-tab.service'; import { Subject, takeUntil } from 'rxjs'; import { Message, MessageService } from '../../../shared/services/message'; @Component({ selector: 'eo-api-tab', templateUrl: './api-tab.component.html', - styleUrls: ['./api-tab.component.scss'] + styleUrls: ['./api-tab.component.scss'], }) export class ApiTabComponent implements OnInit, OnDestroy { apiDataItems: { [key: number | string]: ApiData }; diff --git a/src/workbench/browser/src/app/pages/api/test/api-test.component.ts b/src/workbench/browser/src/app/pages/api/test/api-test.component.ts index 70fa90c3e..213d8fbb0 100644 --- a/src/workbench/browser/src/app/pages/api/test/api-test.component.ts +++ b/src/workbench/browser/src/app/pages/api/test/api-test.component.ts @@ -9,7 +9,7 @@ import { RequestProtocol, StorageHandleResult, StorageHandleStatus, -} from '../../../../../../../platform/browser/IndexedDB'; +} from 'eo/platform/browser/IndexedDB'; import { MessageService } from '../../../shared/services/message'; import { interval, Subscription, Observable, of, Subject } from 'rxjs'; diff --git a/src/workbench/browser/src/app/pages/api/test/api-test.service.ts b/src/workbench/browser/src/app/pages/api/test/api-test.service.ts index d7a3381bd..47992ca8b 100644 --- a/src/workbench/browser/src/app/pages/api/test/api-test.service.ts +++ b/src/workbench/browser/src/app/pages/api/test/api-test.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { ApiTestQuery } from '../../../shared/services/api-test/api-test-params.model'; -import { ApiTestHistory } from '../../../../../../../platform/browser/IndexedDB'; +import { ApiTestHistory } from 'eo/platform/browser/IndexedDB'; import { treeToListHasLevel } from '../../../utils/tree/tree.utils'; import { text2UiData } from '../../../utils/data-transfer/data-transfer.utils'; diff --git a/src/workbench/browser/src/app/pages/api/test/body/api-test-body.component.ts b/src/workbench/browser/src/app/pages/api/test/body/api-test-body.component.ts index 3e02d46da..7483baba2 100644 --- a/src/workbench/browser/src/app/pages/api/test/body/api-test-body.component.ts +++ b/src/workbench/browser/src/app/pages/api/test/body/api-test-body.component.ts @@ -3,8 +3,12 @@ import { Component, OnInit, Input, Output, EventEmitter, OnChanges, OnDestroy } import { Subject } from 'rxjs'; import { pairwise, takeUntil, debounceTime } from 'rxjs/operators'; -import { ApiTestParamsTypeFormData, ApiTestParamsTypeJsonOrXml, ApiTestBody } from '../../../../shared/services/api-test/api-test-params.model'; -import { ApiBodyType, JsonRootType } from '../../../../../../../../platform/browser/IndexedDB'; +import { + ApiTestParamsTypeFormData, + ApiTestParamsTypeJsonOrXml, + ApiTestBody, +} from '../../../../shared/services/api-test/api-test-params.model'; +import { ApiBodyType, JsonRootType } from 'eo/platform/browser/IndexedDB'; import { ApiTestService } from '../api-test.service'; import { Message, MessageService } from '../../../../shared/services/message'; @@ -77,7 +81,10 @@ export class ApiTestBodyComponent implements OnInit, OnChanges, OnDestroy { this.destroy$.complete(); } ngOnChanges(changes) { - if ((changes.model && !changes.model.previousValue && changes.model.currentValue) || changes.model.currentValue?.length===0) { + if ( + (changes.model && !changes.model.previousValue && changes.model.currentValue) || + changes.model.currentValue?.length === 0 + ) { this.beforeChangeBodyByType(this.bodyType); this.changeBodyType('init'); } diff --git a/src/workbench/browser/src/app/pages/api/test/history/api-test-history.component.ts b/src/workbench/browser/src/app/pages/api/test/history/api-test-history.component.ts index ef755c27a..f7be7cc8d 100644 --- a/src/workbench/browser/src/app/pages/api/test/history/api-test-history.component.ts +++ b/src/workbench/browser/src/app/pages/api/test/history/api-test-history.component.ts @@ -8,7 +8,7 @@ import { ApiTestHistoryFrame, StorageHandleResult, StorageHandleStatus, -} from '../../../../../../../../platform/browser/IndexedDB'; +} from 'eo/platform/browser/IndexedDB'; @Component({ selector: 'eo-api-test-history', diff --git a/src/workbench/browser/src/app/pages/api/test/result-response/api-test-result-response.component.ts b/src/workbench/browser/src/app/pages/api/test/result-response/api-test-result-response.component.ts index 7c00ecabb..4250e6684 100644 --- a/src/workbench/browser/src/app/pages/api/test/result-response/api-test-result-response.component.ts +++ b/src/workbench/browser/src/app/pages/api/test/result-response/api-test-result-response.component.ts @@ -1,5 +1,5 @@ import { Component, Input, OnInit, OnChanges } from '@angular/core'; -import { ApiTestHistoryResponse } from '../../../../../../../../platform/browser/IndexedDB'; +import { ApiTestHistoryResponse } from 'eo/platform/browser/IndexedDB'; import { ApiTestService } from '../api-test.service'; @Component({ selector: 'eo-api-test-result-response', diff --git a/src/workbench/browser/src/app/pages/pages.component.ts b/src/workbench/browser/src/app/pages/pages.component.ts index 34e09aea9..6afc44ff2 100644 --- a/src/workbench/browser/src/app/pages/pages.component.ts +++ b/src/workbench/browser/src/app/pages/pages.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectorRef, Component, OnInit } from '@angular/core'; import { SafeResourceUrl } from '@angular/platform-browser'; -import { SidebarService } from '../shared/components/sidebar/sidebar.service'; +import { SidebarService } from 'eo/workbench/browser/src/app/shared/components/sidebar/sidebar.service'; @Component({ selector: 'eo-pages', diff --git a/src/workbench/browser/src/app/shared/components/export-api/export-api.component.ts b/src/workbench/browser/src/app/shared/components/export-api/export-api.component.ts index 154a46ffd..274c6f746 100644 --- a/src/workbench/browser/src/app/shared/components/export-api/export-api.component.ts +++ b/src/workbench/browser/src/app/shared/components/export-api/export-api.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { StorageService } from '../../../shared/services/storage'; -import { StorageHandleResult, StorageHandleStatus } from '../../../../../../../platform/browser/IndexedDB'; +import { StorageHandleResult, StorageHandleStatus } from 'eo/platform/browser/IndexedDB'; import packageJson from '../../../../../../../../package.json'; @Component({ selector: 'eo-export-api', diff --git a/src/workbench/browser/src/app/shared/components/navbar/navbar.component.ts b/src/workbench/browser/src/app/shared/components/navbar/navbar.component.ts index 3e24fa46f..1882e32f3 100644 --- a/src/workbench/browser/src/app/shared/components/navbar/navbar.component.ts +++ b/src/workbench/browser/src/app/shared/components/navbar/navbar.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { ElectronService } from '../../../core/services'; -import { ModuleInfo } from '../../../../../../../platform/node/extension-manager'; +import { ModuleInfo } from 'eo/platform/node/extension-manager'; @Component({ selector: 'eo-navbar', templateUrl: './navbar.component.html', @@ -44,7 +44,7 @@ export class NavbarComponent implements OnInit { let result = ''; let assetIndex = assets.findIndex( (asset) => - new RegExp(`${item.suffix}$`,'g').test(asset.browser_download_url)&& + new RegExp(`${item.suffix}$`, 'g').test(asset.browser_download_url) && (!item.keyword || asset.browser_download_url.includes(item.keyword)) ); if (assetIndex === -1) { @@ -74,7 +74,7 @@ export class NavbarComponent implements OnInit { item ); }); - console.log(this.resourceInfo) + console.log(this.resourceInfo); }); } minimize() { diff --git a/src/workbench/browser/src/app/shared/components/sync-api/sync-api.component.ts b/src/workbench/browser/src/app/shared/components/sync-api/sync-api.component.ts index 69a5059aa..8a4678804 100644 --- a/src/workbench/browser/src/app/shared/components/sync-api/sync-api.component.ts +++ b/src/workbench/browser/src/app/shared/components/sync-api/sync-api.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { NzModalRef } from 'ng-zorro-antd/modal'; -import { StorageHandleResult, StorageHandleStatus } from '../../../../../../../platform/browser/IndexedDB'; +import { StorageHandleResult, StorageHandleStatus } from 'eo/platform/browser/IndexedDB'; import { StorageService } from '../../services/storage'; import packageJson from '../../../../../../../../package.json'; diff --git a/src/workbench/browser/src/app/shared/services/api-test/api-test.utils.ts b/src/workbench/browser/src/app/shared/services/api-test/api-test.utils.ts index 120bcb1ba..281daa79d 100644 --- a/src/workbench/browser/src/app/shared/services/api-test/api-test.utils.ts +++ b/src/workbench/browser/src/app/shared/services/api-test/api-test.utils.ts @@ -1,7 +1,7 @@ import { listToTreeHasLevel } from '../../../utils/tree/tree.utils'; import { formatDate } from '@angular/common'; import { TestLocalNodeData } from './local-node/api-server-data.model'; -import { ApiBodyType, ApiTestResGeneral, ApiTestHistoryResponse } from '../../../../../../../platform/browser/IndexedDB'; +import { ApiBodyType, ApiTestResGeneral, ApiTestHistoryResponse } from 'eo/platform/browser/IndexedDB'; const METHOD = ['POST', 'GET', 'PUT', 'DELETE', 'HEAD', 'OPTIONS', 'PATCH'], PROTOCOL = ['http', 'https'], REQUEST_BODY_TYPE = ['formData', 'raw', 'json', 'xml', 'binary']; @@ -98,7 +98,7 @@ export const eoFormatRequestData = (data, opts = { env: {} }, locale) => { }; return result; }; -export const eoFormatResponseData = ({type,report, history, id }) => { +export const eoFormatResponseData = ({ type, report, history, id }) => { let { httpCode, ...response } = history.resultInfo; response = { statusCode: httpCode, diff --git a/src/workbench/browser/src/app/shared/services/api-test/test-server.model.ts b/src/workbench/browser/src/app/shared/services/api-test/test-server.model.ts index cd10202f2..3b8ca1dee 100644 --- a/src/workbench/browser/src/app/shared/services/api-test/test-server.model.ts +++ b/src/workbench/browser/src/app/shared/services/api-test/test-server.model.ts @@ -1,4 +1,4 @@ -import { Environment, ApiTestHistoryFrame } from '../../../../../../../platform/browser/IndexedDB'; +import { Environment, ApiTestHistoryFrame } from 'eo/platform/browser/IndexedDB'; export interface TestServer { init: (receiveMessage: (message: any) => void) => void; send: (action: string, message: any) => void; diff --git a/src/workbench/browser/src/app/shared/services/storage/storage.service.ts b/src/workbench/browser/src/app/shared/services/storage/storage.service.ts index 8c9f42287..e47466c46 100644 --- a/src/workbench/browser/src/app/shared/services/storage/storage.service.ts +++ b/src/workbench/browser/src/app/shared/services/storage/storage.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; -import { StorageHandleStatus } from '../../../../../../../platform/browser/IndexedDB'; -import { Storage as IndexedDBStorage } from '../../../../../../../platform/browser/IndexedDB/lib'; -import { isNotEmpty } from '../../../../../../../shared/common/common'; +import { StorageHandleStatus } from 'eo/platform/browser/IndexedDB'; +import { Storage as IndexedDBStorage } from 'eo/platform/browser/IndexedDB/lib'; +import { isNotEmpty } from 'eo/shared/common/common'; /** * @description diff --git a/src/workbench/browser/src/app/utils/data-transfer/data-transfer.utils.ts b/src/workbench/browser/src/app/utils/data-transfer/data-transfer.utils.ts index 551a5e9b7..c13178440 100644 --- a/src/workbench/browser/src/app/utils/data-transfer/data-transfer.utils.ts +++ b/src/workbench/browser/src/app/utils/data-transfer/data-transfer.utils.ts @@ -1,5 +1,5 @@ import { whatType, whatTextType } from '..'; -import { ApiBodyType, JsonRootType } from '../../../../../../platform/browser/IndexedDB'; +import { ApiBodyType, JsonRootType } from 'eo/platform/browser/IndexedDB'; import { flatData } from '../tree/tree.utils'; export const isXML = (data) => { diff --git a/src/workbench/browser/src/tsconfig.app.json b/src/workbench/browser/src/tsconfig.app.json index f0fc33cf4..3457ffdb4 100644 --- a/src/workbench/browser/src/tsconfig.app.json +++ b/src/workbench/browser/src/tsconfig.app.json @@ -3,7 +3,12 @@ "compilerOptions": { "outDir": "../out-tsc/app", "baseUrl": "", - "types": [] + "types": [], + "paths": { + "eo/*": [ + "../../../../src/*" + ] + } }, "files": [ "main.ts", diff --git a/src/workbench/browser/tsconfig.json b/src/workbench/browser/tsconfig.json index 72d69b70b..cf1605613 100644 --- a/src/workbench/browser/tsconfig.json +++ b/src/workbench/browser/tsconfig.json @@ -2,15 +2,19 @@ "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", - "resolveJsonModule":true, - "allowSyntheticDefaultImports":true, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, "module": "es2020", "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, + "baseUrl": "../../../", "paths": { + "eo/*": [ + "./src/*" + ] }, "allowJs": true, "target": "es5", diff --git a/tsconfig.json b/tsconfig.json index f1b71ca7d..61633785c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,13 +7,30 @@ "experimentalDecorators": true, "module": "commonjs", "target": "es5", - "types": ["node"], - "lib": ["es2017", "es2016", "es2015", "dom"], - "baseUrl": "./", - "paths": {} + "types": [ + "node" + ], + "lib": [ + "es2017", + "es2016", + "es2015", + "dom" + ], + "baseUrl": ".", + "paths": { + "eo/*": [ + "./src/*" + ] + } }, - "include": ["**/**.ts"], - "exclude": ["node_modules", "**/*.spec.ts", "**/browser/**/*.ts"], + "include": [ + "**/**.ts", + ], + "exclude": [ + "node_modules", + "**/*.spec.ts", + "**/browser/**/*.ts" + ], "angularCompilerOptions": { "enableIvy": true }