Copy README.md to NPM package root

PiperOrigin-RevId: 501929871
This commit is contained in:
Sebastian Schmidt 2023-01-13 13:45:47 -08:00 committed by Copybara-Service
parent f997c0ab1a
commit aef4cca406
10 changed files with 216 additions and 258 deletions

View File

@ -1,158 +1,5 @@
# This contains the MediaPipe Tasks NPM package definitions.
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_library")
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
load(
"//mediapipe/framework/tool:mediapipe_files.bzl",
"mediapipe_files",
)
package(default_visibility = ["//mediapipe/tasks:internal"])
mediapipe_files(srcs = [
"wasm/audio_wasm_internal.js",
"wasm/audio_wasm_internal.wasm",
"wasm/audio_wasm_nosimd_internal.js",
"wasm/audio_wasm_nosimd_internal.wasm",
"wasm/text_wasm_internal.js",
"wasm/text_wasm_internal.wasm",
"wasm/text_wasm_nosimd_internal.js",
"wasm/text_wasm_nosimd_internal.wasm",
"wasm/vision_wasm_internal.js",
"wasm/vision_wasm_internal.wasm",
"wasm/vision_wasm_nosimd_internal.js",
"wasm/vision_wasm_nosimd_internal.wasm",
exports_files([
"karma.conf.ts",
"package.json",
"rollup.config.mjs",
])
# Audio
mediapipe_ts_library(
name = "audio_lib",
srcs = ["audio.ts"],
deps = ["//mediapipe/tasks/web/audio:audio_lib"],
)
rollup_bundle(
name = "audio_bundle",
config_file = "rollup.config.mjs",
entry_point = "audio.ts",
format = "esm",
output_dir = False,
sourcemap = "false",
deps = [
":audio_lib",
"@npm//@rollup/plugin-commonjs",
"@npm//@rollup/plugin-node-resolve",
"@npm//@rollup/plugin-terser",
"@npm//google-protobuf",
],
)
pkg_npm(
name = "audio_pkg",
package_name = "@mediapipe/tasks-__NAME__",
srcs = ["package.json"],
substitutions = {
"__NAME__": "audio",
"__DESCRIPTION__": "MediaPipe Audio Tasks",
"__TYPES__": "audio.d.ts",
},
tgz = "audio.tgz",
deps = [
"wasm/audio_wasm_internal.js",
"wasm/audio_wasm_internal.wasm",
"wasm/audio_wasm_nosimd_internal.js",
"wasm/audio_wasm_nosimd_internal.wasm",
":audio_bundle",
"//mediapipe/tasks/web/audio:README.md",
],
)
# Text
mediapipe_ts_library(
name = "text_lib",
srcs = ["text.ts"],
deps = ["//mediapipe/tasks/web/text:text_lib"],
)
rollup_bundle(
name = "text_bundle",
config_file = "rollup.config.mjs",
entry_point = "text.ts",
format = "esm",
output_dir = False,
sourcemap = "false",
deps = [
":text_lib",
"@npm//@rollup/plugin-commonjs",
"@npm//@rollup/plugin-node-resolve",
"@npm//@rollup/plugin-terser",
"@npm//google-protobuf",
],
)
pkg_npm(
name = "text_pkg",
package_name = "@mediapipe/tasks-__NAME__",
srcs = ["package.json"],
substitutions = {
"__NAME__": "text",
"__DESCRIPTION__": "MediaPipe Text Tasks",
"__TYPES__": "text.d.ts",
},
tgz = "text.tgz",
deps = [
"wasm/text_wasm_internal.js",
"wasm/text_wasm_internal.wasm",
"wasm/text_wasm_nosimd_internal.js",
"wasm/text_wasm_nosimd_internal.wasm",
":text_bundle",
"//mediapipe/tasks/web/text:README.md",
],
)
# Vision
mediapipe_ts_library(
name = "vision_lib",
srcs = ["vision.ts"],
deps = ["//mediapipe/tasks/web/vision:vision_lib"],
)
rollup_bundle(
name = "vision_bundle",
config_file = "rollup.config.mjs",
entry_point = "vision.ts",
format = "esm",
output_dir = False,
sourcemap = "false",
deps = [
":vision_lib",
"@npm//@rollup/plugin-commonjs",
"@npm//@rollup/plugin-node-resolve",
"@npm//@rollup/plugin-terser",
"@npm//google-protobuf",
],
)
pkg_npm(
name = "vision_pkg",
package_name = "@mediapipe/tasks-__NAME__",
srcs = ["package.json"],
substitutions = {
"__NAME__": "vision",
"__DESCRIPTION__": "MediaPipe Vision Tasks",
"__TYPES__": "vision.d.ts",
},
tgz = "vision_pkg.tgz",
deps = [
"wasm/vision_wasm_internal.js",
"wasm/vision_wasm_internal.wasm",
"wasm/vision_wasm_nosimd_internal.js",
"wasm/vision_wasm_nosimd_internal.wasm",
":vision_bundle",
"//mediapipe/tasks/web/vision:README.md",
],
)

View File

@ -1,25 +0,0 @@
/**
* Copyright 2022 The MediaPipe Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {AudioClassifier as AudioClassifierImpl, AudioEmbedder as AudioEmbedderImpl, FilesetResolver as FilesetResolverImpl} from '../../tasks/web/audio/index';
// Declare the variables locally so that Rollup in OSS includes them explcilty
// as exports.
const AudioClassifier = AudioClassifierImpl;
const AudioEmbedder = AudioEmbedderImpl;
const FilesetResolver = FilesetResolverImpl;
export {AudioClassifier, AudioEmbedder, FilesetResolver};

View File

@ -1,11 +1,15 @@
# This contains the MediaPipe Audio Tasks.
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_library")
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
load(
"//mediapipe/framework/tool:mediapipe_files.bzl",
"mediapipe_files",
)
package(default_visibility = ["//mediapipe/tasks:internal"])
exports_files(["README.md"])
mediapipe_ts_library(
name = "audio_lib",
srcs = ["index.ts"],
@ -16,3 +20,53 @@ mediapipe_ts_library(
"//mediapipe/tasks/web/core:fileset_resolver",
],
)
mediapipe_files(srcs = [
"wasm/audio_wasm_internal.js",
"wasm/audio_wasm_internal.wasm",
"wasm/audio_wasm_nosimd_internal.js",
"wasm/audio_wasm_nosimd_internal.wasm",
])
rollup_bundle(
name = "audio_bundle",
config_file = "//mediapipe/tasks/web:rollup.config.mjs",
entry_point = "index.ts",
format = "esm",
output_dir = False,
sourcemap = "false",
deps = [
":audio_lib",
"@npm//@rollup/plugin-commonjs",
"@npm//@rollup/plugin-node-resolve",
"@npm//@rollup/plugin-terser",
"@npm//google-protobuf",
],
)
genrule(
name = "package_json",
srcs = ["//mediapipe/tasks/web:package.json"],
outs = ["package.json"],
cmd = "cp $< $@",
)
pkg_npm(
name = "audio_pkg",
package_name = "@mediapipe/tasks-__NAME__",
srcs = ["README.md"],
substitutions = {
"__NAME__": "audio",
"__DESCRIPTION__": "MediaPipe Audio Tasks",
"__TYPES__": "audio.d.ts",
},
tgz = "audio.tgz",
deps = [
"wasm/audio_wasm_internal.js",
"wasm/audio_wasm_internal.wasm",
"wasm/audio_wasm_nosimd_internal.js",
"wasm/audio_wasm_nosimd_internal.wasm",
":audio_bundle",
":package_json",
],
)

View File

@ -14,6 +14,14 @@
* limitations under the License.
*/
export * from '../../../tasks/web/audio/audio_classifier/audio_classifier';
export * from '../../../tasks/web/audio/audio_embedder/audio_embedder';
export * from '../../../tasks/web/core/fileset_resolver';
import {AudioClassifier as AudioClassifierImpl} from '../../../tasks/web/audio/audio_classifier/audio_classifier';
import {AudioEmbedder as AudioEmbedderImpl} from '../../../tasks/web/audio/audio_embedder/audio_embedder';
import {FilesetResolver as FilesetResolverImpl} from '../../../tasks/web/core/fileset_resolver';
// Declare the variables locally so that Rollup in OSS includes them explcilty
// as exports.
const AudioClassifier = AudioClassifierImpl;
const AudioEmbedder = AudioEmbedderImpl;
const FilesetResolver = FilesetResolverImpl;
export {AudioClassifier, AudioEmbedder, FilesetResolver};

View File

@ -1,25 +0,0 @@
/**
* Copyright 2022 The MediaPipe Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {FilesetResolver as FilesetResolverImpl, TextClassifier as TextClassifierImpl, TextEmbedder as TextEmbedderImpl} from '../../tasks/web/text/index';
// Declare the variables locally so that Rollup in OSS includes them explcilty
// as exports.
const FilesetResolver = FilesetResolverImpl;
const TextClassifier = TextClassifierImpl;
const TextEmbedder = TextEmbedderImpl;
export {FilesetResolver, TextClassifier, TextEmbedder};

View File

@ -1,10 +1,21 @@
# This contains the MediaPipe Text Tasks.
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_library")
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
load(
"//mediapipe/framework/tool:mediapipe_files.bzl",
"mediapipe_files",
)
package(default_visibility = ["//mediapipe/tasks:internal"])
exports_files(["README.md"])
mediapipe_files(srcs = [
"wasm/text_wasm_internal.js",
"wasm/text_wasm_internal.wasm",
"wasm/text_wasm_nosimd_internal.js",
"wasm/text_wasm_nosimd_internal.wasm",
])
mediapipe_ts_library(
name = "text_lib",
@ -16,3 +27,46 @@ mediapipe_ts_library(
"//mediapipe/tasks/web/text/text_embedder",
],
)
rollup_bundle(
name = "text_bundle",
config_file = "//mediapipe/tasks/web:rollup.config.mjs",
entry_point = "index.ts",
format = "esm",
output_dir = False,
sourcemap = "false",
deps = [
":text_lib",
"@npm//@rollup/plugin-commonjs",
"@npm//@rollup/plugin-node-resolve",
"@npm//@rollup/plugin-terser",
"@npm//google-protobuf",
],
)
genrule(
name = "package_json",
srcs = ["//mediapipe/tasks/web:package.json"],
outs = ["package.json"],
cmd = "cp $< $@",
)
pkg_npm(
name = "text_pkg",
package_name = "@mediapipe/tasks-__NAME__",
srcs = ["README.md"],
substitutions = {
"__NAME__": "text",
"__DESCRIPTION__": "MediaPipe Text Tasks",
"__TYPES__": "text.d.ts",
},
tgz = "text.tgz",
deps = [
"wasm/text_wasm_internal.js",
"wasm/text_wasm_internal.wasm",
"wasm/text_wasm_nosimd_internal.js",
"wasm/text_wasm_nosimd_internal.wasm",
":package_json",
":text_bundle",
],
)

View File

@ -14,6 +14,14 @@
* limitations under the License.
*/
export * from '../../../tasks/web/text/text_classifier/text_classifier';
export * from '../../../tasks/web/text/text_embedder/text_embedder';
export * from '../../../tasks/web/core/fileset_resolver';
import {FilesetResolver as FilesetResolverImpl} from '../../../tasks/web/core/fileset_resolver';
import {TextClassifier as TextClassifierImpl} from '../../../tasks/web/text/text_classifier/text_classifier';
import {TextEmbedder as TextEmbedderImpl} from '../../../tasks/web/text/text_embedder/text_embedder';
// Declare the variables locally so that Rollup in OSS includes them explcilty
// as exports.
const FilesetResolver = FilesetResolverImpl;
const TextClassifier = TextClassifierImpl;
const TextEmbedder = TextEmbedderImpl;
export {FilesetResolver, TextClassifier, TextEmbedder};

View File

@ -1,35 +0,0 @@
/**
* Copyright 2022 The MediaPipe Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {FilesetResolver as FilesetResolverImpl, GestureRecognizer as GestureRecognizerImpl, HandLandmarker as HandLandmarkerImpl, ImageClassifier as ImageClassifierImpl, ImageEmbedder as ImageEmbedderImpl, ObjectDetector as ObjectDetectorImpl} from '../../tasks/web/vision/index';
// Declare the variables locally so that Rollup in OSS includes them explcilty
// as exports.
const FilesetResolver = FilesetResolverImpl;
const GestureRecognizer = GestureRecognizerImpl;
const HandLandmarker = HandLandmarkerImpl;
const ImageClassifier = ImageClassifierImpl;
const ImageEmbedder = ImageEmbedderImpl;
const ObjectDetector = ObjectDetectorImpl;
export {
FilesetResolver,
GestureRecognizer,
HandLandmarker,
ImageClassifier,
ImageEmbedder,
ObjectDetector
};

View File

@ -1,10 +1,21 @@
# This contains the MediaPipe Vision Tasks.
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_library")
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
load(
"//mediapipe/framework/tool:mediapipe_files.bzl",
"mediapipe_files",
)
package(default_visibility = ["//mediapipe/tasks:internal"])
exports_files(["README.md"])
mediapipe_files(srcs = [
"wasm/vision_wasm_internal.js",
"wasm/vision_wasm_internal.wasm",
"wasm/vision_wasm_nosimd_internal.js",
"wasm/vision_wasm_nosimd_internal.wasm",
])
mediapipe_ts_library(
name = "vision_lib",
@ -19,3 +30,46 @@ mediapipe_ts_library(
"//mediapipe/tasks/web/vision/object_detector",
],
)
rollup_bundle(
name = "vision_bundle",
config_file = "//mediapipe/tasks/web:rollup.config.mjs",
entry_point = "index.ts",
format = "esm",
output_dir = False,
sourcemap = "false",
deps = [
":vision_lib",
"@npm//@rollup/plugin-commonjs",
"@npm//@rollup/plugin-node-resolve",
"@npm//@rollup/plugin-terser",
"@npm//google-protobuf",
],
)
genrule(
name = "package_json",
srcs = ["//mediapipe/tasks/web:package.json"],
outs = ["package.json"],
cmd = "cp $< $@",
)
pkg_npm(
name = "vision_pkg",
package_name = "@mediapipe/tasks-__NAME__",
srcs = ["README.md"],
substitutions = {
"__NAME__": "vision",
"__DESCRIPTION__": "MediaPipe Vision Tasks",
"__TYPES__": "vision.d.ts",
},
tgz = "vision_pkg.tgz",
deps = [
"wasm/vision_wasm_internal.js",
"wasm/vision_wasm_internal.wasm",
"wasm/vision_wasm_nosimd_internal.js",
"wasm/vision_wasm_nosimd_internal.wasm",
":package_json",
":vision_bundle",
],
)

View File

@ -14,9 +14,27 @@
* limitations under the License.
*/
export * from '../../../tasks/web/vision/image_classifier/image_classifier';
export * from '../../../tasks/web/vision/image_embedder/image_embedder';
export * from '../../../tasks/web/vision/gesture_recognizer/gesture_recognizer';
export * from '../../../tasks/web/vision/hand_landmarker/hand_landmarker';
export * from '../../../tasks/web/vision/object_detector/object_detector';
export * from '../../../tasks/web/core/fileset_resolver';
import {FilesetResolver as FilesetResolverImpl} from '../../../tasks/web/core/fileset_resolver';
import {GestureRecognizer as GestureRecognizerImpl} from '../../../tasks/web/vision/gesture_recognizer/gesture_recognizer';
import {HandLandmarker as HandLandmarkerImpl} from '../../../tasks/web/vision/hand_landmarker/hand_landmarker';
import {ImageClassifier as ImageClassifierImpl} from '../../../tasks/web/vision/image_classifier/image_classifier';
import {ImageEmbedder as ImageEmbedderImpl} from '../../../tasks/web/vision/image_embedder/image_embedder';
import {ObjectDetector as ObjectDetectorImpl} from '../../../tasks/web/vision/object_detector/object_detector';
// Declare the variables locally so that Rollup in OSS includes them explcilty
// as exports.
const FilesetResolver = FilesetResolverImpl;
const GestureRecognizer = GestureRecognizerImpl;
const HandLandmarker = HandLandmarkerImpl;
const ImageClassifier = ImageClassifierImpl;
const ImageEmbedder = ImageEmbedderImpl;
const ObjectDetector = ObjectDetectorImpl;
export {
FilesetResolver,
GestureRecognizer,
HandLandmarker,
ImageClassifier,
ImageEmbedder,
ObjectDetector
};