Change NPM Bundle to ESM
PiperOrigin-RevId: 489091370
This commit is contained in:
parent
90eb4a19d8
commit
e66e88802c
|
@ -24,35 +24,25 @@ mediapipe_files(srcs = [
|
||||||
mediapipe_ts_library(
|
mediapipe_ts_library(
|
||||||
name = "audio_lib",
|
name = "audio_lib",
|
||||||
srcs = ["audio.ts"],
|
srcs = ["audio.ts"],
|
||||||
deps = ["//mediapipe/tasks/web/audio:audio_lib"],
|
|
||||||
)
|
|
||||||
|
|
||||||
rollup_bundle(
|
|
||||||
name = "audio_cjs_bundle",
|
|
||||||
config_file = "rollup.config.cjs.mjs",
|
|
||||||
entry_point = "audio.ts",
|
|
||||||
format = "cjs",
|
|
||||||
output_dir = False,
|
|
||||||
deps = [
|
deps = [
|
||||||
":audio_lib",
|
"//mediapipe/tasks/web/audio/audio_classifier",
|
||||||
"@npm//@rollup/plugin-commonjs",
|
|
||||||
"@npm//@rollup/plugin-node-resolve",
|
|
||||||
"@npm//@rollup/plugin-replace",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
rollup_bundle(
|
rollup_bundle(
|
||||||
name = "audio_iife_bundle",
|
name = "audio_bundle",
|
||||||
config_file = "rollup.config.iife.mjs",
|
config_file = "rollup.config.mjs",
|
||||||
entry_point = "audio.ts",
|
entry_point = "audio.ts",
|
||||||
format = "iife",
|
format = "esm",
|
||||||
output_dir = False,
|
output_dir = False,
|
||||||
|
sourcemap = "false",
|
||||||
deps = [
|
deps = [
|
||||||
":audio_lib",
|
":audio_lib",
|
||||||
"@npm//@rollup/plugin-commonjs",
|
"@npm//@rollup/plugin-commonjs",
|
||||||
"@npm//@rollup/plugin-node-resolve",
|
"@npm//@rollup/plugin-node-resolve",
|
||||||
"@npm//@rollup/plugin-replace",
|
"@npm//@rollup/plugin-replace",
|
||||||
"@npm//@rollup/plugin-terser",
|
"@npm//@rollup/plugin-terser",
|
||||||
|
"@npm//google-protobuf",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -69,8 +59,7 @@ pkg_npm(
|
||||||
deps = [
|
deps = [
|
||||||
"wasm/audio_wasm_internal.js",
|
"wasm/audio_wasm_internal.js",
|
||||||
"wasm/audio_wasm_internal.wasm",
|
"wasm/audio_wasm_internal.wasm",
|
||||||
":audio_cjs_bundle",
|
":audio_bundle",
|
||||||
":audio_iife_bundle",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -79,35 +68,26 @@ pkg_npm(
|
||||||
mediapipe_ts_library(
|
mediapipe_ts_library(
|
||||||
name = "text_lib",
|
name = "text_lib",
|
||||||
srcs = ["text.ts"],
|
srcs = ["text.ts"],
|
||||||
deps = ["//mediapipe/tasks/web/text:text_lib"],
|
|
||||||
)
|
|
||||||
|
|
||||||
rollup_bundle(
|
|
||||||
name = "text_cjs_bundle",
|
|
||||||
config_file = "rollup.config.cjs.mjs",
|
|
||||||
entry_point = "text.ts",
|
|
||||||
format = "cjs",
|
|
||||||
output_dir = False,
|
|
||||||
deps = [
|
deps = [
|
||||||
":text_lib",
|
"//mediapipe/tasks/web/text/text_classifier",
|
||||||
"@npm//@rollup/plugin-commonjs",
|
"//mediapipe/tasks/web/text/text_embedder",
|
||||||
"@npm//@rollup/plugin-node-resolve",
|
|
||||||
"@npm//@rollup/plugin-replace",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
rollup_bundle(
|
rollup_bundle(
|
||||||
name = "text_iife_bundle",
|
name = "text_bundle",
|
||||||
config_file = "rollup.config.iife.mjs",
|
config_file = "rollup.config.mjs",
|
||||||
entry_point = "text.ts",
|
entry_point = "text.ts",
|
||||||
format = "iife",
|
format = "esm",
|
||||||
output_dir = False,
|
output_dir = False,
|
||||||
|
sourcemap = "false",
|
||||||
deps = [
|
deps = [
|
||||||
":text_lib",
|
":text_lib",
|
||||||
"@npm//@rollup/plugin-commonjs",
|
"@npm//@rollup/plugin-commonjs",
|
||||||
"@npm//@rollup/plugin-node-resolve",
|
"@npm//@rollup/plugin-node-resolve",
|
||||||
"@npm//@rollup/plugin-replace",
|
"@npm//@rollup/plugin-replace",
|
||||||
"@npm//@rollup/plugin-terser",
|
"@npm//@rollup/plugin-terser",
|
||||||
|
"@npm//google-protobuf",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -124,8 +104,7 @@ pkg_npm(
|
||||||
deps = [
|
deps = [
|
||||||
"wasm/text_wasm_internal.js",
|
"wasm/text_wasm_internal.js",
|
||||||
"wasm/text_wasm_internal.wasm",
|
"wasm/text_wasm_internal.wasm",
|
||||||
":text_cjs_bundle",
|
":text_bundle",
|
||||||
":text_iife_bundle",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -134,35 +113,29 @@ pkg_npm(
|
||||||
mediapipe_ts_library(
|
mediapipe_ts_library(
|
||||||
name = "vision_lib",
|
name = "vision_lib",
|
||||||
srcs = ["vision.ts"],
|
srcs = ["vision.ts"],
|
||||||
deps = ["//mediapipe/tasks/web/vision:vision_lib"],
|
|
||||||
)
|
|
||||||
|
|
||||||
rollup_bundle(
|
|
||||||
name = "vision_cjs_bundle",
|
|
||||||
config_file = "rollup.config.cjs.mjs",
|
|
||||||
entry_point = "vision.ts",
|
|
||||||
format = "cjs",
|
|
||||||
output_dir = False,
|
|
||||||
deps = [
|
deps = [
|
||||||
":vision_lib",
|
"//mediapipe/tasks/web/vision/gesture_recognizer",
|
||||||
"@npm//@rollup/plugin-commonjs",
|
"//mediapipe/tasks/web/vision/hand_landmarker",
|
||||||
"@npm//@rollup/plugin-node-resolve",
|
"//mediapipe/tasks/web/vision/image_classifier",
|
||||||
"@npm//@rollup/plugin-replace",
|
"//mediapipe/tasks/web/vision/image_embedder",
|
||||||
|
"//mediapipe/tasks/web/vision/object_detector",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
rollup_bundle(
|
rollup_bundle(
|
||||||
name = "vision_iife_bundle",
|
name = "vision_bundle",
|
||||||
config_file = "rollup.config.iife.mjs",
|
config_file = "rollup.config.mjs",
|
||||||
entry_point = "vision.ts",
|
entry_point = "vision.ts",
|
||||||
format = "iife",
|
format = "esm",
|
||||||
output_dir = False,
|
output_dir = False,
|
||||||
|
sourcemap = "false",
|
||||||
deps = [
|
deps = [
|
||||||
":vision_lib",
|
":vision_lib",
|
||||||
"@npm//@rollup/plugin-commonjs",
|
"@npm//@rollup/plugin-commonjs",
|
||||||
"@npm//@rollup/plugin-node-resolve",
|
"@npm//@rollup/plugin-node-resolve",
|
||||||
"@npm//@rollup/plugin-replace",
|
"@npm//@rollup/plugin-replace",
|
||||||
"@npm//@rollup/plugin-terser",
|
"@npm//@rollup/plugin-terser",
|
||||||
|
"@npm//google-protobuf",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -179,7 +152,6 @@ pkg_npm(
|
||||||
deps = [
|
deps = [
|
||||||
"wasm/vision_wasm_internal.js",
|
"wasm/vision_wasm_internal.js",
|
||||||
"wasm/vision_wasm_internal.wasm",
|
"wasm/vision_wasm_internal.wasm",
|
||||||
":vision_cjs_bundle",
|
":vision_bundle",
|
||||||
":vision_iife_bundle",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -14,4 +14,10 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export * from '../../tasks/web/audio/index';
|
import {AudioClassifier as AudioClassifierImpl} from '../../tasks/web/audio/audio_classifier/audio_classifier';
|
||||||
|
|
||||||
|
// Declare the variables locally so that Rollup in OSS includes them explcilty
|
||||||
|
// as exports.
|
||||||
|
const AudioClassifier = AudioClassifierImpl;
|
||||||
|
|
||||||
|
export {AudioClassifier};
|
||||||
|
|
|
@ -1,13 +1 @@
|
||||||
# This contains the MediaPipe Audio Tasks.
|
# This contains the MediaPipe Audio Tasks.
|
||||||
|
|
||||||
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_library")
|
|
||||||
|
|
||||||
package(default_visibility = ["//mediapipe/tasks:internal"])
|
|
||||||
|
|
||||||
mediapipe_ts_library(
|
|
||||||
name = "audio_lib",
|
|
||||||
srcs = ["index.ts"],
|
|
||||||
deps = [
|
|
||||||
"//mediapipe/tasks/web/audio/audio_classifier",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,17 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export * from '../../../tasks/web/audio/audio_classifier/audio_classifier';
|
|
|
@ -2,20 +2,10 @@
|
||||||
"name": "@mediapipe/tasks-__NAME__",
|
"name": "@mediapipe/tasks-__NAME__",
|
||||||
"version": "__VERSION__",
|
"version": "__VERSION__",
|
||||||
"description": "__DESCRIPTION__",
|
"description": "__DESCRIPTION__",
|
||||||
"main": "__NAME___cjs_bundle.js",
|
"main": "__NAME___bundle.js",
|
||||||
"module": "__NAME___cjs_bundle.js",
|
|
||||||
"jsdeliver": "__NAME___iife_bundle.js",
|
|
||||||
"exports": {
|
|
||||||
".": "./__NAME___cjs_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",
|
||||||
"types": "__TYPES__",
|
"types": "__TYPES__",
|
||||||
"dependencies": {
|
|
||||||
"google-protobuf": "^3.21.2"
|
|
||||||
},
|
|
||||||
"homepage": "http://mediapipe.dev",
|
"homepage": "http://mediapipe.dev",
|
||||||
"keywords": [ "AR", "ML", "Augmented", "MediaPipe", "MediaPipe Tasks" ]
|
"keywords": [ "AR", "ML", "Augmented", "MediaPipe", "MediaPipe Tasks" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
import resolve from '@rollup/plugin-node-resolve';
|
|
||||||
import commonjs from '@rollup/plugin-commonjs';
|
|
||||||
import terser from '@rollup/plugin-terser';
|
|
||||||
import replace from '@rollup/plugin-replace';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
output: {
|
|
||||||
name: 'bundle',
|
|
||||||
sourcemap: false
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
// Workaround for https://github.com/protocolbuffers/protobuf-javascript/issues/151
|
|
||||||
replace({
|
|
||||||
'var calculator_options_pb = {};': 'var calculator_options_pb = {}; var mediapipe_framework_calculator_options_pb = calculator_options_pb;',
|
|
||||||
delimiters: ['', '']
|
|
||||||
}),
|
|
||||||
resolve({browser: true}),
|
|
||||||
commonjs(),
|
|
||||||
terser()
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,6 +1,7 @@
|
||||||
import resolve from '@rollup/plugin-node-resolve';
|
import resolve from '@rollup/plugin-node-resolve';
|
||||||
import commonjs from '@rollup/plugin-commonjs';
|
import commonjs from '@rollup/plugin-commonjs';
|
||||||
import replace from '@rollup/plugin-replace';
|
import replace from '@rollup/plugin-replace';
|
||||||
|
import terser from '@rollup/plugin-terser';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
plugins: [
|
plugins: [
|
||||||
|
@ -10,6 +11,7 @@ export default {
|
||||||
delimiters: ['', '']
|
delimiters: ['', '']
|
||||||
}),
|
}),
|
||||||
resolve(),
|
resolve(),
|
||||||
commonjs()
|
commonjs(),
|
||||||
|
terser()
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -14,4 +14,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export * from '../../tasks/web/text/index';
|
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 TextClassifier = TextClassifierImpl;
|
||||||
|
const TextEmbedder = TextEmbedderImpl;
|
||||||
|
|
||||||
|
export {TextClassifier, TextEmbedder};
|
||||||
|
|
|
@ -1,14 +1 @@
|
||||||
# This contains the MediaPipe Text Tasks.
|
# This contains the MediaPipe Text Tasks.
|
||||||
|
|
||||||
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_library")
|
|
||||||
|
|
||||||
package(default_visibility = ["//mediapipe/tasks:internal"])
|
|
||||||
|
|
||||||
mediapipe_ts_library(
|
|
||||||
name = "text_lib",
|
|
||||||
srcs = ["index.ts"],
|
|
||||||
deps = [
|
|
||||||
"//mediapipe/tasks/web/text/text_classifier",
|
|
||||||
"//mediapipe/tasks/web/text/text_embedder",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,18 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export * from '../../../tasks/web/text/text_classifier/text_classifier';
|
|
||||||
export * from '../../../tasks/web/text/text_embedder/text_embedder';
|
|
|
@ -14,4 +14,24 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export * from '../../tasks/web/vision/index';
|
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 GestureRecognizer = GestureRecognizerImpl;
|
||||||
|
const HandLandmarker = HandLandmarkerImpl;
|
||||||
|
const ImageClassifier = ImageClassifierImpl;
|
||||||
|
const ImageEmbedder = ImageEmbedderImpl;
|
||||||
|
const ObjectDetector = ObjectDetectorImpl;
|
||||||
|
|
||||||
|
export {
|
||||||
|
GestureRecognizer,
|
||||||
|
HandLandmarker,
|
||||||
|
ImageClassifier,
|
||||||
|
ImageEmbedder,
|
||||||
|
ObjectDetector
|
||||||
|
};
|
||||||
|
|
|
@ -1,17 +1 @@
|
||||||
# This contains the MediaPipe Vision Tasks.
|
# This contains the MediaPipe Vision Tasks.
|
||||||
|
|
||||||
load("//mediapipe/framework/port:build_config.bzl", "mediapipe_ts_library")
|
|
||||||
|
|
||||||
package(default_visibility = ["//mediapipe/tasks:internal"])
|
|
||||||
|
|
||||||
mediapipe_ts_library(
|
|
||||||
name = "vision_lib",
|
|
||||||
srcs = ["index.ts"],
|
|
||||||
deps = [
|
|
||||||
"//mediapipe/tasks/web/vision/gesture_recognizer",
|
|
||||||
"//mediapipe/tasks/web/vision/hand_landmarker",
|
|
||||||
"//mediapipe/tasks/web/vision/image_classifier",
|
|
||||||
"//mediapipe/tasks/web/vision/image_embedder",
|
|
||||||
"//mediapipe/tasks/web/vision/object_detector",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,21 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
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';
|
|
Loading…
Reference in New Issue
Block a user