next-cloudinary 6.13.0 → 7.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CldImage-37af4d37.esm.js +138 -0
- package/dist/CldImage-6cc29250.cjs.js +146 -0
- package/dist/CldUploadButton-196b419b.esm.js +101 -0
- package/dist/CldUploadButton-db9b095b.cjs.js +109 -0
- package/dist/CldUploadWidget-496b6240.cjs.js +215 -0
- package/dist/CldUploadWidget-d1442bef.esm.js +207 -0
- package/dist/CldVideoPlayer-25af8fc2.cjs.js +149 -0
- package/dist/CldVideoPlayer-d3572d86.esm.js +140 -0
- package/dist/cloudinary-50fd58f7.esm.js +134 -0
- package/dist/cloudinary-c07e74d7.cjs.js +141 -0
- package/dist/cloudinary-loader-b7898036.cjs.js +62 -0
- package/dist/cloudinary-loader-d86c263a.esm.js +59 -0
- package/dist/declarations/src/components/CldImage/CldImage.d.ts +14 -0
- package/dist/declarations/src/components/CldImage/CldImage.d.ts.map +1 -0
- package/dist/declarations/src/components/CldImage/index.d.ts +3 -0
- package/dist/declarations/src/components/CldImage/index.d.ts.map +1 -0
- package/dist/declarations/src/components/CldOgImage/CldOgImage.d.ts +9 -0
- package/dist/declarations/src/components/CldOgImage/CldOgImage.d.ts.map +1 -0
- package/dist/declarations/src/components/CldOgImage/index.d.ts +3 -0
- package/dist/declarations/src/components/CldOgImage/index.d.ts.map +1 -0
- package/dist/declarations/src/components/CldUploadButton/CldUploadButton.d.ts +9 -0
- package/dist/declarations/src/components/CldUploadButton/CldUploadButton.d.ts.map +1 -0
- package/dist/declarations/src/components/CldUploadButton/index.d.ts +3 -0
- package/dist/declarations/src/components/CldUploadButton/index.d.ts.map +1 -0
- package/dist/declarations/src/components/CldUploadWidget/CldUploadWidget.d.ts +4 -0
- package/dist/declarations/src/components/CldUploadWidget/CldUploadWidget.d.ts.map +1 -0
- package/dist/declarations/src/components/CldUploadWidget/CldUploadWidget.types.d.ts +59 -0
- package/dist/declarations/src/components/CldUploadWidget/CldUploadWidget.types.d.ts.map +1 -0
- package/dist/declarations/src/components/CldUploadWidget/index.d.ts +3 -0
- package/dist/declarations/src/components/CldUploadWidget/index.d.ts.map +1 -0
- package/dist/declarations/src/components/CldVideoPlayer/CldVideoPlayer.d.ts +4 -0
- package/dist/declarations/src/components/CldVideoPlayer/CldVideoPlayer.d.ts.map +1 -0
- package/dist/declarations/src/components/CldVideoPlayer/CldVideoPlayer.types.d.ts +28 -0
- package/dist/declarations/src/components/CldVideoPlayer/CldVideoPlayer.types.d.ts.map +1 -0
- package/dist/declarations/src/components/CldVideoPlayer/index.d.ts +3 -0
- package/dist/declarations/src/components/CldVideoPlayer/index.d.ts.map +1 -0
- package/dist/declarations/src/helpers/getCldImageUrl.d.ts +9 -0
- package/dist/declarations/src/helpers/getCldImageUrl.d.ts.map +1 -0
- package/dist/declarations/src/helpers/getCldOgImageUrl.d.ts +7 -0
- package/dist/declarations/src/helpers/getCldOgImageUrl.d.ts.map +1 -0
- package/dist/declarations/src/helpers/getCldVideoUrl.d.ts +9 -0
- package/dist/declarations/src/helpers/getCldVideoUrl.d.ts.map +1 -0
- package/dist/declarations/src/index.d.ts +21 -0
- package/dist/declarations/src/index.d.ts.map +1 -0
- package/dist/declarations/src/loaders/cloudinary-loader.d.ts +15 -0
- package/dist/declarations/src/loaders/cloudinary-loader.d.ts.map +1 -0
- package/dist/next-cloudinary.cjs.d.mts +2 -0
- package/dist/next-cloudinary.cjs.d.ts +2 -0
- package/dist/next-cloudinary.cjs.js +165 -0
- package/dist/next-cloudinary.cjs.mjs +11 -0
- package/dist/next-cloudinary.esm.js +134 -0
- package/package.json +50 -12
- package/dist/index.d.mts +0 -152
- package/dist/index.d.ts +0 -152
- package/dist/index.js +0 -4
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -4
- package/dist/index.mjs.map +0 -1
- package/plugins/copy-assets.ts +0 -80
- package/tsconfig.json +0 -23
- package/tsup.config.ts +0 -18
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var CldImage = require('./CldImage-6cc29250.cjs.js');
|
|
6
|
+
var Head = require('next/head');
|
|
7
|
+
var cloudinaryLoader = require('./cloudinary-loader-b7898036.cjs.js');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
var CldUploadButton = require('./CldUploadButton-db9b095b.cjs.js');
|
|
10
|
+
var CldUploadWidget = require('./CldUploadWidget-496b6240.cjs.js');
|
|
11
|
+
var CldVideoPlayer = require('./CldVideoPlayer-25af8fc2.cjs.js');
|
|
12
|
+
var urlLoader = require('@cloudinary-util/url-loader');
|
|
13
|
+
var cloudinary = require('./cloudinary-c07e74d7.cjs.js');
|
|
14
|
+
require('next/package.json');
|
|
15
|
+
|
|
16
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
17
|
+
|
|
18
|
+
var CldImage__default = /*#__PURE__*/_interopDefault(CldImage);
|
|
19
|
+
var Head__default = /*#__PURE__*/_interopDefault(Head);
|
|
20
|
+
var CldUploadButton__default = /*#__PURE__*/_interopDefault(CldUploadButton);
|
|
21
|
+
var CldUploadWidget__default = /*#__PURE__*/_interopDefault(CldUploadWidget);
|
|
22
|
+
var CldVideoPlayer__default = /*#__PURE__*/_interopDefault(CldVideoPlayer);
|
|
23
|
+
|
|
24
|
+
const OG_IMAGE_WIDTH = 1200;
|
|
25
|
+
const OG_IMAGE_HEIGHT = 627;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* getCldImageUrl
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
function getCldOgImageUrl(options) {
|
|
32
|
+
return cloudinaryLoader.getCldImageUrl({
|
|
33
|
+
...options,
|
|
34
|
+
format: options.format || 'jpg',
|
|
35
|
+
width: options.width || OG_IMAGE_WIDTH,
|
|
36
|
+
height: options.height || OG_IMAGE_HEIGHT,
|
|
37
|
+
crop: options.crop || {
|
|
38
|
+
type: 'fill',
|
|
39
|
+
gravity: 'center',
|
|
40
|
+
source: true
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const TWITTER_CARD = 'summary_large_image';
|
|
46
|
+
const CldOgImage = ({
|
|
47
|
+
excludeTags = [],
|
|
48
|
+
twitterTitle,
|
|
49
|
+
keys = {},
|
|
50
|
+
...props
|
|
51
|
+
}) => {
|
|
52
|
+
const {
|
|
53
|
+
alt
|
|
54
|
+
} = props;
|
|
55
|
+
|
|
56
|
+
// We need to separately handle the width and the height to allow our user to pass in
|
|
57
|
+
// a custom value, but also we need to know this at the component level so that we can
|
|
58
|
+
// use it when rendering the meta tags
|
|
59
|
+
|
|
60
|
+
let {
|
|
61
|
+
width = OG_IMAGE_WIDTH,
|
|
62
|
+
height = OG_IMAGE_HEIGHT
|
|
63
|
+
} = props;
|
|
64
|
+
|
|
65
|
+
// Normalize the width and height
|
|
66
|
+
|
|
67
|
+
width = typeof width === 'string' ? parseInt(width) : width;
|
|
68
|
+
height = typeof height === 'string' ? parseInt(height) : height;
|
|
69
|
+
|
|
70
|
+
// Render the final URLs. We use two different format versions to deliver
|
|
71
|
+
// webp for Twitter as it supports it (and we can control with tags) where
|
|
72
|
+
// other platforms may not support webp, so we deliver jpg
|
|
73
|
+
|
|
74
|
+
const ogImageUrl = getCldOgImageUrl({
|
|
75
|
+
...props,
|
|
76
|
+
width,
|
|
77
|
+
height
|
|
78
|
+
});
|
|
79
|
+
const twitterImageUrl = getCldOgImageUrl({
|
|
80
|
+
...props,
|
|
81
|
+
width,
|
|
82
|
+
height,
|
|
83
|
+
format: props.format || 'webp'
|
|
84
|
+
});
|
|
85
|
+
const metaKeys = {
|
|
86
|
+
'og:image': 'og-image',
|
|
87
|
+
'og:image:secure_url': 'og-image-secureurl',
|
|
88
|
+
'og:image:width': 'og-image-width',
|
|
89
|
+
'og:image:height': 'og-image-height',
|
|
90
|
+
'og:image:alt': 'og-image-alt',
|
|
91
|
+
'twitter:title': 'twitter-title',
|
|
92
|
+
'twitter:card': 'twitter-card',
|
|
93
|
+
'twitter:image': 'twitter-image',
|
|
94
|
+
...keys
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// We need to include the tags within the Next.js Head component rather than
|
|
98
|
+
// direcly adding them inside of the Head otherwise we get unexpected results
|
|
99
|
+
|
|
100
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Head__default["default"], {
|
|
101
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("meta", {
|
|
102
|
+
property: "og:image",
|
|
103
|
+
content: ogImageUrl
|
|
104
|
+
}, metaKeys['og:image']), /*#__PURE__*/jsxRuntime.jsx("meta", {
|
|
105
|
+
property: "og:image:secure_url",
|
|
106
|
+
content: ogImageUrl
|
|
107
|
+
}, metaKeys['og:image:secure_url']), /*#__PURE__*/jsxRuntime.jsx("meta", {
|
|
108
|
+
property: "og:image:width",
|
|
109
|
+
content: `${width}`
|
|
110
|
+
}, metaKeys['og:image:width']), /*#__PURE__*/jsxRuntime.jsx("meta", {
|
|
111
|
+
property: "og:image:height",
|
|
112
|
+
content: `${height}`
|
|
113
|
+
}, metaKeys['og:image:height']), alt && /*#__PURE__*/jsxRuntime.jsx("meta", {
|
|
114
|
+
property: "og:image:alt",
|
|
115
|
+
content: alt
|
|
116
|
+
}, metaKeys['og:image:alt']), !excludeTags.includes('twitter:title') && /*#__PURE__*/jsxRuntime.jsx("meta", {
|
|
117
|
+
property: "twitter:title",
|
|
118
|
+
content: twitterTitle || ' '
|
|
119
|
+
}, metaKeys['twitter:title']), /*#__PURE__*/jsxRuntime.jsx("meta", {
|
|
120
|
+
property: "twitter:card",
|
|
121
|
+
content: TWITTER_CARD
|
|
122
|
+
}, metaKeys['twitter:card']), /*#__PURE__*/jsxRuntime.jsx("meta", {
|
|
123
|
+
property: "twitter:image",
|
|
124
|
+
content: twitterImageUrl
|
|
125
|
+
}, metaKeys['twitter:image'])]
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* getCldVideoUrl
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
function getCldVideoUrl(options, config, analytics) {
|
|
134
|
+
return urlLoader.constructCloudinaryUrl({
|
|
135
|
+
options: {
|
|
136
|
+
assetType: 'video',
|
|
137
|
+
format: 'auto:video',
|
|
138
|
+
...options
|
|
139
|
+
},
|
|
140
|
+
config: cloudinary.getCloudinaryConfig(config),
|
|
141
|
+
analytics: cloudinary.getCloudinaryAnalytics(analytics)
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
Object.defineProperty(exports, 'CldImage', {
|
|
146
|
+
enumerable: true,
|
|
147
|
+
get: function () { return CldImage__default["default"]; }
|
|
148
|
+
});
|
|
149
|
+
exports.cloudinaryLoader = cloudinaryLoader.cloudinaryLoader;
|
|
150
|
+
exports.getCldImageUrl = cloudinaryLoader.getCldImageUrl;
|
|
151
|
+
Object.defineProperty(exports, 'CldUploadButton', {
|
|
152
|
+
enumerable: true,
|
|
153
|
+
get: function () { return CldUploadButton__default["default"]; }
|
|
154
|
+
});
|
|
155
|
+
Object.defineProperty(exports, 'CldUploadWidget', {
|
|
156
|
+
enumerable: true,
|
|
157
|
+
get: function () { return CldUploadWidget__default["default"]; }
|
|
158
|
+
});
|
|
159
|
+
Object.defineProperty(exports, 'CldVideoPlayer', {
|
|
160
|
+
enumerable: true,
|
|
161
|
+
get: function () { return CldVideoPlayer__default["default"]; }
|
|
162
|
+
});
|
|
163
|
+
exports.CldOgImage = CldOgImage;
|
|
164
|
+
exports.getCldOgImageUrl = getCldOgImageUrl;
|
|
165
|
+
exports.getCldVideoUrl = getCldVideoUrl;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
export { default as CldImage } from './CldImage-37af4d37.esm.js';
|
|
2
|
+
import Head from 'next/head';
|
|
3
|
+
import { g as getCldImageUrl } from './cloudinary-loader-d86c263a.esm.js';
|
|
4
|
+
export { c as cloudinaryLoader, g as getCldImageUrl } from './cloudinary-loader-d86c263a.esm.js';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
export { default as CldUploadButton } from './CldUploadButton-196b419b.esm.js';
|
|
7
|
+
export { default as CldUploadWidget } from './CldUploadWidget-d1442bef.esm.js';
|
|
8
|
+
export { default as CldVideoPlayer } from './CldVideoPlayer-d3572d86.esm.js';
|
|
9
|
+
import { constructCloudinaryUrl } from '@cloudinary-util/url-loader';
|
|
10
|
+
import { g as getCloudinaryConfig, a as getCloudinaryAnalytics } from './cloudinary-50fd58f7.esm.js';
|
|
11
|
+
import 'next/package.json';
|
|
12
|
+
|
|
13
|
+
const OG_IMAGE_WIDTH = 1200;
|
|
14
|
+
const OG_IMAGE_HEIGHT = 627;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* getCldImageUrl
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function getCldOgImageUrl(options) {
|
|
21
|
+
return getCldImageUrl({
|
|
22
|
+
...options,
|
|
23
|
+
format: options.format || 'jpg',
|
|
24
|
+
width: options.width || OG_IMAGE_WIDTH,
|
|
25
|
+
height: options.height || OG_IMAGE_HEIGHT,
|
|
26
|
+
crop: options.crop || {
|
|
27
|
+
type: 'fill',
|
|
28
|
+
gravity: 'center',
|
|
29
|
+
source: true
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const TWITTER_CARD = 'summary_large_image';
|
|
35
|
+
const CldOgImage = ({
|
|
36
|
+
excludeTags = [],
|
|
37
|
+
twitterTitle,
|
|
38
|
+
keys = {},
|
|
39
|
+
...props
|
|
40
|
+
}) => {
|
|
41
|
+
const {
|
|
42
|
+
alt
|
|
43
|
+
} = props;
|
|
44
|
+
|
|
45
|
+
// We need to separately handle the width and the height to allow our user to pass in
|
|
46
|
+
// a custom value, but also we need to know this at the component level so that we can
|
|
47
|
+
// use it when rendering the meta tags
|
|
48
|
+
|
|
49
|
+
let {
|
|
50
|
+
width = OG_IMAGE_WIDTH,
|
|
51
|
+
height = OG_IMAGE_HEIGHT
|
|
52
|
+
} = props;
|
|
53
|
+
|
|
54
|
+
// Normalize the width and height
|
|
55
|
+
|
|
56
|
+
width = typeof width === 'string' ? parseInt(width) : width;
|
|
57
|
+
height = typeof height === 'string' ? parseInt(height) : height;
|
|
58
|
+
|
|
59
|
+
// Render the final URLs. We use two different format versions to deliver
|
|
60
|
+
// webp for Twitter as it supports it (and we can control with tags) where
|
|
61
|
+
// other platforms may not support webp, so we deliver jpg
|
|
62
|
+
|
|
63
|
+
const ogImageUrl = getCldOgImageUrl({
|
|
64
|
+
...props,
|
|
65
|
+
width,
|
|
66
|
+
height
|
|
67
|
+
});
|
|
68
|
+
const twitterImageUrl = getCldOgImageUrl({
|
|
69
|
+
...props,
|
|
70
|
+
width,
|
|
71
|
+
height,
|
|
72
|
+
format: props.format || 'webp'
|
|
73
|
+
});
|
|
74
|
+
const metaKeys = {
|
|
75
|
+
'og:image': 'og-image',
|
|
76
|
+
'og:image:secure_url': 'og-image-secureurl',
|
|
77
|
+
'og:image:width': 'og-image-width',
|
|
78
|
+
'og:image:height': 'og-image-height',
|
|
79
|
+
'og:image:alt': 'og-image-alt',
|
|
80
|
+
'twitter:title': 'twitter-title',
|
|
81
|
+
'twitter:card': 'twitter-card',
|
|
82
|
+
'twitter:image': 'twitter-image',
|
|
83
|
+
...keys
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// We need to include the tags within the Next.js Head component rather than
|
|
87
|
+
// direcly adding them inside of the Head otherwise we get unexpected results
|
|
88
|
+
|
|
89
|
+
return /*#__PURE__*/jsxs(Head, {
|
|
90
|
+
children: [/*#__PURE__*/jsx("meta", {
|
|
91
|
+
property: "og:image",
|
|
92
|
+
content: ogImageUrl
|
|
93
|
+
}, metaKeys['og:image']), /*#__PURE__*/jsx("meta", {
|
|
94
|
+
property: "og:image:secure_url",
|
|
95
|
+
content: ogImageUrl
|
|
96
|
+
}, metaKeys['og:image:secure_url']), /*#__PURE__*/jsx("meta", {
|
|
97
|
+
property: "og:image:width",
|
|
98
|
+
content: `${width}`
|
|
99
|
+
}, metaKeys['og:image:width']), /*#__PURE__*/jsx("meta", {
|
|
100
|
+
property: "og:image:height",
|
|
101
|
+
content: `${height}`
|
|
102
|
+
}, metaKeys['og:image:height']), alt && /*#__PURE__*/jsx("meta", {
|
|
103
|
+
property: "og:image:alt",
|
|
104
|
+
content: alt
|
|
105
|
+
}, metaKeys['og:image:alt']), !excludeTags.includes('twitter:title') && /*#__PURE__*/jsx("meta", {
|
|
106
|
+
property: "twitter:title",
|
|
107
|
+
content: twitterTitle || ' '
|
|
108
|
+
}, metaKeys['twitter:title']), /*#__PURE__*/jsx("meta", {
|
|
109
|
+
property: "twitter:card",
|
|
110
|
+
content: TWITTER_CARD
|
|
111
|
+
}, metaKeys['twitter:card']), /*#__PURE__*/jsx("meta", {
|
|
112
|
+
property: "twitter:image",
|
|
113
|
+
content: twitterImageUrl
|
|
114
|
+
}, metaKeys['twitter:image'])]
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* getCldVideoUrl
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
function getCldVideoUrl(options, config, analytics) {
|
|
123
|
+
return constructCloudinaryUrl({
|
|
124
|
+
options: {
|
|
125
|
+
assetType: 'video',
|
|
126
|
+
format: 'auto:video',
|
|
127
|
+
...options
|
|
128
|
+
},
|
|
129
|
+
config: getCloudinaryConfig(config),
|
|
130
|
+
analytics: getCloudinaryAnalytics(analytics)
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export { CldOgImage, getCldOgImageUrl, getCldVideoUrl };
|
package/package.json
CHANGED
|
@@ -1,26 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-cloudinary",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-beta.2",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"main": "
|
|
6
|
-
"module": "
|
|
7
|
-
"
|
|
8
|
-
|
|
5
|
+
"main": "dist/next-cloudinary.cjs.js",
|
|
6
|
+
"module": "dist/next-cloudinary.esm.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": {
|
|
10
|
+
"import": "./dist/next-cloudinary.cjs.mjs",
|
|
11
|
+
"default": "./dist/next-cloudinary.cjs.js"
|
|
12
|
+
},
|
|
13
|
+
"module": "./dist/next-cloudinary.esm.js",
|
|
14
|
+
"import": "./dist/next-cloudinary.cjs.mjs",
|
|
15
|
+
"default": "./dist/next-cloudinary.cjs.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json",
|
|
18
|
+
"./cld-video-player.css": "./dist/cld-video-player.css",
|
|
19
|
+
"./dist/cld-video-player.css": "./dist/cld-video-player.css",
|
|
20
|
+
"./cloudinary_icon_for_black_bg.svg": "./dist/cloudinary_icon_for_black_bg.svg",
|
|
21
|
+
"./dist/cloudinary_icon_for_black_bg.svg": "./dist/cloudinary_icon_for_black_bg.svg",
|
|
22
|
+
"./cloudinary_icon_for_white_bg.svg": "./dist/cloudinary_icon_for_white_bg.svg",
|
|
23
|
+
"./dist/cloudinary_icon_for_white_bg.svg": "./dist/cloudinary_icon_for_white_bg.svg"
|
|
24
|
+
},
|
|
25
|
+
"types": "./dist/next-cloudinary.cjs.d.ts",
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
9
29
|
"dependencies": {
|
|
10
30
|
"@cloudinary-util/types": "1.5.8",
|
|
11
31
|
"@cloudinary-util/url-loader": "5.10.3",
|
|
12
|
-
"@cloudinary-util/util": "^3.3.2"
|
|
13
|
-
"@tsconfig/recommended": "^1.0.7"
|
|
32
|
+
"@cloudinary-util/util": "^3.3.2"
|
|
14
33
|
},
|
|
15
34
|
"devDependencies": {
|
|
16
35
|
"@babel/core": "^7.25.2",
|
|
17
|
-
"@babel/preset-env": "^7.25.
|
|
36
|
+
"@babel/preset-env": "^7.25.4",
|
|
37
|
+
"@babel/preset-react": "^7.24.7",
|
|
38
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
39
|
+
"@tsconfig/recommended": "^1.0.7",
|
|
18
40
|
"@types/node": "^22.0.2",
|
|
19
41
|
"@types/react": "^18.3.3",
|
|
20
42
|
"@types/react-dom": "^18.3.0",
|
|
21
43
|
"dotenv": "^16.4.5",
|
|
22
44
|
"mkdirp": "^3.0.1",
|
|
23
|
-
"
|
|
45
|
+
"tsx": "^4.19.1",
|
|
24
46
|
"typescript": "^5.5.4",
|
|
25
47
|
"vitest": "^2.0.5"
|
|
26
48
|
},
|
|
@@ -28,11 +50,27 @@
|
|
|
28
50
|
"next": "^12 || ^13 || ^14 || >=15.0.0-rc",
|
|
29
51
|
"react": "^17 || ^18 || >=19.0.0-beta"
|
|
30
52
|
},
|
|
53
|
+
"preconstruct": {
|
|
54
|
+
"exports": {
|
|
55
|
+
"importConditionDefaultExport": "default",
|
|
56
|
+
"extra": {
|
|
57
|
+
"./cld-video-player.css": "./dist/cld-video-player.css",
|
|
58
|
+
"./dist/cld-video-player.css": "./dist/cld-video-player.css",
|
|
59
|
+
"./cloudinary_icon_for_black_bg.svg": "./dist/cloudinary_icon_for_black_bg.svg",
|
|
60
|
+
"./dist/cloudinary_icon_for_black_bg.svg": "./dist/cloudinary_icon_for_black_bg.svg",
|
|
61
|
+
"./cloudinary_icon_for_white_bg.svg": "./dist/cloudinary_icon_for_white_bg.svg",
|
|
62
|
+
"./dist/cloudinary_icon_for_white_bg.svg": "./dist/cloudinary_icon_for_white_bg.svg"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
|
|
66
|
+
"importsConditions": true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
31
69
|
"scripts": {
|
|
32
|
-
"build": "
|
|
33
|
-
"dev": "
|
|
70
|
+
"build": "preconstruct build && tsx scripts/copy-assets.ts",
|
|
71
|
+
"dev": "preconstruct watch",
|
|
34
72
|
"test": "vitest run",
|
|
35
|
-
"test:app": "NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=\"test\" pnpm build && cd tests/nextjs-app &&
|
|
73
|
+
"test:app": "NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=\"test\" pnpm build && cd tests/nextjs-app && pnpm build",
|
|
36
74
|
"test:watch": "vitest"
|
|
37
75
|
}
|
|
38
76
|
}
|
package/dist/index.d.mts
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import React, { MutableRefObject } from 'react';
|
|
2
|
-
import { ImageProps } from 'next/image';
|
|
3
|
-
import { ImageOptions, ConfigOptions, AnalyticsOptions, VideoOptions } from '@cloudinary-util/url-loader';
|
|
4
|
-
import { CloudinaryUploadWidgetOptions, CloudinaryUploadWidgetError, CloudinaryUploadWidgetResults, CloudinaryUploadWidgetInstanceMethods, CloudinaryVideoPlayerOptions, CloudinaryVideoPlayer, CloudinaryVideoPlayerOptionsLogo } from '@cloudinary-util/types';
|
|
5
|
-
export { CloudinaryUploadWidgetError, CloudinaryUploadWidgetInfo, CloudinaryUploadWidgetInstanceMethodCloseOptions, CloudinaryUploadWidgetInstanceMethodDestroyOptions, CloudinaryUploadWidgetInstanceMethodOpenOptions, CloudinaryUploadWidgetInstanceMethodUpdateOptions, CloudinaryUploadWidgetInstanceMethods, CloudinaryUploadWidgetOptions, CloudinaryUploadWidgetResults, CloudinaryUploadWidgetSources, CloudinaryVideoPlayer, CloudinaryVideoPlayerOptions, CloudinaryVideoPlayerOptionsColors, CloudinaryVideoPlayerOptionsLogo } from '@cloudinary-util/types';
|
|
6
|
-
|
|
7
|
-
type CldImageProps = Omit<ImageProps, 'src' | 'quality'> & ImageOptions & {
|
|
8
|
-
config?: ConfigOptions;
|
|
9
|
-
src: string;
|
|
10
|
-
unoptimized?: boolean;
|
|
11
|
-
};
|
|
12
|
-
declare const CldImage: React.ForwardRefExoticComponent<Omit<ImageProps, "src" | "quality"> & ImageOptions & {
|
|
13
|
-
config?: ConfigOptions;
|
|
14
|
-
src: string;
|
|
15
|
-
unoptimized?: boolean;
|
|
16
|
-
} & React.RefAttributes<HTMLImageElement>>;
|
|
17
|
-
|
|
18
|
-
type CldOgImageProps = CldImageProps & {
|
|
19
|
-
excludeTags?: Array<string>;
|
|
20
|
-
keys?: object;
|
|
21
|
-
twitterTitle?: string;
|
|
22
|
-
};
|
|
23
|
-
declare const CldOgImage: ({ excludeTags, twitterTitle, keys, ...props }: CldOgImageProps) => React.JSX.Element;
|
|
24
|
-
|
|
25
|
-
type CldUploadWidgetCloudinaryInstance = any;
|
|
26
|
-
type CldUploadWidgetWidgetInstance = any;
|
|
27
|
-
interface CldUploadWidgetProps {
|
|
28
|
-
children?: ({ cloudinary, widget, open, results, error }: CldUploadWidgetPropsChildren) => JSX.Element;
|
|
29
|
-
config?: ConfigOptions;
|
|
30
|
-
onError?: CldUploadEventCallbackError;
|
|
31
|
-
onOpen?: CldUploadEventCallbackWidgetOnly;
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated use onSuccess instead
|
|
34
|
-
*/
|
|
35
|
-
onUpload?: CldUploadEventCallbackNoOptions;
|
|
36
|
-
onAbort?: CldUploadEventCallback;
|
|
37
|
-
onBatchCancelled?: CldUploadEventCallback;
|
|
38
|
-
onClose?: CldUploadEventCallback;
|
|
39
|
-
onDisplayChanged?: CldUploadEventCallback;
|
|
40
|
-
onPublicId?: CldUploadEventCallback;
|
|
41
|
-
onQueuesEnd?: CldUploadEventCallback;
|
|
42
|
-
onQueuesStart?: CldUploadEventCallback;
|
|
43
|
-
onRetry?: CldUploadEventCallback;
|
|
44
|
-
onShowCompleted?: CldUploadEventCallback;
|
|
45
|
-
onSourceChanged?: CldUploadEventCallback;
|
|
46
|
-
onSuccess?: CldUploadEventCallback;
|
|
47
|
-
onTags?: CldUploadEventCallback;
|
|
48
|
-
onUploadAdded?: CldUploadEventCallback;
|
|
49
|
-
options?: CloudinaryUploadWidgetOptions;
|
|
50
|
-
signatureEndpoint?: URL | RequestInfo;
|
|
51
|
-
uploadPreset?: string;
|
|
52
|
-
onAbortAction?: CldUploadEventAction;
|
|
53
|
-
onBatchCancelledAction?: CldUploadEventAction;
|
|
54
|
-
onCloseAction?: CldUploadEventAction;
|
|
55
|
-
onDisplayChangedAction?: CldUploadEventAction;
|
|
56
|
-
onPublicIdAction?: CldUploadEventAction;
|
|
57
|
-
onQueuesEndAction?: CldUploadEventAction;
|
|
58
|
-
onQueuesStartAction?: CldUploadEventAction;
|
|
59
|
-
onRetryAction?: CldUploadEventAction;
|
|
60
|
-
onShowCompletedAction?: CldUploadEventAction;
|
|
61
|
-
onSourceChangedAction?: CldUploadEventAction;
|
|
62
|
-
onSuccessAction?: CldUploadEventAction;
|
|
63
|
-
onTagsAction?: CldUploadEventAction;
|
|
64
|
-
onUploadAddedAction?: CldUploadEventAction;
|
|
65
|
-
}
|
|
66
|
-
type CldUploadWidgetPropsChildren = {
|
|
67
|
-
cloudinary: CldUploadWidgetCloudinaryInstance;
|
|
68
|
-
widget: CldUploadWidgetWidgetInstance;
|
|
69
|
-
error?: CloudinaryUploadWidgetError;
|
|
70
|
-
isLoading?: boolean;
|
|
71
|
-
results?: CloudinaryUploadWidgetResults;
|
|
72
|
-
} & CloudinaryUploadWidgetInstanceMethods;
|
|
73
|
-
type CldUploadEventCallback = (results: CloudinaryUploadWidgetResults, widget: CldUploadEventCallbackWidget) => void;
|
|
74
|
-
type CldUploadEventAction = (results: CloudinaryUploadWidgetResults) => void;
|
|
75
|
-
type CldUploadEventCallbackNoOptions = (results: CloudinaryUploadWidgetResults, widget: CldUploadWidgetWidgetInstance) => void;
|
|
76
|
-
type CldUploadEventCallbackWidgetOnly = (widget: CldUploadWidgetWidgetInstance) => void;
|
|
77
|
-
type CldUploadEventCallbackError = (error: CloudinaryUploadWidgetError, widget: CldUploadEventCallbackWidget) => void;
|
|
78
|
-
type CldUploadEventCallbackWidget = {
|
|
79
|
-
widget: CldUploadWidgetWidgetInstance;
|
|
80
|
-
} & CloudinaryUploadWidgetInstanceMethods;
|
|
81
|
-
|
|
82
|
-
declare const CldUploadWidget: ({ children, config, onError, onOpen, onUpload, options, signatureEndpoint, uploadPreset, ...props }: CldUploadWidgetProps) => React.JSX.Element;
|
|
83
|
-
|
|
84
|
-
interface CldUploadButtonProps extends Omit<CldUploadWidgetProps, 'children'> {
|
|
85
|
-
className?: string;
|
|
86
|
-
children?: JSX.Element | string | Array<JSX.Element | string>;
|
|
87
|
-
onClick?: Function;
|
|
88
|
-
}
|
|
89
|
-
declare const CldUploadButton: ({ className, children, onClick, onError, onOpen, onUpload, onAbort, onBatchCancelled, onClose, onDisplayChanged, onPublicId, onQueuesEnd, onQueuesStart, onRetry, onShowCompleted, onSourceChanged, onSuccess, onTags, onUploadAdded, options, signatureEndpoint, uploadPreset, onAbortAction, onBatchCancelledAction, onCloseAction, onDisplayChangedAction, onPublicIdAction, onQueuesEndAction, onQueuesStartAction, onRetryAction, onShowCompletedAction, onSourceChangedAction, onSuccessAction, onTagsAction, onUploadAddedAction, ...props }: CldUploadButtonProps) => React.JSX.Element;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* getCldImageUrl
|
|
93
|
-
*/
|
|
94
|
-
type GetCldImageUrlOptions = ImageOptions;
|
|
95
|
-
type GetCldImageUrlConfig = ConfigOptions;
|
|
96
|
-
type GetCldImageUrlAnalytics = AnalyticsOptions;
|
|
97
|
-
declare function getCldImageUrl(options: GetCldImageUrlOptions, config?: GetCldImageUrlConfig, analytics?: GetCldImageUrlAnalytics): string;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* getCldVideoUrl
|
|
101
|
-
*/
|
|
102
|
-
type GetCldVideoUrlOptions = VideoOptions;
|
|
103
|
-
type GetCldVideoUrlConfig = ConfigOptions;
|
|
104
|
-
type GetCldVideoUrlAnalytics = AnalyticsOptions;
|
|
105
|
-
declare function getCldVideoUrl(options: GetCldVideoUrlOptions, config?: GetCldVideoUrlConfig, analytics?: GetCldVideoUrlAnalytics): string;
|
|
106
|
-
|
|
107
|
-
type CldVideoPlayerProps = Omit<CloudinaryVideoPlayerOptions, "cloud_name" | "autoplayMode" | "publicId" | "secure" | "showLogo" | "logoImageUrl" | "logoOnclickUrl"> & {
|
|
108
|
-
className?: string;
|
|
109
|
-
config?: ConfigOptions;
|
|
110
|
-
id?: string;
|
|
111
|
-
logo?: boolean | CldVideoPlayerPropsLogo;
|
|
112
|
-
onDataLoad?: Function;
|
|
113
|
-
onError?: Function;
|
|
114
|
-
onMetadataLoad?: Function;
|
|
115
|
-
onPause?: Function;
|
|
116
|
-
onPlay?: Function;
|
|
117
|
-
onEnded?: Function;
|
|
118
|
-
playerRef?: MutableRefObject<CloudinaryVideoPlayer | null>;
|
|
119
|
-
poster?: string | GetCldImageUrlOptions | GetCldVideoUrlOptions;
|
|
120
|
-
src: string;
|
|
121
|
-
videoRef?: MutableRefObject<HTMLVideoElement | null>;
|
|
122
|
-
quality?: string | number;
|
|
123
|
-
};
|
|
124
|
-
interface CldVideoPlayerPropsLogo {
|
|
125
|
-
imageUrl?: CloudinaryVideoPlayerOptionsLogo['logoImageUrl'];
|
|
126
|
-
logo?: boolean;
|
|
127
|
-
onClickUrl?: CloudinaryVideoPlayerOptionsLogo['logoOnclickUrl'];
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
declare const CldVideoPlayer: (props: CldVideoPlayerProps) => React.JSX.Element;
|
|
131
|
-
|
|
132
|
-
interface CloudinaryLoaderCldOptions {
|
|
133
|
-
}
|
|
134
|
-
interface CloudinaryLoaderLoaderOptions {
|
|
135
|
-
height?: string | number;
|
|
136
|
-
width?: string | number;
|
|
137
|
-
}
|
|
138
|
-
interface CloudinaryLoader {
|
|
139
|
-
loaderOptions: CloudinaryLoaderLoaderOptions;
|
|
140
|
-
imageProps: ImageProps;
|
|
141
|
-
cldOptions: CloudinaryLoaderCldOptions;
|
|
142
|
-
cldConfig?: object;
|
|
143
|
-
}
|
|
144
|
-
declare function cloudinaryLoader({ loaderOptions, imageProps, cldOptions, cldConfig }: CloudinaryLoader): string;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* getCldImageUrl
|
|
148
|
-
*/
|
|
149
|
-
type GetCldOgImageUrlOptions = GetCldImageUrlOptions;
|
|
150
|
-
declare function getCldOgImageUrl(options: GetCldOgImageUrlOptions): string;
|
|
151
|
-
|
|
152
|
-
export { CldImage, type CldImageProps, CldOgImage, type CldOgImageProps, CldUploadButton, type CldUploadButtonProps, CldUploadWidget, type CldUploadWidgetProps, type CldUploadWidgetPropsChildren, CldVideoPlayer, type CldVideoPlayerProps, type CldVideoPlayerPropsLogo, type CloudinaryLoader, type CloudinaryLoaderCldOptions, type CloudinaryLoaderLoaderOptions, type GetCldImageUrlAnalytics, type GetCldImageUrlConfig, type GetCldImageUrlOptions, type GetCldOgImageUrlOptions, type GetCldVideoUrlAnalytics, type GetCldVideoUrlConfig, type GetCldVideoUrlOptions, cloudinaryLoader, getCldImageUrl, getCldOgImageUrl, getCldVideoUrl };
|