@wordpress/list-reusable-blocks 5.42.0 → 5.43.1-next.v.202604091042.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
CHANGED
package/build/utils/import.cjs
CHANGED
|
@@ -39,7 +39,7 @@ async function importReusableBlock(file) {
|
|
|
39
39
|
let parsedContent;
|
|
40
40
|
try {
|
|
41
41
|
parsedContent = JSON.parse(fileContent);
|
|
42
|
-
} catch
|
|
42
|
+
} catch {
|
|
43
43
|
throw new Error("Invalid JSON file");
|
|
44
44
|
}
|
|
45
45
|
if (parsedContent.__file !== "wp_block" || !parsedContent.title || !parsedContent.content || typeof parsedContent.title !== "string" || typeof parsedContent.content !== "string" || parsedContent.syncStatus && typeof parsedContent.syncStatus !== "string") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/import.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { readTextFile } from './file';\n\n/**\n * Import a reusable block from a JSON file.\n *\n * @param {File} file File.\n * @return {Promise} Promise returning the imported reusable block.\n */\nasync function importReusableBlock( file ) {\n\tconst fileContent = await readTextFile( file );\n\tlet parsedContent;\n\ttry {\n\t\tparsedContent = JSON.parse( fileContent );\n\t} catch
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAqB;AAKrB,kBAA6B;AAQ7B,eAAe,oBAAqB,MAAO;AAC1C,QAAM,cAAc,UAAM,0BAAc,IAAK;AAC7C,MAAI;AACJ,MAAI;AACH,oBAAgB,KAAK,MAAO,WAAY;AAAA,EACzC,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { readTextFile } from './file';\n\n/**\n * Import a reusable block from a JSON file.\n *\n * @param {File} file File.\n * @return {Promise} Promise returning the imported reusable block.\n */\nasync function importReusableBlock( file ) {\n\tconst fileContent = await readTextFile( file );\n\tlet parsedContent;\n\ttry {\n\t\tparsedContent = JSON.parse( fileContent );\n\t} catch {\n\t\tthrow new Error( 'Invalid JSON file' );\n\t}\n\tif (\n\t\tparsedContent.__file !== 'wp_block' ||\n\t\t! parsedContent.title ||\n\t\t! parsedContent.content ||\n\t\ttypeof parsedContent.title !== 'string' ||\n\t\ttypeof parsedContent.content !== 'string' ||\n\t\t( parsedContent.syncStatus &&\n\t\t\ttypeof parsedContent.syncStatus !== 'string' )\n\t) {\n\t\tthrow new Error( 'Invalid pattern JSON file' );\n\t}\n\tconst postType = await apiFetch( { path: `/wp/v2/types/wp_block` } );\n\tconst reusableBlock = await apiFetch( {\n\t\tpath: `/wp/v2/${ postType.rest_base }`,\n\t\tdata: {\n\t\t\ttitle: parsedContent.title,\n\t\t\tcontent: parsedContent.content,\n\t\t\tstatus: 'publish',\n\t\t\tmeta:\n\t\t\t\tparsedContent.syncStatus === 'unsynced'\n\t\t\t\t\t? { wp_pattern_sync_status: parsedContent.syncStatus }\n\t\t\t\t\t: undefined,\n\t\t},\n\t\tmethod: 'POST',\n\t} );\n\n\treturn reusableBlock;\n}\n\nexport default importReusableBlock;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAqB;AAKrB,kBAA6B;AAQ7B,eAAe,oBAAqB,MAAO;AAC1C,QAAM,cAAc,UAAM,0BAAc,IAAK;AAC7C,MAAI;AACJ,MAAI;AACH,oBAAgB,KAAK,MAAO,WAAY;AAAA,EACzC,QAAQ;AACP,UAAM,IAAI,MAAO,mBAAoB;AAAA,EACtC;AACA,MACC,cAAc,WAAW,cACzB,CAAE,cAAc,SAChB,CAAE,cAAc,WAChB,OAAO,cAAc,UAAU,YAC/B,OAAO,cAAc,YAAY,YAC/B,cAAc,cACf,OAAO,cAAc,eAAe,UACpC;AACD,UAAM,IAAI,MAAO,2BAA4B;AAAA,EAC9C;AACA,QAAM,WAAW,UAAM,iBAAAA,SAAU,EAAE,MAAM,wBAAwB,CAAE;AACnE,QAAM,gBAAgB,UAAM,iBAAAA,SAAU;AAAA,IACrC,MAAM,UAAW,SAAS,SAAU;AAAA,IACpC,MAAM;AAAA,MACL,OAAO,cAAc;AAAA,MACrB,SAAS,cAAc;AAAA,MACvB,QAAQ;AAAA,MACR,MACC,cAAc,eAAe,aAC1B,EAAE,wBAAwB,cAAc,WAAW,IACnD;AAAA,IACL;AAAA,IACA,QAAQ;AAAA,EACT,CAAE;AAEF,SAAO;AACR;AAEA,IAAO,iBAAQ;",
|
|
6
6
|
"names": ["apiFetch"]
|
|
7
7
|
}
|
|
@@ -6,7 +6,7 @@ async function importReusableBlock(file) {
|
|
|
6
6
|
let parsedContent;
|
|
7
7
|
try {
|
|
8
8
|
parsedContent = JSON.parse(fileContent);
|
|
9
|
-
} catch
|
|
9
|
+
} catch {
|
|
10
10
|
throw new Error("Invalid JSON file");
|
|
11
11
|
}
|
|
12
12
|
if (parsedContent.__file !== "wp_block" || !parsedContent.title || !parsedContent.content || typeof parsedContent.title !== "string" || typeof parsedContent.content !== "string" || parsedContent.syncStatus && typeof parsedContent.syncStatus !== "string") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/import.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { readTextFile } from './file';\n\n/**\n * Import a reusable block from a JSON file.\n *\n * @param {File} file File.\n * @return {Promise} Promise returning the imported reusable block.\n */\nasync function importReusableBlock( file ) {\n\tconst fileContent = await readTextFile( file );\n\tlet parsedContent;\n\ttry {\n\t\tparsedContent = JSON.parse( fileContent );\n\t} catch
|
|
5
|
-
"mappings": ";AAGA,OAAO,cAAc;AAKrB,SAAS,oBAAoB;AAQ7B,eAAe,oBAAqB,MAAO;AAC1C,QAAM,cAAc,MAAM,aAAc,IAAK;AAC7C,MAAI;AACJ,MAAI;AACH,oBAAgB,KAAK,MAAO,WAAY;AAAA,EACzC,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { readTextFile } from './file';\n\n/**\n * Import a reusable block from a JSON file.\n *\n * @param {File} file File.\n * @return {Promise} Promise returning the imported reusable block.\n */\nasync function importReusableBlock( file ) {\n\tconst fileContent = await readTextFile( file );\n\tlet parsedContent;\n\ttry {\n\t\tparsedContent = JSON.parse( fileContent );\n\t} catch {\n\t\tthrow new Error( 'Invalid JSON file' );\n\t}\n\tif (\n\t\tparsedContent.__file !== 'wp_block' ||\n\t\t! parsedContent.title ||\n\t\t! parsedContent.content ||\n\t\ttypeof parsedContent.title !== 'string' ||\n\t\ttypeof parsedContent.content !== 'string' ||\n\t\t( parsedContent.syncStatus &&\n\t\t\ttypeof parsedContent.syncStatus !== 'string' )\n\t) {\n\t\tthrow new Error( 'Invalid pattern JSON file' );\n\t}\n\tconst postType = await apiFetch( { path: `/wp/v2/types/wp_block` } );\n\tconst reusableBlock = await apiFetch( {\n\t\tpath: `/wp/v2/${ postType.rest_base }`,\n\t\tdata: {\n\t\t\ttitle: parsedContent.title,\n\t\t\tcontent: parsedContent.content,\n\t\t\tstatus: 'publish',\n\t\t\tmeta:\n\t\t\t\tparsedContent.syncStatus === 'unsynced'\n\t\t\t\t\t? { wp_pattern_sync_status: parsedContent.syncStatus }\n\t\t\t\t\t: undefined,\n\t\t},\n\t\tmethod: 'POST',\n\t} );\n\n\treturn reusableBlock;\n}\n\nexport default importReusableBlock;\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,cAAc;AAKrB,SAAS,oBAAoB;AAQ7B,eAAe,oBAAqB,MAAO;AAC1C,QAAM,cAAc,MAAM,aAAc,IAAK;AAC7C,MAAI;AACJ,MAAI;AACH,oBAAgB,KAAK,MAAO,WAAY;AAAA,EACzC,QAAQ;AACP,UAAM,IAAI,MAAO,mBAAoB;AAAA,EACtC;AACA,MACC,cAAc,WAAW,cACzB,CAAE,cAAc,SAChB,CAAE,cAAc,WAChB,OAAO,cAAc,UAAU,YAC/B,OAAO,cAAc,YAAY,YAC/B,cAAc,cACf,OAAO,cAAc,eAAe,UACpC;AACD,UAAM,IAAI,MAAO,2BAA4B;AAAA,EAC9C;AACA,QAAM,WAAW,MAAM,SAAU,EAAE,MAAM,wBAAwB,CAAE;AACnE,QAAM,gBAAgB,MAAM,SAAU;AAAA,IACrC,MAAM,UAAW,SAAS,SAAU;AAAA,IACpC,MAAM;AAAA,MACL,OAAO,cAAc;AAAA,MACrB,SAAS,cAAc;AAAA,MACvB,QAAQ;AAAA,MACR,MACC,cAAc,eAAe,aAC1B,EAAE,wBAAwB,cAAc,WAAW,IACnD;AAAA,IACL;AAAA,IACA,QAAQ;AAAA,EACT,CAAE;AAEF,SAAO;AACR;AAEA,IAAO,iBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/list-reusable-blocks",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.43.1-next.v.202604091042.0+668146787",
|
|
4
4
|
"description": "Adding Export/Import support to the reusable blocks listing.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
},
|
|
44
44
|
"wpScript": true,
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@wordpress/api-fetch": "^7.
|
|
47
|
-
"@wordpress/base-styles": "^6.
|
|
48
|
-
"@wordpress/blob": "^4.
|
|
49
|
-
"@wordpress/components": "^32.
|
|
50
|
-
"@wordpress/compose": "^7.
|
|
51
|
-
"@wordpress/element": "^6.
|
|
52
|
-
"@wordpress/i18n": "^6.
|
|
46
|
+
"@wordpress/api-fetch": "^7.43.1-next.v.202604091042.0+668146787",
|
|
47
|
+
"@wordpress/base-styles": "^6.19.1-next.v.202604091042.0+668146787",
|
|
48
|
+
"@wordpress/blob": "^4.43.1-next.v.202604091042.0+668146787",
|
|
49
|
+
"@wordpress/components": "^32.5.2-next.v.202604091042.0+668146787",
|
|
50
|
+
"@wordpress/compose": "^7.43.1-next.v.202604091042.0+668146787",
|
|
51
|
+
"@wordpress/element": "^6.44.1-next.v.202604091042.0+668146787",
|
|
52
|
+
"@wordpress/i18n": "^6.17.1-next.v.202604091042.0+668146787",
|
|
53
53
|
"change-case": "^4.1.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "73606df74f1c38a084bfa5db97205259ef817593"
|
|
63
63
|
}
|