@uploadcare/file-uploader 1.19.2 → 1.19.3
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/blocks/Config/side-effects.d.ts.map +1 -1
- package/blocks/Config/side-effects.js +2 -1
- package/env.d.ts +1 -1
- package/env.js +1 -1
- package/index.ssr.d.ts +1 -1
- package/index.ssr.js +1 -1
- package/package.json +1 -1
- package/utils/isPromiseLike.d.ts +2 -0
- package/utils/isPromiseLike.d.ts.map +1 -0
- package/utils/isPromiseLike.js +12 -0
- package/utils/isPromiseLike.test.d.ts +2 -0
- package/utils/isPromiseLike.test.d.ts.map +1 -0
- package/utils/isPromiseLike.test.js +20 -0
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.js +4 -4
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-img.min.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side-effects.d.ts","sourceRoot":"","sources":["side-effects.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"side-effects.d.ts","sourceRoot":"","sources":["side-effects.js"],"names":[],"mappings":"AA0FO,+BAZ+C,CAAC,SAA1C,MAAO,OAAO,aAAa,EAAE,UAAW,+BAC1C;IACN,GAAG,EAAE,CAAC,CAAC;IACP,QAAQ,EAAE,CAAC,SAAS,SAAS,MAAM,OAAO,aAAa,EAAE,UAAU,EACjE,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,OAAO,aAAa,EAAE,UAAU,CAAC,SAAS,CAAC,KAC/C,IAAI,CAAC;IACV,QAAQ,EAAE,CAAC,SAAS,SAAS,MAAM,OAAO,aAAa,EAAE,UAAU,EACjE,GAAG,EAAE,SAAS,KACX,OAAO,aAAa,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;CAClD,QAqCH;wCAnHqD,IAAI,SAA7C,MAAO,OAAO,aAAa,EAAE,UAAW,EACkB,KAAK,SAA9D,OAAO,CAAC,MAAM,OAAO,aAAa,EAAE,UAAU,EAAE,IAAI,CAAC,EAAG;SAExD,IAAI;UACJ,KAAK;QACL,CACT,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,aAAa,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,GAC1D,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,GAC1D,KACE,OAAO,aAAa,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,OAAO,aAAa,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { getPrefixedCdnBaseAsync, isPrefixedCdnBase } from '@uploadcare/cname-prefix/async';
|
|
6
6
|
import { deserializeCsv, serializeCsv } from '../utils/comma-separated.js';
|
|
7
7
|
import { DEFAULT_CDN_CNAME } from './initialConfig.js';
|
|
8
|
+
import { isPromiseLike } from '../../utils/isPromiseLike.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @template {keyof import('../../types').ConfigType} TKey
|
|
@@ -105,7 +106,7 @@ export const runSideEffects = ({ key, setValue, getValue }) => {
|
|
|
105
106
|
),
|
|
106
107
|
};
|
|
107
108
|
const result = computed.fn(args);
|
|
108
|
-
if (result
|
|
109
|
+
if (isPromiseLike(result)) {
|
|
109
110
|
const prevValue = getValue(computed.key);
|
|
110
111
|
result
|
|
111
112
|
.then((resolvedValue) => {
|
package/env.d.ts
CHANGED
package/env.js
CHANGED
package/index.ssr.d.ts
CHANGED
|
@@ -550,7 +550,7 @@ export namespace ModalEvents {
|
|
|
550
550
|
let DESTROY: string;
|
|
551
551
|
}
|
|
552
552
|
export const PACKAGE_NAME: "blocks";
|
|
553
|
-
export const PACKAGE_VERSION: "1.19.
|
|
553
|
+
export const PACKAGE_VERSION: "1.19.3";
|
|
554
554
|
export const PresenceToggle: {
|
|
555
555
|
new (): {};
|
|
556
556
|
template: string;
|
package/index.ssr.js
CHANGED
|
@@ -1070,7 +1070,7 @@ export const ModalEvents = {
|
|
|
1070
1070
|
DESTROY: "modal:destroy",
|
|
1071
1071
|
};
|
|
1072
1072
|
export const PACKAGE_NAME = `blocks`;
|
|
1073
|
-
export const PACKAGE_VERSION = `1.19.
|
|
1073
|
+
export const PACKAGE_VERSION = `1.19.3`;
|
|
1074
1074
|
export const PresenceToggle = class {
|
|
1075
1075
|
static template = `<slot></slot> `;
|
|
1076
1076
|
static reg = () => {};
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPromiseLike.d.ts","sourceRoot":"","sources":["isPromiseLike.js"],"names":[],"mappings":"AAMO,qCAHI,OAAO,GACL,KAAK,gBAAW,CAO5B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {unknown} value
|
|
5
|
+
* @returns {value is Promise}
|
|
6
|
+
*/
|
|
7
|
+
export const isPromiseLike = (value) => {
|
|
8
|
+
return (
|
|
9
|
+
value instanceof Promise ||
|
|
10
|
+
Boolean(value && typeof value === 'object' && 'then' in value && typeof value.then === 'function')
|
|
11
|
+
);
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPromiseLike.test.d.ts","sourceRoot":"","sources":["isPromiseLike.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isPromiseLike } from './isPromiseLike';
|
|
2
|
+
import { expect } from '@esm-bundle/chai';
|
|
3
|
+
|
|
4
|
+
describe('isPromiseLike', () => {
|
|
5
|
+
it('should return true for Promise instances', () => {
|
|
6
|
+
expect(isPromiseLike(Promise.resolve())).to.be.true;
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('should return true for thenable objects', () => {
|
|
10
|
+
const thenable = { then: () => {} };
|
|
11
|
+
expect(isPromiseLike(thenable)).to.be.true;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should return false for non-thenable objects', () => {
|
|
15
|
+
expect(isPromiseLike({})).to.be.false;
|
|
16
|
+
expect(isPromiseLike(null)).to.be.false;
|
|
17
|
+
expect(isPromiseLike(42)).to.be.false;
|
|
18
|
+
expect(isPromiseLike('string')).to.be.false;
|
|
19
|
+
});
|
|
20
|
+
});
|