Skip to content

Commit cdefbcc

Browse files
authored
Merge pull request #29 from czfadmin/feat-add-swc-loader
feat: 使用 swc-loader 编译,提升编译速度
2 parents 8b2cdb7 + 42c3e55 commit cdefbcc

10 files changed

Lines changed: 1245 additions & 58 deletions

File tree

.swcrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "https://json.schemastore.org/swcrc",
3+
"jsc": {
4+
"parser": {
5+
"syntax": "typescript",
6+
"dynamicImport": true,
7+
"decorators": false
8+
},
9+
"target": "es5",
10+
"loose": false,
11+
"externalHelpers": false,
12+
"keepClassNames": false
13+
},
14+
"minify": true
15+
}

.vscode/tasks.json

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
11
// See https://go.microsoft.com/fwlink/?LinkId=733558
22
// for the documentation about the tasks.json format
33
{
4-
"version": "2.0.0",
5-
"tasks": [
6-
{
7-
"type": "npm",
8-
"script": "watch",
9-
"problemMatcher": "$ts-webpack-watch",
10-
"isBackground": true,
11-
"presentation": {
12-
"reveal": "never",
13-
"group": "watchers"
14-
},
15-
"group": {
16-
"kind": "build",
17-
"isDefault": true
18-
}
19-
},
20-
{
21-
"type": "npm",
22-
"script": "watch-tests",
23-
"problemMatcher": "$tsc-watch",
24-
"isBackground": true,
25-
"presentation": {
26-
"reveal": "never",
27-
"group": "watchers"
28-
},
29-
"group": "build"
30-
},
31-
{
32-
"label": "tasks: watch-tests",
33-
"dependsOn": [
34-
"npm: watch",
35-
"npm: watch-tests"
36-
],
37-
"problemMatcher": []
38-
}
39-
]
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "watch",
9+
"problemMatcher": "$ts-webpack-watch",
10+
"isBackground": true,
11+
"presentation": {
12+
"reveal": "never",
13+
"group": "watchers"
14+
},
15+
"group": {
16+
"kind": "build",
17+
"isDefault": true
18+
}
19+
},
20+
21+
{
22+
"type": "npm",
23+
"script": "watch-tests",
24+
"problemMatcher": "$tsc-watch",
25+
"isBackground": true,
26+
"presentation": {
27+
"reveal": "never",
28+
"group": "watchers"
29+
},
30+
"group": "build"
31+
},
32+
{
33+
"label": "tasks: watch-tests",
34+
"dependsOn": ["npm: watch", "npm: watch-tests"],
35+
"problemMatcher": []
36+
}
37+
]
4038
}

.vscodeignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ vsc-extension-quickstart.md
1515
resources/bootstrap-icons.json
1616
resources/bootstrap-icons.svg
1717
resources/bootstrap-icons.woff
18+
.swrrc
19+
.github/**
20+
.husky/**
21+
.eslintignore

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## 0.0.29
4+
5+
### Patch Changes
6+
7+
- 使用swc-loader提升编译速度
8+
39
## 0.0.28
410

511
### Patch Changes

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "bookmark-manager",
33
"displayName": "Bookmark Manager (BM)",
44
"description": "Simple and easy to use bookmark manager",
5-
"version": "0.0.28",
5+
"version": "0.0.29",
66
"engines": {
77
"vscode": "^1.82.0"
88
},
@@ -589,6 +589,7 @@
589589
},
590590
"devDependencies": {
591591
"@changesets/cli": "^2.26.2",
592+
"@swc/core": "^1.4.8",
592593
"@types/glob": "^8.1.0",
593594
"@types/lodash": "^4.14.199",
594595
"@types/mocha": "^10.0.1",
@@ -605,14 +606,14 @@
605606
"lint-staged": "^15.0.2",
606607
"mocha": "^10.2.0",
607608
"prettier": "^3.0.3",
609+
"swc-loader": "^0.2.6",
608610
"ts-loader": "^9.4.2",
609611
"typescript": "^5.0.4",
610612
"webpack": "^5.81.0",
611613
"webpack-cli": "^5.0.2"
612614
},
613615
"dependencies": {
614616
"@vscode/l10n": "^0.0.16",
615-
"@vscode/vsce": "^2.23.0",
616617
"lodash": "^4.17.21",
617618
"mobx": "^6.12.0",
618619
"mobx-state-tree": "^5.4.1",

package.nls.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@
5151
"bookmark-manager.group": "Group",
5252
"bookmark-manager.useBuiltInColors": "When this configuration is turned on, the built-in color set will be added to the defined color (label) set; at the same time, when the user does not customize the color, the built-in color set will be used by default, otherwise the user-defined color set will be used.",
5353
"bookmark-manager.alwaysIgnore": "Always add 'bookmark-manager.json' to the '.gitignore 'file",
54-
"bookmark-manager.autoSwitchSingleToMultiWithLineWrap": "Automatically switches a single-line bookmark to a multi-line bookmark when wrapping"
54+
"bookmark-manager.autoSwitchSingleToMultiWithLineWrap": "Automatically switches a single-line bookmark to a multi-line bookmark when wrapping",
55+
"bookmark-manager.addBookmark": "Add new bookmark"
5556
}

package.nls.zh.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@
5151
"bookmark-manager.group": "分组",
5252
"bookmark-manager.useBuiltInColors": "开启此配置,将会在已定义的颜色(标签)集合中追加内置的颜色集合; 同时当用户未自定义颜色的时候, 默认也使用内置的颜色集合, 反之使用用户自定义颜色集合.",
5353
"bookmark-manager.alwaysIgnore": "将`bookmark-manager.json`总是添加到`.gitignore` 文件中",
54-
"bookmark-manager.autoSwitchSingleToMultiWithLineWrap": "当在存在单行书签的时候进行换行时,自动改变将单行书签类型的书签改变成多行书签"
54+
"bookmark-manager.autoSwitchSingleToMultiWithLineWrap": "当在存在单行书签的时候进行换行时,自动改变将单行书签类型的书签改变成多行书签",
55+
"bookmark-manager.addBookmark": "增加新书签"
5556
}

src/extension.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {disableAllEvents} from './events';
33
import logger from './utils/logger';
44
import {ExtensionContext} from 'vscode';
55
import bootstrap from './bootstrap';
6-
76
/**
87
* 插件上下文
98
*/

webpack.config.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@ const extensionConfig = {
3434
module: {
3535
rules: [
3636
{
37-
test: /\.ts$/,
38-
exclude: /node_modules/,
39-
use: [
40-
{
41-
loader: 'ts-loader',
42-
},
43-
],
37+
test: /\.m?ts$/,
38+
exclude: /(node_modules)/,
39+
use: {
40+
loader: 'swc-loader',
41+
},
4442
},
4543
],
4644
},

0 commit comments

Comments
 (0)