diff --git a/MODULE.bazel b/MODULE.bazel index 0dcb37d45..0d9820544 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,7 +4,7 @@ bazel_dep(name = "rules_player") git_override( remote = "https://github.com/player-ui/rules_player.git", - commit = "10d56d526846171b2e05dce00c03b8a4f7310cf0", + commit = "d9c8d7c1802916dc6e4619b5da2ac0cab590944a", module_name = "rules_player", ) # local_path_override(module_name = "rules_player", path = "../rules_player") diff --git a/core/make-flow/BUILD b/core/make-flow/BUILD index 0c3c46840..a97e629eb 100644 --- a/core/make-flow/BUILD +++ b/core/make-flow/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/make-flow", + native_bundle = "MakeFlow", build_deps = [ "//:tsup_config", "//:typings", diff --git a/core/make-flow/package.json b/core/make-flow/package.json index 47cb70cee..c9ed5950c 100644 --- a/core/make-flow/package.json +++ b/core/make-flow/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/make-flow", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/MakeFlow.native.js", "dependencies": { "@player-ui/types": "workspace:*" } diff --git a/core/partial-match-registry/BUILD b/core/partial-match-registry/BUILD index b475e0899..011a79eb5 100644 --- a/core/partial-match-registry/BUILD +++ b/core/partial-match-registry/BUILD @@ -6,6 +6,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/partial-match-registry", + native_bundle = "Registry", deps = [ "//:node_modules/@types/dlv", "//:node_modules/dlv", diff --git a/core/partial-match-registry/package.json b/core/partial-match-registry/package.json index 7d37bc2bb..b20e49d92 100644 --- a/core/partial-match-registry/package.json +++ b/core/partial-match-registry/package.json @@ -1,6 +1,5 @@ { "name": "@player-ui/partial-match-registry", "version": "0.0.0-PLACEHOLDER", - "main": "src/index.ts", - "bundle": "dist/Registry.native.js" + "main": "src/index.ts" } diff --git a/core/player/BUILD b/core/player/BUILD index 4e2241ae1..5f60553af 100644 --- a/core/player/BUILD +++ b/core/player/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/player", + native_bundle = "Player", test_deps = [ ":node_modules/@player-ui/make-flow", "//:vitest_config", diff --git a/core/player/package.json b/core/player/package.json index 15d194440..b90e026e7 100644 --- a/core/player/package.json +++ b/core/player/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/player", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/Player.native.js", "dependencies": { "@player-ui/partial-match-registry": "workspace:*", "@player-ui/make-flow": "workspace:*", diff --git a/plugins/beacon/core/BUILD b/plugins/beacon/core/BUILD index 110183fda..bae5ea559 100644 --- a/plugins/beacon/core/BUILD +++ b/plugins/beacon/core/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/beacon-plugin", + native_bundle = "BeaconPlugin", peer_deps = [ ":node_modules/@player-ui/player", ], diff --git a/plugins/beacon/core/package.json b/plugins/beacon/core/package.json index ed20a19ba..e2c4a4dbc 100644 --- a/plugins/beacon/core/package.json +++ b/plugins/beacon/core/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/beacon-plugin", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/BeaconPlugin.native.js", "peerDependencies": { "@player-ui/player": "workspace:*", "@player-ui/types": "workspace:*" diff --git a/plugins/check-path/core/BUILD b/plugins/check-path/core/BUILD index 3b761bfad..922f02b47 100644 --- a/plugins/check-path/core/BUILD +++ b/plugins/check-path/core/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/check-path-plugin", + native_bundle = "PubSubPlugin", peer_deps = [ ":node_modules/@player-ui/player", ], diff --git a/plugins/check-path/core/package.json b/plugins/check-path/core/package.json index 6b07d4560..1bc404ef9 100644 --- a/plugins/check-path/core/package.json +++ b/plugins/check-path/core/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/check-path-plugin", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/PubSubPlugin.native.js", "peerDependencies": { "@player-ui/player": "workspace:*" }, diff --git a/plugins/common-expressions/core/BUILD b/plugins/common-expressions/core/BUILD index acc298474..281325c10 100644 --- a/plugins/common-expressions/core/BUILD +++ b/plugins/common-expressions/core/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/common-expressions-plugin", + native_bundle = "CommonExpressionsPlugin", peer_deps = [ ":node_modules/@player-ui/player", ], diff --git a/plugins/common-expressions/core/package.json b/plugins/common-expressions/core/package.json index 8c7ac64ad..cb56bfd86 100644 --- a/plugins/common-expressions/core/package.json +++ b/plugins/common-expressions/core/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/common-expressions-plugin", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/CommonExpressionsPlugin.native.js", "peerDependencies": { "@player-ui/player": "workspace:*" }, diff --git a/plugins/common-types/core/BUILD b/plugins/common-types/core/BUILD index 4be059bd0..588444c10 100644 --- a/plugins/common-types/core/BUILD +++ b/plugins/common-types/core/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/common-types-plugin", + native_bundle = "CommonTypesPlugin", peer_deps = [ ":node_modules/@player-ui/player", ], diff --git a/plugins/common-types/core/package.json b/plugins/common-types/core/package.json index 842280412..13b5afac0 100644 --- a/plugins/common-types/core/package.json +++ b/plugins/common-types/core/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/common-types-plugin", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/CommonTypesPlugin.native.js", "dependencies": { "@player-ui/types-provider-plugin": "workspace:*" }, diff --git a/plugins/computed-properties/core/BUILD b/plugins/computed-properties/core/BUILD index e996486b2..148de2b8f 100644 --- a/plugins/computed-properties/core/BUILD +++ b/plugins/computed-properties/core/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/computed-properties-plugin", + native_bundle = "ComputedPropertiesPlugin", peer_deps = [ ":node_modules/@player-ui/player", ], diff --git a/plugins/computed-properties/core/package.json b/plugins/computed-properties/core/package.json index 5dca7d424..00b0c6877 100644 --- a/plugins/computed-properties/core/package.json +++ b/plugins/computed-properties/core/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/computed-properties-plugin", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/ComputedPropertiesPlugin.native.js", "peerDependencies": { "@player-ui/player": "workspace:*" }, diff --git a/plugins/expression/core/BUILD b/plugins/expression/core/BUILD index 49644d281..be14b2b51 100644 --- a/plugins/expression/core/BUILD +++ b/plugins/expression/core/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/expression-plugin", + native_bundle = "ExpressionPlugin", peer_deps = [ ":node_modules/@player-ui/player", ], diff --git a/plugins/expression/core/package.json b/plugins/expression/core/package.json index bc300cc41..9194379b1 100644 --- a/plugins/expression/core/package.json +++ b/plugins/expression/core/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/expression-plugin", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/ExpressionPlugin.native.js", "peerDependencies": { "@player-ui/player": "workspace:*" } diff --git a/plugins/external-action/core/BUILD b/plugins/external-action/core/BUILD index fa2b9e301..538c65bb5 100644 --- a/plugins/external-action/core/BUILD +++ b/plugins/external-action/core/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/external-action-plugin", + native_bundle = "ExternalActionPlugin", peer_deps = [ ":node_modules/@player-ui/player", ], diff --git a/plugins/external-action/core/package.json b/plugins/external-action/core/package.json index 72337af48..03e3f0442 100644 --- a/plugins/external-action/core/package.json +++ b/plugins/external-action/core/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/external-action-plugin", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/ExternalActionPlugin.native.js", "peerDependencies": { "@player-ui/player": "workspace:*" } diff --git a/plugins/markdown/core/BUILD b/plugins/markdown/core/BUILD index f597de84b..816a11c94 100644 --- a/plugins/markdown/core/BUILD +++ b/plugins/markdown/core/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/markdown-plugin", + native_bundle = "MarkdownPlugin", peer_deps = [ ":node_modules/@player-ui/player", ":node_modules/@player-ui/types", diff --git a/plugins/markdown/core/package.json b/plugins/markdown/core/package.json index 97bd159e8..88ce05ddf 100644 --- a/plugins/markdown/core/package.json +++ b/plugins/markdown/core/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/markdown-plugin", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/MarkdownPlugin.native.js", "peerDependencies": { "@player-ui/player": "workspace:*", "@player-ui/types": "workspace:*" diff --git a/plugins/metrics/core/BUILD b/plugins/metrics/core/BUILD index 069e9fd54..bd54a11ac 100644 --- a/plugins/metrics/core/BUILD +++ b/plugins/metrics/core/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/metrics-plugin", + native_bundle = "MetricsPlugin", peer_deps = [ ":node_modules/@player-ui/player", ], diff --git a/plugins/metrics/core/package.json b/plugins/metrics/core/package.json index 878b3f81e..da4ea6320 100644 --- a/plugins/metrics/core/package.json +++ b/plugins/metrics/core/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/metrics-plugin", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/MetricsPlugin.native.js", "dependencies": { "@player-ui/beacon-plugin": "workspace:*" }, diff --git a/plugins/partial-match-fingerprint/core/BUILD b/plugins/partial-match-fingerprint/core/BUILD index 692ca4175..46898fe2a 100644 --- a/plugins/partial-match-fingerprint/core/BUILD +++ b/plugins/partial-match-fingerprint/core/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/partial-match-fingerprint-plugin", + native_bundle = "PartialMatchFingerprintPlugin", peer_deps = [ ":node_modules/@player-ui/player", ], diff --git a/plugins/partial-match-fingerprint/core/package.json b/plugins/partial-match-fingerprint/core/package.json index 6b73730e6..cf5989737 100644 --- a/plugins/partial-match-fingerprint/core/package.json +++ b/plugins/partial-match-fingerprint/core/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/partial-match-fingerprint-plugin", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/PartialMatchFingerprintPlugin.native.js", "dependencies": { "@player-ui/partial-match-registry": "workspace:*" }, diff --git a/plugins/pubsub/core/BUILD b/plugins/pubsub/core/BUILD index 865992a8f..cafa34ccf 100644 --- a/plugins/pubsub/core/BUILD +++ b/plugins/pubsub/core/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/pubsub-plugin", + native_bundle = "PubSubPlugin", peer_deps = [ ":node_modules/@player-ui/player", ], diff --git a/plugins/pubsub/core/package.json b/plugins/pubsub/core/package.json index bb013fba6..e331871f2 100644 --- a/plugins/pubsub/core/package.json +++ b/plugins/pubsub/core/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/pubsub", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/PubSubPlugin.native.js", "peerDependencies": { "@player-ui/player": "workspace:*" } diff --git a/plugins/reference-assets/core/BUILD b/plugins/reference-assets/core/BUILD index 898806b70..bbca2a8d8 100644 --- a/plugins/reference-assets/core/BUILD +++ b/plugins/reference-assets/core/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/reference-assets-plugin", + native_bundle = "ReferenceAssetsPlugin", peer_deps = [ ":node_modules/@player-ui/player", ], diff --git a/plugins/reference-assets/core/package.json b/plugins/reference-assets/core/package.json index 0d418fb19..6f6506a45 100644 --- a/plugins/reference-assets/core/package.json +++ b/plugins/reference-assets/core/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/reference-assets-plugin", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/ReferenceAssetsPlugin.native.js", "dependencies": { "@player-ui/asset-transform-plugin": "workspace:*", "@player-ui/beacon-plugin": "workspace:*" diff --git a/plugins/stage-revert-data/core/BUILD b/plugins/stage-revert-data/core/BUILD index ce45c48d4..3115cdaa6 100644 --- a/plugins/stage-revert-data/core/BUILD +++ b/plugins/stage-revert-data/core/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/stage-revert-data-plugin", + native_bundle = "StageRevertDataPlugin", peer_deps = [ ":node_modules/@player-ui/player", ], diff --git a/plugins/stage-revert-data/core/package.json b/plugins/stage-revert-data/core/package.json index 0cedc10ec..51db2f7cf 100644 --- a/plugins/stage-revert-data/core/package.json +++ b/plugins/stage-revert-data/core/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/stage-revert-data-plugin", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/StageRevertDataPlugin.native.js", "devDependencies": { "@player-ui/make-flow": "workspace:*", "@player-ui/types": "workspace:*" diff --git a/plugins/types-provider/core/BUILD b/plugins/types-provider/core/BUILD index 3f1048d53..45376b855 100644 --- a/plugins/types-provider/core/BUILD +++ b/plugins/types-provider/core/BUILD @@ -10,6 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/types-provider-plugin", + native_bundle = "TypesProviderPlugin", peer_deps = [ ":node_modules/@player-ui/player", ], diff --git a/plugins/types-provider/core/package.json b/plugins/types-provider/core/package.json index 4a9ce1c9a..a80dfd18b 100644 --- a/plugins/types-provider/core/package.json +++ b/plugins/types-provider/core/package.json @@ -2,7 +2,6 @@ "name": "@player-ui/types-provider-plugin", "version": "0.0.0-PLACEHOLDER", "main": "src/index.ts", - "bundle": "dist/TypesProviderPlugin.native.js", "peerDependencies": { "@player-ui/player": "workspace:*" }, diff --git a/tsup.config.ts b/tsup.config.ts index 8189a845a..4d53679ad 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -16,27 +16,33 @@ export function createConfig() { ...options, }; - const bundleConfig: Options[] = []; + if (process.env.PLAYER_NATIVE_BUNDLE) { + const bundleEntryName = process.env.PLAYER_NATIVE_BUNDLE; + const bundleFileTarget = path.join( + "dist", + bundleEntryName + ".native.js", + ); + return [ + { + ...defaultOptions, + globalName: bundleEntryName, + external: [], + format: ["iife"], + async onSuccess() { + await fs.promises.copyFile( + "dist/index.global.js", + bundleFileTarget, + ); + await fs.promises.copyFile( + "dist/index.global.js.map", + bundleFileTarget + ".map", + ); - if (pkgJson.bundle) { - const bundleFileTarget = pkgJson.bundle; - const bundleEntryName = path.basename(bundleFileTarget, ".native.js"); - - bundleConfig.push({ - ...defaultOptions, - globalName: bundleEntryName, - format: ["iife"], - async onSuccess() { - await fs.promises.copyFile("dist/index.global.js", bundleFileTarget); - await fs.promises.copyFile( - "dist/index.global.js.map", - bundleFileTarget + ".map", - ); - - await fs.promises.rm("dist/index.global.js"); - await fs.promises.rm("dist/index.global.js.map"); + await fs.promises.rm("dist/index.global.js"); + await fs.promises.rm("dist/index.global.js.map"); + }, }, - }); + ]; } return [ @@ -58,7 +64,6 @@ export function createConfig() { }, format: ["esm"], outExtension: () => ({ js: ".mjs" }), - minify: true, }, { ...defaultOptions, @@ -66,7 +71,6 @@ export function createConfig() { outDir: "./dist/cjs/", outExtension: () => ({ js: ".cjs" }), }, - ...bundleConfig, ]; }); }