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

feat(lumos): export more missing modules #729

Merged
merged 4 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .changeset/odd-tomatoes-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ckb-lumos/lumos": minor
---

feat: export some missing modules
5 changes: 5 additions & 0 deletions .changeset/strange-shirts-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ckb-lumos/lumos": minor
---

feat: added `bi`, `base`, `ckb-indexer`, `hd`, `light-client` as subpackages to make import more fine-grained
2 changes: 1 addition & 1 deletion packages/hd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@ckb-lumos/bi": "0.24.0-next.0",
"@ckb-lumos/codec": "0.24.0-next.0",
"@ckb-lumos/crypto": "0.24.0-next.0",
"bn.js": "^5.1.3",
"bn.js": "^4.12.0",
Keith-CY marked this conversation as resolved.
Show resolved Hide resolved
"elliptic": "^6.5.4",
"uuid": "^8.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/lumos/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*
!src
!src/*
!src/**/*
!.gitignore
!.npmignore
!CHANGELOG.md
Expand Down
2 changes: 2 additions & 0 deletions packages/lumos/src/base/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./types";
export * as since from "./since";
15 changes: 15 additions & 0 deletions packages/lumos/src/base/since.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export {
type EpochSinceValue,
type SinceValidationInfo,
type SinceType,
generateSince,
generateAbsoluteEpochSince,
generateHeaderEpoch,
parseAbsoluteEpochSince,
parseSinceCompatible,
parseEpoch,
parseSince,
validateAbsoluteEpochSince,
validateSince,
maximumAbsoluteEpochSince,
} from "@ckb-lumos/base/lib/since";
26 changes: 26 additions & 0 deletions packages/lumos/src/base/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export {
type Script,
type Cell,
type RawTransaction,
type Transaction,
type OutPoint,
type CellDep,
type WitnessArgs,
type Header,
type Block,
type HashType,
type DepType,
type Input,
type Output,
} from "@ckb-lumos/base/lib/api";

export {
type Address,
type Hash,
type HexNumber,
type HexString,
type Hexadecimal,
type HexadecimalRange,
type PackedDao,
type PackedSince,
} from "@ckb-lumos/base/lib/primitive";
1 change: 1 addition & 0 deletions packages/lumos/src/bi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { BI, parseUnit, formatUnit, isBIish, type BIish } from "@ckb-lumos/bi";
7 changes: 7 additions & 0 deletions packages/lumos/src/ckb-indexer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export {
Indexer,
TransactionCollector,
CellCollector,
} from "@ckb-lumos/ckb-indexer";

export { type QueryOptions } from "@ckb-lumos/base";
2 changes: 1 addition & 1 deletion packages/lumos/src/codec/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ export {
isFixedCodec,
} from "@ckb-lumos/codec";

export { blockchain } from "@ckb-lumos/base";
export * as blockchain from "./blockchain";
1 change: 1 addition & 0 deletions packages/lumos/src/hd.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "@ckb-lumos/hd";
1 change: 1 addition & 0 deletions packages/lumos/src/light-client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { LightClientRPC } from "@ckb-lumos/light-client";
3 changes: 2 additions & 1 deletion packages/lumos/src/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { RPC, CKBRPC, ParamsFormatter, ResultFormatter } from "@ckb-lumos/rpc";
export type { Base } from "@ckb-lumos/rpc/lib/Base";
export { Method } from "@ckb-lumos/rpc/lib/method";
export { Base } from "@ckb-lumos/rpc/lib/Base";
export type { RPC as RPCTypes } from "@ckb-lumos/rpc/lib/types/rpc";
export type { CKBComponents } from "@ckb-lumos/rpc/lib/types/api";
1 change: 1 addition & 0 deletions packages/lumos/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export {
assertHexadecimal,
computeScriptHash,
generateTypeIdScript,
ckbHash160,
} from "@ckb-lumos/base/lib/utils";

export { parseUnit, formatUnit } from "@ckb-lumos/bi";
1 change: 1 addition & 0 deletions playground/bundler/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stats.json
26 changes: 26 additions & 0 deletions playground/bundler/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@ckb-lumos/bundler",
"homepage": "https://github.com/ckb-js/lumos#readme",
"bugs": {
"url": "https://github.com/ckb-js/lumos/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ckb-js/lumos.git"
},
"license": "MIT",
"scripts": {
"bundle-stats": "webpack --profile --json > stats.json",
"bundle-analyze": "npm run bundle-stats && webpack-bundle-analyzer stats.json"
},
"devDependencies": {
"@ckb-lumos/lumos": "workspace:*",
"@types/webpack-bundle-analyzer": "^4.7.0",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"ts-loader": "^9.5.1",
"unminified-webpack-plugin": "^3.0.0",
"webpack": "^5.92.1",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-cli": "^5.1.4"
}
}
3 changes: 3 additions & 0 deletions playground/bundler/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as codec from "@ckb-lumos/lumos/codec";

console.log(codec);
8 changes: 8 additions & 0 deletions playground/bundler/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
},
"include": ["src"]
}
24 changes: 24 additions & 0 deletions playground/bundler/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const path = require("path");
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");

/** @type {import('webpack').Configuration} */
module.exports = {
mode: "production",
devtool: "source-map",
entry: { output: "./src/index.ts" },
output: {
path: path.join(__dirname, "lib"),
filename: "lumos.min.js",
library: "lumos",
libraryTarget: "umd",
globalObject: "this",
},
module: {
rules: [{ test: /\.tsx?$/, loader: "ts-loader", options: {} }],
},
resolve: {
extensions: [".ts", ".js", ".json"],
},
infrastructureLogging: { level: "verbose" },
plugins: [new ForkTsCheckerWebpackPlugin({ async: false })],
};
Loading
Loading