@sanvika/cloudinary 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -3
  2. package/package.json +6 -10
package/dist/index.js CHANGED
@@ -186,10 +186,18 @@ var _appName = null;
186
186
  var _configured = false;
187
187
  var _cloudinary = null;
188
188
  async function loadLegacyCloudinary() {
189
+ var _a;
189
190
  if (_cloudinary) return _cloudinary;
190
- const mod = await import("cloudinary");
191
- _cloudinary = mod.v2;
192
- return _cloudinary;
191
+ try {
192
+ const dynamicImport = new Function("m", "return import(m)");
193
+ const mod = await dynamicImport("cloudinary");
194
+ _cloudinary = mod.v2 || ((_a = mod.default) == null ? void 0 : _a.v2) || mod.default || mod;
195
+ return _cloudinary;
196
+ } catch (err) {
197
+ throw new Error(
198
+ "@sanvika/cloudinary: legacy direct mode requires the 'cloudinary' npm package to be installed. Either install it (pnpm add cloudinary) OR (recommended) use gateway mode by setting CLOUDINARY_GATEWAY_URL + CLOUDINARY_TOKEN. Original error: " + err.message
199
+ );
200
+ }
193
201
  }
194
202
  async function configureSanvikaCloudinary({ appName, cloudName, apiKey, apiSecret } = {}) {
195
203
  const resolvedApp = appName || process.env.CLOUDINARY_APP_NAME;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sanvika/cloudinary",
3
- "version": "0.3.0",
4
- "description": "Centralized Cloudinary SDK for the Sanvika ecosystem — proxy gateway mode (zero credentials) + legacy direct mode",
3
+ "version": "0.3.1",
4
+ "description": "Centralized Cloudinary SDK for the Sanvika ecosystem — proxy gateway mode (zero credentials). Legacy direct mode requires consumer to install 'cloudinary' npm package (not recommended).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -12,16 +12,9 @@
12
12
  "files": [
13
13
  "dist"
14
14
  ],
15
- "scripts": {
16
- "build": "tsup",
17
- "prepublishOnly": "npm run build"
18
- },
19
15
  "devDependencies": {
20
16
  "tsup": "^8.5.1"
21
17
  },
22
- "dependencies": {
23
- "cloudinary": "^2.5.0"
24
- },
25
18
  "keywords": [
26
19
  "cloudinary",
27
20
  "sanvika",
@@ -55,5 +48,8 @@
55
48
  "type": "git",
56
49
  "url": "https://github.com/sanvikaproduction/sanvika-cloudinary",
57
50
  "directory": "packages/sanvika-cloudinary-sdk"
51
+ },
52
+ "scripts": {
53
+ "build": "tsup"
58
54
  }
59
- }
55
+ }