feat: use pnpm & lock core-js shim

This commit is contained in:
2023-10-25 11:29:01 +08:00
parent 5bf4b1c09e
commit 54eaae96bd
32 changed files with 444 additions and 178 deletions

View File

@@ -17,18 +17,21 @@
],
"scripts": {
"clean": "rimraf dist",
"watch": "tsc --watch",
"build": "yarn clean && tsc",
"watch": "pnpm rollup -c rollup.config.js --watch",
"build": "pnpm clean && pnpm rollup -c rollup.config.js",
"test": "echo \"Error: run tests from root\" && exit 1"
},
"devDependencies": {
"reflect-metadata": "^0.1.13",
"rimraf": "^4.1.2",
"typescript": "^4.9.5"
"@rollup/plugin-typescript": "^11.1.5",
"rollup": "^2.79.1",
"rollup-obfuscator": "^3.0.2",
"rollup-plugin-peer-deps-external": "^2.2.4"
},
"dependencies": {
"@ccms/api": "^0.28.0-beta.3",
"@ccms/container": "^0.28.0-beta.3"
"@ccms/common": "^0.28.0-beta.3",
"@ccms/container": "^0.28.0-beta.3",
"js-yaml": "^4.1.0"
},
"gitHead": "781524f83e52cad26d7c480513e3c525df867121"
}

View File

@@ -0,0 +1,49 @@
import typescript from '@rollup/plugin-typescript'
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
import { obfuscator } from 'rollup-obfuscator'
import pkg from './package.json'
const external = ['path', 'fs', 'typescript', 'tslib']
/**
* @type {import('rollup').RollupOptions}
*/
export default {
input: 'src/index.ts',
plugins: [
peerDepsExternal(),
typescript(),
obfuscator({
compact: true,
deadCodeInjection: true,
deadCodeInjectionThreshold: 1,
identifierNamesGenerator: 'mangled-shuffled',
numbersToExpressions: true,
simplify: true,
stringArray: true,
stringArrayThreshold: 1,
stringArrayEncoding: ['rc4'],
stringArrayCallsTransform: true,
stringArrayCallsTransformThreshold: 1,
stringArrayWrappersChainedCalls: true,
stringArrayWrappersParametersMaxCount: 3,
sourceMap: true,
sourceMapSourcesMode: 'sources',
inputFileName: `${pkg.name}.ts`,
transformObjectKeys: true,
unicodeEscapeSequence: true,
target: 'browser-no-eval'
}),
],
external,
treeshake: false,
output: [
{
format: 'cjs',
interop: "auto",
exports: "named",
sourcemap: true,
file: pkg.main || `dist/${pkg.name}.js`
}
]
}