@leofcoin/codec-format-interface 1.4.2 → 1.5.0

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@leofcoin/codec-format-interface",
3
- "version": "1.4.2",
3
+ "version": "1.5.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
- "module": "dist/module.js",
6
+ "type": "module",
7
7
  "scripts": {
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
- "c": "rollup -c"
9
+ "build": "rollup -c"
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
@@ -27,7 +27,11 @@
27
27
  "varint": "^6.0.0"
28
28
  },
29
29
  "devDependencies": {
30
- "rollup": "^2.79.1",
31
- "tape": "^5.5.3"
30
+ "@rollup/plugin-commonjs": "^23.0.3",
31
+ "@rollup/plugin-node-resolve": "^15.0.1",
32
+ "@rollup/plugin-typescript": "^10.0.1",
33
+ "rollup": "^3.5.1",
34
+ "tape": "^5.5.3",
35
+ "tslib": "^2.4.1"
32
36
  }
33
37
  }
package/rollup.config.js CHANGED
@@ -1,19 +1,15 @@
1
- import resolve from 'rollup-plugin-node-resolve'
2
- import commonjs from 'rollup-plugin-commonjs'
1
+ import resolve from '@rollup/plugin-node-resolve'
2
+ import commonjs from '@rollup/plugin-commonjs'
3
+ import typescript from '@rollup/plugin-typescript'
3
4
  export default [{
4
- input: ['src/index.js'],
5
+ input: ['src/index.ts'],
5
6
  output: [{
6
- dir: 'dist',
7
- format: 'cjs'
8
- }]
9
- }, {
10
- input: ['src/index.js'],
11
- output: [{
12
- file: 'dist/module.js',
7
+ file: 'dist/index.js',
13
8
  format: 'es'
14
9
  }],
15
10
  plugins: [
16
11
  commonjs(),
17
- resolve()
12
+ resolve({preferBuiltins: true}),
13
+ typescript()
18
14
  ]
19
15
  }]
@@ -1,5 +1,5 @@
1
1
  import bs32 from '@vandeurenglenn/base32';
2
- import bs58 from '@vandeurenglenn/base58';
2
+ import base58 from '@vandeurenglenn/base58';
3
3
  import isHex from '@vandeurenglenn/is-hex';
4
4
 
5
5
  export default class BasicInterface {
@@ -19,7 +19,7 @@ export default class BasicInterface {
19
19
  return bs32.isBase32(string)
20
20
  }
21
21
  isBase58(string) {
22
- return bs58.isBase58(string)
22
+ return base58.isBase58(string)
23
23
  }
24
24
  /**
25
25
  * @param {String} encoded
@@ -32,8 +32,8 @@ export default class BasicInterface {
32
32
  /**
33
33
  * @param {String} encoded
34
34
  */
35
- fromBs58(encoded) {
36
- this.encoded = bs58.decode(encoded)
35
+ frombase58(encoded) {
36
+ this.encoded = base58.decode(encoded)
37
37
  return this.handleDecode()
38
38
  }
39
39
 
@@ -94,9 +94,9 @@ export default class BasicInterface {
94
94
  /**
95
95
  * @return {String} encoded
96
96
  */
97
- async toBs58() {
97
+ async tobase58() {
98
98
  if (!this.encoded) await this.handleEncode()
99
- return bs58.encode(this.encoded)
99
+ return base58.encode(this.encoded)
100
100
  }
101
101
 
102
102
  /**
File without changes
package/test/index.js CHANGED
@@ -1,5 +1,5 @@
1
- const test = require('tape');
2
- const {FormatInterface} = require('./../dist/index')
1
+ import test from 'tape'
2
+ import {FormatInterface} from './../dist/index.js'
3
3
 
4
4
  globalThis.peernet = {codecs: {}}
5
5
  class FormatTest extends FormatInterface {
package/tsconfig.js ADDED
@@ -0,0 +1,16 @@
1
+ export default {
2
+
3
+ "esModuleInterop": true,
4
+ 'allowSyntheticDefaultImports': true,
5
+ "compilerOptions": {
6
+ "outDir": "./dist",
7
+ "esModuleInterop": true,
8
+ 'allowSyntheticDefaultImports': true,
9
+ "allowJs": true,
10
+ "target": "es11"
11
+ },
12
+ "include": [
13
+ "./src/**/*",
14
+ "./node_modules/**/*"
15
+ ]
16
+ }