feat: support for import via absolute path (#35)

* feat: support for import via absolute path

* update code

* update code

* update code
This commit is contained in:
bqy_fe 2022-05-23 12:39:35 +08:00 committed by GitHub
parent 2ff4006884
commit 8a0baab60b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 241 additions and 198 deletions

View File

@ -11,12 +11,11 @@
],
"parserOptions": {
"project": [
"./tsconfig.serve.json"
// "./tsconfig.serve.json"
],
"createDefaultProgram": true
},
"extends": [
],
"extends": [],
"rules": {
"prefer-arrow/prefer-arrow-functions": 0,
"@angular-eslint/directive-selector": 0,
@ -34,10 +33,8 @@
"files": [
"*.html"
],
"extends": [
],
"rules": {
}
"extends": [],
"rules": {}
}
]
}

View File

@ -1,4 +1,5 @@
{
"typescript.preferences.importModuleSpecifier": "non-relative",
"eslint.workingDirectories": [
{
"mode": "auto"
@ -11,4 +12,3 @@
"**/*.js.map": true,
}
}

56
package-lock.json generated
View File

@ -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": {

View File

@ -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"
}
}

View File

@ -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;
@ -26,10 +32,11 @@ class StorageService {
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) => {
Storage[action](...args.params).subscribe(
(result: any) => {
handleResult.data = result;
if (isNotEmpty(result)) {
handleResult.status = StorageHandleStatus.success;
@ -37,10 +44,12 @@ class StorageService {
handleResult.status = StorageHandleStatus.empty;
}
this.storageListenHandleNotify(args.type, handleResult);
}, (error: any) => {
},
(error: any) => {
handleResult.status = StorageHandleStatus.error;
this.storageListenHandleNotify(args.type, handleResult);
});
}
);
} else {
this.storageListenHandleNotify(args.type, handleResult);
}

View File

@ -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;

View File

@ -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;

View File

@ -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 = {

View File

@ -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;

View File

@ -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,
bounds: ViewBounds;
partition?: string;
preloadPath?: string;
viewPath: string;
preload?: string;
}

View File

@ -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 {
/**

View File

@ -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';
/**
*

View File

@ -1,7 +1,7 @@
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';
/**

View File

@ -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,7 +82,7 @@ export class ModuleManager implements ModuleManagerInterface {
const modules: Map<string, ModuleInfo> = this.moduleBelongs();
modules?.forEach((module: ModuleInfo) => {
if (module.isApp) {
module.main= processEnv === 'development' && module.main_debug ? module.main_debug : module.main,
(module.main = processEnv === 'development' && module.main_debug ? module.main_debug : module.main),
output.push(module);
}
});

View File

@ -1,4 +1,4 @@
import { SidePosition } from '../../../../shared/common/bounds';
import { SidePosition } from 'eo/shared/common/bounds';
import { ModuleHandlerResult } from './handler';
/**

View File

@ -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
},
@ -43,8 +43,7 @@
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {
}
"rules": {}
}
]
}

View File

@ -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()

View File

@ -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) {

View File

@ -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;
}

View File

@ -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: '标签',
});
}
}

View File

@ -1,11 +1,11 @@
import { Component, OnInit, Input } from '@angular/core';
import { ApiEditQuery } from '../../../../../../../../platform/browser/IndexedDB';
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[];
@ -17,7 +17,7 @@ export class ApiDetailQueryComponent implements OnInit {
}
private initListConf() {
this.listConf = this.detailService.initListConf({
dragCacheVar:'DRAG_VAR_API_EDIT_QUERY'
dragCacheVar: 'DRAG_VAR_API_EDIT_QUERY',
});
}
}

View File

@ -1,5 +1,5 @@
import { Component, OnInit, Input } from '@angular/core';
import { ApiEditRest } from '../../../../../../../../platform/browser/IndexedDB';
import { ApiEditRest } from 'eo/platform/browser/IndexedDB';
import { ApiDetailService } from '../api-detail.service';
@Component({
selector: 'eo-api-detail-rest',

View File

@ -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';

View File

@ -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;
@ -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');
}

View File

@ -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',

View File

@ -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',

View File

@ -1,11 +1,11 @@
import { Component, OnInit, Input, ChangeDetectorRef, AfterViewChecked, OnChanges } from '@angular/core';
import { ApiEditQuery } from '../../../../../../../../platform/browser/IndexedDB';
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 {
@Input() model: object[];
@ -36,7 +36,7 @@ export class ApiEditQueryComponent implements OnInit,OnChanges,AfterViewChecked
itemStructure: this.itemStructure,
nzOnOkMoreSetting: (inputArg) => {
this.model[inputArg.$index] = inputArg.item;
}
},
});
}
}

View File

@ -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',
@ -34,7 +34,7 @@ export class ApiEditRestComponent implements OnInit, OnChanges, AfterViewChecked
itemStructure: this.itemStructure,
nzOnOkMoreSetting: (inputArg) => {
this.model[inputArg.$index] = inputArg.item;
}
},
});
}
}

View File

@ -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';

View File

@ -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 {

View File

@ -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 };

View File

@ -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';

View File

@ -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';

View File

@ -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');
}

View File

@ -8,7 +8,7 @@ import {
ApiTestHistoryFrame,
StorageHandleResult,
StorageHandleStatus,
} from '../../../../../../../../platform/browser/IndexedDB';
} from 'eo/platform/browser/IndexedDB';
@Component({
selector: 'eo-api-test-history',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',
@ -74,7 +74,7 @@ export class NavbarComponent implements OnInit {
item
);
});
console.log(this.resourceInfo)
console.log(this.resourceInfo);
});
}
minimize() {

View File

@ -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';

View File

@ -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'];

View File

@ -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;

View File

@ -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

View File

@ -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) => {

View File

@ -3,7 +3,12 @@
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "",
"types": []
"types": [],
"paths": {
"eo/*": [
"../../../../src/*"
]
}
},
"files": [
"main.ts",

View File

@ -10,7 +10,11 @@
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"baseUrl": "../../../",
"paths": {
"eo/*": [
"./src/*"
]
},
"allowJs": true,
"target": "es5",

View File

@ -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
}