@api3/commons 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -15
- package/dist/node-index.d.ts +4 -0
- package/dist/node-index.d.ts.map +1 -0
- package/dist/{index.js → node-index.js} +2 -2
- package/dist/node-index.js.map +1 -0
- package/dist/universal-index.d.ts +2 -0
- package/dist/universal-index.d.ts.map +1 -0
- package/dist/universal-index.js +19 -0
- package/dist/universal-index.js.map +1 -0
- package/package.json +9 -3
- package/src/{index.ts → node-index.ts} +1 -1
- package/src/universal-index.ts +2 -0
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -4,13 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
The commons library is meant to stop "reinventing the wheel". It holds the canonical implementations that can be
|
|
6
6
|
imported in other packages. This way we ensure that all package use the same logic, simplify bug fixes and avoid code
|
|
7
|
-
duplication.
|
|
7
|
+
duplication. The package is cross platform and can be used in Node.js and browser.
|
|
8
8
|
|
|
9
|
-
The commons library is a
|
|
10
|
-
|
|
11
|
-
- [`eslint`](./src/eslint/README.md) - The configrations for ESLint.
|
|
12
|
-
|
|
13
|
-
Read the documentation of each module for more information.
|
|
9
|
+
The commons library is a collection of multiple modules, with each module having its own README that you can refer to.
|
|
14
10
|
|
|
15
11
|
## Related repositories
|
|
16
12
|
|
|
@@ -26,17 +22,23 @@ Read the documentation of each module for more information.
|
|
|
26
22
|
pnpm add @api3/commons
|
|
27
23
|
```
|
|
28
24
|
|
|
29
|
-
Read the documentation of each module how to use it in the project.
|
|
25
|
+
Read the documentation and sources of each module how to use it in the project.
|
|
26
|
+
|
|
27
|
+
## Using the package in universal context
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
Some modules may be used only in both browser and Node.js context and some are Node.js only. To support this
|
|
30
|
+
requirement, we use different entrypoints for each context. Note, there is no support for browser-only modules.
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
The bundler or Node.js picks up the right entrypoint automatically, but bear in mind that only a subset of modules is
|
|
33
|
+
available when using universal modules. If you use TypeScript, it may not pick up the correct types. You can set these
|
|
34
|
+
manually, by adding the following to your `tsconfig.json`:
|
|
34
35
|
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
```json
|
|
37
|
+
"compilerOptions": {
|
|
38
|
+
"paths": {
|
|
39
|
+
"@api3/commons": ["./node_modules/@api3/commons/dist/universal-index.d.ts"]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
40
42
|
```
|
|
41
43
|
|
|
42
44
|
## Release
|
|
@@ -60,7 +62,7 @@ To release a new version follow these steps:
|
|
|
60
62
|
|
|
61
63
|
1. Create a new directory in `src` with the name of the utility.
|
|
62
64
|
2. Create `index.ts` file in the directory. This file will be the entry point for the utility.
|
|
63
|
-
3. Re-export the new utility from
|
|
65
|
+
3. Re-export the new utility from `universal-index.ts` or `node-index.ts` file.
|
|
64
66
|
4. Create a `README.md` with documentation.
|
|
65
67
|
|
|
66
68
|
#### Testing the package locally
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-index.d.ts","sourceRoot":"","sources":["../src/node-index.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
|
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
// NOTE: Not exporting ESLint rules because they need to be imported in a special way inside .eslintrc.js config.
|
|
18
|
+
__exportStar(require("./universal-index"), exports);
|
|
18
19
|
__exportStar(require("./logger"), exports);
|
|
19
20
|
__exportStar(require("./processing"), exports);
|
|
20
|
-
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
21
|
+
//# sourceMappingURL=node-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-index.js","sourceRoot":"","sources":["../src/node-index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iHAAiH;AACjH,oDAAkC;AAClC,2CAAyB;AACzB,+CAA6B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"universal-index.d.ts","sourceRoot":"","sources":["../src/universal-index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// NOTE: Only export modules which work in both Node.js and browser environments.
|
|
18
|
+
__exportStar(require("./blockchain-utilities"), exports);
|
|
19
|
+
//# sourceMappingURL=universal-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"universal-index.js","sourceRoot":"","sources":["../src/universal-index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iFAAiF;AACjF,yDAAuC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@api3/commons",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -11,8 +11,14 @@
|
|
|
11
11
|
"dist",
|
|
12
12
|
"src"
|
|
13
13
|
],
|
|
14
|
-
"
|
|
15
|
-
"
|
|
14
|
+
"browser": "./dist/universal-index.js",
|
|
15
|
+
"main": "./dist/node-index.js",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"browser": "./dist/universal-index.js",
|
|
19
|
+
"default": "./dist/node-index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
16
22
|
"dependencies": {
|
|
17
23
|
"@api3/ois": "^2.3.0",
|
|
18
24
|
"@api3/promise-utils": "^0.4.0",
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iHAAiH;AACjH,2CAAyB;AACzB,+CAA6B;AAC7B,yDAAuC"}
|