Commit b42ce13e authored by nanahira's avatar nanahira

support esm build

parent 1020c0f0
Pipeline #15952 passed with stages
in 49 seconds
This diff is collapsed.
......@@ -2,11 +2,15 @@
"name": "onedice",
"description": "Node.js implementation of [OneDice](https://github.com/OlivOS-Team/onedice)",
"version": "1.0.8",
"main": "dist/index.js",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"scripts": {
"compile:cjs": "esbuild index.ts --outfile=dist/index.cjs --bundle --sourcemap --platform=node --target=es2019",
"compile:esm": "esbuild index.ts --outfile=dist/index.mjs --bundle --sourcemap --platform=neutral --target=esnext",
"compile:types": "tsc --emitDeclarationOnly --declaration",
"lint": "eslint --fix .",
"build": "rimraf dist && tsc",
"build": "rimraf dist && npm run compile:cjs && npm run compile:esm && npm run compile:types",
"test": "jest --passWithNoTests",
"start": "node dist/index.js"
},
......@@ -43,6 +47,8 @@
"@types/node": "^18.7.6",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"esbuild": "^0.15.5",
"esbuild-register": "^3.3.3",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^3.4.1",
......
......@@ -326,7 +326,7 @@ export class OneDice {
if (this.config.valueDict) {
for (const [key, val] of Object.entries(this.config.valueDict)) {
const reg = new RegExp(`\\{${key}\\}`, 'g');
expr = expr.replaceAll(reg, val.toString());
expr = expr.replace(reg, val.toString());
}
}
const result: (string | number)[] = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment