Skip to content

Commit 3665e10

Browse files
Export version in public API (#53)
1 parent 5ccdf44 commit 3665e10

14 files changed

+93
-18
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
> - 🏠 Internal
1111
> - 💅 Polish
1212
13+
## Unreleased
14+
15+
- 💅 Export `version` in public API. ([#53](https://github.com/THEOplayer/web-ui/pull/53))
16+
- 💅 Allow importing `@theoplayer/web-ui/package.json`. ([#53](https://github.com/THEOplayer/web-ui/pull/53))
17+
1318
## v1.7.0 (2024-02-15)
1419

1520
- 🚀 Added support for loading in Node for static site generation (SSG) or server-side rendering (SSR). ([#50](https://github.com/THEOplayer/web-ui/pull/50))

package-lock.json

+53-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"import": "./dist/THEOplayerUI.es5.mjs",
1919
"default": "./dist/THEOplayerUI.es5.js"
2020
},
21-
"./dist/*": "./dist/*"
21+
"./dist/*": "./dist/*",
22+
"./package": "./package.json",
23+
"./package.json": "./package.json"
2224
},
2325
"files": [
2426
"dist/",
@@ -61,6 +63,7 @@
6163
},
6264
"devDependencies": {
6365
"@rollup/plugin-inject": "^5.0.5",
66+
"@rollup/plugin-json": "^6.1.0",
6467
"@rollup/plugin-node-resolve": "^15.2.1",
6568
"@rollup/plugin-virtual": "^3.0.2",
6669
"@rollup/pluginutils": "^5.0.4",

react/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
## Unreleased
1414

1515
- 🐛 Fix "Warning: useLayoutEffect does nothing on the server" when using `@theoplayer/react-ui` in Node. ([#52](https://github.com/THEOplayer/web-ui/pull/52))
16+
- 💅 Export `version` in public API. ([#53](https://github.com/THEOplayer/web-ui/pull/53))
17+
- 💅 Allow importing `@theoplayer/react-ui/package.json`. ([#53](https://github.com/THEOplayer/web-ui/pull/53))
1618

1719
## v1.7.0 (2024-02-15)
1820

react/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
"import": "./dist/THEOplayerReactUI.es5.mjs",
1717
"default": "./dist/THEOplayerReactUI.es5.js"
1818
},
19-
"./dist/*": "./dist/*"
19+
"./dist/*": "./dist/*",
20+
"./package": "./package.json",
21+
"./package.json": "./package.json"
2022
},
2123
"files": [
2224
"dist/",
@@ -58,6 +60,7 @@
5860
"theoplayer": "^6"
5961
},
6062
"devDependencies": {
63+
"@rollup/plugin-json": "^6.1.0",
6164
"@rollup/plugin-node-resolve": "^15.2.1",
6265
"@rollup/plugin-replace": "^5.0.5",
6366
"@swc/cli": "^0.1.62",

react/rollup.config.mjs

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineConfig } from 'rollup';
22
import nodeResolve from '@rollup/plugin-node-resolve';
33
import replace from '@rollup/plugin-replace';
4+
import json from '@rollup/plugin-json';
45
import { minify, swc } from 'rollup-plugin-swc3';
56
import * as path from 'node:path';
67
import { readFile } from 'node:fs/promises';
@@ -106,6 +107,7 @@ function jsPlugins({ es5 = false, module = false, production = false, sourcemap
106107
}
107108
}),
108109
nodeResolve(),
110+
json(),
109111
// Transpile TypeScript.
110112
swc({
111113
include: './src/**',

react/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './UIContainer';
33
export * from './DefaultUI';
44
export * from './components/index';
55
export * from './hooks/index';
6+
export * from './version';

react/src/version.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { version as packageVersion } from '../package.json';
2+
3+
/**
4+
* The version of Open Video UI for React.
5+
*/
6+
export const version: string = packageVersion;

rollup.config.mjs

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { string } from 'rollup-plugin-string';
1111
import dts from 'rollup-plugin-dts';
1212
import inject from '@rollup/plugin-inject';
1313
import virtual from '@rollup/plugin-virtual';
14+
import json from '@rollup/plugin-json';
1415

1516
const fileName = 'THEOplayerUI';
1617
const umdName = 'THEOplayerUI';
@@ -117,6 +118,7 @@ function jsPlugins({ es5 = false, node = false, module = false, production = fal
117118
// Remove createTemplate() helper.
118119
['./src/util/TemplateUtils']: `export function createTemplate() { return () => undefined; }`
119120
}),
121+
json(),
120122
// Run PostCSS on .css files.
121123
postcss({
122124
include: './src/**/*.css',

src/DefaultUI.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ const template = createTemplate('theoplayer-default-ui', `<style>${defaultUiCss}
2727
* ## Usage
2828
*
2929
* 1. Create a `<theoplayer-default-ui>` element.
30-
* 1. Set its `configuration` attribute or property to a valid player configuration.
31-
* 1. Set its `source` attribute or property to a valid stream source.
32-
* 1. Optionally, customize the player using CSS custom properties and/or extra controls.
30+
* 2. Set its `configuration` attribute or property to a valid player configuration.
31+
* 3. Set its `source` attribute or property to a valid stream source.
32+
* 4. Optionally, customize the player using CSS custom properties and/or extra controls.
3333
*
3434
* ## Customization
3535
*

src/UIContainer.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ const DEFAULT_DVR_THRESHOLD = 60;
5454
* ## Usage
5555
*
5656
* 1. Create a `<theoplayer-ui>` element.
57-
* 1. Place your UI elements as children of the `<theoplayer-ui>`.
57+
* 2. Place your UI elements as children of the `<theoplayer-ui>`.
5858
* Set their `slot` attribute to one of the defined slots (see below) to place them in the layout.
59-
* 1. Set its `configuration` attribute or property to a valid player configuration.
60-
* 1. Set its `source` attribute or property to a valid stream source.
59+
* 3. Set its `configuration` attribute or property to a valid player configuration.
60+
* 4. Set its `source` attribute or property to a valid stream source.
6161
*
6262
* ## Customization
6363
*

src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ export { type DeviceType } from './util/DeviceType';
77
export { type StreamType } from './util/StreamType';
88
export { type Constructor } from './util/CommonUtils';
99
export { ColorStops } from './util/ColorStops';
10+
export * from './version';

src/version.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { version as packageVersion } from '../package.json';
2+
3+
/**
4+
* The version of Open Video UI for Web.
5+
*/
6+
export const version: string = packageVersion;

tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"module": "es2015",
55
"moduleResolution": "bundler",
66
"esModuleInterop": true,
7+
"resolveJsonModule": true,
78
"forceConsistentCasingInFileNames": true,
89
"strict": true,
910
"skipDefaultLibCheck": true,

0 commit comments

Comments
 (0)