Skip to content

Commit ab7bc9b

Browse files
committed
⬆️ 升级依赖、处理babel
1 parent 4df67fa commit ab7bc9b

26 files changed

Lines changed: 2006 additions & 1416 deletions

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/build
22
/node_modules
33
.eslintrc.js
4+
webpack.*
5+
/scripts

.eslintrc.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@ module.exports = {
8888
"@typescript-eslint/no-explicit-any": ["off"],
8989
"@typescript-eslint/no-unsafe-assignment": ["off"],
9090
"@typescript-eslint/no-implied-eval": ["off"],
91-
91+
"@typescript-eslint/no-this-alias": [
92+
"error",
93+
{
94+
"allowDestructuring": false, // Disallow `const { props, state } = this`; true by default
95+
"allowedNames": ["self"] // Allow `const self = this`; `[]` by default
96+
}
97+
]
9298
// '@typescript-eslint/no-unsafe-return': ['off'],
9399
// '@typescript-eslint/no-unsafe-call': ['off'],
94100
// '@typescript-eslint/no-empty-function': ['off'],

babel.config.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
{
22
"presets": [
33
"@vue/babel-preset-jsx",
4-
"@babel/preset-env",
4+
[
5+
"@babel/preset-env",
6+
{
7+
"targets": {
8+
"chrome": "67"
9+
},
10+
"useBuiltIns": "usage",
11+
"corejs": "3.18"
12+
}
13+
],
514
"@babel/preset-typescript"
615
],
716
"plugins": [

build/scriptcat/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "ScriptCat",
4-
"version": "0.8.2",
4+
"version": "0.9.0",
55
"description": "脚本猫,一个用户脚本的框架,可编写脚本每天帮你自动处理事务.",
66
"background": {
77
"page": "background.html"

package-lock.json

Lines changed: 1850 additions & 1287 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,35 @@
1818
"dependencies": {
1919
"adm-zip": "^0.5.3",
2020
"axios": "^0.21.1",
21-
"buffer": "^4.9.2",
21+
"core-js": "^3.20.3",
2222
"cron": "^1.8.2",
2323
"crypto-js": "^4.0.0",
2424
"dayjs": "^1.10.4",
25-
"dexie": "^3.0.3",
25+
"dexie": "^3.2.0",
2626
"file-saver": "^2.0.5",
2727
"jszip": "^3.7.1",
28-
"monaco-editor": "^0.22.3",
28+
"monaco-editor": "^0.31.1",
2929
"reflect-metadata": "^0.1.13",
3030
"sortablejs": "^1.14.0",
3131
"uuid": "^8.3.2",
3232
"vue": "^2.6.12",
3333
"vue-i18n": "^8.24.1",
3434
"vue-router": "^3.5.1",
35-
"vuetify": "^2.4.5",
35+
"vuetify": "^2.6.2",
3636
"vuetify-dialog-promise": "^2.4.2",
3737
"vuex": "^3.6.2",
3838
"vuex-module-decorators": "^1.0.1",
3939
"yaml": "^1.10.2"
4040
},
4141
"devDependencies": {
42-
"@babel/core": "^7.13.10",
43-
"@babel/plugin-transform-runtime": "^7.13.10",
44-
"@babel/preset-env": "^7.13.10",
45-
"@babel/preset-typescript": "^7.13.0",
46-
"@babel/register": "^7.13.8",
42+
"@babel/core": "^7.16.12",
43+
"@babel/plugin-transform-runtime": "^7.16.10",
44+
"@babel/preset-env": "^7.16.11",
45+
"@babel/preset-typescript": "^7.16.7",
46+
"@babel/register": "^7.16.8",
4747
"@mdi/js": "^5.9.55",
4848
"@types/adm-zip": "^0.4.34",
49-
"@types/chrome": "0.0.127",
49+
"@types/chrome": "0.0.176",
5050
"@types/cron": "^1.7.2",
5151
"@types/crypto-js": "^4.0.1",
5252
"@types/file-saver": "^2.0.3",
@@ -84,7 +84,7 @@
8484
"style-loader": "^2.0.0",
8585
"ts-jest": "^27.0.7",
8686
"ts-loader": "^8.3.0",
87-
"typescript": "^4.1.3",
87+
"typescript": "^4.5.5",
8888
"vue-class-component": "^7.2.6",
8989
"vue-loader": "^15.9.8",
9090
"vue-property-decorator": "^9.1.2",

src/apps/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const ExtVersion = '0.8.2';
1+
export const ExtVersion = '0.9.0';
22

33
export const Server = process.env.NODE_ENV == 'production' ? 'https://sc.icodef.com/' : 'http://localhost:8080/';
44

src/apps/grant/background.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ export class BackgroundGrant {
347347
const item = list.pop();
348348
if (item) {
349349
void App.Cache.set('confirm:info:' + item.uuid, [item, list.length]);
350-
chrome.tabs.create({ url: chrome.runtime.getURL('confirm.html?uuid=' + item.uuid) });
350+
void chrome.tabs.create({ url: chrome.runtime.getURL('confirm.html?uuid=' + item.uuid) });
351351
} else {
352352
void App.Cache.del('confirm:window:' + confirm.permission + ':list:' + script.id.toString());
353353
}
@@ -484,7 +484,7 @@ export class BackgroundGrant {
484484
if (xhr.response instanceof ArrayBuffer) {
485485
respond.response = URL.createObjectURL(new Blob([xhr.response]));
486486
} else {
487-
respond.response = URL.createObjectURL(xhr.response);
487+
respond.response = URL.createObjectURL(<Blob>xhr.response);
488488
}
489489
setTimeout(() => {
490490
URL.revokeObjectURL(<string>respond.response);
@@ -832,7 +832,7 @@ export class BackgroundGrant {
832832
@BackgroundGrant.GMFunction({ default: true })
833833
protected GM_closeInTab(grant: Grant): Promise<any> {
834834
return new Promise(resolve => {
835-
chrome.tabs.remove(<number>grant.params[0]);
835+
void chrome.tabs.remove(<number>grant.params[0]);
836836
resolve(undefined);
837837
})
838838
}
@@ -889,9 +889,9 @@ export class BackgroundGrant {
889889
return reject('param is null');
890890
}
891891
const details: GM_Types.NotificationDetails = params[0];
892-
const options: chrome.notifications.NotificationOptions = {
892+
const options: chrome.notifications.NotificationOptions<true> = {
893893
title: details.title || 'ScriptCat',
894-
message: details.text,
894+
message: details.text || '无消息内容',
895895
iconUrl: details.image || getIcon(script) || chrome.runtime.getURL('assets/logo.png'),
896896
type: (isFirefox() || details.progress === undefined) ? 'basic' : 'progress',
897897
};

src/apps/logger/console.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { LOGGER_LEVEL, LOGGER_LEVEL_DEBUG, LOGGER_LEVEL_ERROR, LOGGER_LEVEL_INFO, LOGGER_LEVEL_WARN } from '@App/model/do/logger';
2+
import { Logger } from './logger';
3+
4+
export class ConsoleLogger implements Logger {
5+
public Logger(level: LOGGER_LEVEL, origin: string, msg: string, title = ''): Logger {
6+
console.log({ level: level, origin: origin, msg: msg, title: title });
7+
return this;
8+
}
9+
10+
public Debug(origin: string, msg: string, title = ''): Logger {
11+
return this.Logger(LOGGER_LEVEL_DEBUG, origin, msg, title);
12+
}
13+
14+
public Info(origin: string, msg: string, title = ''): Logger {
15+
return this.Logger(LOGGER_LEVEL_INFO, origin, msg, title);
16+
}
17+
18+
public Warn(origin: string, msg: string, title = ''): Logger {
19+
return this.Logger(LOGGER_LEVEL_WARN, origin, msg, title);
20+
}
21+
22+
public Error(origin: string, msg: string, title = ''): Logger {
23+
return this.Logger(LOGGER_LEVEL_ERROR, origin, msg, title);
24+
}
25+
}

src/apps/logger/dblogger.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { Log, LOGGER_LEVEL, LOGGER_LEVEL_ERROR, LOGGER_LEVEL_INFO, LOGGER_LEVEL_WARN } from '@App/model/do/logger';
2+
import { LoggerModel } from '@App/model/logger';
3+
import { Logger } from './logger';
4+
5+
export class DBLogger implements Logger {
6+
public logger = new LoggerModel();
7+
8+
public Logger(level: LOGGER_LEVEL, origin: string, msg: string, title = '', scriptId?: number): Logger {
9+
const log: Log = {
10+
id: 0,
11+
level: level,
12+
message: msg,
13+
origin: origin,
14+
title: title,
15+
createtime: new Date().getTime(),
16+
};
17+
if (scriptId) {
18+
log.scriptId = scriptId;
19+
}
20+
void this.logger.save(log);
21+
return this;
22+
}
23+
24+
public Debug(origin: string, msg: string, title = '', scriptId?: number): Logger {
25+
console.log(origin + '-' + title + ': ' + msg, scriptId);
26+
return this;
27+
// return this.Logger(LOGGER_LEVEL_DEBUG, origin, msg, title);
28+
}
29+
30+
public Info(origin: string, msg: string, title = '', scriptId?: number): Logger {
31+
return this.Logger(LOGGER_LEVEL_INFO, origin, msg, title, scriptId);
32+
}
33+
34+
public Warn(origin: string, msg: string, title = '', scriptId?: number): Logger {
35+
return this.Logger(LOGGER_LEVEL_WARN, origin, msg, title, scriptId);
36+
}
37+
38+
public Error(origin: string, msg: string, title = '', scriptId?: number): Logger {
39+
return this.Logger(LOGGER_LEVEL_ERROR, origin, msg, title, scriptId);
40+
}
41+
}

0 commit comments

Comments
 (0)