Skip to content

Commit 7684a1c

Browse files
committed
add pagkage module and browser fields
1 parent 8021ee6 commit 7684a1c

File tree

5 files changed

+45
-14
lines changed

5 files changed

+45
-14
lines changed

.npmignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
!/LICENSE
66
!/Readme.md
77
!/dist/**/*
8-
!/magickApi.js
98

109
# ignore these in /dist:
1110
/dist/assets/**/*
1211
/dist/spec/**/
12+
/dist/esm5/**/
13+
/dist/esm6/**/
14+
/dist/esm2018/**/
1315
/dist/bundle.js

Readme.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ This project is not affiliated with [ImageMagick](https://www.imagemagick.org) ,
44

55
## Demos and examples
66

7-
* Simple example. See [samples/rotate#code](samples/rotate#code). A simple webpage that has image in array and loads magickApi.js to rotate file. Demonstration site [https://knicknic.github.io/imagemagick/rotate/](https://knicknic.github.io/imagemagick/rotate/)
8-
9-
* [https://knicknic.github.io/imagemagick/](https://knicknic.github.io/imagemagick/) a commandline sample of using ImageMagick
10-
* For code see [samples/cmdline](samples/cmdline)
11-
12-
* Used in [Croppy](https://knicknic.github.io/croppy/) to split webcomics from one long vertical strip into many panels.
13-
* For code see https://github.com/KnicKnic/croppy.
14-
157
* Basic playground (React & TypeScript project): [![Basic playground (React & TypeScript project)](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/lp7lxz6l59).
168

179
* Image Diff Example (React & TypeScript project): [![Basic playground for image diff (React & TypeScript project)](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/yvn6rkr16z).
@@ -20,6 +12,13 @@ This project is not affiliated with [ImageMagick](https://www.imagemagick.org) ,
2012

2113
* [Picture Frame editor](https://cancerberosgx.github.io/autumn-leaves/#/imageFrame).
2214

15+
* Simple example. See [samples/rotate#code](samples/rotate#code). A simple webpage that has image in array and loads magickApi.js to rotate file. Demonstration site [https://knicknic.github.io/imagemagick/rotate/](https://knicknic.github.io/imagemagick/rotate/)
16+
17+
* [https://knicknic.github.io/imagemagick/](https://knicknic.github.io/imagemagick/) a commandline sample of using ImageMagick
18+
* For code see [samples/cmdline](samples/cmdline)
19+
20+
* Used in [Croppy](https://knicknic.github.io/croppy/) to split webcomics from one long vertical strip into many panels.
21+
* For code see https://github.com/KnicKnic/croppy.
2322

2423
## Status
2524

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
"description": "Webassembly compilation of ImageMagick",
55
"main": "dist/src/index.js",
66
"typings": "dist/src/index.d.ts",
7-
"module": "dist/esm5/index.js",
8-
"es2015": "dist/esm2018/index.js",
7+
"module": "dist/bundles/wasm-imagemagick.esm-es5.js",
8+
"browser": "dist/bundles/wasm-imagemagick.umd-es5.js",
99
"scripts": {
1010
"build-wasm": "docker build -t wasm-imagemagick-build-tools . && docker run --rm --workdir /code -v \"$PWD\":/code wasm-imagemagick-build-tools bash ./build.sh",
1111
"build-ts": "rm -rf dist && tsc && npm run bundle",
1212
"bundle": "npx tsc --project tsconfig-esm5.json && npx tsc --project tsconfig-esm6.json && npx tsc --project tsconfig-esm2018.json && mkdir -p dist/bundles && npx rollup -c rollup.config.js && npx rollup -c rollup.config.js --environment NODE_ENV:production",
1313
"build": "npm run build-wasm && npm run build-ts",
1414
"prepare": "npm run build && npm run copy && npm run magickApiJs",
1515
"copy": "cp magick.js magick.wasm dist && cp magick.js magick.wasm spec/assets && cp -r spec/assets dist",
16-
"magickApiJs": "cp dist/bundles/index.esm.js magickApi.js",
16+
"magickApiJs": "cp dist/bundles/wasm-imagemagick.esm-es6.js magickApi.js",
1717
"clean": "sh clean.sh",
1818
"lint": "tslint \"src/**/*.ts\" \"spec/**/*.ts\"",
1919
"lint-and-fix": "tslint \"src/**/*.ts\" \"spec/**/*.ts\" --fix",
2020
"generateImEnums": "npx ts-node scripts/generateImEnums.ts",
2121
"test": "npm run test-node && npm run test-browser",
2222
"test-node": "cd tests/rotate && node node",
23-
"test-browser-build": "tsc && browserify -d dist/spec/index.js -o dist/bundle.js",
23+
"test-browser-build": "tsc && browserify --no-browser-field -d dist/spec/index.js -o dist/bundle.js",
2424
"test-browser": "rm -rf dist && npm run test-browser-build && npm run copy && gulp --gulpfile spec/gulpfile.js jasmine",
2525
"test-browser-server": "rm -rf dist && npm run test-browser-build && npm run copy && gulp --gulpfile spec/gulpfile.js jasmine-server",
2626
"test-browser-start": "rm -rf dist && tsc && npm run copy && npm run test-browser-watch-all",

rollup.config.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,35 @@ const UMDEs6config = {
136136
),
137137
}
138138

139+
140+
141+
const FESMEs5config = {
142+
...CommonConfig,
143+
input: resolve(PATHS.entry.esm5, 'index.js'),
144+
output: [
145+
{
146+
file: getOutputFileName(
147+
resolve(PATHS.bundles, `${pkg.name}.esm-es5.js`),
148+
ifProduction()
149+
),
150+
format: 'es',
151+
sourcemap: true,
152+
},
153+
],
154+
plugins: removeEmpty(
155+
([...plugins, ifProduction(terser()), babel({
156+
include: 'node_modules/**', babelrc: false, presets: [
157+
[
158+
"@babel/preset-env",
159+
{
160+
"targets": "ie 10"
161+
}
162+
]
163+
]
164+
})])
165+
),
166+
}
167+
139168
const FESMEs6config = {
140169
...CommonConfig,
141170
input: resolve(PATHS.entry.esm6, 'index.js'),
@@ -175,6 +204,7 @@ const FESMEs2018config = {
175204
export default [
176205
UMDEs5config,
177206
UMDEs6config,
207+
FESMEs5config,
178208
FESMEs6config,
179209
FESMEs2018config
180210
]

webworker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file helps make the compiled js file be imported as a web worker which is done by magickApi.js
1+
// This file helps make the compiled js file be imported as a web worker by the src/magickApi.ts file
22

33
const stdout = []
44
const stderr = []

0 commit comments

Comments
 (0)