@wordpress/preferences-persistence 3.1.0 → 3.3.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/build/create/index.cjs +12 -10
- package/build/create/index.cjs.map +1 -1
- package/build/get-newest-data.cjs +9 -7
- package/build/get-newest-data.cjs.map +1 -1
- package/build/index.cjs +10 -8
- package/build/index.cjs.map +1 -1
- package/build/migrations/legacy-local-storage-data/index.cjs +14 -12
- package/build/migrations/legacy-local-storage-data/index.cjs.map +1 -1
- package/build/migrations/preferences-package-data/convert-editor-settings.cjs +8 -6
- package/build/migrations/preferences-package-data/convert-editor-settings.cjs.map +1 -1
- package/build/migrations/preferences-package-data/index.cjs +9 -7
- package/build/migrations/preferences-package-data/index.cjs.map +1 -1
- package/package.json +5 -5
package/build/create/index.cjs
CHANGED
|
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
11
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
12
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
15
|
-
key
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
16
|
+
desc = __getOwnPropDesc(from, key);
|
|
17
|
+
__defProp(to, key, {
|
|
18
|
+
get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
|
|
19
|
+
enumerable: !desc || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
return to;
|
|
22
24
|
};
|
|
@@ -25,14 +27,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
27
|
enumerable: true
|
|
26
28
|
}) : target, mod));
|
|
27
29
|
let _wordpress_api_fetch = require("@wordpress/api-fetch");
|
|
28
|
-
_wordpress_api_fetch = __toESM(_wordpress_api_fetch);
|
|
29
30
|
let __debounce_async_ts = require("./debounce-async.cjs");
|
|
30
|
-
__debounce_async_ts = __toESM(__debounce_async_ts);
|
|
31
31
|
let ___get_newest_data_ts = require("../get-newest-data.cjs");
|
|
32
|
-
___get_newest_data_ts = __toESM(___get_newest_data_ts);
|
|
33
32
|
let ___is_preferences_data_ts = require("../is-preferences-data.cjs");
|
|
34
|
-
___is_preferences_data_ts = __toESM(___is_preferences_data_ts);
|
|
35
33
|
let ___local_storage_ts = require("../local-storage.cjs");
|
|
34
|
+
_wordpress_api_fetch = __toESM(_wordpress_api_fetch);
|
|
35
|
+
__debounce_async_ts = __toESM(__debounce_async_ts);
|
|
36
|
+
___get_newest_data_ts = __toESM(___get_newest_data_ts);
|
|
37
|
+
___is_preferences_data_ts = __toESM(___is_preferences_data_ts);
|
|
36
38
|
// packages/preferences-persistence/src/create/index.ts
|
|
37
39
|
/**
|
|
38
40
|
* Creates a persistence layer that stores data in WordPress user meta via the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["isPreferencesData","debounceAsync","apiFetch","getNewestData"],"sources":["../../src/create/index.ts"],"sourcesContent":["import apiFetch from '@wordpress/api-fetch';\nimport debounceAsync from './debounce-async';\nimport getNewestData from '../get-newest-data';\nimport isPreferencesData from '../is-preferences-data';\nimport { writeStoredJSON } from '../local-storage';\nimport type {\n\tCreateOptions,\n\tPersistenceLayer,\n\tPreferencesData,\n} from '../types';\n\n/**\n * Creates a persistence layer that stores data in WordPress user meta via the\n * REST API.\n *\n * @param {CreateOptions} [options]\n * @param {PreferencesData|null} [options.preloadedData] Any persisted preferences data that should be preloaded.\n * When set, the persistence layer will avoid fetching data\n * from the REST API.\n * @param {string} [options.localStorageRestoreKey] The key to use for restoring the localStorage backup, used\n * when the persistence layer calls `localStorage.getItem` or\n * `localStorage.setItem`.\n * @param {number} [options.requestDebounceMS] Debounce requests to the API so that they only occur at\n * minimum every `requestDebounceMS` milliseconds, and don't\n * swamp the server. Defaults to 2500ms.\n *\n * @return A persistence layer for WordPress user meta.\n */\nexport default function create( {\n\tpreloadedData,\n\tlocalStorageRestoreKey = 'WP_PREFERENCES_RESTORE_DATA',\n\trequestDebounceMS = 2500,\n}: CreateOptions = {} ): PersistenceLayer {\n\tlet cache = isPreferencesData( preloadedData ) ? preloadedData : undefined;\n\tconst debouncedApiFetch = debounceAsync( apiFetch, requestDebounceMS );\n\n\tasync function get() {\n\t\tif ( cache ) {\n\t\t\treturn cache;\n\t\t}\n\n\t\tconst user = await apiFetch< {\n\t\t\tmeta?: { persisted_preferences?: unknown };\n\t\t} >( {\n\t\t\tpath: '/wp/v2/users/me?context=edit',\n\t\t} );\n\n\t\tcache =\n\t\t\tgetNewestData(\n\t\t\t\tuser?.meta?.persisted_preferences,\n\t\t\t\tlocalStorageRestoreKey\n\t\t\t) ?? {};\n\n\t\treturn cache;\n\t}\n\n\tfunction set( newData: PreferencesData ) {\n\t\tconst dataWithTimestamp = {\n\t\t\t...newData,\n\t\t\t_modified: new Date().toISOString(),\n\t\t};\n\t\tcache = dataWithTimestamp;\n\n\t\t// Store data in local storage as a fallback. If for some reason the\n\t\t// api request does not complete or becomes unavailable, this data\n\t\t// can be used to restore preferences.\n\t\twriteStoredJSON( localStorageRestoreKey, dataWithTimestamp );\n\n\t\t// The user meta endpoint seems susceptible to errors when consecutive\n\t\t// requests are made in quick succession. Ensure there's a gap between\n\t\t// any consecutive requests.\n\t\t//\n\t\t// Catch and do nothing with errors from the REST API.\n\t\tdebouncedApiFetch( {\n\t\t\tpath: '/wp/v2/users/me',\n\t\t\tmethod: 'PUT',\n\t\t\t// `keepalive` will still send the request in the background,\n\t\t\t// even when a browser unload event might interrupt it.\n\t\t\t// This should hopefully make things more resilient.\n\t\t\t// This does have a size limit of 64kb, but the data is usually\n\t\t\t// much less.\n\t\t\tkeepalive: true,\n\t\t\tdata: {\n\t\t\t\tmeta: {\n\t\t\t\t\tpersisted_preferences: dataWithTimestamp,\n\t\t\t\t},\n\t\t\t},\n\t\t} ).catch( () => {} );\n\t}\n\n\treturn {\n\t\tget,\n\t\tset,\n\t};\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["isPreferencesData","debounceAsync","apiFetch","getNewestData","writeStoredJSON"],"sources":["../../src/create/index.ts"],"sourcesContent":["import apiFetch from '@wordpress/api-fetch';\nimport debounceAsync from './debounce-async';\nimport getNewestData from '../get-newest-data';\nimport isPreferencesData from '../is-preferences-data';\nimport { writeStoredJSON } from '../local-storage';\nimport type {\n\tCreateOptions,\n\tPersistenceLayer,\n\tPreferencesData,\n} from '../types';\n\n/**\n * Creates a persistence layer that stores data in WordPress user meta via the\n * REST API.\n *\n * @param {CreateOptions} [options]\n * @param {PreferencesData|null} [options.preloadedData] Any persisted preferences data that should be preloaded.\n * When set, the persistence layer will avoid fetching data\n * from the REST API.\n * @param {string} [options.localStorageRestoreKey] The key to use for restoring the localStorage backup, used\n * when the persistence layer calls `localStorage.getItem` or\n * `localStorage.setItem`.\n * @param {number} [options.requestDebounceMS] Debounce requests to the API so that they only occur at\n * minimum every `requestDebounceMS` milliseconds, and don't\n * swamp the server. Defaults to 2500ms.\n *\n * @return A persistence layer for WordPress user meta.\n */\nexport default function create( {\n\tpreloadedData,\n\tlocalStorageRestoreKey = 'WP_PREFERENCES_RESTORE_DATA',\n\trequestDebounceMS = 2500,\n}: CreateOptions = {} ): PersistenceLayer {\n\tlet cache = isPreferencesData( preloadedData ) ? preloadedData : undefined;\n\tconst debouncedApiFetch = debounceAsync( apiFetch, requestDebounceMS );\n\n\tasync function get() {\n\t\tif ( cache ) {\n\t\t\treturn cache;\n\t\t}\n\n\t\tconst user = await apiFetch< {\n\t\t\tmeta?: { persisted_preferences?: unknown };\n\t\t} >( {\n\t\t\tpath: '/wp/v2/users/me?context=edit',\n\t\t} );\n\n\t\tcache =\n\t\t\tgetNewestData(\n\t\t\t\tuser?.meta?.persisted_preferences,\n\t\t\t\tlocalStorageRestoreKey\n\t\t\t) ?? {};\n\n\t\treturn cache;\n\t}\n\n\tfunction set( newData: PreferencesData ) {\n\t\tconst dataWithTimestamp = {\n\t\t\t...newData,\n\t\t\t_modified: new Date().toISOString(),\n\t\t};\n\t\tcache = dataWithTimestamp;\n\n\t\t// Store data in local storage as a fallback. If for some reason the\n\t\t// api request does not complete or becomes unavailable, this data\n\t\t// can be used to restore preferences.\n\t\twriteStoredJSON( localStorageRestoreKey, dataWithTimestamp );\n\n\t\t// The user meta endpoint seems susceptible to errors when consecutive\n\t\t// requests are made in quick succession. Ensure there's a gap between\n\t\t// any consecutive requests.\n\t\t//\n\t\t// Catch and do nothing with errors from the REST API.\n\t\tdebouncedApiFetch( {\n\t\t\tpath: '/wp/v2/users/me',\n\t\t\tmethod: 'PUT',\n\t\t\t// `keepalive` will still send the request in the background,\n\t\t\t// even when a browser unload event might interrupt it.\n\t\t\t// This should hopefully make things more resilient.\n\t\t\t// This does have a size limit of 64kb, but the data is usually\n\t\t\t// much less.\n\t\t\tkeepalive: true,\n\t\t\tdata: {\n\t\t\t\tmeta: {\n\t\t\t\t\tpersisted_preferences: dataWithTimestamp,\n\t\t\t\t},\n\t\t\t},\n\t\t} ).catch( () => {} );\n\t}\n\n\treturn {\n\t\tget,\n\t\tset,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAwB,OAAQ,EAC/B,eACA,yBAAyB,+BACzB,oBAAoB,SACF,CAAC,GAAsB;CACzC,IAAI,SAAA,GAAQA,0BAAAA,QAAAA,CAAmB,aAAc,IAAI,gBAAgB,KAAA;CACjE,MAAM,qBAAA,GAAoBC,oBAAAA,QAAAA,CAAeC,qBAAAA,SAAU,iBAAkB;CAErE,eAAe,MAAM;EACpB,IAAK,OACJ,OAAO;EAGR,MAAM,OAAO,OAAA,GAAMA,qBAAAA,QAAAA,CAEd,EACJ,MAAM,+BACP,CAAE;EAEF,SAAA,GACCC,sBAAAA,QAAAA,CACC,MAAM,MAAM,uBACZ,sBACD,KAAK,CAAC;EAEP,OAAO;CACR;CAEA,SAAS,IAAK,SAA2B;EACxC,MAAM,oBAAoB;GACzB,GAAG;GACH,4BAAW,IAAI,KAAK,EAAA,CAAE,YAAY;EACnC;EACA,QAAQ;EAKRC,CAAAA,GAAAA,oBAAAA,gBAAAA,CAAiB,wBAAwB,iBAAkB;EAO3D,kBAAmB;GAClB,MAAM;GACN,QAAQ;GAMR,WAAW;GACX,MAAM,EACL,MAAM,EACL,uBAAuB,kBACxB,EACD;EACD,CAAE,CAAC,CAAC,YAAa,CAAC,CAAE;CACrB;CAEA,OAAO;EACN;EACA;CACD;AACD"}
|
|
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
11
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
12
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
15
|
-
key
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
16
|
+
desc = __getOwnPropDesc(from, key);
|
|
17
|
+
__defProp(to, key, {
|
|
18
|
+
get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
|
|
19
|
+
enumerable: !desc || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
return to;
|
|
22
24
|
};
|
|
@@ -25,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
27
|
enumerable: true
|
|
26
28
|
}) : target, mod));
|
|
27
29
|
let __is_preferences_data_ts = require("./is-preferences-data.cjs");
|
|
28
|
-
__is_preferences_data_ts = __toESM(__is_preferences_data_ts);
|
|
29
30
|
let __local_storage_ts = require("./local-storage.cjs");
|
|
30
31
|
let __migrations_preferences_package_data_index_ts = require("./migrations/preferences-package-data/index.cjs");
|
|
32
|
+
__is_preferences_data_ts = __toESM(__is_preferences_data_ts);
|
|
31
33
|
__migrations_preferences_package_data_index_ts = __toESM(__migrations_preferences_package_data_index_ts);
|
|
32
34
|
// packages/preferences-persistence/src/get-newest-data.ts
|
|
33
35
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-newest-data.cjs","names":["readStoredJSON","isPreferencesData","convertPreferencesPackageData"],"sources":["../src/get-newest-data.ts"],"sourcesContent":["import isPreferencesData from './is-preferences-data';\nimport { readStoredJSON } from './local-storage';\nimport convertPreferencesPackageData from './migrations/preferences-package-data';\nimport type { PreferencesData, ScopedPreferences } from './types';\n\n/**\n * Picks the most recently modified preferences from the server data and the\n * local storage backup, ignoring either when it is not a preferences object.\n *\n * @param serverData Preferences data from the server.\n * @param localStorageRestoreKey The key of the local storage backup.\n *\n * @return The newest preferences data, or `null` when neither is valid.\n */\nfunction pickNewestData(\n\tserverData: unknown,\n\tlocalStorageRestoreKey: string\n): PreferencesData | null {\n\tconst storedData = readStoredJSON( localStorageRestoreKey );\n\tconst localData = isPreferencesData( storedData ) ? storedData : null;\n\tif ( ! isPreferencesData( serverData ) ) {\n\t\treturn localData;\n\t}\n\n\t// Date parse returns NaN for invalid input. Coerce anything invalid\n\t// into a conveniently comparable zero.\n\tconst serverModified = Date.parse( serverData._modified ?? '' ) || 0;\n\tconst localModified = Date.parse( localData?._modified ?? '' ) || 0;\n\n\t// Prefer server data when it is at least as recent.\n\treturn localData && localModified > serverModified ? localData : serverData;\n}\n\n/**\n * Gets the newest persisted preferences, migrated to the current format.\n *\n * @param serverData Preferences data from the server.\n * @param localStorageRestoreKey The key of the local storage backup.\n *\n * @return The migrated preferences, or `undefined` when there are none.\n */\nexport default function getNewestData(\n\tserverData: unknown,\n\tlocalStorageRestoreKey: string\n): ScopedPreferences | undefined {\n\tconst newestData = pickNewestData( serverData, localStorageRestoreKey );\n\treturn newestData\n\t\t? convertPreferencesPackageData( newestData as ScopedPreferences )\n\t\t: undefined;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-newest-data.cjs","names":["readStoredJSON","isPreferencesData","convertPreferencesPackageData"],"sources":["../src/get-newest-data.ts"],"sourcesContent":["import isPreferencesData from './is-preferences-data';\nimport { readStoredJSON } from './local-storage';\nimport convertPreferencesPackageData from './migrations/preferences-package-data';\nimport type { PreferencesData, ScopedPreferences } from './types';\n\n/**\n * Picks the most recently modified preferences from the server data and the\n * local storage backup, ignoring either when it is not a preferences object.\n *\n * @param serverData Preferences data from the server.\n * @param localStorageRestoreKey The key of the local storage backup.\n *\n * @return The newest preferences data, or `null` when neither is valid.\n */\nfunction pickNewestData(\n\tserverData: unknown,\n\tlocalStorageRestoreKey: string\n): PreferencesData | null {\n\tconst storedData = readStoredJSON( localStorageRestoreKey );\n\tconst localData = isPreferencesData( storedData ) ? storedData : null;\n\tif ( ! isPreferencesData( serverData ) ) {\n\t\treturn localData;\n\t}\n\n\t// Date parse returns NaN for invalid input. Coerce anything invalid\n\t// into a conveniently comparable zero.\n\tconst serverModified = Date.parse( serverData._modified ?? '' ) || 0;\n\tconst localModified = Date.parse( localData?._modified ?? '' ) || 0;\n\n\t// Prefer server data when it is at least as recent.\n\treturn localData && localModified > serverModified ? localData : serverData;\n}\n\n/**\n * Gets the newest persisted preferences, migrated to the current format.\n *\n * @param serverData Preferences data from the server.\n * @param localStorageRestoreKey The key of the local storage backup.\n *\n * @return The migrated preferences, or `undefined` when there are none.\n */\nexport default function getNewestData(\n\tserverData: unknown,\n\tlocalStorageRestoreKey: string\n): ScopedPreferences | undefined {\n\tconst newestData = pickNewestData( serverData, localStorageRestoreKey );\n\treturn newestData\n\t\t? convertPreferencesPackageData( newestData as ScopedPreferences )\n\t\t: undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,eACR,YACA,wBACyB;CACzB,MAAM,cAAA,GAAaA,mBAAAA,eAAAA,CAAgB,sBAAuB;CAC1D,MAAM,aAAA,GAAYC,yBAAAA,QAAAA,CAAmB,UAAW,IAAI,aAAa;CACjE,IAAK,EAAA,GAAEA,yBAAAA,QAAAA,CAAmB,UAAW,GACpC,OAAO;CAKR,MAAM,iBAAiB,KAAK,MAAO,WAAW,aAAa,EAAG,KAAK;CACnE,MAAM,gBAAgB,KAAK,MAAO,WAAW,aAAa,EAAG,KAAK;CAGlE,OAAO,aAAa,gBAAgB,iBAAiB,YAAY;AAClE;;;;;;;;;AAUA,SAAwB,cACvB,YACA,wBACgC;CAChC,MAAM,aAAa,eAAgB,YAAY,sBAAuB;CACtE,OAAO,cAAA,GACJC,+CAAAA,QAAAA,CAA+B,UAAgC,IAC/D,KAAA;AACJ"}
|
package/build/index.cjs
CHANGED
|
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
11
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
12
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
15
|
-
key
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
16
|
+
desc = __getOwnPropDesc(from, key);
|
|
17
|
+
__defProp(to, key, {
|
|
18
|
+
get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
|
|
19
|
+
enumerable: !desc || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
return to;
|
|
22
24
|
};
|
|
@@ -25,10 +27,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
27
|
enumerable: true
|
|
26
28
|
}) : target, mod));
|
|
27
29
|
let __create_index_ts = require("./create/index.cjs");
|
|
28
|
-
__create_index_ts = __toESM(__create_index_ts);
|
|
29
30
|
let __migrations_legacy_local_storage_data_index_ts = require("./migrations/legacy-local-storage-data/index.cjs");
|
|
30
|
-
__migrations_legacy_local_storage_data_index_ts = __toESM(__migrations_legacy_local_storage_data_index_ts);
|
|
31
31
|
let __get_newest_data_ts = require("./get-newest-data.cjs");
|
|
32
|
+
__create_index_ts = __toESM(__create_index_ts);
|
|
33
|
+
__migrations_legacy_local_storage_data_index_ts = __toESM(__migrations_legacy_local_storage_data_index_ts);
|
|
32
34
|
__get_newest_data_ts = __toESM(__get_newest_data_ts);
|
|
33
35
|
// packages/preferences-persistence/src/index.ts
|
|
34
36
|
/**
|
package/build/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["create","getNewestData","convertLegacyLocalStorageData"],"sources":["../src/index.ts"],"sourcesContent":["import create from './create';\nimport convertLegacyLocalStorageData from './migrations/legacy-local-storage-data';\nimport getNewestData from './get-newest-data';\nimport type { PersistenceLayer } from './types';\n\nexport { create };\n\nexport type * from './types';\n\n/**\n * Creates the persistence layer with preloaded data.\n *\n * It prioritizes any data from the server, but falls back first to localStorage\n * restore data, and then to any legacy data.\n *\n * This function is used internally by WordPress in an inline script, so\n * prefixed with `__unstable`.\n *\n * @param serverData Preferences data preloaded from the server.\n * @param userId The user id.\n *\n * @return The persistence layer initialized with the preloaded data.\n */\nexport function __unstableCreatePersistenceLayer(\n\tserverData: unknown,\n\tuserId: string | number\n): PersistenceLayer {\n\tconst localStorageRestoreKey = `WP_PREFERENCES_USER_${ userId }`;\n\treturn create( {\n\t\t/*\n\t\t * Fall back to data in the legacy format from the old persistence system.\n\t\t * The server data is already preloaded, so fetching it again is redundant.\n\t\t */\n\t\tpreloadedData:\n\t\t\tgetNewestData( serverData, localStorageRestoreKey ) ??\n\t\t\tconvertLegacyLocalStorageData( userId ) ??\n\t\t\t{},\n\t\tlocalStorageRestoreKey,\n\t} );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["create","getNewestData","convertLegacyLocalStorageData"],"sources":["../src/index.ts"],"sourcesContent":["import create from './create';\nimport convertLegacyLocalStorageData from './migrations/legacy-local-storage-data';\nimport getNewestData from './get-newest-data';\nimport type { PersistenceLayer } from './types';\n\nexport { create };\n\nexport type * from './types';\n\n/**\n * Creates the persistence layer with preloaded data.\n *\n * It prioritizes any data from the server, but falls back first to localStorage\n * restore data, and then to any legacy data.\n *\n * This function is used internally by WordPress in an inline script, so\n * prefixed with `__unstable`.\n *\n * @param serverData Preferences data preloaded from the server.\n * @param userId The user id.\n *\n * @return The persistence layer initialized with the preloaded data.\n */\nexport function __unstableCreatePersistenceLayer(\n\tserverData: unknown,\n\tuserId: string | number\n): PersistenceLayer {\n\tconst localStorageRestoreKey = `WP_PREFERENCES_USER_${ userId }`;\n\treturn create( {\n\t\t/*\n\t\t * Fall back to data in the legacy format from the old persistence system.\n\t\t * The server data is already preloaded, so fetching it again is redundant.\n\t\t */\n\t\tpreloadedData:\n\t\t\tgetNewestData( serverData, localStorageRestoreKey ) ??\n\t\t\tconvertLegacyLocalStorageData( userId ) ??\n\t\t\t{},\n\t\tlocalStorageRestoreKey,\n\t} );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,iCACf,YACA,QACmB;CACnB,MAAM,yBAAyB,uBAAwB;CACvD,QAAA,GAAOA,kBAAAA,QAAAA,CAAQ;EAKd,gBAAA,GACCC,qBAAAA,QAAAA,CAAe,YAAY,sBAAuB,MAAA,GAClDC,gDAAAA,QAAAA,CAA+B,MAAO,KACtC,CAAC;EACF;CACD,CAAE;AACH"}
|
|
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
11
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
12
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
15
|
-
key
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
16
|
+
desc = __getOwnPropDesc(from, key);
|
|
17
|
+
__defProp(to, key, {
|
|
18
|
+
get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
|
|
19
|
+
enumerable: !desc || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
return to;
|
|
22
24
|
};
|
|
@@ -25,18 +27,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
27
|
enumerable: true
|
|
26
28
|
}) : target, mod));
|
|
27
29
|
let __move_feature_preferences_ts = require("./move-feature-preferences.cjs");
|
|
28
|
-
__move_feature_preferences_ts = __toESM(__move_feature_preferences_ts);
|
|
29
30
|
let __move_third_party_feature_preferences_ts = require("./move-third-party-feature-preferences.cjs");
|
|
30
|
-
__move_third_party_feature_preferences_ts = __toESM(__move_third_party_feature_preferences_ts);
|
|
31
31
|
let __move_individual_preference_ts = require("./move-individual-preference.cjs");
|
|
32
|
-
__move_individual_preference_ts = __toESM(__move_individual_preference_ts);
|
|
33
32
|
let __move_interface_enable_items_ts = require("./move-interface-enable-items.cjs");
|
|
34
|
-
__move_interface_enable_items_ts = __toESM(__move_interface_enable_items_ts);
|
|
35
33
|
let __convert_edit_post_panels_ts = require("./convert-edit-post-panels.cjs");
|
|
36
|
-
__convert_edit_post_panels_ts = __toESM(__convert_edit_post_panels_ts);
|
|
37
34
|
let ______is_preferences_data_ts = require("../../is-preferences-data.cjs");
|
|
38
|
-
______is_preferences_data_ts = __toESM(______is_preferences_data_ts);
|
|
39
35
|
let ______local_storage_ts = require("../../local-storage.cjs");
|
|
36
|
+
__move_feature_preferences_ts = __toESM(__move_feature_preferences_ts);
|
|
37
|
+
__move_third_party_feature_preferences_ts = __toESM(__move_third_party_feature_preferences_ts);
|
|
38
|
+
__move_individual_preference_ts = __toESM(__move_individual_preference_ts);
|
|
39
|
+
__move_interface_enable_items_ts = __toESM(__move_interface_enable_items_ts);
|
|
40
|
+
__convert_edit_post_panels_ts = __toESM(__convert_edit_post_panels_ts);
|
|
41
|
+
______is_preferences_data_ts = __toESM(______is_preferences_data_ts);
|
|
40
42
|
// packages/preferences-persistence/src/migrations/legacy-local-storage-data/index.ts
|
|
41
43
|
/**
|
|
42
44
|
* Gets the legacy local storage data for a given user.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["readStoredJSON","moveFeaturePreferences","moveThirdPartyFeaturePreferences","moveInterfaceEnableItems","moveIndividualPreference","convertEditPostPanels","isPreferencesData"],"sources":["../../../src/migrations/legacy-local-storage-data/index.ts"],"sourcesContent":["import moveFeaturePreferences from './move-feature-preferences';\nimport moveThirdPartyFeaturePreferences from './move-third-party-feature-preferences';\nimport moveIndividualPreference from './move-individual-preference';\nimport moveInterfaceEnableItems from './move-interface-enable-items';\nimport convertEditPostPanels from './convert-edit-post-panels';\nimport isPreferencesData from '../../is-preferences-data';\nimport { readStoredJSON } from '../../local-storage';\nimport type { ScopedPreferences } from '../../types';\nimport type { LegacyData } from './types';\n\n/**\n * Gets the legacy local storage data for a given user.\n *\n * @param userId The user id.\n *\n * @return The local storage data.\n */\nfunction getLegacyData( userId: string | number ): LegacyData | null {\n\treturn readStoredJSON( `WP_DATA_USER_${ userId }` ) as LegacyData | null;\n}\n\n/**\n * Converts data from the old `@wordpress/data` package format.\n *\n * @param data The legacy data in its original format.\n *\n * @return The converted data or `undefined` if there was\n * nothing to convert.\n */\nexport function convertLegacyData(\n\tdata: LegacyData | null | undefined\n): ScopedPreferences | undefined {\n\tif ( ! data ) {\n\t\treturn;\n\t}\n\n\t// Move boolean feature preferences from each editor into the\n\t// preferences store data structure.\n\tdata = moveFeaturePreferences( data, 'core/edit-widgets' );\n\tdata = moveFeaturePreferences( data, 'core/customize-widgets' );\n\tdata = moveFeaturePreferences( data, 'core/edit-post' );\n\tdata = moveFeaturePreferences( data, 'core/edit-site' );\n\n\t// Move third party boolean feature preferences from the interface package\n\t// to the preferences store data structure.\n\tdata = moveThirdPartyFeaturePreferences( data );\n\n\t// Move and convert the interface store's `enableItems` data into the\n\t// preferences data structure.\n\tdata = moveInterfaceEnableItems( data );\n\n\t// Move individual ad-hoc preferences from various packages into the\n\t// preferences store data structure.\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'hiddenBlockTypes'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'editorMode'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'panels',\n\t\tconvertEditPostPanels\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/editor', to: 'core' },\n\t\t'isPublishSidebarEnabled'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core' },\n\t\t'isPublishSidebarEnabled'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-site', to: 'core/edit-site' },\n\t\t'editorMode'\n\t);\n\n\t// The new system is only concerned with persisting\n\t// 'core/preferences' preferences reducer, so only return that.\n\tconst preferences = data?.[ 'core/preferences' ]?.preferences;\n\treturn isPreferencesData( preferences ) ? preferences : undefined;\n}\n\n/**\n * Gets the legacy local storage data for the given user and returns the\n * data converted to the new format.\n *\n * @param userId The user id.\n *\n * @return The converted data or undefined if no local\n * storage data could be found.\n */\nexport default function convertLegacyLocalStorageData(\n\tuserId: string | number\n): ScopedPreferences | undefined {\n\tconst data = getLegacyData( userId );\n\treturn convertLegacyData( data );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["readStoredJSON","moveFeaturePreferences","moveThirdPartyFeaturePreferences","moveInterfaceEnableItems","moveIndividualPreference","convertEditPostPanels","isPreferencesData"],"sources":["../../../src/migrations/legacy-local-storage-data/index.ts"],"sourcesContent":["import moveFeaturePreferences from './move-feature-preferences';\nimport moveThirdPartyFeaturePreferences from './move-third-party-feature-preferences';\nimport moveIndividualPreference from './move-individual-preference';\nimport moveInterfaceEnableItems from './move-interface-enable-items';\nimport convertEditPostPanels from './convert-edit-post-panels';\nimport isPreferencesData from '../../is-preferences-data';\nimport { readStoredJSON } from '../../local-storage';\nimport type { ScopedPreferences } from '../../types';\nimport type { LegacyData } from './types';\n\n/**\n * Gets the legacy local storage data for a given user.\n *\n * @param userId The user id.\n *\n * @return The local storage data.\n */\nfunction getLegacyData( userId: string | number ): LegacyData | null {\n\treturn readStoredJSON( `WP_DATA_USER_${ userId }` ) as LegacyData | null;\n}\n\n/**\n * Converts data from the old `@wordpress/data` package format.\n *\n * @param data The legacy data in its original format.\n *\n * @return The converted data or `undefined` if there was\n * nothing to convert.\n */\nexport function convertLegacyData(\n\tdata: LegacyData | null | undefined\n): ScopedPreferences | undefined {\n\tif ( ! data ) {\n\t\treturn;\n\t}\n\n\t// Move boolean feature preferences from each editor into the\n\t// preferences store data structure.\n\tdata = moveFeaturePreferences( data, 'core/edit-widgets' );\n\tdata = moveFeaturePreferences( data, 'core/customize-widgets' );\n\tdata = moveFeaturePreferences( data, 'core/edit-post' );\n\tdata = moveFeaturePreferences( data, 'core/edit-site' );\n\n\t// Move third party boolean feature preferences from the interface package\n\t// to the preferences store data structure.\n\tdata = moveThirdPartyFeaturePreferences( data );\n\n\t// Move and convert the interface store's `enableItems` data into the\n\t// preferences data structure.\n\tdata = moveInterfaceEnableItems( data );\n\n\t// Move individual ad-hoc preferences from various packages into the\n\t// preferences store data structure.\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'hiddenBlockTypes'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'editorMode'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'panels',\n\t\tconvertEditPostPanels\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/editor', to: 'core' },\n\t\t'isPublishSidebarEnabled'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core' },\n\t\t'isPublishSidebarEnabled'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-site', to: 'core/edit-site' },\n\t\t'editorMode'\n\t);\n\n\t// The new system is only concerned with persisting\n\t// 'core/preferences' preferences reducer, so only return that.\n\tconst preferences = data?.[ 'core/preferences' ]?.preferences;\n\treturn isPreferencesData( preferences ) ? preferences : undefined;\n}\n\n/**\n * Gets the legacy local storage data for the given user and returns the\n * data converted to the new format.\n *\n * @param userId The user id.\n *\n * @return The converted data or undefined if no local\n * storage data could be found.\n */\nexport default function convertLegacyLocalStorageData(\n\tuserId: string | number\n): ScopedPreferences | undefined {\n\tconst data = getLegacyData( userId );\n\treturn convertLegacyData( data );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,SAAS,cAAe,QAA6C;CACpE,QAAA,GAAOA,uBAAAA,eAAAA,CAAgB,gBAAiB,QAAU;AACnD;;;;;;;;;AAUA,SAAgB,kBACf,MACgC;CAChC,IAAK,CAAE,MACN;CAKD,QAAA,GAAOC,8BAAAA,QAAAA,CAAwB,MAAM,mBAAoB;CACzD,QAAA,GAAOA,8BAAAA,QAAAA,CAAwB,MAAM,wBAAyB;CAC9D,QAAA,GAAOA,8BAAAA,QAAAA,CAAwB,MAAM,gBAAiB;CACtD,QAAA,GAAOA,8BAAAA,QAAAA,CAAwB,MAAM,gBAAiB;CAItD,QAAA,GAAOC,0CAAAA,QAAAA,CAAkC,IAAK;CAI9C,QAAA,GAAOC,iCAAAA,QAAAA,CAA0B,IAAK;CAItC,QAAA,GAAOC,gCAAAA,QAAAA,CACN,MACA;EAAE,MAAM;EAAkB,IAAI;CAAiB,GAC/C,kBACD;CACA,QAAA,GAAOA,gCAAAA,QAAAA,CACN,MACA;EAAE,MAAM;EAAkB,IAAI;CAAiB,GAC/C,YACD;CACA,QAAA,GAAOA,gCAAAA,QAAAA,CACN,MACA;EAAE,MAAM;EAAkB,IAAI;CAAiB,GAC/C,UACAC,8BAAAA,OACD;CACA,QAAA,GAAOD,gCAAAA,QAAAA,CACN,MACA;EAAE,MAAM;EAAe,IAAI;CAAO,GAClC,yBACD;CACA,QAAA,GAAOA,gCAAAA,QAAAA,CACN,MACA;EAAE,MAAM;EAAkB,IAAI;CAAO,GACrC,yBACD;CACA,QAAA,GAAOA,gCAAAA,QAAAA,CACN,MACA;EAAE,MAAM;EAAkB,IAAI;CAAiB,GAC/C,YACD;CAIA,MAAM,cAAc,OAAQ,mBAAoB,EAAE;CAClD,QAAA,GAAOE,6BAAAA,QAAAA,CAAmB,WAAY,IAAI,cAAc,KAAA;AACzD;;;;;;;;;;AAWA,SAAwB,8BACvB,QACgC;CAEhC,OAAO,kBADM,cAAe,MACC,CAAE;AAChC"}
|
|
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
11
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
12
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
15
|
-
key
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
16
|
+
desc = __getOwnPropDesc(from, key);
|
|
17
|
+
__defProp(to, key, {
|
|
18
|
+
get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
|
|
19
|
+
enumerable: !desc || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
return to;
|
|
22
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-editor-settings.cjs","names":["isPreferencesData"],"sources":["../../../src/migrations/preferences-package-data/convert-editor-settings.ts"],"sourcesContent":["import isPreferencesData from '../../is-preferences-data';\nimport type { ScopedPreferences } from '../../types';\n\nconst copyScope = ( scope: unknown ) =>\n\tisPreferencesData( scope ) ? { ...scope } : undefined;\n\nexport default function convertEditorSettings( data: ScopedPreferences ) {\n\tconst newData = { ...data };\n\tconst editPost = copyScope( data[ 'core/edit-post' ] );\n\tconst editSite = copyScope( data[ 'core/edit-site' ] );\n\tconst settingsToMoveToCore = [\n\t\t'allowRightClickOverrides',\n\t\t'distractionFree',\n\t\t'editorMode',\n\t\t'fixedToolbar',\n\t\t'focusMode',\n\t\t'hiddenBlockTypes',\n\t\t'inactivePanels',\n\t\t'keepCaretInsideBlock',\n\t\t'mostUsedBlocks',\n\t\t'openPanels',\n\t\t'showBlockBreadcrumbs',\n\t\t'showIconLabels',\n\t\t'showListViewByDefault',\n\t\t'isPublishSidebarEnabled',\n\t\t'isComplementaryAreaVisible',\n\t\t'pinnedItems',\n\t];\n\n\tsettingsToMoveToCore.forEach( ( setting ) => {\n\t\tif ( editPost?.[ setting ] !== undefined ) {\n\t\t\tnewData.core = {\n\t\t\t\t...copyScope( newData.core ),\n\t\t\t\t[ setting ]: editPost[ setting ],\n\t\t\t};\n\t\t\tdelete editPost[ setting ];\n\t\t}\n\n\t\tif ( editSite?.[ setting ] !== undefined ) {\n\t\t\tdelete editSite[ setting ];\n\t\t}\n\t} );\n\n\t// Empty and invalid scopes are removed rather than persisted.\n\tif ( editPost && Object.keys( editPost ).length > 0 ) {\n\t\tnewData[ 'core/edit-post' ] = editPost;\n\t} else {\n\t\tdelete newData[ 'core/edit-post' ];\n\t}\n\n\tif ( editSite && Object.keys( editSite ).length > 0 ) {\n\t\tnewData[ 'core/edit-site' ] = editSite;\n\t} else {\n\t\tdelete newData[ 'core/edit-site' ];\n\t}\n\n\treturn newData;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"convert-editor-settings.cjs","names":["isPreferencesData"],"sources":["../../../src/migrations/preferences-package-data/convert-editor-settings.ts"],"sourcesContent":["import isPreferencesData from '../../is-preferences-data';\nimport type { ScopedPreferences } from '../../types';\n\nconst copyScope = ( scope: unknown ) =>\n\tisPreferencesData( scope ) ? { ...scope } : undefined;\n\nexport default function convertEditorSettings( data: ScopedPreferences ) {\n\tconst newData = { ...data };\n\tconst editPost = copyScope( data[ 'core/edit-post' ] );\n\tconst editSite = copyScope( data[ 'core/edit-site' ] );\n\tconst settingsToMoveToCore = [\n\t\t'allowRightClickOverrides',\n\t\t'distractionFree',\n\t\t'editorMode',\n\t\t'fixedToolbar',\n\t\t'focusMode',\n\t\t'hiddenBlockTypes',\n\t\t'inactivePanels',\n\t\t'keepCaretInsideBlock',\n\t\t'mostUsedBlocks',\n\t\t'openPanels',\n\t\t'showBlockBreadcrumbs',\n\t\t'showIconLabels',\n\t\t'showListViewByDefault',\n\t\t'isPublishSidebarEnabled',\n\t\t'isComplementaryAreaVisible',\n\t\t'pinnedItems',\n\t];\n\n\tsettingsToMoveToCore.forEach( ( setting ) => {\n\t\tif ( editPost?.[ setting ] !== undefined ) {\n\t\t\tnewData.core = {\n\t\t\t\t...copyScope( newData.core ),\n\t\t\t\t[ setting ]: editPost[ setting ],\n\t\t\t};\n\t\t\tdelete editPost[ setting ];\n\t\t}\n\n\t\tif ( editSite?.[ setting ] !== undefined ) {\n\t\t\tdelete editSite[ setting ];\n\t\t}\n\t} );\n\n\t// Empty and invalid scopes are removed rather than persisted.\n\tif ( editPost && Object.keys( editPost ).length > 0 ) {\n\t\tnewData[ 'core/edit-post' ] = editPost;\n\t} else {\n\t\tdelete newData[ 'core/edit-post' ];\n\t}\n\n\tif ( editSite && Object.keys( editSite ).length > 0 ) {\n\t\tnewData[ 'core/edit-site' ] = editSite;\n\t} else {\n\t\tdelete newData[ 'core/edit-site' ];\n\t}\n\n\treturn newData;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,aAAc,WAAA,GACnBA,6BAAAA,QAAAA,CAAmB,KAAM,IAAI,EAAE,GAAG,MAAM,IAAI,KAAA;AAE7C,SAAwB,sBAAuB,MAA0B;CACxE,MAAM,UAAU,EAAE,GAAG,KAAK;CAC1B,MAAM,WAAW,UAAW,KAAM,iBAAmB;CACrD,MAAM,WAAW,UAAW,KAAM,iBAAmB;CAoBrD;EAlBC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAGkB,CAAC,CAAC,SAAW,YAAa;EAC5C,IAAK,WAAY,aAAc,KAAA,GAAY;GAC1C,QAAQ,OAAO;IACd,GAAG,UAAW,QAAQ,IAAK;KACzB,UAAW,SAAU;GACxB;GACA,OAAO,SAAU;EAClB;EAEA,IAAK,WAAY,aAAc,KAAA,GAC9B,OAAO,SAAU;CAEnB,CAAE;CAGF,IAAK,YAAY,OAAO,KAAM,QAAS,CAAC,CAAC,SAAS,GACjD,QAAS,oBAAqB;MAE9B,OAAO,QAAS;CAGjB,IAAK,YAAY,OAAO,KAAM,QAAS,CAAC,CAAC,SAAS,GACjD,QAAS,oBAAqB;MAE9B,OAAO,QAAS;CAGjB,OAAO;AACR"}
|
|
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
11
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
12
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
15
|
-
key
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
16
|
+
desc = __getOwnPropDesc(from, key);
|
|
17
|
+
__defProp(to, key, {
|
|
18
|
+
get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
|
|
19
|
+
enumerable: !desc || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
return to;
|
|
22
24
|
};
|
|
@@ -25,8 +27,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
27
|
enumerable: true
|
|
26
28
|
}) : target, mod));
|
|
27
29
|
let __convert_complementary_areas_ts = require("./convert-complementary-areas.cjs");
|
|
28
|
-
__convert_complementary_areas_ts = __toESM(__convert_complementary_areas_ts);
|
|
29
30
|
let __convert_editor_settings_ts = require("./convert-editor-settings.cjs");
|
|
31
|
+
__convert_complementary_areas_ts = __toESM(__convert_complementary_areas_ts);
|
|
30
32
|
__convert_editor_settings_ts = __toESM(__convert_editor_settings_ts);
|
|
31
33
|
// packages/preferences-persistence/src/migrations/preferences-package-data/index.ts
|
|
32
34
|
function convertPreferencesPackageData(data) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["convertComplementaryAreas","convertEditorSettings"],"sources":["../../../src/migrations/preferences-package-data/index.ts"],"sourcesContent":["import convertComplementaryAreas from './convert-complementary-areas';\nimport convertEditorSettings from './convert-editor-settings';\nimport type { ScopedPreferences } from '../../types';\n\nexport default function convertPreferencesPackageData(\n\tdata: ScopedPreferences\n) {\n\tlet newData = convertComplementaryAreas( data );\n\tnewData = convertEditorSettings( newData );\n\treturn newData;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["convertComplementaryAreas","convertEditorSettings"],"sources":["../../../src/migrations/preferences-package-data/index.ts"],"sourcesContent":["import convertComplementaryAreas from './convert-complementary-areas';\nimport convertEditorSettings from './convert-editor-settings';\nimport type { ScopedPreferences } from '../../types';\n\nexport default function convertPreferencesPackageData(\n\tdata: ScopedPreferences\n) {\n\tlet newData = convertComplementaryAreas( data );\n\tnewData = convertEditorSettings( newData );\n\treturn newData;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAAwB,8BACvB,MACC;CACD,IAAI,WAAA,GAAUA,iCAAAA,QAAAA,CAA2B,IAAK;CAC9C,WAAA,GAAUC,6BAAAA,QAAAA,CAAuB,OAAQ;CACzC,OAAO;AACR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/preferences-persistence",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Persistence utilities for `wordpress/preferences`.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"types": "build-types",
|
|
43
43
|
"sideEffects": false,
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@wordpress/api-fetch": "^8.
|
|
45
|
+
"@wordpress/api-fetch": "^8.3.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@types/node": "^24.
|
|
49
|
-
"vitest": "^5.
|
|
48
|
+
"@types/node": "^24.19.2",
|
|
49
|
+
"vitest": "^5.1.1"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "7f19202f61aeba8f4bdce892a1a0df485ad76e2b"
|
|
55
55
|
}
|