helper-plugin 迁移参考

页面摘要: 参考指南,按字母顺序并按领域分组,列出了已弃用的 helper-plugin 包中的每一个导出项,及其到 @strapi/strapi/admin、@strapi/design-system 和其他包中替代组件与工具的迁移路径。

本文档旨在帮助开发者将他们的 Strapi 插件和应用迁移为不使用 helper-plugin 包。 它按字母顺序、按领域分组,列出了 helper-plugin 包中曾存在的每一个导出项。

Components

AnErrorOccurred

此组件已被移除,并重构为 @strapi/strapi/admin 导出的 Page 组件的一部分。你应该使用来自那里的 Page 组件:

// Before
import { AnErrorOccurred } from '@strapi/helper-plugin';

const MyPage = () => {
  // ...

  if (error) {
    return <AnErrorOccurred />;
  }

  // ...
};

// After
import { Page } from '@strapi/strapi/admin';

const MyPage = () => {
  // ...

  if (error) {
    return <Page.Error />;
  }

  // ...
};

CheckPermissions

此组件已被移除,且未被替换。如果你认为需要此组件,请在 Strapi 仓库中提 issue 讨论你的使用场景。

我们建议使用 @strapi/strapi/admin 中的 Page.Protect 组件代替(示例参见 CheckPagePermissions)。如果你需要为更低层级的组件检查权限,可以使用 the useRBAC hook。

CheckPagePermissions

此组件已被移除,并重构为 @strapi/strapi/admin 导出的 Page 组件的一部分。你应该使用来自那里的 Page 组件:

// Before
import { CheckPagePermissions } from '@strapi/helper-plugin';

const MyProtectedPage = () => {
  return (
    <CheckPagePermissions
        permissions={[action: 'plugin::my-plugin.read']}
    >
      <MyPag />
    </CheckPagePermissions>
  );
};

// After
import { Page } from '@strapi/strapi/admin';

const MyProtectedPage = () => {
  <Page.Protect permissions={[action: 'plugin::my-plugin.read']}>
  return (
    </Page.Protect>
      <MyPage />
  );
};

其行为略有变化:以前没有权限时会将你重定向到页面根路径,现在则会渲染 NoPermissions 组件。

ConfirmDialog

此组件已移动并重构。它可以从 @strapi/strapi/admin 包导入:

// Before
import { ConfirmDialog } from '@strapi/helper-plugin';

// After
import { ConfirmDialog } from '@strapi/strapi/admin';

如需更多信息,请参阅贡献者关于 ConfirmDialog 组件文档。

ContentBox

此组件已被移除,且未被替换。如果你认为需要此组件,请在 Strapi 仓库中提 issue 讨论你的使用场景。

DateTimePicker

此前它是对 design-system(设计系统)的别名。你应该从那里导入该组件:

// Before
import { DateTimePicker } from '@strapi/helper-plugin';

// After
import { DateTimePicker } from '@strapi/design-system';

DynamicTable

此组件之前已弃用,现已被移除。与弃用通知类似,我们建议使用来自 @strapi/strapi/admin 的 Table 组件。

如需更多信息,请参阅贡献者关于 Table 组件文档。

EmptyBodyTable

此组件已被移除,并属于 Table 组件的一部分。

如需更多信息,请参阅贡献者关于 Table 组件文档。

EmptyStateLayout

此组件已被移除,且未被替换。你应该使用来自 @strapi/design-system 的 EmptyStateLayout:

// Before
import { EmptyStateLayout } from '@strapi/helper-plugin';

// After
import { EmptyStateLayout } from '@strapi/design-system';
NOTE

其 props 将会不同。请参阅 Strapi Design System 关于 EmptyStateLayout 组件文档。

FilterListURLQuery

此组件已移至 admin 包,现在可以作为复合组件 Filters 的一部分,通过 @strapi/strapi 包导入:

// Before
import { FilterListURLQuery } from '@strapi/helper-plugin';

const MyComponent = () => {
  return (
    <FilterListURLQuery
      filtersSchema={[
        {
          name: 'name',
          metadatas: { label: 'Name' },
          fieldSchema: { type: 'string' },
        },
      ]}
    />
  );
};

// After
import { Filters } from '@strapi/strapi/admin';

const MyComponent = () => {
  return (
    <Filters.Root>
      <Filters.List />
    </Filters.Root>
  );
};

FilterPopoverURLQueryProps

此组件已移至 admin 包,现在可以作为复合组件 Filters 的一部分,通过 @strapi/strapi 包导入:

// Before
import { FilterPopoverURLQueryProps } from '@strapi/helper-plugin';

// After
import { Filters } from '@strapi/strapi/admin';

const MyComponent = () => {
  return (
    <Filters.Root>
      <Filters.Trigger />
      <Filters.Popover />
    </Filters.Root>
  );
};

Form

此组件是对 Formik 的别名,我们正在着手将其移除。应该改用 @strapi/strapi/admin 中的 Form 组件及其同级的导出项:

// Before
import { Form } from '@strapi/helper-plugin';

// After
import { Form } from '@strapi/strapi/admin';

用户应注意,任何对 Formik 库的使用都将不再有效,而应查看贡献者关于 Form 组件文档。

GenericInput

此组件已被移除,并重构为来自 @strapi/strapi/admin 的 InputRenderer 组件。你应该使用来自那里的 InputRenderer 组件:

// Before
import { GenericInput } from '@strapi/helper-plugin';

const MyComponent = () => {
  return (
    <GenericInput
      type={'type'}
      hint={'hint'}
      label={'label'}
      name={'name'}
      onChange={onMetaChange}
      value={'value'}
    />
  );
};

// After
import { InputRenderer } from '@strapi/strapi/admin';

注意,InputRenderer 组件具有不同的 API,你应该参考 InputRenderer 组件文档。

InjectionZone

此组件已被移除,且未被替换。不过,你可以通过使用 useStrapiApp hook 在自己的项目中轻松复现该功能:

// Before

import { InjectionZone } from '@strapi/helper-plugin';
<InjectionZone area={`injection.zone.area`} />;

// After

const MyComponent = ({ area, ...compProps }) => {
  const getPlugin = useStrapiApp('MyComponent', (state) => state.getPlugin);

  const [pluginName, page, position] = area.split('.');

  const plugin = getPlugin(pluginName);
  const components = plugin?.getInjectedComponents(page, position);

  if (!plugin || !components) {
    return null;
  }

  return components.map(({ name, Component }) => (
    <Component key={name} {...props} />
  ));
};

此前它是对 design-system(设计系统)的别名,并使用 as prop 配合 react-router-dom。你应该从那里导入该组件:

// Before
import { Link } from '@strapi/helper-plugin';

// After
import { Link } from '@strapi/design-system/v2';
import { NavLink } from 'react-router-dom';

const MyLink = () => {
  return (
    <Link as={NavLink} to="/my-link">
      My Link
    </Link>
  );
};

LinkButton

此前它是对 design-system(设计系统)的别名,并使用 as prop 配合 react-router-dom。你应该从那里导入该组件:

// Before
import { LinkButton } from '@strapi/helper-plugin';

// After
import { LinkButton } from '@strapi/design-system/v2';
import { NavLink } from 'react-router-dom';

const MyLink = () => {
  return (
    <LinkButton as={NavLink} to="/my-link">
      My Link
    </LinkButton>
  );
};

LoadingIndicatorPage

此组件已被移除,并重构为 @strapi/strapi/admin 导出的 Page 组件的一部分。你应该使用来自那里的 Page 组件:

// Before
import { LoadingIndicatorPage } from '@strapi/helper-plugin';

const MyPage = () => {
  // ...

  if (isLoading) {
    return <LoadingIndicatorPage />;
  }

  // ...
};

// After
import { Page } from '@strapi/strapi/admin';

const MyPage = () => {
  // ...

  if (isLoading) {
    return <Page.Loading />;
  }

  // ...
};

NoContent

此组件已被移除,且未被替换,你应该使用来自 @strapi/design-system 的 EmptyStateLayout 组件。

// Before
import { NoContent } from '@strapi/helper-plugin';

<NoContent
  content={{
    id: 'translation_id',
    defaultMessage: 'Message',
  }}
/>;

// After
import { EmptyStateLayout } from '@strapi/design-system';

<EmptyStateLayout
  content={{
    id: 'translation_id',
    defaultMessage: 'Message',
  }}
/>;

NoMedia

此组件已被移除,且未被替换。如果你认为需要此组件,请在 Strapi 仓库中提 issue 讨论你的使用场景。

NoPermissions

此组件已被移除,并重构为 @strapi/strapi/admin 导出的 Page 组件的一部分。你应该使用来自那里的 Page 组件:

// Before
import { NoPermissions } from '@strapi/helper-plugin';

const MyPage = () => {
  // ...

  if (!canRead) {
    return <NoPermissions />;
  }

  // ...
};

// After
import { Page } from '@strapi/strapi/admin';

const MyPage = () => {
  // ...

  if (!canRead) {
    return <Page.NoPermissions />;
  }

  // ...
};

NotAllowedInput

此组件已被移除,且未被替换。如果你认为需要此组件,请在 Strapi 仓库中提 issue 讨论你的使用场景。你可以通过使用 @strapi/design-system 中的 TextInput 在自己的项目中轻松复现该功能:

import { TextInput } from '@strapi/design-system';

const MyComponent = (props) => {
  return (
    <TextInput
      disabled
      placeholder="No permissions to see this field"
      type="text"
      {...props}
    />
  );
};

PageSizeURLQuery

此组件已移至 admin 包,现在可以作为复合组件 Pagination 的一部分,通过 @strapi/strapi 包导入:

// Before
import { PageSizeURLQuery } from '@strapi/helper-plugin';

const MyComponent = () => {
  return (
    <PageSizeURLQuery options={['12', '24', '50', '100']} defaultValue="24" />
  );
};

// After
import { Pagination } from '@strapi/strapi/admin';

const MyComponent = () => {
  return (
    <Pagination.Root>
      <Pagination.PageSize />
    </Pagination.Root>
  );
};

注意,存在一些细微的行为变化,例如当最低 pageSize 为 10 但你只有 9 个条目时,PageSize 不会渲染。由于重构,部分 props 会移动或改变,请查看贡献者关于 Pagination 组件文档 了解更多信息。

PaginationURLQueryProps

此组件已移至 admin 包,现在可以作为复合组件 Pagination 的一部分,通过 @strapi/strapi 包导入:

// Before
import { PaginationURLQueryProps } from '@strapi/helper-plugin';

// After
import { Pagination } from '@strapi/strapi/admin';

const MyComponent = () => {
  return (
    <Pagination.Root pageCount={2}>
      <Pagination.Links />
    </Pagination.Root>
  );
};

注意,存在一些细微的行为变化,例如当页数少于 2 页时,Links 不会渲染。由于重构,部分 props 会移动或改变,请查看 Pagination 组件文档 了解更多信息。

ReactSelect

此组件已被移除,且未被替换。如果你认为需要此组件,请在 Strapi 仓库中提 issue 讨论你的使用场景。

RelativeTime

此组件已被移除,且未被替换。如果你认为需要此组件,请在 Strapi 仓库中提 issue 讨论你的使用场景。

SearchURLQuery

此组件已被移除并更名为 SearchInput,现在可以通过 @strapi/strapi 包导入:

// Before
import { SearchURLQuery } from '@strapi/helper-plugin';

// After
import { SearchInput } from '@strapi/strapi/admin';

SettingsPageTitle

此组件已被移除,且未被替换。如果你认为需要此组件,请在 Strapi 仓库中提 issue 讨论你的使用场景。

Status

此组件应从 @strapi/design-system 包导入:

// Before
import { Status } from '@strapi/helper-plugin';

const MyComponent = () => {
  return (
    <Status variant={statusColor} showBullet={false} size="S">
      <Typography fontWeight="bold" textColor={`${statusColor}700`}>
        {stateMessage[status]}
      </Typography>
    </Status>
  );
};

// After
import { Status } from '@strapi/design-system';

Table

此组件应从 @strapi/strapi/admin 包导入:

// Before
import { Table } from '@strapi/helper-plugin';

const MyComponent = () => {
  return (
    <Table colCount={2} rowCount={2}>
      <Thead>
        <Tr>
          <Th>
            <Typography variant="sigma" textColor="neutral600">
              {`Name`}
            </Typography>
          </Th>
          <Th>
            <Typography variant="sigma" textColor="neutral600">
              {`Description`}
            </Typography>
          </Th>
        </Tr>
      </Thead>
      <Tbody>
        {data?.map(({ name, description }) => {
          return (
            <Tr key={name}>
              <Td>
                <Typography
                  textColor="neutral800"
                  variant="omega"
                  fontWeight="bold"
                >
                  {name}
                </Typography>
              </Td>
              <Td>
                <Typography textColor="neutral800">{description}</Typography>
              </Td>
            </Tr>
          );
        })}
      </Tbody>
    </Table>
  );
};

// After
import { Table } from '@strapi/strapi/admin';
NOTE

部分 props 已更改,请参考贡献者关于 Table 组件文档。

Content Manager

contentManagementUtilRemoveFieldsFromData

此函数已被移除,且未被替换。如果你认为需要此函数,请在 Strapi 仓库中提 issue 讨论你的使用场景。

formatContentTypeData

此函数已被移除,且未被替换。如果你认为需要此函数,请在 Strapi 仓库中提 issue 讨论你的使用场景。

useCMEditViewDataManager

大量内部实现已被重新设计与拆分。我们正暴露一个主要的实验性 hook 来替代它,名为 useContentManagerContext,其余逻辑则分布在数个 hook 中。

// Before
import { useCMEditViewDataManager } from '@strapi/helper-plugin';

// After
import { unstable_useContentManagerContext as useContentManagerContext } from '@strapi/strapi/admin';

以下列出了一些常见使用场景:

// Before
const { slug, isSingleType, isCreatingEntry, hasDraftAndPublished } =
  useCMEditViewDataManager();

// After
const {
  model,
  collectionType,
  id,
  slug,
  isCreatingEntry,
  isSingleType,
  hasDraftAndPublish,
} = useContentManagerContext();
// Before

// 'allLayoutData' 已被移除。它曾包含 'components' 和 'contentType',可以像下面这样从 'useContentManagerContext' hook 中提取。
const { allLayoutData } = useCMEditViewDataManager();

// After
const { components, contentType } = useContentManagerContext();
// Before
const { layout } = useCMEditViewDataManager();

// After
const { layout } = useContentManagerContext();

const {
  edit: { layout, components },
  list: { layout },
} = layout;
// Before
const { initialData, modifiedData, onChange } = useCMEditViewDataManager();

// After
const { form } = useContentManagerContext();

// 这里的 'initialData' 和 'modifiedData' 分别对应 'initialValues' 和 'values'。
const { initialValues, values, onChange } = form;
// Before
const { onPublish, onUnpublish } = useCMEditViewDataManager();

// After
const { publish, unpublish } = useDocumentActions();

在内容管理器(Content Manager)编辑视图(Edit View)中渲染的插件,有时需要 Strapi 为内置字段(slug、草稿与发布标志、记录 id)所使用的相同上下文。Strapi 5 移除了 @strapi/helper-plugin,因此 useCMEditViewDataManager 已不可用。

请从 @strapi/strapi/admin 导入 unstable_useContentManagerContext 并在本地起别名。前缀 unstable_ 意味着该 hook 在插件 API 完成稳定化之前可能会发生变化。

NOTE

此 hook 仅在内容管理器编辑视图(Content Manager Edit View)的 React 树内部生效(包括通过 injection zones 注入的组件)。

JavaScript

import { unstable_useContentManagerContext as useContentManagerContext } from '@strapi/strapi/admin';

export const Preview = () => {
  const {
    model,
    collectionType,
    id,
    slug,
    isCreatingEntry,
    isSingleType,
    hasDraftAndPublish,
  } = useContentManagerContext();

  return (
    <section>
      Editing <code>{slug}</code>
      {isSingleType ? ' (single type)' : ' (collection type)'}
    </section>
  );
};

TypeScript

import { unstable_useContentManagerContext as useContentManagerContext } from '@strapi/strapi/admin';

export const Preview = () => {
  const {
    model,
    collectionType,
    id,
    slug,
    isCreatingEntry,
    isSingleType,
    hasDraftAndPublish,
  } = useContentManagerContext();

  return (
    <section>
      Editing <code>{slug}</code>
      {isSingleType ? ' (single type)' : ' (collection type)'}
    </section>
  );
};

Features

AppInfo

此功能已移至 @strapi/admin,现在仅导出 hook useStrapiApp。

AutoReloadOverlayBlocker

此功能已被移除,且未被替换。如果你认为需要此功能,请在 Strapi 仓库中提 issue 讨论你的使用场景。

CustomFields

此功能已被移除,并属于 useStrapiApp hook 的一部分。

GuidedTour

此功能已移至 @strapi/admin,现在仅导出 hook useGuidedTour。

Library

此功能已被移除,并属于 useStrapiApp hook 的一部分。

Notifications

此功能已移至 @strapi/admin 包,现在仅导出 useNotifications hook。message 属性 不再可以是 TranslationMessage,而只能是一个字符串。如果你之前使用的是 warning 类型,现在应改用 danger 类型;如果你之前使用的是 softWarning 类型,现在应使用 warning。最后,返回类型现在是一个对象。

// Before
import { useNotification } from '@strapi/helper-plugin';

const toggleNotification = useNotification();

toggleNotification({
  type: 'warning',
  message: {
    id: 'my.message.id',
    defaultMessage: 'My message',
  },
});

// After
import { useNotification } from '@strapi/strapi/admin';

const { toggleNotification } = useNotification();

toggleNotification({
  type: 'danger',
  message: formatMessage({
    id: 'my.message.id',
    defaultMessage: 'My message',
  }),
});

RBAC

此功能已被移除,且未被替换。如果你需要访问用户的权限,应该使用 useAuth hook。

// Before
import { useRBACProvider } from '@strapi/helper-plugin';

const { allPermission, refetchPermissions } = useRBACProvider();

// After
import { useAuth } from '@strapi/strapi/admin';

const permissions = useAuth('COMPONENT_NAME', (state) => state.permissions);
const refetchPermission = useAuth(
  'COMPONENT_NAME',
  (state) => state.refetchPermission
);

OverlayBlocker

此功能已被移除,且未被替换。如果你认为需要此功能,请在 Strapi 仓库中提 issue 讨论你的使用场景。

StrapiApp

此功能已移至 @strapi/admin,现在仅导出 hook useStrapiApp。

Tracking

此功能已移至 @strapi/admin 包,现在仅导出 useTracking hook。

Hooks

useAPIErrorHandler

此 hook 已被移除。你应该从 @strapi/strapi/admin 包导入它:

// Before
import { useAPIErrorHandler } from '@strapi/helper-plugin';

// After
import { useAPIErrorHandler } from '@strapi/strapi/admin';

useCallbackRef

此 hook 已被移除。你应该从 @strapi/design-system 包导入它:

// Before
import { useCallbackRef } from '@strapi/helper-plugin';

// After
import { useCallbackRef } from '@strapi/design-system';

useClipboard

此 hook 已被移除,且未被替换。如果你认为需要此 hook,请在 Strapi 仓库中提 issue 讨论你的使用场景。

useCollator

此 hook 已被移除。你应该从 @strapi/design-system 包导入它:

// Before
import { useCollator } from '@strapi/helper-plugin';

// After
import { useCollator } from '@strapi/design-system';

useFetchClient

此 hook 已被移除。你应该从 @strapi/strapi/admin 包导入它:

// Before
import { useFetchClient } from '@strapi/helper-plugin';

// After
import { useFetchClient } from '@strapi/strapi/admin';

useFieldHint

此 hook 已被移除,且未被替换。如果你认为需要此 hook,请在 Strapi 仓库中提 issue 讨论你的使用场景。

useFilter

此 hook 已被移除。你应该从 @strapi/design-system 包导入它:

// Before
import { useFilter } from '@strapi/helper-plugin';

// After
import { useFilter } from '@strapi/design-system';

useFocusInputField

此 hook 已被移除,且未被替换。如果你认为需要此 hook,请在 Strapi 仓库中提 issue 讨论你的使用场景。

useFocusWhenNavigate

此 hook 已被移除,且未被替换。如果你认为需要此 hook,请在 Strapi 仓库中提 issue 讨论你的使用场景。

useFormattedMessage

此 hook 已被移除,且未被替换。如果你认为需要此 hook,请在 Strapi 仓库中提 issue 讨论你的使用场景。

useLockScroll

此 hook 已被移除,且未被替换。如果你认为需要此 hook,请在 Strapi 仓库中提 issue 讨论你的使用场景。

useQuery

此 hook 已被移除,且未被替换。如果你认为需要此 hook,请在 Strapi 仓库中提 issue 讨论你的使用场景。

useQueryParams

此 hook 已移动。你应该从 @strapi/strapi/admin 包导入它:

// Before
import { useQueryParams } from '@strapi/helper-plugin';

// After
import { useQueryParams } from '@strapi/strapi/admin';

useRBAC

此 hook 已移动。你应该从 @strapi/strapi/admin 包导入它:

// Before
import { useRBAC } from '@strapi/helper-plugin';

// After
import { useRBAC } from '@strapi/strapi/admin';

useSelectionState

此 hook 已被移除,且未被替换。如果你认为需要此 hook,请在 Strapi 仓库中提 issue 讨论你的使用场景。

Icons

SortIcon

此组件已被移除,且未被替换。如果你认为需要此函数,请在 Strapi 仓库中提 issue 讨论你的使用场景。

RemoveRoundedButton

此组件已被移除,且未被替换。如果你认为需要此函数,请在 Strapi 仓库中提 issue 讨论你的使用场景。

Utils

awaitToJs

此 util 已被移除,且未被替换,请改用 async / await 配合 try / catch。如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

difference

此 util 已被移除,且未被替换。如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

findMatchingPermissions

此 util 已被移除,且未被替换。你应该自己过滤权限。如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

formatPermissionsForRequest

此 util 已被移除,且未被替换。你应该自己格式化权限。如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

getAPIInnerErrors

此 util 已被移除,且未被替换,请改用 async / await 配合 try / catch。如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

getFetchClient

此 util 已被移除。你应该从 @strapi/strapi/admin 包导入它:

// Before
import { getFetchClient } from '@strapi/helper-plugin';

// After
import { getFetchClient } from '@strapi/strapi/admin';

getFileExtension

此 util 已被移除,且未被替换。如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

getYupInnerErrors

此 util 已被移除,且未被替换。如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

auth

此 util 已被移除,且未被替换。如果你试图与令牌(token)或当前用户交互,你应该改用 useAuth hook。 如果你一般是在与 localStorage 交互,则直接访问它,例如 localStorage.getItem('myKey')。

hasPermissions

此 util 已被移除。如果你需要使用它,你应该使用来自 useAuth hook 的 checkUserHasPermissions 函数。

// Before
import { hasPermissions } from '@strapi/helper-plugin';

const permissions = await Promise.all(
  generalSectionRawLinks.map(({ permissions }) =>
    hasPermissions(userPermissions, permissions)
  )
);

// After
import { useAuth } from '@strapi/strapi/admin';

const { checkUserHasPermissions } = useAuth(
  'COMPONENT_NAME',
  (state) => state.checkUserHasPermissions
);

normalizeAPIError

此 util 已被移除,且未被替换。如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

prefixFileUrlWithBackendUrl

此 util 已被移除,且未被替换。如有需要,请使用 strapi 的 backendUrl 来为相对 url 添加前缀。如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

prefixPluginTranslations

此 util 已被移除,且未被替换。如果需要,你的插件应自行定义此 util,实现方式如下:

type TradOptions = Record<string, string>;

const prefixPluginTranslations = (
  trad: TradOptions,
  pluginId: string
): TradOptions => {
  if (!pluginId) {
    throw new TypeError("pluginId can't be empty");
  }
  return Object.keys(trad).reduce((acc, current) => {
    acc[`${pluginId}.${current}`] = trad[current];
    return acc;
  }, {} as TradOptions);
};

如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

pxToRem

此 util 已被移除,且未被替换。你应该直接使用以下代码来替代 pxToRem:

// Before
pxToRem(
  32
) // After
`${32 / 16}rem`;
// or
('2rem');

如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

request

此 util 已被移除,且未被替换。 你可以使用 @strapi/strapi/admin 中的 useFetchClient。

// Before
import { request } from '@strapi/helper-plugin';

request(`/${pluginId}/settings/config`, { method: 'GET' });

// After
import { useFetchClient } from '@strapi/strapi/admin';

const { get } = useFetchClient();
get(`/${pluginId}/settings/config`);

你可以像这样使用它

const { get } = useFetchClient();

const { data } = await get(requestURL);

如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

setHexOpacity

此 util 已被移除,且未被替换,请改用原生的 CSS opacity 属性。如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

stopPropagation

此 util 已被移除,且未被替换。如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

shouldCheckPermissions

此 util 已被移除,且未被替换。如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

translatedErrors

此 utils 已被移除。你应该从 @strapi/strapi/admin 包导入它:

// Before
import { translatedErrors } from '@strapi/helper-plugin';

// After
import { translatedErrors } from '@strapi/strapi/admin';

如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。

wrapAxiosInstance

此 util 已被移除,且未被替换。如果你认为需要此 util,请在 Strapi 仓库中提 issue 讨论你的使用场景。