From 66b062151386a75a365517300f8a76a93e90118a Mon Sep 17 00:00:00 2001 From: Adam Lippai Date: Thu, 28 Dec 2017 13:49:13 +0100 Subject: [PATCH] Adding ESM build --- .editorconfig | 6 ++++ .gitignore | 1 + Gruntfile.js | 21 +++++++++++-- package.json | 84 ++++++++++++++++++++++++++------------------------- 4 files changed, 69 insertions(+), 43 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d1038de --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space +indent_size = 2 diff --git a/.gitignore b/.gitignore index d04b292..4654e5c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ asmcrypto*.js +asmcrypto*.mjs asmcrypto*.map test/aes.asm.js test/aes.asm.js.map diff --git a/Gruntfile.js b/Gruntfile.js index 23d7d7d..5bee3b7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -17,7 +17,7 @@ module.exports = function (grunt) { options: { format: 'umd', sourceMap: true, - banner: "/*! asmCrypto<%= pkg.version && ' v'+pkg.version %>, (c) 2013 <%= pkg.author.name %>, opensource.org/licenses/<%= pkg.license %> */", + banner: "/*! asmCrypto<%= pkg.version && ' v'+pkg.version %>, (c) 2018 <%= pkg.author.name %>, opensource.org/licenses/<%= pkg.license %> */", }, default: { options: { @@ -27,6 +27,14 @@ module.exports = function (grunt) { 'asmcrypto.js': './src/entry-default.js' } }, + default_esm: { + options: { + format: 'es', + }, + files: { + 'asmcrypto.mjs': './src/entry-default.js' + } + }, all: { options: { moduleName: 'asmCrypto', @@ -35,6 +43,14 @@ module.exports = function (grunt) { 'asmcrypto.js': './src/entry-export_all.js' } }, + all_esm: { + options: { + format: 'es', + }, + files: { + 'asmcrypto.mjs': './src/entry-export_all.js' + } + }, test_AES_ASM: { options: { moduleName: 'AES_asm', @@ -53,7 +69,7 @@ module.exports = function (grunt) { sourceMapIn: 'asmcrypto.js.map', sourceMapIncludeSources: true, screwIE8: true, - banner: "/*! asmCrypto<%= pkg.version && ' v'+pkg.version %>, (c) 2013 <%= pkg.author.name %>, opensource.org/licenses/<%= pkg.license %> */" + banner: "/*! asmCrypto<%= pkg.version && ' v'+pkg.version %>, (c) 2018 <%= pkg.author.name %>, opensource.org/licenses/<%= pkg.license %> */" }, all: { files: { @@ -108,6 +124,7 @@ module.exports = function (grunt) { }); grunt.registerTask('default', ['rollup:default', 'rollup:test_AES_ASM', 'uglify']); + grunt.registerTask('esm', ['rollup:default_esm']); grunt.registerTask('devel', ['rollup:all', 'rollup:test_AES_ASM', 'connect', 'watch']); grunt.registerTask('test', ['connect', 'qunit']); }; diff --git a/package.json b/package.json index 3ceef4d..0bbe001 100644 --- a/package.json +++ b/package.json @@ -1,45 +1,47 @@ { - "name": "asmcrypto.js", - "description": "Asm.js implementation of WebCrypto API", - "homepage": "https://github.com/vibornoff/asmcrypto.js", - "main": "asmcrypto.js", - "license": "MIT", - "author": { - "name": "Artem S Vybornov", - "email": "vybornov@gmail.com", - "web": "https://github.com/vibornoff" + "name": "asmcrypto.js", + "version": "0.13.0", + "description": "Asm.js implementation of WebCrypto API", + "homepage": "https://github.com/vibornoff/asmcrypto.js", + "main": "asmcrypto.js", + "module": "asmcrypto.mjs", + "license": "MIT", + "author": { + "name": "Artem S Vybornov", + "email": "vybornov@gmail.com", + "web": "https://github.com/vibornoff" + }, + "contributors": [ + { + "name": "Ádám Lippai", + "email": "adam@rigo.sk", + "web": "https://github.com/alippai" }, - "contributors": [ - { - "name": "Ádám Lippai", - "email": "adam@rigo.sk", - "web": "https://github.com/alippai" - }, - { - "name": "Ximin Luo", - "email": "infinity0@pwned.gg", - "web": "https://github.com/infinity0" - } - ], - "repository": { - "type": "git", - "url": "https://github.com/vibornoff/asmcrypto.js.git" - }, - "devDependencies": { - "uglify-js": "vibornoff/UglifyJS2", - "grunt": "~1.0", - "grunt-cli": "~1.2", - "grunt-contrib-uglify": "~3.3", - "grunt-contrib-concat": "~1.0", - "grunt-contrib-qunit": "~2.0", - "grunt-contrib-connect": "~1.0", - "grunt-contrib-watch": "~1.0", - "grunt-contrib-clean": "~1.1", - "grunt-jsdoc": "~2.2", - "grunt-rollup": "^8.2.0" - }, - "scripts": { - "prepublish": "grunt", - "test": "grunt test" + { + "name": "Ximin Luo", + "email": "infinity0@pwned.gg", + "web": "https://github.com/infinity0" } + ], + "repository": { + "type": "git", + "url": "https://github.com/vibornoff/asmcrypto.js.git" + }, + "devDependencies": { + "uglify-js": "vibornoff/UglifyJS2", + "grunt": "~1.0", + "grunt-cli": "~1.2", + "grunt-contrib-uglify": "~3.3", + "grunt-contrib-concat": "~1.0", + "grunt-contrib-qunit": "~2.0", + "grunt-contrib-connect": "~1.0", + "grunt-contrib-watch": "~1.0", + "grunt-contrib-clean": "~1.1", + "grunt-jsdoc": "~2.2", + "grunt-rollup": "^8.2.0" + }, + "scripts": { + "prepublish": "grunt && grunt esm", + "test": "grunt test" + } }