@wordpress/blob 3.33.0 → 3.35.0
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/CHANGELOG.md +4 -0
- package/build/index.js +1 -3
- package/build/index.js.map +1 -1
- package/build-module/index.js +1 -3
- package/build-module/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/build/index.js
CHANGED
|
@@ -52,9 +52,7 @@ function getBlobByURL(url) {
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
function getBlobTypeByURL(url) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return (_getBlobByURL = getBlobByURL(url)) === null || _getBlobByURL === void 0 ? void 0 : _getBlobByURL.type.split('/')[0]; // 0: media type , 1: file extension eg ( type: 'image/jpeg' ).
|
|
55
|
+
return getBlobByURL(url)?.type.split('/')[0]; // 0: media type , 1: file extension eg ( type: 'image/jpeg' ).
|
|
58
56
|
}
|
|
59
57
|
/**
|
|
60
58
|
* Remove the resource and file cache from memory.
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/blob/src/index.js"],"names":["cache","createBlobURL","file","url","window","URL","createObjectURL","getBlobByURL","getBlobTypeByURL","type","split","revokeBlobURL","revokeObjectURL","isBlobURL","indexOf"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA,MAAMA,KAAK,GAAG,EAAd;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,aAAT,CAAwBC,IAAxB,EAA+B;AACrC,QAAMC,GAAG,GAAGC,MAAM,CAACC,GAAP,CAAWC,eAAX,CAA4BJ,IAA5B,CAAZ;AAEAF,EAAAA,KAAK,CAAEG,GAAF,CAAL,GAAeD,IAAf;AAEA,SAAOC,GAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,YAAT,CAAuBJ,GAAvB,EAA6B;AACnC,SAAOH,KAAK,CAAEG,GAAF,CAAZ;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,gBAAT,CAA2BL,GAA3B,EAAiC;
|
|
1
|
+
{"version":3,"sources":["@wordpress/blob/src/index.js"],"names":["cache","createBlobURL","file","url","window","URL","createObjectURL","getBlobByURL","getBlobTypeByURL","type","split","revokeBlobURL","revokeObjectURL","isBlobURL","indexOf"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA,MAAMA,KAAK,GAAG,EAAd;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,aAAT,CAAwBC,IAAxB,EAA+B;AACrC,QAAMC,GAAG,GAAGC,MAAM,CAACC,GAAP,CAAWC,eAAX,CAA4BJ,IAA5B,CAAZ;AAEAF,EAAAA,KAAK,CAAEG,GAAF,CAAL,GAAeD,IAAf;AAEA,SAAOC,GAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,YAAT,CAAuBJ,GAAvB,EAA6B;AACnC,SAAOH,KAAK,CAAEG,GAAF,CAAZ;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,gBAAT,CAA2BL,GAA3B,EAAiC;AACvC,SAAOI,YAAY,CAAEJ,GAAF,CAAZ,EAAqBM,IAArB,CAA0BC,KAA1B,CAAiC,GAAjC,EAAwC,CAAxC,CAAP,CADuC,CACa;AACpD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASC,aAAT,CAAwBR,GAAxB,EAA8B;AACpC,MAAKH,KAAK,CAAEG,GAAF,CAAV,EAAoB;AACnBC,IAAAA,MAAM,CAACC,GAAP,CAAWO,eAAX,CAA4BT,GAA5B;AACA;;AAED,SAAOH,KAAK,CAAEG,GAAF,CAAZ;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASU,SAAT,CAAoBV,GAApB,EAA0B;AAChC,MAAK,CAAEA,GAAF,IAAS,CAAEA,GAAG,CAACW,OAApB,EAA8B;AAC7B,WAAO,KAAP;AACA;;AACD,SAAOX,GAAG,CAACW,OAAJ,CAAa,OAAb,MAA2B,CAAlC;AACA","sourcesContent":["/**\n * @type {Record<string, File|undefined>}\n */\nconst cache = {};\n\n/**\n * Create a blob URL from a file.\n *\n * @param {File} file The file to create a blob URL for.\n *\n * @return {string} The blob URL.\n */\nexport function createBlobURL( file ) {\n\tconst url = window.URL.createObjectURL( file );\n\n\tcache[ url ] = file;\n\n\treturn url;\n}\n\n/**\n * Retrieve a file based on a blob URL. The file must have been created by\n * `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return\n * `undefined`.\n *\n * @param {string} url The blob URL.\n *\n * @return {File|undefined} The file for the blob URL.\n */\nexport function getBlobByURL( url ) {\n\treturn cache[ url ];\n}\n\n/**\n * Retrieve a blob type based on URL. The file must have been created by\n * `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return\n * `undefined`.\n *\n * @param {string} url The blob URL.\n *\n * @return {string|undefined} The blob type.\n */\nexport function getBlobTypeByURL( url ) {\n\treturn getBlobByURL( url )?.type.split( '/' )[ 0 ]; // 0: media type , 1: file extension eg ( type: 'image/jpeg' ).\n}\n\n/**\n * Remove the resource and file cache from memory.\n *\n * @param {string} url The blob URL.\n */\nexport function revokeBlobURL( url ) {\n\tif ( cache[ url ] ) {\n\t\twindow.URL.revokeObjectURL( url );\n\t}\n\n\tdelete cache[ url ];\n}\n\n/**\n * Check whether a url is a blob url.\n *\n * @param {string} url The URL.\n *\n * @return {boolean} Is the url a blob url?\n */\nexport function isBlobURL( url ) {\n\tif ( ! url || ! url.indexOf ) {\n\t\treturn false;\n\t}\n\treturn url.indexOf( 'blob:' ) === 0;\n}\n"]}
|
package/build-module/index.js
CHANGED
|
@@ -39,9 +39,7 @@ export function getBlobByURL(url) {
|
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
41
|
export function getBlobTypeByURL(url) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return (_getBlobByURL = getBlobByURL(url)) === null || _getBlobByURL === void 0 ? void 0 : _getBlobByURL.type.split('/')[0]; // 0: media type , 1: file extension eg ( type: 'image/jpeg' ).
|
|
42
|
+
return getBlobByURL(url)?.type.split('/')[0]; // 0: media type , 1: file extension eg ( type: 'image/jpeg' ).
|
|
45
43
|
}
|
|
46
44
|
/**
|
|
47
45
|
* Remove the resource and file cache from memory.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/blob/src/index.js"],"names":["cache","createBlobURL","file","url","window","URL","createObjectURL","getBlobByURL","getBlobTypeByURL","type","split","revokeBlobURL","revokeObjectURL","isBlobURL","indexOf"],"mappings":"AAAA;AACA;AACA;AACA,MAAMA,KAAK,GAAG,EAAd;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBC,IAAxB,EAA+B;AACrC,QAAMC,GAAG,GAAGC,MAAM,CAACC,GAAP,CAAWC,eAAX,CAA4BJ,IAA5B,CAAZ;AAEAF,EAAAA,KAAK,CAAEG,GAAF,CAAL,GAAeD,IAAf;AAEA,SAAOC,GAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,YAAT,CAAuBJ,GAAvB,EAA6B;AACnC,SAAOH,KAAK,CAAEG,GAAF,CAAZ;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,gBAAT,CAA2BL,GAA3B,EAAiC;
|
|
1
|
+
{"version":3,"sources":["@wordpress/blob/src/index.js"],"names":["cache","createBlobURL","file","url","window","URL","createObjectURL","getBlobByURL","getBlobTypeByURL","type","split","revokeBlobURL","revokeObjectURL","isBlobURL","indexOf"],"mappings":"AAAA;AACA;AACA;AACA,MAAMA,KAAK,GAAG,EAAd;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBC,IAAxB,EAA+B;AACrC,QAAMC,GAAG,GAAGC,MAAM,CAACC,GAAP,CAAWC,eAAX,CAA4BJ,IAA5B,CAAZ;AAEAF,EAAAA,KAAK,CAAEG,GAAF,CAAL,GAAeD,IAAf;AAEA,SAAOC,GAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,YAAT,CAAuBJ,GAAvB,EAA6B;AACnC,SAAOH,KAAK,CAAEG,GAAF,CAAZ;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASK,gBAAT,CAA2BL,GAA3B,EAAiC;AACvC,SAAOI,YAAY,CAAEJ,GAAF,CAAZ,EAAqBM,IAArB,CAA0BC,KAA1B,CAAiC,GAAjC,EAAwC,CAAxC,CAAP,CADuC,CACa;AACpD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBR,GAAxB,EAA8B;AACpC,MAAKH,KAAK,CAAEG,GAAF,CAAV,EAAoB;AACnBC,IAAAA,MAAM,CAACC,GAAP,CAAWO,eAAX,CAA4BT,GAA5B;AACA;;AAED,SAAOH,KAAK,CAAEG,GAAF,CAAZ;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASU,SAAT,CAAoBV,GAApB,EAA0B;AAChC,MAAK,CAAEA,GAAF,IAAS,CAAEA,GAAG,CAACW,OAApB,EAA8B;AAC7B,WAAO,KAAP;AACA;;AACD,SAAOX,GAAG,CAACW,OAAJ,CAAa,OAAb,MAA2B,CAAlC;AACA","sourcesContent":["/**\n * @type {Record<string, File|undefined>}\n */\nconst cache = {};\n\n/**\n * Create a blob URL from a file.\n *\n * @param {File} file The file to create a blob URL for.\n *\n * @return {string} The blob URL.\n */\nexport function createBlobURL( file ) {\n\tconst url = window.URL.createObjectURL( file );\n\n\tcache[ url ] = file;\n\n\treturn url;\n}\n\n/**\n * Retrieve a file based on a blob URL. The file must have been created by\n * `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return\n * `undefined`.\n *\n * @param {string} url The blob URL.\n *\n * @return {File|undefined} The file for the blob URL.\n */\nexport function getBlobByURL( url ) {\n\treturn cache[ url ];\n}\n\n/**\n * Retrieve a blob type based on URL. The file must have been created by\n * `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return\n * `undefined`.\n *\n * @param {string} url The blob URL.\n *\n * @return {string|undefined} The blob type.\n */\nexport function getBlobTypeByURL( url ) {\n\treturn getBlobByURL( url )?.type.split( '/' )[ 0 ]; // 0: media type , 1: file extension eg ( type: 'image/jpeg' ).\n}\n\n/**\n * Remove the resource and file cache from memory.\n *\n * @param {string} url The blob URL.\n */\nexport function revokeBlobURL( url ) {\n\tif ( cache[ url ] ) {\n\t\twindow.URL.revokeObjectURL( url );\n\t}\n\n\tdelete cache[ url ];\n}\n\n/**\n * Check whether a url is a blob url.\n *\n * @param {string} url The URL.\n *\n * @return {boolean} Is the url a blob url?\n */\nexport function isBlobURL( url ) {\n\tif ( ! url || ! url.indexOf ) {\n\t\treturn false;\n\t}\n\treturn url.indexOf( 'blob:' ) === 0;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/blob",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.35.0",
|
|
4
4
|
"description": "Blob utilities for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "a92f606309b1541b834ff9b0a76ed2a466fc45ed"
|
|
36
36
|
}
|