Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Esm support #435

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"scripts": {
"clean": "rm -rf .parcel-cache && pnpm -r run clean",
"build": "pnpm --stream -r run build",
"build": "pnpm run --sequential -r build",
"codegen": "ts-node --swc gen.ts",
"test": "jest -i --config ./jest-config.json --forceExit",
"lint": "eslint . --ext ts,.tsx",
Expand Down Expand Up @@ -60,5 +60,9 @@
"micromatch@<4.0.8": ">=4.0.8"
}
},
"resolutions": {
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"packageManager": "[email protected]+sha512.4abf725084d7bcbafbd728bfc7bee61f2f791f977fd87542b3579dcb23504d170d46337945e4c66485cd12d588a0c0e570ed9c477e7ccdd8507cf05f3f92eaca"
}
21 changes: 17 additions & 4 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"name": "@alephium/cli",
"version": "1.8.2",
"description": "Alephium command line tool",
"keywords": [
"alephium",
"web3"
],
"license": "GPL",
"repository": {
"type": "git",
Expand All @@ -12,15 +16,24 @@
"url": "https://github.com/alephium/alephium-web3/issues"
},
"author": "Alephium dev <[email protected]>",
"main": "dist/index.js",
"main": "dist/_cjs/index.js",
"module": "dist/_esm/index.js",
"types": "dist/_types/index.d.ts",
"exports": {
".": "./dist/index.js"
".": {
"types": "./dist/_types/index.d.ts",
"require": "./dist/_cjs/index.js",
"import": "./dist/_esm/index.js"
}
},
"type": "commonjs",
"scripts": {
"build": "rm -rf dist/* && npx tsc --build ."
"build": "rm -rf dist/* && npm run build:cjs && npm run build:esm && npm run build:dts",
"build:esm": "tsc --module esnext --outDir dist/_esm --declaration false --declarationMap false --sourceMap true",
"build:cjs": "tsc --module commonjs --outDir dist/_cjs --declaration false --declarationMap false --sourceMap true",
"build:dts": "tsc --module esnext --outDir dist/_types --declaration true --declarationMap true --sourceMap false --emitDeclarationOnly"
},
"bin": "cli.js",
"type": "commonjs",
"dependencies": {
"@alephium/web3": "workspace:^",
"@alephium/web3-wallet": "workspace:^",
Expand Down
4 changes: 0 additions & 4 deletions packages/web3-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,5 @@
"rollup-plugin-typescript2": "^0.34.1",
"rollup-plugin-visualizer": "^5.9.0",
"typescript": "^4.9.5"
},
"resolutions": {
"react": "^18.0.0",
"react-dom": "^18.0.0"
}
}
24 changes: 16 additions & 8 deletions packages/web3-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
"web3"
],
"license": "GPL",
"main": "dist/src/index.js",
"browser": "dist/alephium-web3.min.js",
"types": "dist/src/index.d.ts",
"exports": {
".": "./dist/src/index.js"
},
"repository": {
"type": "git",
"url": "[email protected]:alephium/alephium-web3.git"
Expand All @@ -22,11 +16,25 @@
"url": "https://github.com/alephium/alephium-web3/issues"
},
"author": "Alephium dev <[email protected]>",
"main": "dist/_cjs/index.js",
"module": "dist/_esm/index.js",
"browser": "dist/alephium-web3-wallet.min.js",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the package.json of the web3-test package but web3-wallet is referenced in this line. Is this correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! I will fix it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's removed since there is not build for browser for this package.

"types": "dist/_types/index.d.ts",
"exports": {
".": {
"types": "./dist/_types/index.d.ts",
"require": "./dist/_cjs/index.js",
"import": "./dist/_esm/index.js"
}
},
"type": "module",
"scripts": {
"build": "rm -rf dist/* && npx tsc --build .",
"build": "rm -rf dist/* && npm run build:cjs && npm run build:esm && npm run build:dts",
"build:esm": "tsc --module esnext --outDir dist/_esm --declaration false --declarationMap false --sourceMap true",
"build:cjs": "tsc --module commonjs --outDir dist/_cjs --declaration false --declarationMap false --sourceMap true",
"build:dts": "tsc --module esnext --outDir dist/_types --declaration true --declarationMap true --sourceMap false --emitDeclarationOnly",
"test": "jest -i --config ./jest-config.json"
},
"type": "commonjs",
"dependencies": {
"@alephium/web3": "workspace:^",
"@alephium/web3-wallet": "workspace:^"
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"include": ["src/**/*"],
"exclude": ["node_modules", "src/**/*.test.ts", "src/**/fixtures/*"],
"compilerOptions": {
"outDir": "dist/src"
"outDir": "dist"
},
}
31 changes: 16 additions & 15 deletions packages/web3-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,6 @@
"web3"
],
"license": "GPL",
"main": "dist/src/index.js",
"browser": "dist/alephium-web3-wallet.min.js",
"types": "dist/src/index.d.ts",
"exports": {
"node": {
"types": "./dist/src/index.d.ts",
"default": "./dist/src/index.js"
},
"default": {
"types": "./dist/src/index.d.ts",
"default": "./dist/alephium-web3-wallet.min.js"
}
},
"repository": {
"type": "git",
"url": "[email protected]:alephium/alephium-web3.git"
Expand All @@ -29,11 +16,25 @@
"url": "https://github.com/alephium/alephium-web3/issues"
},
"author": "Alephium dev <[email protected]>",
"main": "dist/_cjs/index.js",
"module": "dist/_esm/index.js",
"browser": "dist/_umd/alephium-web3-wallet.min.js",
"types": "dist/_types/index.d.ts",
"exports": {
".": {
"types": "./dist/_types/index.d.ts",
"require": "./dist/_cjs/index.js",
"import": "./dist/_esm/index.js"
}
},
"type": "module",
"scripts": {
"build": "rm -rf dist/* && npx tsc --build . && webpack",
"build": "rm -rf dist/* && npm run build:cjs && npm run build:esm && npm run build:dts && webpack",
"build:esm": "tsc --module esnext --outDir dist/_esm --declaration false --declarationMap false --sourceMap true",
"build:cjs": "tsc --module commonjs --outDir dist/_cjs --declaration false --declarationMap false --sourceMap true",
"build:dts": "tsc --module esnext --outDir dist/_types --declaration true --declarationMap true --sourceMap false --emitDeclarationOnly",
"test": "jest -i --config ./jest-config.json"
},
"type": "commonjs",
"dependencies": {
"@alephium/web3": "workspace:^",
"@noble/secp256k1": "1.7.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-wallet/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"include": ["src/**/*"],
"exclude": ["node_modules", "src/**/*.test.ts", "src/**/fixtures/*"],
"compilerOptions": {
"outDir": "dist/src"
"outDir": "dist"
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const webpack = require('webpack')
module.exports = {
mode: 'production',
entry: {
alephium: './dist/src/index.js'
alephium: './dist/_cjs/index.js'
},
plugins: [
new webpack.SourceMapDevToolPlugin({ filename: '[file].map' }),
Expand All @@ -41,12 +41,15 @@ module.exports = {
}
},
output: {
filename: 'alephium-web3-wallet.min.js',
filename: '_umd/alephium-web3-wallet.min.js',
library: {
name: 'alephium',
type: 'umd'
}
},
experiments: {
asyncWebAssembly: true
Lbqds marked this conversation as resolved.
Show resolved Hide resolved
},
optimization: {
minimize: true
}
Expand Down
42 changes: 20 additions & 22 deletions packages/web3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,11 @@
"name": "@alephium/web3",
"version": "1.8.2",
"description": "A JS/TS library to interact with the Alephium platform",
"keywords": [
"alephium",
"web3"
],
"license": "GPL",
"main": "dist/src/index.js",
"browser": "dist/alephium-web3.min.js",
"types": "dist/src/index.d.ts",
"exports": {
"node": {
"types": "./dist/src/index.d.ts",
"default": "./dist/src/index.js"
},
"default": {
"types": "./dist/src/index.d.ts",
"default": "./dist/alephium-web3.min.js"
}
},
"typesVersions": {
"*": {
"test": [
"dist/src/test/"
]
}
},
"repository": {
"type": "git",
"url": "[email protected]:alephium/alephium-web3.git"
Expand All @@ -32,19 +16,33 @@
"url": "https://github.com/alephium/alephium-web3/issues"
},
"author": "Alephium dev <[email protected]>",
"main": "dist/_cjs/src/index.js",
"module": "dist/_esm/src/index.js",
"browser": "dist/_umd/alephium-web3.min.js",
"types": "dist/_types/src/index.d.ts",
"exports": {
".": {
"types": "./dist/_types/src/index.d.ts",
"require": "./dist/_cjs/src/index.js",
"import": "./dist/_esm/src/index.js"
}
},
"type": "module",
"config": {
"alephium_version": "3.8.1",
"explorer_backend_version": "2.2.3"
},
"scripts": {
"build": "rm -rf dist/* && npx tsc --build . && webpack",
"build": "rm -rf dist/* && npm run build:cjs && npm run build:esm && npm run build:dts && webpack",
"build:esm": "tsc --module esnext --outDir dist/_esm --declaration false --declarationMap false --sourceMap true",
"build:cjs": "tsc --module commonjs --outDir dist/_cjs --declaration false --declarationMap false --sourceMap true",
"build:dts": "tsc --module esnext --outDir dist/_types --declaration true --declarationMap true --sourceMap false --emitDeclarationOnly",
"test": "jest -i --config ./jest-config.json",
"update-schemas": "npm run update-schema:alephium && npm run update-schema:explorer",
"update-schema:alephium": "npx swagger-typescript-api --disable-throw-on-error -t ./configs -o ./src/api -n api-alephium.ts -p https://raw.githubusercontent.com/alephium/alephium/v${npm_package_config_alephium_version}/api/src/main/resources/openapi.json",
"update-schema:explorer": "npx swagger-typescript-api --disable-throw-on-error -t ./configs -o ./src/api -n api-explorer.ts -p https://raw.githubusercontent.com/alephium/explorer-backend/v${npm_package_config_explorer_backend_version}/app/src/main/resources/explorer-backend-openapi.json",
"check-versions": "node scripts/check-versions.js ${npm_package_config_alephium_version} ${npm_package_config_explorer_backend_version}"
},
"type": "commonjs",
"dependencies": {
"@noble/secp256k1": "1.7.1",
"base-x": "4.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const webpack = require('webpack')
module.exports = {
mode: 'production',
entry: {
alephium: './dist/src/index.js'
alephium: './dist/_cjs/src/index.js'
},
plugins: [
new webpack.SourceMapDevToolPlugin({ filename: '[file].map' }),
Expand All @@ -41,7 +41,7 @@ module.exports = {
}
},
output: {
filename: 'alephium-web3.min.js',
filename: '_umd/alephium-web3.min.js',
library: {
name: 'alephium',
type: 'umd'
Expand Down
Loading
Loading