@wordpress/blob 3.44.1-next.f8d8eceb.0 → 3.46.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 +8 -0
- package/README.md +25 -0
- package/build/index.js +42 -0
- package/build/index.js.map +1 -1
- package/build-module/index.js +41 -0
- package/build-module/index.js.map +1 -1
- package/build-types/index.d.ts +24 -0
- package/build-types/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.js +40 -0
- package/src/test/index.js +58 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 3.46.0 (2023-11-16)
|
|
6
|
+
|
|
7
|
+
### New feature
|
|
8
|
+
|
|
9
|
+
- Add `downloadBlob` function and remove `downloadjs` dependency ([#56024](https://github.com/WordPress/gutenberg/pull/56024)).
|
|
10
|
+
|
|
11
|
+
## 3.45.0 (2023-11-02)
|
|
12
|
+
|
|
5
13
|
## 3.44.0 (2023-10-18)
|
|
6
14
|
|
|
7
15
|
## 3.43.0 (2023-10-05)
|
package/README.md
CHANGED
|
@@ -26,6 +26,31 @@ _Returns_
|
|
|
26
26
|
|
|
27
27
|
- `string`: The blob URL.
|
|
28
28
|
|
|
29
|
+
### downloadBlob
|
|
30
|
+
|
|
31
|
+
Downloads a file, e.g., a text or readable stream, in the browser. Appropriate for downloading smaller file sizes, e.g., \< 5 MB.
|
|
32
|
+
|
|
33
|
+
Example usage:
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
const fileContent = JSON.stringify(
|
|
37
|
+
{
|
|
38
|
+
title: 'My Post',
|
|
39
|
+
},
|
|
40
|
+
null,
|
|
41
|
+
2
|
|
42
|
+
);
|
|
43
|
+
const fileName = 'file.json';
|
|
44
|
+
|
|
45
|
+
downloadBlob( 'file.json', fileContent, 'application/json' );
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
_Parameters_
|
|
49
|
+
|
|
50
|
+
- _filename_ `string`: File name.
|
|
51
|
+
- _content_ `BlobPart`: File content (BufferSource | Blob | string).
|
|
52
|
+
- _contentType_ `string`: (Optional) File mime type. Default is `''`.
|
|
53
|
+
|
|
29
54
|
### getBlobByURL
|
|
30
55
|
|
|
31
56
|
Retrieve a file based on a blob URL. The file must have been created by `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return `undefined`.
|
package/build/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createBlobURL = createBlobURL;
|
|
7
|
+
exports.downloadBlob = downloadBlob;
|
|
7
8
|
exports.getBlobByURL = getBlobByURL;
|
|
8
9
|
exports.getBlobTypeByURL = getBlobTypeByURL;
|
|
9
10
|
exports.isBlobURL = isBlobURL;
|
|
@@ -77,4 +78,45 @@ function isBlobURL(url) {
|
|
|
77
78
|
}
|
|
78
79
|
return url.indexOf('blob:') === 0;
|
|
79
80
|
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Downloads a file, e.g., a text or readable stream, in the browser.
|
|
84
|
+
* Appropriate for downloading smaller file sizes, e.g., < 5 MB.
|
|
85
|
+
*
|
|
86
|
+
* Example usage:
|
|
87
|
+
*
|
|
88
|
+
* ```js
|
|
89
|
+
* const fileContent = JSON.stringify(
|
|
90
|
+
* {
|
|
91
|
+
* "title": "My Post",
|
|
92
|
+
* },
|
|
93
|
+
* null,
|
|
94
|
+
* 2
|
|
95
|
+
* );
|
|
96
|
+
* const fileName = 'file.json';
|
|
97
|
+
*
|
|
98
|
+
* downloadBlob( 'file.json', fileContent, 'application/json' );
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* @param {string} filename File name.
|
|
102
|
+
* @param {BlobPart} content File content (BufferSource | Blob | string).
|
|
103
|
+
* @param {string} contentType (Optional) File mime type. Default is `''`.
|
|
104
|
+
*/
|
|
105
|
+
function downloadBlob(filename, content, contentType = '') {
|
|
106
|
+
if (!filename || !content) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const file = new window.Blob([content], {
|
|
110
|
+
type: contentType
|
|
111
|
+
});
|
|
112
|
+
const url = window.URL.createObjectURL(file);
|
|
113
|
+
const anchorElement = document.createElement('a');
|
|
114
|
+
anchorElement.href = url;
|
|
115
|
+
anchorElement.download = filename;
|
|
116
|
+
anchorElement.style.display = 'none';
|
|
117
|
+
document.body.appendChild(anchorElement);
|
|
118
|
+
anchorElement.click();
|
|
119
|
+
document.body.removeChild(anchorElement);
|
|
120
|
+
window.URL.revokeObjectURL(url);
|
|
121
|
+
}
|
|
80
122
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["cache","createBlobURL","file","url","window","URL","createObjectURL","getBlobByURL","getBlobTypeByURL","type","split","revokeBlobURL","revokeObjectURL","isBlobURL","indexOf"],"sources":["@wordpress/blob/src/index.js"],"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|undefined} 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"],"mappings":"
|
|
1
|
+
{"version":3,"names":["cache","createBlobURL","file","url","window","URL","createObjectURL","getBlobByURL","getBlobTypeByURL","type","split","revokeBlobURL","revokeObjectURL","isBlobURL","indexOf","downloadBlob","filename","content","contentType","Blob","anchorElement","document","createElement","href","download","style","display","body","appendChild","click","removeChild"],"sources":["@wordpress/blob/src/index.js"],"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|undefined} 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\n/**\n * Downloads a file, e.g., a text or readable stream, in the browser.\n * Appropriate for downloading smaller file sizes, e.g., < 5 MB.\n *\n * Example usage:\n *\n * ```js\n * \tconst fileContent = JSON.stringify(\n * \t\t{\n * \t\t\t\"title\": \"My Post\",\n * \t\t},\n * \t\tnull,\n * \t\t2\n * \t);\n * \tconst fileName = 'file.json';\n *\n * \tdownloadBlob( 'file.json', fileContent, 'application/json' );\n * ```\n *\n * @param {string} filename File name.\n * @param {BlobPart} content File content (BufferSource | Blob | string).\n * @param {string} contentType (Optional) File mime type. Default is `''`.\n */\nexport function downloadBlob( filename, content, contentType = '' ) {\n\tif ( ! filename || ! content ) {\n\t\treturn;\n\t}\n\n\tconst file = new window.Blob( [ content ], { type: contentType } );\n\tconst url = window.URL.createObjectURL( file );\n\tconst anchorElement = document.createElement( 'a' );\n\tanchorElement.href = url;\n\tanchorElement.download = filename;\n\tanchorElement.style.display = 'none';\n\tdocument.body.appendChild( anchorElement );\n\tanchorElement.click();\n\tdocument.body.removeChild( anchorElement );\n\twindow.URL.revokeObjectURL( url );\n}\n"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA,MAAMA,KAAK,GAAG,CAAC,CAAC;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAAEC,IAAI,EAAG;EACrC,MAAMC,GAAG,GAAGC,MAAM,CAACC,GAAG,CAACC,eAAe,CAAEJ,IAAK,CAAC;EAE9CF,KAAK,CAAEG,GAAG,CAAE,GAAGD,IAAI;EAEnB,OAAOC,GAAG;AACX;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,YAAYA,CAAEJ,GAAG,EAAG;EACnC,OAAOH,KAAK,CAAEG,GAAG,CAAE;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,gBAAgBA,CAAEL,GAAG,EAAG;EACvC,OAAOI,YAAY,CAAEJ,GAAI,CAAC,EAAEM,IAAI,CAACC,KAAK,CAAE,GAAI,CAAC,CAAE,CAAC,CAAE,CAAC,CAAC;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAAER,GAAG,EAAG;EACpC,IAAKH,KAAK,CAAEG,GAAG,CAAE,EAAG;IACnBC,MAAM,CAACC,GAAG,CAACO,eAAe,CAAET,GAAI,CAAC;EAClC;EAEA,OAAOH,KAAK,CAAEG,GAAG,CAAE;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASU,SAASA,CAAEV,GAAG,EAAG;EAChC,IAAK,CAAEA,GAAG,IAAI,CAAEA,GAAG,CAACW,OAAO,EAAG;IAC7B,OAAO,KAAK;EACb;EACA,OAAOX,GAAG,CAACW,OAAO,CAAE,OAAQ,CAAC,KAAK,CAAC;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAAEC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,GAAG,EAAE,EAAG;EACnE,IAAK,CAAEF,QAAQ,IAAI,CAAEC,OAAO,EAAG;IAC9B;EACD;EAEA,MAAMf,IAAI,GAAG,IAAIE,MAAM,CAACe,IAAI,CAAE,CAAEF,OAAO,CAAE,EAAE;IAAER,IAAI,EAAES;EAAY,CAAE,CAAC;EAClE,MAAMf,GAAG,GAAGC,MAAM,CAACC,GAAG,CAACC,eAAe,CAAEJ,IAAK,CAAC;EAC9C,MAAMkB,aAAa,GAAGC,QAAQ,CAACC,aAAa,CAAE,GAAI,CAAC;EACnDF,aAAa,CAACG,IAAI,GAAGpB,GAAG;EACxBiB,aAAa,CAACI,QAAQ,GAAGR,QAAQ;EACjCI,aAAa,CAACK,KAAK,CAACC,OAAO,GAAG,MAAM;EACpCL,QAAQ,CAACM,IAAI,CAACC,WAAW,CAAER,aAAc,CAAC;EAC1CA,aAAa,CAACS,KAAK,CAAC,CAAC;EACrBR,QAAQ,CAACM,IAAI,CAACG,WAAW,CAAEV,aAAc,CAAC;EAC1ChB,MAAM,CAACC,GAAG,CAACO,eAAe,CAAET,GAAI,CAAC;AAClC"}
|
package/build-module/index.js
CHANGED
|
@@ -67,4 +67,45 @@ export function isBlobURL(url) {
|
|
|
67
67
|
}
|
|
68
68
|
return url.indexOf('blob:') === 0;
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Downloads a file, e.g., a text or readable stream, in the browser.
|
|
73
|
+
* Appropriate for downloading smaller file sizes, e.g., < 5 MB.
|
|
74
|
+
*
|
|
75
|
+
* Example usage:
|
|
76
|
+
*
|
|
77
|
+
* ```js
|
|
78
|
+
* const fileContent = JSON.stringify(
|
|
79
|
+
* {
|
|
80
|
+
* "title": "My Post",
|
|
81
|
+
* },
|
|
82
|
+
* null,
|
|
83
|
+
* 2
|
|
84
|
+
* );
|
|
85
|
+
* const fileName = 'file.json';
|
|
86
|
+
*
|
|
87
|
+
* downloadBlob( 'file.json', fileContent, 'application/json' );
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @param {string} filename File name.
|
|
91
|
+
* @param {BlobPart} content File content (BufferSource | Blob | string).
|
|
92
|
+
* @param {string} contentType (Optional) File mime type. Default is `''`.
|
|
93
|
+
*/
|
|
94
|
+
export function downloadBlob(filename, content, contentType = '') {
|
|
95
|
+
if (!filename || !content) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const file = new window.Blob([content], {
|
|
99
|
+
type: contentType
|
|
100
|
+
});
|
|
101
|
+
const url = window.URL.createObjectURL(file);
|
|
102
|
+
const anchorElement = document.createElement('a');
|
|
103
|
+
anchorElement.href = url;
|
|
104
|
+
anchorElement.download = filename;
|
|
105
|
+
anchorElement.style.display = 'none';
|
|
106
|
+
document.body.appendChild(anchorElement);
|
|
107
|
+
anchorElement.click();
|
|
108
|
+
document.body.removeChild(anchorElement);
|
|
109
|
+
window.URL.revokeObjectURL(url);
|
|
110
|
+
}
|
|
70
111
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["cache","createBlobURL","file","url","window","URL","createObjectURL","getBlobByURL","getBlobTypeByURL","type","split","revokeBlobURL","revokeObjectURL","isBlobURL","indexOf"],"sources":["@wordpress/blob/src/index.js"],"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|undefined} 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"],"mappings":"AAAA;AACA;AACA;AACA,MAAMA,KAAK,GAAG,CAAC,CAAC;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAEC,IAAI,EAAG;EACrC,MAAMC,GAAG,GAAGC,MAAM,CAACC,GAAG,CAACC,eAAe,CAAEJ,IAAK,CAAC;EAE9CF,KAAK,CAAEG,GAAG,CAAE,GAAGD,IAAI;EAEnB,OAAOC,GAAG;AACX;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,YAAYA,CAAEJ,GAAG,EAAG;EACnC,OAAOH,KAAK,CAAEG,GAAG,CAAE;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,gBAAgBA,CAAEL,GAAG,EAAG;EACvC,OAAOI,YAAY,CAAEJ,GAAI,CAAC,EAAEM,IAAI,CAACC,KAAK,CAAE,GAAI,CAAC,CAAE,CAAC,CAAE,CAAC,CAAC;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAER,GAAG,EAAG;EACpC,IAAKH,KAAK,CAAEG,GAAG,CAAE,EAAG;IACnBC,MAAM,CAACC,GAAG,CAACO,eAAe,CAAET,GAAI,CAAC;EAClC;EAEA,OAAOH,KAAK,CAAEG,GAAG,CAAE;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASU,SAASA,CAAEV,GAAG,EAAG;EAChC,IAAK,CAAEA,GAAG,IAAI,CAAEA,GAAG,CAACW,OAAO,EAAG;IAC7B,OAAO,KAAK;EACb;EACA,OAAOX,GAAG,CAACW,OAAO,CAAE,OAAQ,CAAC,KAAK,CAAC;AACpC"}
|
|
1
|
+
{"version":3,"names":["cache","createBlobURL","file","url","window","URL","createObjectURL","getBlobByURL","getBlobTypeByURL","type","split","revokeBlobURL","revokeObjectURL","isBlobURL","indexOf","downloadBlob","filename","content","contentType","Blob","anchorElement","document","createElement","href","download","style","display","body","appendChild","click","removeChild"],"sources":["@wordpress/blob/src/index.js"],"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|undefined} 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\n/**\n * Downloads a file, e.g., a text or readable stream, in the browser.\n * Appropriate for downloading smaller file sizes, e.g., < 5 MB.\n *\n * Example usage:\n *\n * ```js\n * \tconst fileContent = JSON.stringify(\n * \t\t{\n * \t\t\t\"title\": \"My Post\",\n * \t\t},\n * \t\tnull,\n * \t\t2\n * \t);\n * \tconst fileName = 'file.json';\n *\n * \tdownloadBlob( 'file.json', fileContent, 'application/json' );\n * ```\n *\n * @param {string} filename File name.\n * @param {BlobPart} content File content (BufferSource | Blob | string).\n * @param {string} contentType (Optional) File mime type. Default is `''`.\n */\nexport function downloadBlob( filename, content, contentType = '' ) {\n\tif ( ! filename || ! content ) {\n\t\treturn;\n\t}\n\n\tconst file = new window.Blob( [ content ], { type: contentType } );\n\tconst url = window.URL.createObjectURL( file );\n\tconst anchorElement = document.createElement( 'a' );\n\tanchorElement.href = url;\n\tanchorElement.download = filename;\n\tanchorElement.style.display = 'none';\n\tdocument.body.appendChild( anchorElement );\n\tanchorElement.click();\n\tdocument.body.removeChild( anchorElement );\n\twindow.URL.revokeObjectURL( url );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,MAAMA,KAAK,GAAG,CAAC,CAAC;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAEC,IAAI,EAAG;EACrC,MAAMC,GAAG,GAAGC,MAAM,CAACC,GAAG,CAACC,eAAe,CAAEJ,IAAK,CAAC;EAE9CF,KAAK,CAAEG,GAAG,CAAE,GAAGD,IAAI;EAEnB,OAAOC,GAAG;AACX;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,YAAYA,CAAEJ,GAAG,EAAG;EACnC,OAAOH,KAAK,CAAEG,GAAG,CAAE;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASK,gBAAgBA,CAAEL,GAAG,EAAG;EACvC,OAAOI,YAAY,CAAEJ,GAAI,CAAC,EAAEM,IAAI,CAACC,KAAK,CAAE,GAAI,CAAC,CAAE,CAAC,CAAE,CAAC,CAAC;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAER,GAAG,EAAG;EACpC,IAAKH,KAAK,CAAEG,GAAG,CAAE,EAAG;IACnBC,MAAM,CAACC,GAAG,CAACO,eAAe,CAAET,GAAI,CAAC;EAClC;EAEA,OAAOH,KAAK,CAAEG,GAAG,CAAE;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASU,SAASA,CAAEV,GAAG,EAAG;EAChC,IAAK,CAAEA,GAAG,IAAI,CAAEA,GAAG,CAACW,OAAO,EAAG;IAC7B,OAAO,KAAK;EACb;EACA,OAAOX,GAAG,CAACW,OAAO,CAAE,OAAQ,CAAC,KAAK,CAAC;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAEC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,GAAG,EAAE,EAAG;EACnE,IAAK,CAAEF,QAAQ,IAAI,CAAEC,OAAO,EAAG;IAC9B;EACD;EAEA,MAAMf,IAAI,GAAG,IAAIE,MAAM,CAACe,IAAI,CAAE,CAAEF,OAAO,CAAE,EAAE;IAAER,IAAI,EAAES;EAAY,CAAE,CAAC;EAClE,MAAMf,GAAG,GAAGC,MAAM,CAACC,GAAG,CAACC,eAAe,CAAEJ,IAAK,CAAC;EAC9C,MAAMkB,aAAa,GAAGC,QAAQ,CAACC,aAAa,CAAE,GAAI,CAAC;EACnDF,aAAa,CAACG,IAAI,GAAGpB,GAAG;EACxBiB,aAAa,CAACI,QAAQ,GAAGR,QAAQ;EACjCI,aAAa,CAACK,KAAK,CAACC,OAAO,GAAG,MAAM;EACpCL,QAAQ,CAACM,IAAI,CAACC,WAAW,CAAER,aAAc,CAAC;EAC1CA,aAAa,CAACS,KAAK,CAAC,CAAC;EACrBR,QAAQ,CAACM,IAAI,CAACG,WAAW,CAAEV,aAAc,CAAC;EAC1ChB,MAAM,CAACC,GAAG,CAACO,eAAe,CAAET,GAAI,CAAC;AAClC"}
|
package/build-types/index.d.ts
CHANGED
|
@@ -40,4 +40,28 @@ export function revokeBlobURL(url: string): void;
|
|
|
40
40
|
* @return {boolean} Is the url a blob url?
|
|
41
41
|
*/
|
|
42
42
|
export function isBlobURL(url: string | undefined): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Downloads a file, e.g., a text or readable stream, in the browser.
|
|
45
|
+
* Appropriate for downloading smaller file sizes, e.g., < 5 MB.
|
|
46
|
+
*
|
|
47
|
+
* Example usage:
|
|
48
|
+
*
|
|
49
|
+
* ```js
|
|
50
|
+
* const fileContent = JSON.stringify(
|
|
51
|
+
* {
|
|
52
|
+
* "title": "My Post",
|
|
53
|
+
* },
|
|
54
|
+
* null,
|
|
55
|
+
* 2
|
|
56
|
+
* );
|
|
57
|
+
* const fileName = 'file.json';
|
|
58
|
+
*
|
|
59
|
+
* downloadBlob( 'file.json', fileContent, 'application/json' );
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @param {string} filename File name.
|
|
63
|
+
* @param {BlobPart} content File content (BufferSource | Blob | string).
|
|
64
|
+
* @param {string} contentType (Optional) File mime type. Default is `''`.
|
|
65
|
+
*/
|
|
66
|
+
export function downloadBlob(filename: string, content: BlobPart, contentType?: string): void;
|
|
43
67
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,oCAJW,IAAI,GAEH,MAAM,CAQjB;AAED;;;;;;;;GAQG;AACH,kCAJW,MAAM,GAEL,IAAI,GAAC,SAAS,CAIzB;AAED;;;;;;;;GAQG;AACH,sCAJW,MAAM,GAEL,MAAM,GAAC,SAAS,CAI3B;AAED;;;;GAIG;AACH,mCAFW,MAAM,QAQhB;AAED;;;;;;GAMG;AACH,+BAJW,MAAM,GAAC,SAAS,GAEf,OAAO,CAOlB"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,oCAJW,IAAI,GAEH,MAAM,CAQjB;AAED;;;;;;;;GAQG;AACH,kCAJW,MAAM,GAEL,IAAI,GAAC,SAAS,CAIzB;AAED;;;;;;;;GAQG;AACH,sCAJW,MAAM,GAEL,MAAM,GAAC,SAAS,CAI3B;AAED;;;;GAIG;AACH,mCAFW,MAAM,QAQhB;AAED;;;;;;GAMG;AACH,+BAJW,MAAM,GAAC,SAAS,GAEf,OAAO,CAOlB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,uCAJW,MAAM,WACN,QAAQ,gBACR,MAAM,QAiBhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/blob",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.46.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": "839018ff6029ba749780e288e08ff9cd898e50e8"
|
|
36
36
|
}
|
package/src/index.js
CHANGED
|
@@ -70,3 +70,43 @@ export function isBlobURL( url ) {
|
|
|
70
70
|
}
|
|
71
71
|
return url.indexOf( 'blob:' ) === 0;
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Downloads a file, e.g., a text or readable stream, in the browser.
|
|
76
|
+
* Appropriate for downloading smaller file sizes, e.g., < 5 MB.
|
|
77
|
+
*
|
|
78
|
+
* Example usage:
|
|
79
|
+
*
|
|
80
|
+
* ```js
|
|
81
|
+
* const fileContent = JSON.stringify(
|
|
82
|
+
* {
|
|
83
|
+
* "title": "My Post",
|
|
84
|
+
* },
|
|
85
|
+
* null,
|
|
86
|
+
* 2
|
|
87
|
+
* );
|
|
88
|
+
* const fileName = 'file.json';
|
|
89
|
+
*
|
|
90
|
+
* downloadBlob( 'file.json', fileContent, 'application/json' );
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @param {string} filename File name.
|
|
94
|
+
* @param {BlobPart} content File content (BufferSource | Blob | string).
|
|
95
|
+
* @param {string} contentType (Optional) File mime type. Default is `''`.
|
|
96
|
+
*/
|
|
97
|
+
export function downloadBlob( filename, content, contentType = '' ) {
|
|
98
|
+
if ( ! filename || ! content ) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const file = new window.Blob( [ content ], { type: contentType } );
|
|
103
|
+
const url = window.URL.createObjectURL( file );
|
|
104
|
+
const anchorElement = document.createElement( 'a' );
|
|
105
|
+
anchorElement.href = url;
|
|
106
|
+
anchorElement.download = filename;
|
|
107
|
+
anchorElement.style.display = 'none';
|
|
108
|
+
document.body.appendChild( anchorElement );
|
|
109
|
+
anchorElement.click();
|
|
110
|
+
document.body.removeChild( anchorElement );
|
|
111
|
+
window.URL.revokeObjectURL( url );
|
|
112
|
+
}
|
package/src/test/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { isBlobURL, getBlobTypeByURL } from '../';
|
|
4
|
+
import { isBlobURL, getBlobTypeByURL, downloadBlob } from '../';
|
|
5
5
|
|
|
6
6
|
describe( 'isBlobURL', () => {
|
|
7
7
|
it( 'returns true if the url starts with "blob:"', () => {
|
|
@@ -26,3 +26,60 @@ describe( 'getBlobTypeByURL', () => {
|
|
|
26
26
|
expect( getBlobTypeByURL() ).toBe( undefined );
|
|
27
27
|
} );
|
|
28
28
|
} );
|
|
29
|
+
|
|
30
|
+
describe( 'downloadBlob', () => {
|
|
31
|
+
const originalURL = window.URL;
|
|
32
|
+
const createObjectURL = jest.fn().mockReturnValue( 'blob:pannacotta' );
|
|
33
|
+
const revokeObjectURL = jest.fn().mockReturnValue( false );
|
|
34
|
+
const mockAnchorElement = document.createElement( 'a' );
|
|
35
|
+
mockAnchorElement.click = jest.fn();
|
|
36
|
+
const createElementSpy = jest
|
|
37
|
+
.spyOn( global.document, 'createElement' )
|
|
38
|
+
.mockReturnValue( mockAnchorElement );
|
|
39
|
+
const mockBlob = jest.fn();
|
|
40
|
+
const blobSpy = jest.spyOn( window, 'Blob' ).mockReturnValue( mockBlob );
|
|
41
|
+
jest.spyOn( document.body, 'appendChild' );
|
|
42
|
+
jest.spyOn( document.body, 'removeChild' );
|
|
43
|
+
beforeEach( () => {
|
|
44
|
+
// Can't seem to spy on these static methods. They are `undefined`.
|
|
45
|
+
// Possibly overwritten: https://github.com/WordPress/gutenberg/blob/trunk/packages/jest-preset-default/scripts/setup-globals.js#L5
|
|
46
|
+
window.URL = {
|
|
47
|
+
createObjectURL,
|
|
48
|
+
revokeObjectURL,
|
|
49
|
+
};
|
|
50
|
+
} );
|
|
51
|
+
|
|
52
|
+
afterAll( () => {
|
|
53
|
+
window.URL = originalURL;
|
|
54
|
+
} );
|
|
55
|
+
|
|
56
|
+
it( 'requires a filename argument', () => {
|
|
57
|
+
downloadBlob( '', '{}', 'application/json' );
|
|
58
|
+
expect( blobSpy ).not.toHaveBeenCalled();
|
|
59
|
+
} );
|
|
60
|
+
|
|
61
|
+
it( 'requires a content argument', () => {
|
|
62
|
+
downloadBlob( 'text.txt', '', 'text/plain' );
|
|
63
|
+
expect( blobSpy ).not.toHaveBeenCalled();
|
|
64
|
+
} );
|
|
65
|
+
|
|
66
|
+
it( 'constructs an anchor element with attributes and removes it', () => {
|
|
67
|
+
downloadBlob( 'filename.json', '{}', 'application/json' );
|
|
68
|
+
expect( blobSpy ).toHaveBeenCalledWith( [ '{}' ], {
|
|
69
|
+
type: 'application/json',
|
|
70
|
+
} );
|
|
71
|
+
expect( createObjectURL ).toHaveBeenCalledWith( mockBlob );
|
|
72
|
+
expect( createElementSpy ).toHaveBeenCalledWith( 'a' );
|
|
73
|
+
expect( mockAnchorElement.download ).toBe( 'filename.json' );
|
|
74
|
+
expect( mockAnchorElement.href ).toBe( 'blob:pannacotta' );
|
|
75
|
+
expect( mockAnchorElement ).toHaveStyle( 'display:none' );
|
|
76
|
+
expect( document.body.appendChild ).toHaveBeenCalledWith(
|
|
77
|
+
mockAnchorElement
|
|
78
|
+
);
|
|
79
|
+
expect( mockAnchorElement.click ).toHaveBeenCalledTimes( 1 );
|
|
80
|
+
expect( document.body.removeChild ).toHaveBeenCalledWith(
|
|
81
|
+
mockAnchorElement
|
|
82
|
+
);
|
|
83
|
+
expect( revokeObjectURL ).toHaveBeenCalled();
|
|
84
|
+
} );
|
|
85
|
+
} );
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","./src/index.js"],"fileInfos":[{"version":"f59215c5f1d886b05395ee7aca73e0ac69ddfad2843aa88530e797879d511bad","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","27147504487dc1159369da4f4da8a26406364624fa9bc3db632f7d94a5bae2c3","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","f4e736d6c8d69ae5b3ab0ddfcaa3dc365c3e76909d6660af5b4e979b3934ac20","eeeb3aca31fbadef8b82502484499dfd1757204799a6f5b33116201c810676ec",{"version":"3dda5344576193a4ae48b8d03f105c86f20b2f2aff0a1d1fd7935f5d68649654","affectsGlobalScope":true},{"version":"9d9885c728913c1d16e0d2831b40341d6ad9a0ceecaabc55209b306ad9c736a5","affectsGlobalScope":true},{"version":"17bea081b9c0541f39dd1ae9bc8c78bdd561879a682e60e2f25f688c0ecab248","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"ab22100fdd0d24cfc2cc59d0a00fc8cf449830d9c4030dc54390a46bd562e929","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"36ae84ccc0633f7c0787bc6108386c8b773e95d3b052d9464a99cd9b8795fbec","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"c4138a3dd7cd6cf1f363ca0f905554e8d81b45844feea17786cdf1626cb8ea06","affectsGlobalScope":true},{"version":"6ff3e2452b055d8f0ec026511c6582b55d935675af67cdb67dd1dc671e8065df","affectsGlobalScope":true},{"version":"03de17b810f426a2f47396b0b99b53a82c1b60e9cba7a7edda47f9bb077882f4","affectsGlobalScope":true},{"version":"8184c6ddf48f0c98429326b428478ecc6143c27f79b79e85740f17e6feb090f1","affectsGlobalScope":true},{"version":"261c4d2cf86ac5a89ad3fb3fafed74cbb6f2f7c1d139b0540933df567d64a6ca","affectsGlobalScope":true},{"version":"6af1425e9973f4924fca986636ac19a0cf9909a7e0d9d3009c349e6244e957b6","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"15a630d6817718a2ddd7088c4f83e4673fde19fa992d2eae2cf51132a302a5d3","affectsGlobalScope":true},{"version":"f06948deb2a51aae25184561c9640fb66afeddb34531a9212d011792b1d19e0a","affectsGlobalScope":true},{"version":"01e0ee7e1f661acedb08b51f8a9b7d7f959e9cdb6441360f06522cc3aea1bf2e","affectsGlobalScope":true},{"version":"ac17a97f816d53d9dd79b0d235e1c0ed54a8cc6a0677e9a3d61efb480b2a3e4e","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"9cc66b0513ad41cb5f5372cca86ef83a0d37d1c1017580b7dace3ea5661836df","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"709efdae0cb5df5f49376cde61daacc95cdd44ae4671da13a540da5088bf3f30","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"61ed9b6d07af959e745fb11f9593ecd743b279418cc8a99448ea3cd5f3b3eb22","affectsGlobalScope":true},{"version":"038a2f66a34ee7a9c2fbc3584c8ab43dff2995f8c68e3f566f4c300d2175e31e","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"f5c92f2c27b06c1a41b88f6db8299205aee52c2a2943f7ed29bd585977f254e8","affectsGlobalScope":true},{"version":"930b0e15811f84e203d3c23508674d5ded88266df4b10abee7b31b2ac77632d2","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"b9ea5778ff8b50d7c04c9890170db34c26a5358cccba36844fe319f50a43a61a","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"25de46552b782d43cb7284df22fe2a265de387cf0248b747a7a1b647d81861f6","affectsGlobalScope":true},{"version":"307c8b7ebbd7f23a92b73a4c6c0a697beca05b06b036c23a34553e5fe65e4fdc","affectsGlobalScope":true},{"version":"189c0703923150aa30673fa3de411346d727cc44a11c75d05d7cf9ef095daa22","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"7771552f6fcbac4befcfe6064d2216a9b381fc27d1a6b1527232d8f114397f00","signature":"9692cf6c6727f208af91a1710ca3c5d753672429e7e3d43a1b045d34617b3fec"}],"root":[61],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[59,60,12,14,13,2,15,16,17,18,19,20,21,22,3,4,26,23,24,25,27,28,29,5,30,31,32,33,6,37,34,35,36,38,7,39,44,45,40,41,42,43,8,49,46,47,48,50,9,51,52,53,56,54,55,57,10,1,11,58,61],"latestChangedDtsFile":"./build-types/index.d.ts"},"version":"5.1.6"}
|
|
1
|
+
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","./src/index.js"],"fileInfos":[{"version":"f59215c5f1d886b05395ee7aca73e0ac69ddfad2843aa88530e797879d511bad","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","27147504487dc1159369da4f4da8a26406364624fa9bc3db632f7d94a5bae2c3","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","f4e736d6c8d69ae5b3ab0ddfcaa3dc365c3e76909d6660af5b4e979b3934ac20","eeeb3aca31fbadef8b82502484499dfd1757204799a6f5b33116201c810676ec",{"version":"3dda5344576193a4ae48b8d03f105c86f20b2f2aff0a1d1fd7935f5d68649654","affectsGlobalScope":true},{"version":"9d9885c728913c1d16e0d2831b40341d6ad9a0ceecaabc55209b306ad9c736a5","affectsGlobalScope":true},{"version":"17bea081b9c0541f39dd1ae9bc8c78bdd561879a682e60e2f25f688c0ecab248","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"ab22100fdd0d24cfc2cc59d0a00fc8cf449830d9c4030dc54390a46bd562e929","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"36ae84ccc0633f7c0787bc6108386c8b773e95d3b052d9464a99cd9b8795fbec","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"c4138a3dd7cd6cf1f363ca0f905554e8d81b45844feea17786cdf1626cb8ea06","affectsGlobalScope":true},{"version":"6ff3e2452b055d8f0ec026511c6582b55d935675af67cdb67dd1dc671e8065df","affectsGlobalScope":true},{"version":"03de17b810f426a2f47396b0b99b53a82c1b60e9cba7a7edda47f9bb077882f4","affectsGlobalScope":true},{"version":"8184c6ddf48f0c98429326b428478ecc6143c27f79b79e85740f17e6feb090f1","affectsGlobalScope":true},{"version":"261c4d2cf86ac5a89ad3fb3fafed74cbb6f2f7c1d139b0540933df567d64a6ca","affectsGlobalScope":true},{"version":"6af1425e9973f4924fca986636ac19a0cf9909a7e0d9d3009c349e6244e957b6","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"15a630d6817718a2ddd7088c4f83e4673fde19fa992d2eae2cf51132a302a5d3","affectsGlobalScope":true},{"version":"f06948deb2a51aae25184561c9640fb66afeddb34531a9212d011792b1d19e0a","affectsGlobalScope":true},{"version":"01e0ee7e1f661acedb08b51f8a9b7d7f959e9cdb6441360f06522cc3aea1bf2e","affectsGlobalScope":true},{"version":"ac17a97f816d53d9dd79b0d235e1c0ed54a8cc6a0677e9a3d61efb480b2a3e4e","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"9cc66b0513ad41cb5f5372cca86ef83a0d37d1c1017580b7dace3ea5661836df","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"709efdae0cb5df5f49376cde61daacc95cdd44ae4671da13a540da5088bf3f30","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"61ed9b6d07af959e745fb11f9593ecd743b279418cc8a99448ea3cd5f3b3eb22","affectsGlobalScope":true},{"version":"038a2f66a34ee7a9c2fbc3584c8ab43dff2995f8c68e3f566f4c300d2175e31e","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"f5c92f2c27b06c1a41b88f6db8299205aee52c2a2943f7ed29bd585977f254e8","affectsGlobalScope":true},{"version":"930b0e15811f84e203d3c23508674d5ded88266df4b10abee7b31b2ac77632d2","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"b9ea5778ff8b50d7c04c9890170db34c26a5358cccba36844fe319f50a43a61a","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"25de46552b782d43cb7284df22fe2a265de387cf0248b747a7a1b647d81861f6","affectsGlobalScope":true},{"version":"307c8b7ebbd7f23a92b73a4c6c0a697beca05b06b036c23a34553e5fe65e4fdc","affectsGlobalScope":true},{"version":"189c0703923150aa30673fa3de411346d727cc44a11c75d05d7cf9ef095daa22","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"cd540180da4dc174b7c2a452ab6009b605e1271ee22116566868d5de182227b1","signature":"b98d8eea1b3a36eaa3421a05013e32892926c73f3cda51afa1717f67e8305b0d"}],"root":[61],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[59,60,12,14,13,2,15,16,17,18,19,20,21,22,3,4,26,23,24,25,27,28,29,5,30,31,32,33,6,37,34,35,36,38,7,39,44,45,40,41,42,43,8,49,46,47,48,50,9,51,52,53,56,54,55,57,10,1,11,58,61],"latestChangedDtsFile":"./build-types/index.d.ts"},"version":"5.1.6"}
|