From debd81046f39eacd78d5c62c9f313e8b12df4d84 Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Mon, 15 Jul 2024 16:03:56 -0700 Subject: [PATCH] types(ses): Add new module descriptor shapes --- packages/ses/types.d.ts | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/ses/types.d.ts b/packages/ses/types.d.ts index d95ae4c7b0..6ccbab0b1b 100644 --- a/packages/ses/types.d.ts +++ b/packages/ses/types.d.ts @@ -72,27 +72,32 @@ export interface VirtualModuleSource { export type ModuleSource = PrecompiledModuleSource | VirtualModuleSource; -export interface RedirectModuleDescriptor { - specifier: string; - record?: ModuleSource; +export interface SourceModuleDescriptor { + source: string | ModuleSource; + specifier?: string; importMeta?: any; + compartment?: Compartment; // defaults to parent +} + +export interface NamespaceModuleDescriptor { + namespace: string | ModuleExportsNamespace; compartment?: Compartment; } -export interface ReferenceModuleDescriptor { +// Deprecated in favor of SourceModuleDescriptor, +// but beware the change in default compartment. +export interface RecordModuleDescriptor { specifier: string; record?: ModuleSource; importMeta?: any; - compartment?: Compartment; + compartment?: Compartment; // defaults to self } export type ModuleDescriptor = - // These descriptor shapes are needed for XS parity: - // | SourceModuleDescriptor - // | NamespaceModuleDescriptor + | SourceModuleDescriptor + | NamespaceModuleDescriptor // To be deprecated: - | RedirectModuleDescriptor - | ReferenceModuleDescriptor + | RecordModuleDescriptor | ModuleExportsNamespace | VirtualModuleSource | PrecompiledModuleSource; @@ -100,7 +105,7 @@ export type ModuleDescriptor = // Deprecated type aliases: export type PrecompiledStaticModuleInterface = PrecompiledModuleSource; export type ThirdPartyStaticModuleInterface = VirtualModuleSource; -export type RedirectStaticModuleInterface = RedirectModuleDescriptor; +export type RedirectStaticModuleInterface = RecordModuleDescriptor; export type FinalStaticModuleType = ModuleSource; export type StaticModuleType = RedirectStaticModuleInterface | ModuleSource;