diff --git a/.swc.cjs.swcrc b/.swc.cjs.swcrc deleted file mode 100644 index 69115da2..00000000 --- a/.swc.cjs.swcrc +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/swcrc", - "module": { - "type": "commonjs" - }, - "exclude": ["(.*).(spec|test).(j|t)s$"], - "jsc": { - "target": "es2022", - "parser": { - "syntax": "typescript" - }, - "minify": { - "mangle": true, - "compress": { - "hoist_funs": true, - "reduce_funcs": true - } - } - }, - "minify": true, - "sourceMaps": false -} diff --git a/.swc.esm.swcrc b/.swcrc similarity index 100% rename from .swc.esm.swcrc rename to .swcrc diff --git a/CHANGELOG.md b/CHANGELOG.md index 36dba7f7..51f91530 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.5.14 - 4 June 2023 +Improvement: +- Using tsc to compile CommonJS instead of SWC to support `module.exports` syntax + # 0.5.13 - 4 June 2023 Bug fix: - Add loosen type for onError's code for defying custom error status diff --git a/package.json b/package.json index d9474ad7..cd165e7c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "elysia", "description": "Fast, and friendly Bun web framework", - "version": "0.5.13", + "version": "0.5.14", "author": { "name": "saltyAom", "url": "https://github.com/SaltyAom", @@ -100,8 +100,8 @@ "test:types": "tsc --project tsconfig.test.json", "dev": "bun run --hot example/http.ts", "build": "rimraf dist && npm run build:esm && npm run build:cjs", - "build:esm": "swc src --config-file .swc.esm.swcrc -d dist && tsc --project tsconfig.esm.json", - "build:cjs": "swc src --config-file .swc.cjs.swcrc -d dist/cjs && tsc --project tsconfig.cjs.json", + "build:esm": "swc src -d dist && tsc --project tsconfig.esm.json", + "build:cjs": "tsc --project tsconfig.cjs.json", "release": "npm run release:test && npm run release:github", "release:test": "npm run build && npm run test", "release:github": "bumpp package.json --commit --push --tag", diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json index 19f0bc30..3607f7f8 100644 --- a/tsconfig.cjs.json +++ b/tsconfig.cjs.json @@ -46,7 +46,7 @@ /* Emit */ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ "outDir": "./dist/cjs", /* Specify an output folder for all emitted files. */ @@ -70,7 +70,7 @@ /* Interop Constraints */ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */