Skip to content

Commit 1dfdd37

Browse files
authored
Merge pull request #42 from KubrickCode/develop/shlee/41
Optimize extension package size by 95.7% (187MB → 8MB)
2 parents 365d86b + f3b731e commit 1dfdd37

File tree

6 files changed

+34
-28
lines changed

6 files changed

+34
-28
lines changed

.vscodeignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ src/extension/*.spec.js
99
# Development dependencies
1010
src/web-view/node_modules/
1111

12+
# Exclude dev dependencies from extension package
13+
src/extension/node_modules/@jest/
14+
src/extension/node_modules/@babel/
15+
src/extension/node_modules/@types/
16+
src/extension/node_modules/typescript/
17+
src/extension/node_modules/jest/
18+
src/extension/node_modules/jest-*/
19+
src/extension/node_modules/ts-jest/
20+
src/extension/node_modules/@sinclair/
21+
src/extension/node_modules/@unrs/
22+
src/extension/node_modules/caniuse-lite/
23+
src/extension/node_modules/handlebars/
24+
src/extension/node_modules/uglify-js/
25+
1226
# Development config files
1327
src/extension/tsconfig.json
1428
src/extension/jest.config.js

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Quick Command Buttons",
44
"icon": "public/logo.png",
55
"description": "Add customizable buttons to quickly execute commands in VS Code",
6-
"version": "0.2.5",
6+
"version": "0.2.6",
77
"publisher": "KubrickCode",
88
"license": "MIT",
99
"repository": {

src/extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"dependencies": {
2222
"@indic-transliteration/sanscript": "^1.3.3",
2323
"convert-layout": "^0.11.1",
24-
"pinyin": "^4.0.0",
24+
"tiny-pinyin": "^1.3.2",
2525
"wanakana": "^5.3.1"
2626
}
2727
}

src/extension/src/keyboard-layout-converter.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import by from "convert-layout/by";
1111
import uk from "convert-layout/uk";
1212
import kk from "convert-layout/kk";
1313
import * as wanakana from "wanakana";
14-
import pinyin from "pinyin";
14+
import * as pinyin from "tiny-pinyin";
1515
import * as sanscript from "@indic-transliteration/sanscript";
1616

1717
type LayoutConverter = {
@@ -52,12 +52,7 @@ const japaneseConverter: LayoutConverter = {
5252
const chineseConverter: LayoutConverter = {
5353
toEn: (text: string): string => {
5454
try {
55-
const pinyinResult = pinyin(text, {
56-
style: pinyin.STYLE_NORMAL,
57-
heteronym: false,
58-
segment: false,
59-
});
60-
return pinyinResult.flat().join("");
55+
return pinyin.convertToPinyin(text, "", true);
6156
} catch {
6257
return text;
6358
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
declare module "tiny-pinyin" {
2+
export const isSupported: (text: string) => boolean;
3+
export const convertToPinyin: (
4+
text: string,
5+
separator?: string,
6+
lowerCase?: boolean
7+
) => string;
8+
export const parse: (text: string) => Array<{ target: string; origin: string }>;
9+
export const patchDict: (dict: Record<string, string>) => void;
10+
export const genToken: (ch: string) => string;
11+
}

src/extension/yarn.lock

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,13 +1077,6 @@ color-name@~1.1.4:
10771077
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
10781078
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
10791079

1080-
commander@~1.1.1:
1081-
version "1.1.1"
1082-
resolved "https://registry.yarnpkg.com/commander/-/commander-1.1.1.tgz#50d1651868ae60eccff0a2d9f34595376bc6b041"
1083-
integrity sha512-71Rod2AhcH3JhkBikVpNd0pA+fWsmAaVoti6OR38T76chA7vE3pSerS0Jor4wDw+tOueD2zLVvFOw5H0Rcj7rA==
1084-
dependencies:
1085-
keypress "0.1.x"
1086-
10871080
10881081
version "0.0.1"
10891082
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
@@ -1821,11 +1814,6 @@ json5@^2.2.3:
18211814
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
18221815
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
18231816

1824-
1825-
version "0.1.0"
1826-
resolved "https://registry.yarnpkg.com/keypress/-/keypress-0.1.0.tgz#4a3188d4291b66b4f65edb99f806aa9ae293592a"
1827-
integrity sha512-x0yf9PL/nx9Nw9oLL8ZVErFAk85/lslwEP7Vz7s5SI1ODXZIgit3C5qyWjw4DxOuO/3Hb4866SQh28a1V1d+WA==
1828-
18291817
leven@^3.1.0:
18301818
version "3.1.0"
18311819
resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2"
@@ -2056,13 +2044,6 @@ picomatch@^4.0.2:
20562044
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.3.tgz#796c76136d1eead715db1e7bad785dedd695a042"
20572045
integrity sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==
20582046

2059-
pinyin@^4.0.0:
2060-
version "4.0.0"
2061-
resolved "https://registry.yarnpkg.com/pinyin/-/pinyin-4.0.0.tgz#9c15fd9d45c08b6813221fc602f77759429bfa4f"
2062-
integrity sha512-vHpV5K+vpp6XUUpZNGRDuHoN+1xcmieM3EWlH4QjSX2kkpG/gVOwpqwV9EOJ9x9c9UERFKeLml5XVSukE/PLgQ==
2063-
dependencies:
2064-
commander "~1.1.1"
2065-
20662047
pirates@^4.0.7:
20672048
version "4.0.7"
20682049
resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.7.tgz#643b4a18c4257c8a65104b73f3049ce9a0a15e22"
@@ -2274,6 +2255,11 @@ test-exclude@^6.0.0:
22742255
glob "^7.1.4"
22752256
minimatch "^3.0.4"
22762257

2258+
tiny-pinyin@^1.3.2:
2259+
version "1.3.2"
2260+
resolved "https://registry.yarnpkg.com/tiny-pinyin/-/tiny-pinyin-1.3.2.tgz#ce31f0f3afc2a80ee9df708fc7f4e914854d534a"
2261+
integrity sha512-uHNGu4evFt/8eNLldazeAM1M8JrMc1jshhJJfVRARTN3yT8HEEibofeQ7QETWQ5ISBjd6fKtTVBCC/+mGS6FpA==
2262+
22772263
22782264
version "1.0.5"
22792265
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc"

0 commit comments

Comments
 (0)