-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add infrastructure to build and publish as wasm32 (#3840)
Co-authored-by: Ingvar Stepanyan <[email protected]>
- Loading branch information
Showing
17 changed files
with
241 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
"linux-x64", | ||
"linuxmusl-arm64", | ||
"linuxmusl-x64", | ||
"wasm32", | ||
"win32-ia32", | ||
"win32-x64" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "@img/sharp-wasm32", | ||
"version": "0.33.0-alpha.10", | ||
"description": "Prebuilt sharp for use with wasm32", | ||
"author": "Lovell Fuller <[email protected]>", | ||
"homepage": "https://sharp.pixelplumbing.com", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/lovell/sharp.git", | ||
"directory": "npm/wasm32" | ||
}, | ||
"license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", | ||
"funding": { | ||
"url": "https://opencollective.com/libvips" | ||
}, | ||
"preferUnplugged": true, | ||
"files": [ | ||
"lib", | ||
"versions.json" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"type": "commonjs", | ||
"exports": { | ||
"./sharp.node": "./lib/sharp-wasm32.node.js", | ||
"./package": "./package.json", | ||
"./versions": "./versions.json" | ||
}, | ||
"engines": { | ||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0", | ||
"npm": ">=9.6.5", | ||
"yarn": ">=3.2.0", | ||
"pnpm": ">=7.1.0" | ||
}, | ||
"dependencies": { | ||
"@emnapi/runtime": "^0.43.1" | ||
}, | ||
"cpu": [ | ||
"wasm32" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,7 +87,8 @@ | |
"Brahim Ait elhaj <[email protected]>", | ||
"Mart Jansink <[email protected]>", | ||
"Lachlan Newman <[email protected]>", | ||
"Dennis Beatty <[email protected]>" | ||
"Dennis Beatty <[email protected]>", | ||
"Ingvar Stepanyan <[email protected]>" | ||
], | ||
"scripts": { | ||
"install": "node install/check", | ||
|
@@ -156,16 +157,20 @@ | |
"@img/sharp-linux-x64": "0.33.0-alpha.10", | ||
"@img/sharp-linuxmusl-arm64": "0.33.0-alpha.10", | ||
"@img/sharp-linuxmusl-x64": "0.33.0-alpha.10", | ||
"@img/sharp-wasm32": "0.33.0-alpha.10", | ||
"@img/sharp-win32-ia32": "0.33.0-alpha.10", | ||
"@img/sharp-win32-x64": "0.33.0-alpha.10" | ||
}, | ||
"devDependencies": { | ||
"@emnapi/runtime": "^0.43.1", | ||
"@img/sharp-libvips-dev": "0.0.3", | ||
"@img/sharp-libvips-dev-wasm32": "0.0.3", | ||
"@img/sharp-libvips-win32-ia32": "0.0.3", | ||
"@img/sharp-libvips-win32-x64": "0.0.3", | ||
"@types/node": "*", | ||
"async": "^3.2.5", | ||
"cc": "^3.0.1", | ||
"emnapi": "^0.43.1", | ||
"exif-reader": "^2.0.0", | ||
"extract-zip": "^2.0.1", | ||
"icc": "^3.0.0", | ||
|
@@ -203,6 +208,11 @@ | |
"build/include" | ||
] | ||
}, | ||
"nyc": { | ||
"include": [ | ||
"lib" | ||
] | ||
}, | ||
"tsd": { | ||
"directory": "test/types/" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright 2013 Lovell Fuller and others. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
{ | ||
'variables': { | ||
'OS': 'emscripten' | ||
}, | ||
'target_defaults': { | ||
'default_configuration': 'Release', | ||
'type': 'executable', | ||
'cflags': [ | ||
'-pthread', | ||
'-sDEFAULT_TO_CXX=0' | ||
], | ||
'cflags_cc': [ | ||
'-pthread' | ||
], | ||
'ldflags': [ | ||
'--js-library=<!(node -p "require(\'emnapi\').js_library")', | ||
'-sAUTO_JS_LIBRARIES=0', | ||
'-sAUTO_NATIVE_LIBRARIES=0', | ||
'-sNODEJS_CATCH_EXIT=0', | ||
'-sNODEJS_CATCH_REJECTION=0' | ||
], | ||
'defines': [ | ||
'__STDC_FORMAT_MACROS', | ||
'BUILDING_NODE_EXTENSION', | ||
'EMNAPI_WORKER_POOL_SIZE=1' | ||
], | ||
'include_dirs': [ | ||
'<!(node -p "require(\'emnapi\').include")' | ||
], | ||
'sources': [ | ||
'<!@(node -p "require(\'emnapi\').sources.map(x => JSON.stringify(path.relative(process.cwd(), x))).join(\' \')")' | ||
], | ||
'configurations': { | ||
'Release': {} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2013 Lovell Fuller and others. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
/* global Module, ENV, _vips_shutdown, _uv_library_shutdown */ | ||
|
||
Module.preRun = () => { | ||
ENV.VIPS_CONCURRENCY = Number(process.env.VIPS_CONCURRENCY) || 1; | ||
}; | ||
|
||
Module.onRuntimeInitialized = () => { | ||
module.exports = Module.emnapiInit({ | ||
context: require('@emnapi/runtime').getDefaultContext() | ||
}); | ||
|
||
process.once('exit', () => { | ||
_vips_shutdown(); | ||
_uv_library_shutdown(); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.