Add pre-compiled WASM files to NPM packages
PiperOrigin-RevId: 487283112
This commit is contained in:
parent
0a5534204f
commit
84895316d2
|
@ -546,3 +546,6 @@ rules_proto_toolchains()
|
||||||
|
|
||||||
load("//third_party:external_files.bzl", "external_files")
|
load("//third_party:external_files.bzl", "external_files")
|
||||||
external_files()
|
external_files()
|
||||||
|
|
||||||
|
load("//third_party:wasm_files.bzl", "wasm_files")
|
||||||
|
wasm_files()
|
||||||
|
|
|
@ -3,9 +3,22 @@
|
||||||
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_library")
|
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_library")
|
||||||
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
|
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
|
||||||
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
|
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
|
||||||
|
load(
|
||||||
|
"//mediapipe/framework/tool:mediapipe_files.bzl",
|
||||||
|
"mediapipe_files",
|
||||||
|
)
|
||||||
|
|
||||||
package(default_visibility = ["//mediapipe/tasks:internal"])
|
package(default_visibility = ["//mediapipe/tasks:internal"])
|
||||||
|
|
||||||
|
mediapipe_files(srcs = [
|
||||||
|
"wasm/audio_wasm_internal.js",
|
||||||
|
"wasm/audio_wasm_internal.wasm",
|
||||||
|
"wasm/text_wasm_internal.js",
|
||||||
|
"wasm/text_wasm_internal.wasm",
|
||||||
|
"wasm/vision_wasm_internal.js",
|
||||||
|
"wasm/vision_wasm_internal.wasm",
|
||||||
|
])
|
||||||
|
|
||||||
# Audio
|
# Audio
|
||||||
|
|
||||||
mediapipe_ts_library(
|
mediapipe_ts_library(
|
||||||
|
@ -28,15 +41,18 @@ rollup_bundle(
|
||||||
|
|
||||||
pkg_npm(
|
pkg_npm(
|
||||||
name = "audio_pkg",
|
name = "audio_pkg",
|
||||||
package_name = "__PACKAGE_NAME__",
|
package_name = "@mediapipe/tasks-__NAME__",
|
||||||
srcs = ["package.json"],
|
srcs = ["package.json"],
|
||||||
substitutions = {
|
substitutions = {
|
||||||
"__PACKAGE_NAME__": "@mediapipe/tasks-audio",
|
"__NAME__": "audio",
|
||||||
"__DESCRIPTION__": "MediaPipe Audio Tasks",
|
"__DESCRIPTION__": "MediaPipe Audio Tasks",
|
||||||
"__BUNDLE__": "audio_bundle.js",
|
|
||||||
},
|
},
|
||||||
tgz = "audio.tgz",
|
tgz = "audio.tgz",
|
||||||
deps = [":audio_bundle"],
|
deps = [
|
||||||
|
"wasm/audio_wasm_internal.js",
|
||||||
|
"wasm/audio_wasm_internal.wasm",
|
||||||
|
":audio_bundle",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Text
|
# Text
|
||||||
|
@ -61,15 +77,18 @@ rollup_bundle(
|
||||||
|
|
||||||
pkg_npm(
|
pkg_npm(
|
||||||
name = "text_pkg",
|
name = "text_pkg",
|
||||||
package_name = "__PACKAGE_NAME__",
|
package_name = "@mediapipe/tasks-__NAME__",
|
||||||
srcs = ["package.json"],
|
srcs = ["package.json"],
|
||||||
substitutions = {
|
substitutions = {
|
||||||
"__PACKAGE_NAME__": "@mediapipe/tasks-text",
|
"__NAME__": "text",
|
||||||
"__DESCRIPTION__": "MediaPipe Text Tasks",
|
"__DESCRIPTION__": "MediaPipe Text Tasks",
|
||||||
"__BUNDLE__": "text_bundle.js",
|
|
||||||
},
|
},
|
||||||
tgz = "text.tgz",
|
tgz = "text.tgz",
|
||||||
deps = [":text_bundle"],
|
deps = [
|
||||||
|
"wasm/text_wasm_internal.js",
|
||||||
|
"wasm/text_wasm_internal.wasm",
|
||||||
|
":text_bundle",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Vision
|
# Vision
|
||||||
|
@ -94,13 +113,16 @@ rollup_bundle(
|
||||||
|
|
||||||
pkg_npm(
|
pkg_npm(
|
||||||
name = "vision_pkg",
|
name = "vision_pkg",
|
||||||
package_name = "__PACKAGE_NAME__",
|
package_name = "@mediapipe/tasks-__NAME__",
|
||||||
srcs = ["package.json"],
|
srcs = ["package.json"],
|
||||||
substitutions = {
|
substitutions = {
|
||||||
"__PACKAGE_NAME__": "@mediapipe/tasks-vision",
|
"__NAME__": "vision",
|
||||||
"__DESCRIPTION__": "MediaPipe Vision Tasks",
|
"__DESCRIPTION__": "MediaPipe Vision Tasks",
|
||||||
"__BUNDLE__": "vision_bundle.js",
|
|
||||||
},
|
},
|
||||||
tgz = "vision.tgz",
|
tgz = "vision_pkg.tgz",
|
||||||
deps = [":vision_bundle"],
|
deps = [
|
||||||
|
"wasm/vision_wasm_internal.js",
|
||||||
|
"wasm/vision_wasm_internal.wasm",
|
||||||
|
":vision_bundle",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
{
|
{
|
||||||
"name": "__PACKAGE_NAME__",
|
"name": "@mediapipe/tasks-__NAME__",
|
||||||
"version": "__VERSION__",
|
"version": "__VERSION__",
|
||||||
"description": "__DESCRIPTION__",
|
"description": "__DESCRIPTION__",
|
||||||
"main": "__BUNDLE__",
|
"main": "__NAME__bundle.js",
|
||||||
"module": "__BUNDLE__",
|
"module": "__NAME__bundle.js",
|
||||||
|
"exports": {
|
||||||
|
".": "./__NAME__bundle.js",
|
||||||
|
"./loader": "./wasm/__NAME__wasm_internal.js",
|
||||||
|
"./wasm": "./wasm/__NAME__wasm_internal.wasm"
|
||||||
|
},
|
||||||
"author": "mediapipe@google.com",
|
"author": "mediapipe@google.com",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
47
third_party/wasm_files.bzl
vendored
Normal file
47
third_party/wasm_files.bzl
vendored
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
"""
|
||||||
|
WASM dependencies for MediaPipe.
|
||||||
|
|
||||||
|
This file is auto-generated.
|
||||||
|
"""
|
||||||
|
|
||||||
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
|
||||||
|
|
||||||
|
# buildifier: disable=unnamed-macro
|
||||||
|
def wasm_files():
|
||||||
|
"""WASM dependencies for MediaPipe."""
|
||||||
|
|
||||||
|
http_file(
|
||||||
|
name = "com_google_mediapipe_wasm_audio_wasm_internal_js",
|
||||||
|
sha256 = "9419766229f24790388805d891af907cf11fe8e2cdacabcf016feb054b720c82",
|
||||||
|
urls = ["https://storage.googleapis.com/mediapipe-assets/wasm/audio_wasm_internal.js?generation=1667934266184984"],
|
||||||
|
)
|
||||||
|
|
||||||
|
http_file(
|
||||||
|
name = "com_google_mediapipe_wasm_text_wasm_internal_js",
|
||||||
|
sha256 = "39d9445ab3b90f625a3332251fe82e59b40cd0501a5657475f3b115b7c6122c8",
|
||||||
|
urls = ["https://storage.googleapis.com/mediapipe-assets/wasm/text_wasm_internal.js?generation=1667934268229056"],
|
||||||
|
)
|
||||||
|
|
||||||
|
http_file(
|
||||||
|
name = "com_google_mediapipe_wasm_vision_wasm_internal_js",
|
||||||
|
sha256 = "b43c7078fe5da72990394af4fefd798bd844b4ac47849a49067bd68c3c910a3d",
|
||||||
|
urls = ["https://storage.googleapis.com/mediapipe-assets/wasm/vision_wasm_internal.js?generation=1667934270239845"],
|
||||||
|
)
|
||||||
|
|
||||||
|
http_file(
|
||||||
|
name = "com_google_mediapipe_wasm_audio_wasm_internal_wasm",
|
||||||
|
sha256 = "9f2abe2a51d1ebc854859f620759cec1cc643773f3748d0d19e0868578c3d746",
|
||||||
|
urls = ["https://storage.googleapis.com/mediapipe-assets/wasm/audio_wasm_internal.wasm?generation=1667934272818542"],
|
||||||
|
)
|
||||||
|
|
||||||
|
http_file(
|
||||||
|
name = "com_google_mediapipe_wasm_text_wasm_internal_wasm",
|
||||||
|
sha256 = "8334caec5fb10cd1f936f6ee41f8853771c7bf3a421f5c15c39ee41aa503ca54",
|
||||||
|
urls = ["https://storage.googleapis.com/mediapipe-assets/wasm/text_wasm_internal.wasm?generation=1667934275451198"],
|
||||||
|
)
|
||||||
|
|
||||||
|
http_file(
|
||||||
|
name = "com_google_mediapipe_wasm_vision_wasm_internal_wasm",
|
||||||
|
sha256 = "b996eaa324da151359ad8e16edad27d9768505f1fd073625bc50dbb0f252e098",
|
||||||
|
urls = ["https://storage.googleapis.com/mediapipe-assets/wasm/vision_wasm_internal.wasm?generation=1667934277855507"],
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user