Merge branch 'swc' into 'master'

build: use swc for TypeScript compilation

See merge request dungeonslayers/ds4!190
This commit is contained in:
Johannes Loher 2022-04-22 01:07:39 +00:00
commit 31608add8b
3 changed files with 270 additions and 70 deletions

View file

@ -52,6 +52,7 @@
"test:ci": "jest --ci --reporters=default --reporters=jest-junit",
"format": "prettier --write \"./**/*.(ts|js|cjs|mjs|json|scss|yml)\"",
"typecheck": "tsc --noEmit",
"typecheck:watch": "tsc --noEmit --watch",
"bump-version": "node ./tools/bump-version.js",
"convert-packs-to-json": "node ./tools/convert-packs-to-json.js",
"postinstall": "husky install",
@ -72,6 +73,7 @@
"@pixi/utils": "6.2.1",
"@rollup/plugin-typescript": "8.3.2",
"@seald-io/nedb": "3.0.0",
"@swc/core": "1.2.170",
"@types/fs-extra": "9.0.13",
"@types/jest": "27.4.1",
"@typescript-eslint/eslint-plugin": "5.20.0",
@ -92,7 +94,7 @@
"rimraf": "3.0.2",
"rollup": "2.70.2",
"rollup-plugin-styles": "4.0.0",
"rollup-plugin-terser": "7.0.2",
"rollup-plugin-swc3": "0.3.0",
"sass": "1.50.1",
"semver": "7.3.7",
"ts-jest": "27.1.4",

View file

@ -3,9 +3,9 @@
// SPDX-License-Identifier: MIT
import copy from "@guanghechen/rollup-plugin-copy";
import typescript from "@rollup/plugin-typescript";
import styles from "rollup-plugin-styles";
import { terser } from "rollup-plugin-terser";
import { swc } from "rollup-plugin-swc3";
import { distDirectory, name, sourceDirectory } from "./tools/const.js";
import { convertJSONToPack } from "./tools/json-pack-tools.js";
@ -30,7 +30,7 @@ const isProduction = process.env.NODE_ENV === "production";
* @type {import('rollup').RollupOptions}
*/
const config = {
input: { [`${name}`]: `${sourceDirectory}/${name}.ts` },
input: { [name]: `${sourceDirectory}/${name}.ts` },
output: {
dir: distDirectory,
format: "es",
@ -38,7 +38,11 @@ const config = {
assetFileNames: "[name].[ext]",
},
plugins: [
typescript(),
swc({
minify: isProduction,
jsc: { minify: { sourceMap: true, keepFnames: true } },
sourceMaps: true,
}),
styles({
mode: ["extract", `css/${name}.css`],
url: false,
@ -60,8 +64,8 @@ const config = {
rename: (name, extension) => `${name.replace(".json", ".db")}.${extension}`,
},
],
verbose: true,
}),
isProduction && terser({ ecma: 2020, keep_fnames: true }),
],
};

322
yarn.lock
View file

@ -14,7 +14,7 @@ __metadata:
languageName: node
linkType: hard
"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.16.7":
"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.16.7":
version: 7.16.7
resolution: "@babel/code-frame@npm:7.16.7"
dependencies:
@ -1493,6 +1493,16 @@ __metadata:
languageName: node
linkType: hard
"@rollup/pluginutils@npm:^4.2.1":
version: 4.2.1
resolution: "@rollup/pluginutils@npm:4.2.1"
dependencies:
estree-walker: ^2.0.1
picomatch: ^2.2.2
checksum: 6bc41f22b1a0f1efec3043899e4d3b6b1497b3dea4d94292d8f83b4cf07a1073ecbaedd562a22d11913ff7659f459677b01b09e9598a98936e746780ecc93a12
languageName: node
linkType: hard
"@seald-io/binary-search-tree@npm:^1.0.2":
version: 1.0.2
resolution: "@seald-io/binary-search-tree@npm:1.0.2"
@ -1543,6 +1553,147 @@ __metadata:
languageName: node
linkType: hard
"@swc/core-android-arm-eabi@npm:1.2.170":
version: 1.2.170
resolution: "@swc/core-android-arm-eabi@npm:1.2.170"
conditions: os=android & cpu=arm
languageName: node
linkType: hard
"@swc/core-android-arm64@npm:1.2.170":
version: 1.2.170
resolution: "@swc/core-android-arm64@npm:1.2.170"
conditions: os=android & cpu=arm64
languageName: node
linkType: hard
"@swc/core-darwin-arm64@npm:1.2.170":
version: 1.2.170
resolution: "@swc/core-darwin-arm64@npm:1.2.170"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard
"@swc/core-darwin-x64@npm:1.2.170":
version: 1.2.170
resolution: "@swc/core-darwin-x64@npm:1.2.170"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard
"@swc/core-freebsd-x64@npm:1.2.170":
version: 1.2.170
resolution: "@swc/core-freebsd-x64@npm:1.2.170"
conditions: os=freebsd & cpu=x64
languageName: node
linkType: hard
"@swc/core-linux-arm-gnueabihf@npm:1.2.170":
version: 1.2.170
resolution: "@swc/core-linux-arm-gnueabihf@npm:1.2.170"
conditions: os=linux & cpu=arm
languageName: node
linkType: hard
"@swc/core-linux-arm64-gnu@npm:1.2.170":
version: 1.2.170
resolution: "@swc/core-linux-arm64-gnu@npm:1.2.170"
conditions: os=linux & cpu=arm64 & libc=glibc
languageName: node
linkType: hard
"@swc/core-linux-arm64-musl@npm:1.2.170":
version: 1.2.170
resolution: "@swc/core-linux-arm64-musl@npm:1.2.170"
conditions: os=linux & cpu=arm64 & libc=musl
languageName: node
linkType: hard
"@swc/core-linux-x64-gnu@npm:1.2.170":
version: 1.2.170
resolution: "@swc/core-linux-x64-gnu@npm:1.2.170"
conditions: os=linux & cpu=x64 & libc=glibc
languageName: node
linkType: hard
"@swc/core-linux-x64-musl@npm:1.2.170":
version: 1.2.170
resolution: "@swc/core-linux-x64-musl@npm:1.2.170"
conditions: os=linux & cpu=x64 & libc=musl
languageName: node
linkType: hard
"@swc/core-win32-arm64-msvc@npm:1.2.170":
version: 1.2.170
resolution: "@swc/core-win32-arm64-msvc@npm:1.2.170"
conditions: os=win32 & cpu=arm64
languageName: node
linkType: hard
"@swc/core-win32-ia32-msvc@npm:1.2.170":
version: 1.2.170
resolution: "@swc/core-win32-ia32-msvc@npm:1.2.170"
conditions: os=win32 & cpu=ia32
languageName: node
linkType: hard
"@swc/core-win32-x64-msvc@npm:1.2.170":
version: 1.2.170
resolution: "@swc/core-win32-x64-msvc@npm:1.2.170"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard
"@swc/core@npm:1.2.170":
version: 1.2.170
resolution: "@swc/core@npm:1.2.170"
dependencies:
"@swc/core-android-arm-eabi": 1.2.170
"@swc/core-android-arm64": 1.2.170
"@swc/core-darwin-arm64": 1.2.170
"@swc/core-darwin-x64": 1.2.170
"@swc/core-freebsd-x64": 1.2.170
"@swc/core-linux-arm-gnueabihf": 1.2.170
"@swc/core-linux-arm64-gnu": 1.2.170
"@swc/core-linux-arm64-musl": 1.2.170
"@swc/core-linux-x64-gnu": 1.2.170
"@swc/core-linux-x64-musl": 1.2.170
"@swc/core-win32-arm64-msvc": 1.2.170
"@swc/core-win32-ia32-msvc": 1.2.170
"@swc/core-win32-x64-msvc": 1.2.170
dependenciesMeta:
"@swc/core-android-arm-eabi":
optional: true
"@swc/core-android-arm64":
optional: true
"@swc/core-darwin-arm64":
optional: true
"@swc/core-darwin-x64":
optional: true
"@swc/core-freebsd-x64":
optional: true
"@swc/core-linux-arm-gnueabihf":
optional: true
"@swc/core-linux-arm64-gnu":
optional: true
"@swc/core-linux-arm64-musl":
optional: true
"@swc/core-linux-x64-gnu":
optional: true
"@swc/core-linux-x64-musl":
optional: true
"@swc/core-win32-arm64-msvc":
optional: true
"@swc/core-win32-ia32-msvc":
optional: true
"@swc/core-win32-x64-msvc":
optional: true
bin:
swcx: run_swcx.js
checksum: 7aa3e2c77c9094675e84e2cdc0c29eafad4e2dec95b2c450faaaa1bbae1bd709eba4b67c87efad89f1c52bb1faae20090c8511515cce43ea06a983f8a7180f8e
languageName: node
linkType: hard
"@tootallnate/once@npm:1":
version: 1.1.2
resolution: "@tootallnate/once@npm:1.1.2"
@ -2045,7 +2196,7 @@ __metadata:
languageName: node
linkType: hard
"acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.5.0, acorn@npm:^8.7.0":
"acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.7.0":
version: 8.7.0
resolution: "acorn@npm:8.7.0"
bin:
@ -2365,6 +2516,15 @@ __metadata:
languageName: node
linkType: hard
"brace-expansion@npm:^2.0.1":
version: 2.0.1
resolution: "brace-expansion@npm:2.0.1"
dependencies:
balanced-match: ^1.0.0
checksum: a61e7cd2e8a8505e9f0036b3b6108ba5e926b4b55089eeb5550cd04a471fe216c96d4fe7e4c7f995c728c554ae20ddfc4244cad10aef255e72b62930afd233d1
languageName: node
linkType: hard
"braces@npm:^3.0.1, braces@npm:^3.0.2, braces@npm:~3.0.2":
version: 3.0.2
resolution: "braces@npm:3.0.2"
@ -2701,13 +2861,6 @@ __metadata:
languageName: node
linkType: hard
"commander@npm:^2.20.0":
version: 2.20.3
resolution: "commander@npm:2.20.3"
checksum: ab8c07884e42c3a8dbc5dd9592c606176c7eb5c1ca5ff274bcf907039b2c41de3626f684ea75ccf4d361ba004bbaff1f577d5384c155f3871e456bdf27becf9e
languageName: node
linkType: hard
"commander@npm:^7.2.0":
version: 7.2.0
resolution: "commander@npm:7.2.0"
@ -3388,6 +3541,7 @@ __metadata:
"@pixi/utils": 6.2.1
"@rollup/plugin-typescript": 8.3.2
"@seald-io/nedb": 3.0.0
"@swc/core": 1.2.170
"@types/fs-extra": 9.0.13
"@types/jest": 27.4.1
"@typescript-eslint/eslint-plugin": 5.20.0
@ -3408,7 +3562,7 @@ __metadata:
rimraf: 3.0.2
rollup: 2.70.2
rollup-plugin-styles: 4.0.0
rollup-plugin-terser: 7.0.2
rollup-plugin-swc3: 0.3.0
sass: 1.50.1
semver: 7.3.7
ts-jest: 27.1.4
@ -5410,17 +5564,6 @@ __metadata:
languageName: node
linkType: hard
"jest-worker@npm:^26.2.1":
version: 26.6.2
resolution: "jest-worker@npm:26.6.2"
dependencies:
"@types/node": "*"
merge-stream: ^2.0.0
supports-color: ^7.0.0
checksum: f9afa3b88e3f12027901e4964ba3ff048285b5783b5225cab28fac25b4058cea8ad54001e9a1577ee2bed125fac3ccf5c80dc507b120300cc1bbcb368796533e
languageName: node
linkType: hard
"jest-worker@npm:^27.5.1":
version: 27.5.1
resolution: "jest-worker@npm:27.5.1"
@ -5450,6 +5593,13 @@ __metadata:
languageName: node
linkType: hard
"joycon@npm:^3.1.1":
version: 3.1.1
resolution: "joycon@npm:3.1.1"
checksum: 8003c9c3fc79c5c7602b1c7e9f7a2df2e9916f046b0dbad862aa589be78c15734d11beb9fe846f5e06138df22cb2ad29961b6a986ba81c4920ce2b15a7f11067
languageName: node
linkType: hard
"js-tokens@npm:^4.0.0":
version: 4.0.0
resolution: "js-tokens@npm:4.0.0"
@ -5575,6 +5725,13 @@ __metadata:
languageName: node
linkType: hard
"jsonc-parser@npm:^3.0.0":
version: 3.0.0
resolution: "jsonc-parser@npm:3.0.0"
checksum: 1df2326f1f9688de30c70ff19c5b2a83ba3b89a1036160da79821d1361090775e9db502dc57a67c11b56e1186fc1ed70b887f25c5febf9a3ec4f91435836c99d
languageName: node
linkType: hard
"jsonfile@npm:^6.0.1":
version: 6.1.0
resolution: "jsonfile@npm:6.1.0"
@ -5816,6 +5973,13 @@ __metadata:
languageName: node
linkType: hard
"lunr@npm:^2.3.9":
version: 2.3.9
resolution: "lunr@npm:2.3.9"
checksum: 176719e24fcce7d3cf1baccce9dd5633cd8bdc1f41ebe6a180112e5ee99d80373fe2454f5d4624d437e5a8319698ca6837b9950566e15d2cae5f2a543a3db4b8
languageName: node
linkType: hard
"make-dir@npm:^3.0.0":
version: 3.1.0
resolution: "make-dir@npm:3.1.0"
@ -5879,6 +6043,15 @@ __metadata:
languageName: node
linkType: hard
"marked@npm:^4.0.12":
version: 4.0.14
resolution: "marked@npm:4.0.14"
bin:
marked: bin/marked.js
checksum: 778bc2fc94c51ae4fbafe5a08bc1f3917799c4dd39e9fccd972a97df4e5bc5aa78664b7143d12d4b4969608fb90c6a2de3f19811a2f9ccf6b7f207022f2842ba
languageName: node
linkType: hard
"mdn-data@npm:2.0.14":
version: 2.0.14
resolution: "mdn-data@npm:2.0.14"
@ -5992,6 +6165,15 @@ __metadata:
languageName: node
linkType: hard
"minimatch@npm:^5.0.1":
version: 5.0.1
resolution: "minimatch@npm:5.0.1"
dependencies:
brace-expansion: ^2.0.1
checksum: b34b98463da4754bc526b244d680c69d4d6089451ebe512edaf6dd9eeed0279399cfa3edb19233513b8f830bf4bfcad911dddcdf125e75074100d52f724774f0
languageName: node
linkType: hard
"minimist-options@npm:4.1.0":
version: 4.1.0
resolution: "minimist-options@npm:4.1.0"
@ -7214,15 +7396,6 @@ __metadata:
languageName: node
linkType: hard
"randombytes@npm:^2.1.0":
version: 2.1.0
resolution: "randombytes@npm:2.1.0"
dependencies:
safe-buffer: ^5.1.0
checksum: d779499376bd4cbb435ef3ab9a957006c8682f343f14089ed5f27764e4645114196e75b7f6abf1cbd84fd247c0cb0651698444df8c9bf30e62120fbbc52269d6
languageName: node
linkType: hard
"react-is@npm:^17.0.1":
version: 17.0.2
resolution: "react-is@npm:17.0.2"
@ -7478,17 +7651,19 @@ __metadata:
languageName: node
linkType: hard
"rollup-plugin-terser@npm:7.0.2":
version: 7.0.2
resolution: "rollup-plugin-terser@npm:7.0.2"
"rollup-plugin-swc3@npm:0.3.0":
version: 0.3.0
resolution: "rollup-plugin-swc3@npm:0.3.0"
dependencies:
"@babel/code-frame": ^7.10.4
jest-worker: ^26.2.1
serialize-javascript: ^4.0.0
terser: ^5.0.0
"@rollup/pluginutils": ^4.2.1
deepmerge: ^4.2.2
joycon: ^3.1.1
jsonc-parser: ^3.0.0
typedoc: ^0.22.15
peerDependencies:
"@swc/core": ">=1.2.165"
rollup: ^2.0.0
checksum: af84bb7a7a894cd00852b6486528dfb8653cf94df4c126f95f389a346f401d054b08c46bee519a2ab6a22b33804d1d6ac6d8c90b1b2bf8fffb097eed73fc3c72
checksum: 7171adaf31d16ded805e7ef15078acd1f7a065605624e2a8791d524664e4fbb9f144ffb9d203d276777dcccb740d3aef22b35aa58457c43bb43cce0c9026cf5c
languageName: node
linkType: hard
@ -7524,7 +7699,7 @@ __metadata:
languageName: node
linkType: hard
"safe-buffer@npm:^5.1.0, safe-buffer@npm:^5.1.2, safe-buffer@npm:~5.1.0, safe-buffer@npm:~5.1.1":
"safe-buffer@npm:^5.1.2, safe-buffer@npm:~5.1.0, safe-buffer@npm:~5.1.1":
version: 5.1.2
resolution: "safe-buffer@npm:5.1.2"
checksum: f2f1f7943ca44a594893a852894055cf619c1fbcb611237fc39e461ae751187e7baf4dc391a72125e0ac4fb2d8c5c0b3c71529622e6a58f46b960211e704903c
@ -7607,15 +7782,6 @@ __metadata:
languageName: node
linkType: hard
"serialize-javascript@npm:^4.0.0":
version: 4.0.0
resolution: "serialize-javascript@npm:4.0.0"
dependencies:
randombytes: ^2.1.0
checksum: 3273b3394b951671fcf388726e9577021870dfbf85e742a1183fb2e91273e6101bdccea81ff230724f6659a7ee4cef924b0ff9baca32b79d9384ec37caf07302
languageName: node
linkType: hard
"set-blocking@npm:^2.0.0":
version: 2.0.0
resolution: "set-blocking@npm:2.0.0"
@ -7662,6 +7828,17 @@ __metadata:
languageName: node
linkType: hard
"shiki@npm:^0.10.1":
version: 0.10.1
resolution: "shiki@npm:0.10.1"
dependencies:
jsonc-parser: ^3.0.0
vscode-oniguruma: ^1.6.1
vscode-textmate: 5.2.0
checksum: fb746f3cb3de7e545e3b10a6cb658d3938f840e4ccc9a3c90ceb7e69a8f89dbb432171faac1e9f02a03f103684dad88ee5e54b5c4964fa6b579fca6e8e26424d
languageName: node
linkType: hard
"side-channel@npm:^1.0.4":
version: 1.0.4
resolution: "side-channel@npm:1.0.4"
@ -7785,7 +7962,7 @@ __metadata:
languageName: node
linkType: hard
"source-map-support@npm:^0.5.6, source-map-support@npm:~0.5.20":
"source-map-support@npm:^0.5.6":
version: 0.5.21
resolution: "source-map-support@npm:0.5.21"
dependencies:
@ -7809,7 +7986,7 @@ __metadata:
languageName: node
linkType: hard
"source-map@npm:^0.7.3, source-map@npm:~0.7.2":
"source-map@npm:^0.7.3":
version: 0.7.3
resolution: "source-map@npm:0.7.3"
checksum: cd24efb3b8fa69b64bf28e3c1b1a500de77e84260c5b7f2b873f88284df17974157cc88d386ee9b6d081f08fdd8242f3fc05c953685a6ad81aad94c7393dedea
@ -8185,20 +8362,6 @@ __metadata:
languageName: node
linkType: hard
"terser@npm:^5.0.0":
version: 5.12.1
resolution: "terser@npm:5.12.1"
dependencies:
acorn: ^8.5.0
commander: ^2.20.0
source-map: ~0.7.2
source-map-support: ~0.5.20
bin:
terser: bin/terser
checksum: dd33af5d87a1159bcc38f354707505f1449a33d1491c512e9536f11fea7c3474cdc40e2e5fdf75f58658cfaab8ef47cb7454acd6406b2ce487675cb1978c6275
languageName: node
linkType: hard
"test-exclude@npm:^6.0.0":
version: 6.0.0
resolution: "test-exclude@npm:6.0.0"
@ -8486,6 +8649,23 @@ __metadata:
languageName: node
linkType: hard
"typedoc@npm:^0.22.15":
version: 0.22.15
resolution: "typedoc@npm:0.22.15"
dependencies:
glob: ^7.2.0
lunr: ^2.3.9
marked: ^4.0.12
minimatch: ^5.0.1
shiki: ^0.10.1
peerDependencies:
typescript: 4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x || 4.6.x
bin:
typedoc: bin/typedoc
checksum: 3f5f1cb9288bf811f42df59750c7062a026a23257b38dfe227515a30007a28e3d8139187949fcd19300fd6b2ef76bcdc4cf54549100bff3e000e61bb19958fb2
languageName: node
linkType: hard
"typescript@npm:4.6.3":
version: 4.6.3
resolution: "typescript@npm:4.6.3"
@ -8672,6 +8852,20 @@ __metadata:
languageName: node
linkType: hard
"vscode-oniguruma@npm:^1.6.1":
version: 1.6.2
resolution: "vscode-oniguruma@npm:1.6.2"
checksum: 6b754acdafd5b68242ea5938bb00a32effc16c77f471d4f0f337d879d0e8e592622998e2441f42d9a7ff799c1593f31c11f26ca8d9bf9917e3ca881d3c1f3e19
languageName: node
linkType: hard
"vscode-textmate@npm:5.2.0":
version: 5.2.0
resolution: "vscode-textmate@npm:5.2.0"
checksum: 5449b42d451080f6f3649b66948f4b5ee4643c4e88cfe3558a3b31c84c78060cfdd288c4958c1690eaa5cd65d09992fa6b7c3bef9d4aa72b3651054a04624d20
languageName: node
linkType: hard
"w3c-hr-time@npm:^1.0.2":
version: 1.0.2
resolution: "w3c-hr-time@npm:1.0.2"