Skip to content

Commit

Permalink
Add ESM target
Browse files Browse the repository at this point in the history
olivier-lando committed Jun 19, 2024
1 parent bc2021a commit df3f9a6
Showing 7 changed files with 1,737 additions and 194 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@

All changes to this project will be documented in this file.

## [1.2.31] - 2024-06-19

- Add ESM target

## [1.2.30] - 2024-06-19

- Add hotkeys parameter
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -10,23 +10,24 @@
## Table of contents

- [Table of contents](#table-of-contents)
- [Project description](#project-description)
- [Getting started](#getting-started)
- [Installation](#installation)
- [Method #1: requirejs](#method-1-requirejs)
- [Method #2: typescript](#method-2-typescript)
- [Method #2: simple include in a javascript project](#method-2-simple-include-in-a-javascript-project)
- [Documentation](#documentation)
- [Instantiation](#instantiation)
- [Ads](#ads)
- [Methods](#methods)
- [Full example](#full-example)
- [Control an existing embedded player using the SDK](#control-an-existing-embedded-player-using-the-sdk)
- [Project description](#project-description)
- [Getting started](#getting-started)
- [Installation](#installation)
- [Method #1: requirejs](#method-1-requirejs)
- [Method #2: typescript](#method-2-typescript)
- [Method #2: simple include in a javascript project](#method-2-simple-include-in-a-javascript-project)
- [Documentation](#documentation)
- [Instantiation](#instantiation)
- [Ads](#ads)
- [Methods](#methods)
- [Full example](#full-example)
- [Control an existing embedded player using the SDK](#control-an-existing-embedded-player-using-the-sdk)

<!--</documentation_excluded>-->

## <!--<documentation_only>
<!--<documentation_only>
---
title: api.video Player SDK
meta:
description: The official api.video Player SDK for api.video. [api.video](https://api.video/) is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
1,801 changes: 1,659 additions & 142 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@api.video/player-sdk",
"version": "1.2.30",
"version": "1.2.31",
"description": "api.video player SDK",
"repository": {
"type": "git",
@@ -14,23 +14,27 @@
"apivideo"
],
"main": "dist/index.js",
"module": "dist/index.js",
"module": "dist/index.es.js",
"types": "dist/index.d.ts",
"scripts": {
"tslint": "tslint --project .",
"dev": "webpack-dev-server --host 0.0.0.0 --open --mode development",
"build": "npm run tslint && webpack --mode production",
"build": "npm run tslint && webpack --mode production && rollup -c",
"test": "npm run tslint && mocha -r ts-node/register -r jsdom-global/register 'test/**/*.ts'",
"prepublishOnly": "npm run build"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.2.14",
"@types/jsdom": "^16.2.6",
"@types/mocha": "^9.0.0",
"chai": "^4.2.0",
"jsdom": "^16.4.0",
"jsdom-global": "^3.0.2",
"mocha": "^9.1.3",
"rollup": "^4.18.0",
"rollup-plugin-typescript2": "^0.36.0",
"ts-loader": "^9.2.6",
"ts-node": "^9.1.1",
"tslint": "^6.1.3",
17 changes: 17 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import commonjs from "@rollup/plugin-commonjs";
import nodeResolve from "@rollup/plugin-node-resolve";
import typescript from "rollup-plugin-typescript2";
import packageJson from "./package.json" assert { type: "json" };

export default {
input: "index.ts",
output: [
{
file: packageJson.module,
format: "esm",
sourcemap: true,
},
],
plugins: [typescript(), commonjs(), nodeResolve()],
external: ["react", "@api.video/player-sdk"],
};
20 changes: 10 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"compilerOptions": {
"target": "ES3",
"lib": ["ES2015", "dom"],
"outDir": "./dist",
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"declaration": true
}
}
"compilerOptions": {
"target": "ES6",
"lib": ["ES2015", "dom"],
"outDir": "./dist",
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"declaration": true
}
}
52 changes: 26 additions & 26 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
const path = require('path');
const path = require("path");

module.exports = {
entry: {
sdk: ['core-js/stable/promise', 'url-polyfill', './index.ts']
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
output: {
libraryTarget: 'umd',
filename: 'index.js',
globalObject: 'this'
},
devServer: {
port: 8082,
static: {
directory: path.join(__dirname, 'samples'),
},
entry: {
sdk: ["core-js/stable/promise", "url-polyfill", "./index.ts"],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [".ts", ".js"],
},
output: {
libraryTarget: "umd",
filename: "index.js",
globalObject: "this",
},
devServer: {
port: 8082,
static: {
directory: path.join(__dirname, "samples"),
},
},
};

0 comments on commit df3f9a6

Please sign in to comment.