strapi-plugin-oembed
Version:
Embed content from third-party sites in Strapi
189 lines (188 loc) • 4.91 kB
JavaScript
import { useRef, useEffect } from "react";
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
const v = glob[path];
if (v) {
return typeof v === "function" ? v() : Promise.resolve(v);
}
return new Promise((_, reject) => {
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
reject.bind(
null,
new Error(
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
)
)
);
});
};
const name = "strapi-plugin-oembed";
const version = "2.0.2";
const description = "Embed content from third-party sites in Strapi";
const keywords = [
"strapi",
"plugin",
"oembed",
"embed",
"media",
"youtube",
"vimeo",
"tiktok",
"soundcloud",
"spotify",
"codepen",
"twitter"
];
const homepage = "https://github.com/nicolashmln/strapi-plugin-oembed";
const repository = {
type: "git",
url: "https://github.com/nicolashmln/strapi-plugin-oembed"
};
const license = "MIT";
const type = "commonjs";
const exports = {
"./package.json": "./package.json",
"./strapi-admin": {
types: "./dist/admin/src/index.d.ts",
source: "./admin/src/index.ts",
"import": "./dist/admin/index.mjs",
require: "./dist/admin/index.js",
"default": "./dist/admin/index.js"
},
"./strapi-server": {
types: "./dist/server/src/index.d.ts",
source: "./server/src/index.ts",
"import": "./dist/server/index.mjs",
require: "./dist/server/index.js",
"default": "./dist/server/index.js"
}
};
const files = [
"dist"
];
const scripts = {
build: "strapi-plugin build",
lint: "eslint .",
prepare: "husky",
"test:ts:back": "run -T tsc -p server/tsconfig.json",
"test:ts:front": "run -T tsc -p admin/tsconfig.json",
verify: "strapi-plugin verify",
watch: "strapi-plugin watch",
"watch:link": "strapi-plugin watch:link"
};
const dependencies = {
"@extractus/oembed-extractor": "^4.0.7",
"@strapi/design-system": "^2.0.0-rc.23",
"@strapi/icons": "^2.0.0-rc.23",
"react-intl": "^7.1.10"
};
const devDependencies = {
"@eslint/compat": "^1.2.8",
"@eslint/js": "^9.20.0",
"@strapi/sdk-plugin": "^5.3.2",
"@strapi/strapi": "^5.12.5",
"@strapi/typescript-utils": "^5.12.5",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
eslint: "^9.23.0",
"eslint-config-prettier": "^10.1.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.11.0",
"eslint-plugin-prettier": "^5.2.6",
"eslint-plugin-promise": "^7.2.1",
"eslint-plugin-react": "7.37.4",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sonarjs": "^3.0.2",
husky: "^9.1.7",
prettier: "3.5.3",
react: "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.30.0",
"sort-package-json": "^3.0.0",
"styled-components": "^6.1.17",
typescript: "^5.8.3",
"typescript-eslint": "^8.29.0"
};
const peerDependencies = {
"@strapi/sdk-plugin": "^5.3.2",
"@strapi/strapi": "^5.12.5",
react: "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.30.0",
"styled-components": "^6.1.17"
};
const strapi = {
kind: "plugin",
name: "oembed",
displayName: "oEmbed",
description: "Embed content from third-party sites in Strapi v5"
};
const pkgJson = {
name,
version,
description,
keywords,
homepage,
repository,
license,
type,
exports,
files,
scripts,
dependencies,
devDependencies,
peerDependencies,
strapi
};
const Initializer = ({ setPlugin }) => {
const ref = useRef(setPlugin);
useEffect(() => {
ref.current(pkgJson.strapi.name);
}, []);
return null;
};
const index = {
register(app) {
app.registerPlugin({
id: pkgJson.strapi.name,
initializer: Initializer,
isReady: true,
name: pkgJson.strapi.name
});
app.customFields.register({
pluginId: pkgJson.strapi.name,
name: "oembed",
type: "json",
components: {
Input: async () => import(
/* webpackChunkName: "oembed-input" */
"./index-D9WPMUl7.mjs"
)
},
intlLabel: {
id: "oembed.custom-field.label",
defaultMessage: "oEmbed"
},
intlDescription: {
id: "oembed.custom-field.description",
defaultMessage: "Embed content from external sources"
}
});
},
async registerTrads({ locales }) {
return Promise.all(
locales.map(async (locale) => {
try {
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-D7uI6Siv.mjs") }), `./translations/${locale}.json`, 3);
return { data, locale };
} catch {
return { data: {}, locale };
}
})
);
}
};
export {
index as i,
pkgJson as p
};