// Copyright (C) 2026 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Type declarations for virtual modules generated by Vite plugins. See
// pluginAllPluginsBarrel in ui/vite.config.mjs.
//
// NB: this file must be an ambient script (no top-level imports), otherwise
// the `declare module` blocks would become module-scoped and tsc wouldn't
// pick them up when resolving the `virtual:` imports elsewhere. Imports
// inside a `declare module` block can't be relative, so we go via baseUrl.

declare module 'virtual:perfetto/all_plugins' {
  // Putting the imports here rather than hoisting to the top of the file keeps
  // this as an ambient script, which is required in order to get tsc to pick up
  // the module declarations.
  import type {PerfettoPluginStatic, PerfettoPlugin} from 'src/public/plugin';
  const plugins: PerfettoPluginStatic<PerfettoPlugin>[];
  export default plugins;
}

declare module 'virtual:perfetto/all_core_plugins' {
  import type {PerfettoPluginStatic, PerfettoPlugin} from 'src/public/plugin';
  const plugins: PerfettoPluginStatic<PerfettoPlugin>[];
  export default plugins;
}
