mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 04:26:32 +08:00
We previously disabled this rule in a lot of places to workaround the fact that the rule wasn't adhering to importing entrypoints in meta files. Instead, let's update the rule to make it clear that this pattern is expected and fine. R=alexrudenko@chromium.org Bug: 1271490 Change-Id: Idd139b42d9bb27f1f20e573b31bcd5efff8815af Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3289221 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Alex Rudenko <alexrudenko@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
58 lines
1.8 KiB
TypeScript
58 lines
1.8 KiB
TypeScript
// Copyright 2020 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import * as Common from '../../core/common/common.js';
|
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
import * as WorkspaceDiff from '../../models/workspace_diff/workspace_diff.js';
|
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
|
|
import type * as Changes from './changes.js';
|
|
|
|
let loadedChangesModule: (typeof Changes|undefined);
|
|
|
|
const UIStrings = {
|
|
/**
|
|
* @description Title of the 'Changes' tool in the bottom drawer
|
|
*/
|
|
changes: 'Changes',
|
|
/**
|
|
* @description Command for showing the 'Changes' tool in the bottom drawer
|
|
*/
|
|
showChanges: 'Show Changes',
|
|
};
|
|
const str_ = i18n.i18n.registerUIStrings('panels/changes/changes-meta.ts', UIStrings);
|
|
const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
|
|
|
|
async function loadChangesModule(): Promise<typeof Changes> {
|
|
if (!loadedChangesModule) {
|
|
loadedChangesModule = await import('./changes.js');
|
|
}
|
|
return loadedChangesModule;
|
|
}
|
|
|
|
UI.ViewManager.registerViewExtension({
|
|
location: UI.ViewManager.ViewLocationValues.DRAWER_VIEW,
|
|
id: 'changes.changes',
|
|
title: i18nLazyString(UIStrings.changes),
|
|
commandPrompt: i18nLazyString(UIStrings.showChanges),
|
|
persistence: UI.ViewManager.ViewPersistence.CLOSEABLE,
|
|
async loadView() {
|
|
const Changes = await loadChangesModule();
|
|
return Changes.ChangesView.ChangesView.instance();
|
|
},
|
|
});
|
|
|
|
Common.Revealer.registerRevealer({
|
|
contextTypes() {
|
|
return [
|
|
WorkspaceDiff.WorkspaceDiff.DiffUILocation,
|
|
];
|
|
},
|
|
destination: Common.Revealer.RevealerDestination.CHANGES_DRAWER,
|
|
async loadRevealer() {
|
|
const Changes = await loadChangesModule();
|
|
return Changes.ChangesView.DiffUILocationRevealer.instance();
|
|
},
|
|
});
|