File tree Expand file tree Collapse file tree 3 files changed +34
-8
lines changed Expand file tree Collapse file tree 3 files changed +34
-8
lines changed Original file line number Diff line number Diff line change 11* .min.js.gz
2+ * .mjs
3+ * .tgz
24* ~
35.DS_Store
4- .idea
6+ .idea /
7+ .vscode /
58.nyc_output /
69gh-pages
710node_modules
811npm-debug.log *
912package-lock.json
13+ ~$ *
Original file line number Diff line number Diff line change 11# !/usr/bin/env bash -c make
22
33SRC =./int64-buffer.js
4- TESTS =./test/* .js
4+ JSTEST =./test/test .js
55DIST =./dist
66JSDEST =./dist/int64-buffer.min.js
77JSGZIP =./dist/int64-buffer.min.js.gz
8+ ESMDEST =./int64-buffer.mjs
9+ ESMTEST =./test/test.mjs
810
9- all : $(JSGZIP )
11+ all : $(JSGZIP ) $( ESMDEST )
1012
1113clean :
12- rm -fr $(JSDEST ) $(JSGZIP )
14+ rm -fr $(JSDEST ) $(JSGZIP ) $( ESMDEST ) $( ESMTEST )
1315
1416$(DIST ) :
1517 mkdir -p $@
@@ -27,10 +29,23 @@ test-coverage:
2729 ./node_modules/.bin/nyc make mocha
2830 ./node_modules/.bin/nyc report --reporter=text-lcov > .nyc_output/lcov.info
2931
30- mocha :
31- ./node_modules/.bin/mocha -R spec $(TESTS )
32+ mocha : $(JSTEST ) $(ESMTEST )
33+ ./node_modules/.bin/mocha -R spec $(JSTEST )
34+ ./node_modules/.bin/mocha -R spec $(ESMTEST )
3235
3336jshint :
3437 ./node_modules/.bin/jshint .
3538
36- .PHONY : all clean test jshint mocha
39+ # ### ES Module
40+
41+ $(ESMDEST ) : $(SRC ) Makefile
42+ mkdir -p $(dir $@ )
43+ perl -pe ' s#^(var|.*export)#/// $$1#; s#^(\s*)(\S.*= )(factory.")#$$1export const $$2/* \@__PURE__ */ $$3#' < $< > $@
44+
45+ $(ESMTEST ) : $(JSTEST ) Makefile
46+ mkdir -p $(dir $@ )
47+ perl -pe ' s#^(var exported)#/// $$1#; s#^.*#import * as exported from "../int64-buffer.mjs";# if $$. == 1' < $< > $@
48+
49+ # ###
50+
51+ .PHONY : all clean test jshint mocha esm
Original file line number Diff line number Diff line change 1919 "nyc" : " ^17.1.0" ,
2020 "terser" : " ^5.37.0"
2121 },
22+ "exports" : {
23+ "types" : " ./int64-buffer.d.ts" ,
24+ "import" : " ./int64-buffer.mjs" ,
25+ "require" : " ./int64-buffer.js"
26+ },
2227 "files" : [
2328 " LICENSE" ,
2429 " README.md" ,
2530 " dist/int64-buffer.min.js" ,
2631 " int64-buffer.js" ,
27- " int64-buffer.d.ts"
32+ " int64-buffer.d.ts" ,
33+ " int64-buffer.mjs"
2834 ],
2935 "homepage" : " https://github.com/kawanet/int64-buffer" ,
3036 "jshintConfig" : {
6571 "prepack" : " make clean all test" ,
6672 "test" : " make test"
6773 },
74+ "type" : " commonjs" ,
6875 "typings" : " int64-buffer.d.ts"
6976}
You can’t perform that action at this time.
0 commit comments