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(
|
||||
name = "audio_lib",
|
||||
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 = [
|
||||
":audio_lib",
|
||||
"@npm//@rollup/plugin-commonjs",
|
||||
"@npm//@rollup/plugin-node-resolve",
|
||||
"@npm//@rollup/plugin-replace",
|
||||
"//mediapipe/tasks/web/audio/audio_classifier",
|
||||
],
|
||||
)
|
||||
|
||||
rollup_bundle(
|
||||
name = "audio_iife_bundle",
|
||||
config_file = "rollup.config.iife.mjs",
|
||||
name = "audio_bundle",
|
||||
config_file = "rollup.config.mjs",
|
||||
entry_point = "audio.ts",
|
||||
format = "iife",
|
||||
format = "esm",
|
||||
output_dir = False,
|
||||
sourcemap = "false",
|
||||
deps = [
|
||||
":audio_lib",
|
||||
"@npm//@rollup/plugin-commonjs",
|
||||
"@npm//@rollup/plugin-node-resolve",
|
||||
"@npm//@rollup/plugin-replace",
|
||||
"@npm//@rollup/plugin-terser",
|
||||
"@npm//google-protobuf",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -69,8 +59,7 @@ pkg_npm(
|
|||
deps = [
|
||||
"wasm/audio_wasm_internal.js",
|
||||
"wasm/audio_wasm_internal.wasm",
|
||||
":audio_cjs_bundle",
|
||||
":audio_iife_bundle",
|
||||
":audio_bundle",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -79,35 +68,26 @@ pkg_npm(
|
|||
mediapipe_ts_library(
|
||||
name = "text_lib",
|
||||
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 = [
|
||||
":text_lib",
|
||||
"@npm//@rollup/plugin-commonjs",
|
||||
"@npm//@rollup/plugin-node-resolve",
|
||||
"@npm//@rollup/plugin-replace",
|
||||
"//mediapipe/tasks/web/text/text_classifier",
|
||||
"//mediapipe/tasks/web/text/text_embedder",
|
||||
],
|
||||
)
|
||||
|
||||
rollup_bundle(
|
||||
name = "text_iife_bundle",
|
||||
config_file = "rollup.config.iife.mjs",
|
||||
name = "text_bundle",
|
||||
config_file = "rollup.config.mjs",
|
||||
entry_point = "text.ts",
|
||||
format = "iife",
|
||||
format = "esm",
|
||||
output_dir = False,
|
||||
sourcemap = "false",
|
||||
deps = [
|
||||
":text_lib",
|
||||
"@npm//@rollup/plugin-commonjs",
|
||||
"@npm//@rollup/plugin-node-resolve",
|
||||
"@npm//@rollup/plugin-replace",
|
||||
"@npm//@rollup/plugin-terser",
|
||||
"@npm//google-protobuf",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -124,8 +104,7 @@ pkg_npm(
|
|||
deps = [
|
||||
"wasm/text_wasm_internal.js",
|
||||
"wasm/text_wasm_internal.wasm",
|
||||
":text_cjs_bundle",
|
||||
":text_iife_bundle",
|
||||
":text_bundle",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -134,35 +113,29 @@ pkg_npm(
|
|||
mediapipe_ts_library(
|
||||
name = "vision_lib",
|
||||
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 = [
|
||||
":vision_lib",
|
||||
"@npm//@rollup/plugin-commonjs",
|
||||
"@npm//@rollup/plugin-node-resolve",
|
||||
"@npm//@rollup/plugin-replace",
|
||||
"//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",
|
||||
],
|
||||
)
|
||||
|
||||
rollup_bundle(
|
||||
name = "vision_iife_bundle",
|
||||
config_file = "rollup.config.iife.mjs",
|
||||
name = "vision_bundle",
|
||||
config_file = "rollup.config.mjs",
|
||||
entry_point = "vision.ts",
|
||||
format = "iife",
|
||||
format = "esm",
|
||||
output_dir = False,
|
||||
sourcemap = "false",
|
||||
deps = [
|
||||
":vision_lib",
|
||||
"@npm//@rollup/plugin-commonjs",
|
||||
"@npm//@rollup/plugin-node-resolve",
|
||||
"@npm//@rollup/plugin-replace",
|
||||
"@npm//@rollup/plugin-terser",
|
||||
"@npm//google-protobuf",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -179,7 +152,6 @@ pkg_npm(
|
|||
deps = [
|
||||
"wasm/vision_wasm_internal.js",
|
||||
"wasm/vision_wasm_internal.wasm",
|
||||
":vision_cjs_bundle",
|
||||
":vision_iife_bundle",
|
||||
":vision_bundle",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -14,4 +14,10 @@
|
|||
* 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.
|
||||
|
||||
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__",
|
||||
"version": "__VERSION__",
|
||||
"description": "__DESCRIPTION__",
|
||||
"main": "__NAME___cjs_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"
|
||||
},
|
||||
"main": "__NAME___bundle.js",
|
||||
"author": "mediapipe@google.com",
|
||||
"license": "Apache-2.0",
|
||||
"types": "__TYPES__",
|
||||
"dependencies": {
|
||||
"google-protobuf": "^3.21.2"
|
||||
},
|
||||
"homepage": "http://mediapipe.dev",
|
||||
"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 commonjs from '@rollup/plugin-commonjs';
|
||||
import replace from '@rollup/plugin-replace';
|
||||
import terser from '@rollup/plugin-terser';
|
||||
|
||||
export default {
|
||||
plugins: [
|
||||
|
@ -10,6 +11,7 @@ export default {
|
|||
delimiters: ['', '']
|
||||
}),
|
||||
resolve(),
|
||||
commonjs()
|
||||
commonjs(),
|
||||
terser()
|
||||
]
|
||||
}
|
|
@ -14,4 +14,12 @@
|
|||
* 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.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
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.
|
||||
|
||||
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