Skip to content

Commit

Permalink
Apply autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed May 13, 2024
1 parent 15d8cff commit b33d096
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 33 deletions.
32 changes: 16 additions & 16 deletions packages/block-library/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,21 +314,21 @@ export const registerCoreBlocks = (
* __experimentalRegisterExperimentalCoreBlocks( settings );
* ```
*/
export const __experimentalRegisterExperimentalCoreBlocks = process.env
.IS_GUTENBERG_PLUGIN
? ( { enableFSEBlocks } = {} ) => {
const enabledExperiments = [ enableFSEBlocks ? 'fse' : null ];
getAllBlocks()
.filter( ( { metadata } ) =>
isBlockMetadataExperimental( metadata )
)
.filter(
( { metadata: { __experimental } } ) =>
__experimental === true ||
enabledExperiments.includes( __experimental )
)
.forEach( ( { init } ) => init() );
}
: undefined;
export const __experimentalRegisterExperimentalCoreBlocks =
globalThis.IS_GUTENBERG_PLUGIN
? ( { enableFSEBlocks } = {} ) => {
const enabledExperiments = [ enableFSEBlocks ? 'fse' : null ];
getAllBlocks()
.filter( ( { metadata } ) =>
isBlockMetadataExperimental( metadata )
)
.filter(
( { metadata: { __experimental } } ) =>
__experimental === true ||
enabledExperiments.includes( __experimental )
)
.forEach( ( { init } ) => init() );
}
: undefined;

export { privateApis } from './private-apis';
2 changes: 1 addition & 1 deletion packages/blocks/src/api/parser/convert-legacy-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function convertLegacyBlockNameAndAttributes( name, attributes ) {

// The following code is only relevant for the Gutenberg plugin.
// It's a stand-alone if statement for dead-code elimination.
if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
// Convert pattern overrides added during experimental phase.
// Only four blocks were supported initially.
// These checks can be removed in WordPress 6.6.
Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ export const editEntityRecord =
}, {} ),
};
if ( window.__experimentalEnableSync && entityConfig.syncConfig ) {
if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
const objectId = entityConfig.getSyncObjectId( recordId );
getSyncProvider().update(
entityConfig.syncObjectType + '--edit',
Expand Down
4 changes: 2 additions & 2 deletions packages/core-data/src/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ export const getOrLoadEntitiesConfig =

if ( configs?.length > 0 && hasConfig ) {
if ( window.__experimentalEnableSync ) {
if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
registerSyncConfigs( configs );
}
}
Expand All @@ -506,7 +506,7 @@ export const getOrLoadEntitiesConfig =

configs = await loader.loadEntities();
if ( window.__experimentalEnableSync ) {
if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
registerSyncConfigs( configs );
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const getEntityRecord =
entityConfig.syncConfig &&
! query
) {
if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
const objectId = entityConfig.getSyncObjectId( key );

// Loads the persisted document.
Expand Down
2 changes: 1 addition & 1 deletion packages/customize-widgets/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function initialize( editorName, blockEditorSettings ) {
} );
registerCoreBlocks( coreBlocks );
registerLegacyWidgetBlock();
if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
__experimentalRegisterExperimentalCoreBlocks( {
enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,
} );
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-post/src/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { usePaddingAppender } from './use-padding-appender';

const { EditorCanvas } = unlock( editorPrivateApis );

const isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;
const isGutenbergPlugin = globalThis.IS_GUTENBERG_PLUGIN ? true : false;

export default function VisualEditor( { styles } ) {
const {
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-post/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function initializeEditor(
registerCoreBlocks();
registerLegacyWidgetBlock( { inserter: false } );
registerWidgetGroupBlock( { inserter: false } );
if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
__experimentalRegisterExperimentalCoreBlocks( {
enableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,
} );
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function initializeEditor( id, settings ) {
dispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );
registerLegacyWidgetBlock( { inserter: false } );
registerWidgetGroupBlock( { inserter: false } );
if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
__experimentalRegisterExperimentalCoreBlocks( {
enableFSEBlocks: true,
} );
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-widgets/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function initializeEditor( id, settings ) {
dispatch( blocksStore ).reapplyBlockTypeFilters();
registerCoreBlocks( coreBlocks );
registerLegacyWidgetBlock();
if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
__experimentalRegisterExperimentalCoreBlocks( {
enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,
} );
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/bindings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ import postMeta from './post-meta';
const { registerBlockBindingsSource } = unlock( dispatch( blocksStore ) );
registerBlockBindingsSource( postMeta );

if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
registerBlockBindingsSource( patternOverrides );
}
2 changes: 1 addition & 1 deletion packages/editor/src/components/post-actions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ export function usePostActions( postType, onActionPerformed ) {
isTemplateOrTemplatePart && deleteTemplateAction,
! isTemplateOrTemplatePart && permanentlyDeletePostAction,
postRevisionsAction,
process.env.IS_GUTENBERG_PLUGIN
globalThis.IS_GUTENBERG_PLUGIN
? ! isTemplateOrTemplatePart &&
! isPattern &&
duplicatePostAction
Expand Down
8 changes: 4 additions & 4 deletions packages/interactivity-router/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const fetchPage = async ( url, { html } ) => {
const regionsToVdom = async ( dom, { vdom } = {} ) => {
const regions = {};
let head;
if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
if ( navigationMode === 'fullPage' ) {
head = await fetchHeadAssets( dom, headElements );
regions.body = vdom
Expand All @@ -83,7 +83,7 @@ const regionsToVdom = async ( dom, { vdom } = {} ) => {
// Render all interactive regions contained in the given page.
const renderRegions = ( page ) => {
batch( () => {
if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
if ( navigationMode === 'fullPage' ) {
// Once this code is tested and more mature, the head should be updated for region based navigation as well.
updateHead( page.head );
Expand Down Expand Up @@ -139,7 +139,7 @@ window.addEventListener( 'popstate', async () => {

// Initialize the router and cache the initial page using the initial vDOM.
// Once this code is tested and more mature, the head should be updated for region based navigation as well.
if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
if ( navigationMode === 'fullPage' ) {
// Cache the scripts. Has to be called before fetching the assets.
[].map.call( document.querySelectorAll( 'script[src]' ), ( script ) => {
Expand Down Expand Up @@ -329,7 +329,7 @@ export const { state, actions } = store( 'core/router', {
} );

// Add click and prefetch to all links.
if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
if ( navigationMode === 'fullPage' ) {
// Navigate on click.
document.addEventListener(
Expand Down
2 changes: 1 addition & 1 deletion test/integration/full-content/full-content.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe( 'full post content fixture', () => {
formSubmissionNotification,
] );

if ( process.env.IS_GUTENBERG_PLUGIN ) {
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
__experimentalRegisterExperimentalCoreBlocks( {
enableFSEBlocks: true,
} );
Expand Down

0 comments on commit b33d096

Please sign in to comment.