-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from jeasonstudio/feat-use-esbuild-bundle-cjs
Feat use esbuild bundle cjs
- Loading branch information
Showing
11 changed files
with
73 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"solidity-antlr4": patch | ||
--- | ||
|
||
format dist files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
*.js | ||
*.cjs | ||
*.mjs | ||
*.md | ||
src/antlr4/* | ||
dist/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import { defineBuildConfig, BuildEntry } from 'unbuild'; | ||
|
||
const createEntry = (format: 'esm' | 'cjs'): BuildEntry => ({ | ||
builder: 'mkdist', | ||
input: './src/', | ||
outDir: `./dist/${format}/`, | ||
format, | ||
}); | ||
import { defineBuildConfig, MkdistBuildEntry } from 'unbuild'; | ||
|
||
export default defineBuildConfig({ | ||
entries: [createEntry('esm'), createEntry('cjs')], | ||
entries: [ | ||
{ | ||
builder: 'mkdist', | ||
input: './src/', | ||
format: 'esm', | ||
ext: 'mjs', | ||
}, | ||
], | ||
declaration: true, | ||
failOnWarn: false, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,14 +10,23 @@ | |
"lexer", | ||
"antlr4" | ||
], | ||
"main": "./dist/cjs/index.js", | ||
"module": "./dist/esm/index.mjs", | ||
"types": "./dist/esm/index.d.ts", | ||
"type": "module", | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./dist/esm/index.mjs", | ||
"require": "./dist/cjs/index.js", | ||
"types": "./dist/esm/index.d.ts" | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.cjs", | ||
"types": "./dist/index.d.ts" | ||
}, | ||
"./ast": { | ||
"import": "./dist/ast/index.mjs", | ||
"types": "./dist/ast/index.d.ts" | ||
}, | ||
"./antlr4": { | ||
"import": "./dist/antlr4/index.mjs", | ||
"types": "./dist/antlr4/index.d.ts" | ||
} | ||
}, | ||
"files": [ | ||
|
@@ -31,7 +40,7 @@ | |
"repository": "[email protected]:jeasonstudio/solidity-antlr4.git", | ||
"lint-staged": { | ||
"*.ts": "eslint --quiet --fix", | ||
"*.{ts,json}": "prettier --loglevel warn --write" | ||
"*.{ts}": "prettier --loglevel warn --write" | ||
}, | ||
"dependencies": { | ||
"antlr4ng": "^2.0.4", | ||
|
@@ -46,6 +55,7 @@ | |
"@umijs/fabric": "^4.0.1", | ||
"antlr4ng-cli": "^1.0.7", | ||
"changeset": "^0.2.6", | ||
"esbuild": "^0.19.10", | ||
"eslint": "^8.56.0", | ||
"husky": "^8.0.3", | ||
"jest": "^29.7.0", | ||
|
@@ -62,7 +72,9 @@ | |
"scripts": { | ||
"grammar": "antlr4ng -Dlanguage=TypeScript -o src/antlr4/ -message-format vs2005 -visitor -listener -long-messages -Xexact-output-dir grammar/SolidityLexer.g4 grammar/SolidityParser.g4", | ||
"dev": "unbuild --stub", | ||
"build": "unbuild --clean", | ||
"build": "pnpm run build:esm && pnpm run build:cjs", | ||
"build:esm": "unbuild --clean", | ||
"build:cjs": "esbuild ./src/index.ts --bundle --outfile=dist/index.cjs --format=cjs --sourcemap --tsconfig=./tsconfig.json", | ||
"build:typedoc": "typedoc --tsconfig ./tsconfig.json --skipErrorChecking src/index.ts", | ||
"changeset": "changeset", | ||
"release": "changeset version && changeset publish", | ||
|
@@ -72,7 +84,7 @@ | |
"test:ci": "jest --coverage --maxWorkers=4 --forceExit", | ||
"lint": "pnpm run \"/^lint:.+/\"", | ||
"lint:eslint": "eslint --quiet --fix --ext .ts .", | ||
"lint:prettier": "prettier --log-level warn --write '**/*.{ts,tsx,json}'", | ||
"lint:prettier": "prettier **/*.ts --log-level warn --write", | ||
"husky:prepare": "husky install", | ||
"husky:pre-commit": "lint-staged" | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters