From 69acb3f34c86dd2185016fcd759072ec65f2e6b4 Mon Sep 17 00:00:00 2001 From: Andrew Gliga Date: Wed, 8 Jan 2025 15:47:52 -0800 Subject: [PATCH] fix(@internal): added commonjs support for older bundles (#2367) --- .changeset/green-geckos-study.md | 5 +++++ package-lock.json | 6 +++--- package.json | 3 +-- src/node_modules/@internal/highcharts/browser.json | 2 +- .../@internal/highcharts/dynamic-legacy-import.js | 12 ++++++++++++ src/node_modules/@internal/highcharts/package.json | 2 +- src/node_modules/@internal/model-viewer/browser.json | 2 +- .../@internal/model-viewer/dynamic-import.js | 8 +++----- .../@internal/model-viewer/dynamic-legacy-import.js | 5 +++++ src/node_modules/@internal/model-viewer/package.json | 2 +- src/node_modules/@internal/shaka-player/browser.json | 2 +- .../@internal/shaka-player/dynamic-legacy-import.js | 5 +++++ src/node_modules/@internal/shaka-player/package.json | 2 +- 13 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 .changeset/green-geckos-study.md create mode 100644 src/node_modules/@internal/highcharts/dynamic-legacy-import.js create mode 100644 src/node_modules/@internal/model-viewer/dynamic-legacy-import.js create mode 100644 src/node_modules/@internal/shaka-player/dynamic-legacy-import.js diff --git a/.changeset/green-geckos-study.md b/.changeset/green-geckos-study.md new file mode 100644 index 000000000..59cf4f805 --- /dev/null +++ b/.changeset/green-geckos-study.md @@ -0,0 +1,5 @@ +--- +"@ebay/ebayui-core": patch +--- + +fix(@internal): added commonjs support for older bundles diff --git a/package-lock.json b/package-lock.json index ed1cc975b..6479910c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,8 +23,7 @@ "makeup-roving-tabindex": "~0.7.3", "makeup-screenreader-trap": "~0.5.3", "makeup-typeahead": "^0.3.3", - "shaka-player": "4.12.5", - "three": "^0.163.0" + "shaka-player": "4.12.5" }, "devDependencies": { "@babel/cli": "^7.26.4", @@ -15491,7 +15490,8 @@ "version": "0.163.0", "resolved": "https://registry.npmjs.org/three/-/three-0.163.0.tgz", "integrity": "sha512-HlMgCb2TF/dTLRtknBnjUTsR8FsDqBY43itYop2+Zg822I+Kd0Ua2vs8CvfBVefXkBdNDrLMoRTGCIIpfCuDew==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/through": { "version": "2.3.8", diff --git a/package.json b/package.json index 5ac77dbb4..208df9647 100644 --- a/package.json +++ b/package.json @@ -83,8 +83,7 @@ "makeup-roving-tabindex": "~0.7.3", "makeup-screenreader-trap": "~0.5.3", "makeup-typeahead": "^0.3.3", - "shaka-player": "4.12.5", - "three": "^0.163.0" + "shaka-player": "4.12.5" }, "devDependencies": { "@babel/cli": "^7.26.4", diff --git a/src/node_modules/@internal/highcharts/browser.json b/src/node_modules/@internal/highcharts/browser.json index 2f8f661a4..4c8fdcd06 100644 --- a/src/node_modules/@internal/highcharts/browser.json +++ b/src/node_modules/@internal/highcharts/browser.json @@ -1,7 +1,7 @@ { "requireRemap": [ { - "from": "./dynamic-import.js", + "from": "./dynamic-legacy-import.js", "to": "./async-load-with-lasso.js" } ] diff --git a/src/node_modules/@internal/highcharts/dynamic-legacy-import.js b/src/node_modules/@internal/highcharts/dynamic-legacy-import.js new file mode 100644 index 000000000..fd20a69c9 --- /dev/null +++ b/src/node_modules/@internal/highcharts/dynamic-legacy-import.js @@ -0,0 +1,12 @@ +module.exports = { + load: function () { + const modleLoader = import("./module-loader"); + + return modleLoader.then((modules) => { + window.Highcharts = modules.highcharts; + modules.accessibility(window.Highcharts); + modules.patternFill(window.Highcharts); + return modules; + }); + }, +}; diff --git a/src/node_modules/@internal/highcharts/package.json b/src/node_modules/@internal/highcharts/package.json index 4b1f47baf..4638d8c73 100644 --- a/src/node_modules/@internal/highcharts/package.json +++ b/src/node_modules/@internal/highcharts/package.json @@ -6,6 +6,6 @@ } }, "main": "./noop-for-node.js", - "browser": "./dynamic-import.js", + "browser": "./dynamic-legacy-import.js", "types": "index.d.ts" } diff --git a/src/node_modules/@internal/model-viewer/browser.json b/src/node_modules/@internal/model-viewer/browser.json index 2f8f661a4..4c8fdcd06 100644 --- a/src/node_modules/@internal/model-viewer/browser.json +++ b/src/node_modules/@internal/model-viewer/browser.json @@ -1,7 +1,7 @@ { "requireRemap": [ { - "from": "./dynamic-import.js", + "from": "./dynamic-legacy-import.js", "to": "./async-load-with-lasso.js" } ] diff --git a/src/node_modules/@internal/model-viewer/dynamic-import.js b/src/node_modules/@internal/model-viewer/dynamic-import.js index 078712e91..6eff15aed 100644 --- a/src/node_modules/@internal/model-viewer/dynamic-import.js +++ b/src/node_modules/@internal/model-viewer/dynamic-import.js @@ -1,5 +1,3 @@ -module.exports = { - load() { - return import("@google/model-viewer"); - }, -}; +export function load() { + return import("@google/model-viewer/dist/model-viewer.min.js"); +} diff --git a/src/node_modules/@internal/model-viewer/dynamic-legacy-import.js b/src/node_modules/@internal/model-viewer/dynamic-legacy-import.js new file mode 100644 index 000000000..f77959f8a --- /dev/null +++ b/src/node_modules/@internal/model-viewer/dynamic-legacy-import.js @@ -0,0 +1,5 @@ +module.exports = { + load() { + return import("@google/model-viewer/dist/model-viewer.min.js"); + }, +}; diff --git a/src/node_modules/@internal/model-viewer/package.json b/src/node_modules/@internal/model-viewer/package.json index 4b1f47baf..4638d8c73 100644 --- a/src/node_modules/@internal/model-viewer/package.json +++ b/src/node_modules/@internal/model-viewer/package.json @@ -6,6 +6,6 @@ } }, "main": "./noop-for-node.js", - "browser": "./dynamic-import.js", + "browser": "./dynamic-legacy-import.js", "types": "index.d.ts" } diff --git a/src/node_modules/@internal/shaka-player/browser.json b/src/node_modules/@internal/shaka-player/browser.json index 2f8f661a4..4c8fdcd06 100644 --- a/src/node_modules/@internal/shaka-player/browser.json +++ b/src/node_modules/@internal/shaka-player/browser.json @@ -1,7 +1,7 @@ { "requireRemap": [ { - "from": "./dynamic-import.js", + "from": "./dynamic-legacy-import.js", "to": "./async-load-with-lasso.js" } ] diff --git a/src/node_modules/@internal/shaka-player/dynamic-legacy-import.js b/src/node_modules/@internal/shaka-player/dynamic-legacy-import.js new file mode 100644 index 000000000..78e40187b --- /dev/null +++ b/src/node_modules/@internal/shaka-player/dynamic-legacy-import.js @@ -0,0 +1,5 @@ +module.exports = { + load() { + return import("shaka-player/dist/shaka-player.ui.js"); + }, +}; diff --git a/src/node_modules/@internal/shaka-player/package.json b/src/node_modules/@internal/shaka-player/package.json index 4b1f47baf..4638d8c73 100644 --- a/src/node_modules/@internal/shaka-player/package.json +++ b/src/node_modules/@internal/shaka-player/package.json @@ -6,6 +6,6 @@ } }, "main": "./noop-for-node.js", - "browser": "./dynamic-import.js", + "browser": "./dynamic-legacy-import.js", "types": "index.d.ts" }