Skip to content

Commit 8b24db2

Browse files
committedApr 8, 2020
First go at including typing declaration files
1 parent bf3808c commit 8b24db2

File tree

5 files changed

+17
-21
lines changed

5 files changed

+17
-21
lines changed
 

‎karma.conf.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = function (config) {
44

55
config.set({
66
frameworks: ["mocha", "chai"],
7-
files: ["dist/" + shaVariant + ".umd.js", "test/hash_data.js", "test/dist/test_umd.js"],
7+
files: ["dist/" + shaVariant + ".js", "test/hash_data.js", "test/dist/test_umd.js"],
88
reporters: ["progress"],
99
port: 9876, // karma web server port
1010
colors: true,
@@ -15,8 +15,8 @@ module.exports = function (config) {
1515
concurrency: Infinity,
1616
client: {
1717
mocha: {
18-
timeout: 10000 // 10 seconds - upped from 2 seconds
19-
}
20-
}
18+
timeout: 10000, // 10 seconds - upped from 2 seconds
19+
},
20+
},
2121
});
2222
};

‎package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
"name": "jssha",
33
"version": "3.0.0",
44
"description": "jsSHA implements the complete Secure Hash Standard family (SHA-1, SHA-224/256, SHA-384/512, SHA3-224/256/384/512, and SHAKE128/256) with HMAC",
5-
"main": "dist/sha.umd.js",
6-
"module": "dist/sha.esm.mjs",
5+
"main": "dist/sha.js",
6+
"module": "dist/sha.mjs",
7+
"types": "dist/types/src/sha.d.ts",
78
"repository": {
89
"type": "git",
910
"url": "https://github.com/Caligatio/jsSHA.git"

‎rollup.config.js

+8-13
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ export default [
1313
banner: licenseHeaderES3,
1414
format: "umd",
1515
sourcemap: true,
16-
dir: "dist",
17-
entryFileNames: "[name].umd.js",
16+
dir: "./",
17+
entryFileNames: "dist/[name].js",
1818
},
1919
plugins: [
20-
typescript({ lib: ["es6"], target: "es3" }),
20+
typescript({ lib: ["es6"], declaration: true, declarationDir: "dist/types", target: "es3" }),
2121
terser({
2222
sourcemap: true,
2323
compress: { inline: false },
@@ -32,8 +32,7 @@ export default [
3232
name: "jsSHA",
3333
banner: licenseHeaderES3,
3434
format: "umd",
35-
dir: "dist",
36-
entryFileNames: "[name].umd.js",
35+
file: "dist/sha1.js",
3736
},
3837
plugins: [
3938
typescript({ lib: ["es6"], target: "es3" }),
@@ -50,8 +49,7 @@ export default [
5049
name: "jsSHA",
5150
banner: licenseHeaderES3,
5251
format: "umd",
53-
dir: "dist",
54-
entryFileNames: "[name].umd.js",
52+
file: "dist/sha256.js",
5553
},
5654
plugins: [
5755
typescript({ lib: ["es6"], target: "es3" }),
@@ -68,8 +66,7 @@ export default [
6866
name: "jsSHA",
6967
banner: licenseHeaderES3,
7068
format: "umd",
71-
dir: "dist",
72-
entryFileNames: "[name].umd.js",
69+
file: "dist/sha512.js",
7370
},
7471
plugins: [
7572
typescript({ lib: ["es6"], target: "es3" }),
@@ -86,8 +83,7 @@ export default [
8683
name: "jsSHA",
8784
banner: licenseHeaderES3,
8885
format: "umd",
89-
dir: "dist",
90-
entryFileNames: "[name].umd.js",
86+
file: "dist/sha3.js",
9187
},
9288
plugins: [
9389
typescript({ lib: ["es6"], target: "es3" }),
@@ -105,8 +101,7 @@ export default [
105101
banner: licenseHeaderES6,
106102
format: "es",
107103
sourcemap: true,
108-
dir: "dist",
109-
entryFileNames: "[name].esm.mjs",
104+
file: "dist/sha.mjs",
110105
},
111106
plugins: [
112107
typescript({ lib: ["es6"], target: "es6" }),

‎test/dist/test_esm.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import jsSHA from "../../dist/sha.esm.mjs";
1+
import jsSHA from "../../dist/sha.mjs";
22
import hashData from "../hash_data.js";
33
import mocha from "mocha";
44
import chai from "chai";

‎test/dist/test_umd.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/* The below if block allows this to work with preloaded globals (karma testing) and in node */
44
if (typeof exports === "object" && typeof module !== "undefined") {
55
var chai = require("chai");
6-
var jsSHA = require("../../dist/sha.umd.js");
6+
var jsSHA = require("../../dist/sha.js");
77
var hashData = require("../hash_data.js");
88

99
var assert = chai.assert;

0 commit comments

Comments
 (0)