From eded8b3161a48a130df54daefb1005b3807314b0 Mon Sep 17 00:00:00 2001 From: Peter Schorn Date: Tue, 1 Sep 2026 13:07:15 -0500 Subject: [PATCH 01/10] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#75458=20[aws?= =?UTF-8?q?-lambda]=20Allow=20null=20JWT=20authorizer=20scopes=20by=20@Pet?= =?UTF-8?q?er-Schorn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/aws-lambda/test/api-gateway-tests.ts | 5 ++++- types/aws-lambda/trigger/api-gateway-proxy.d.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/aws-lambda/test/api-gateway-tests.ts b/types/aws-lambda/test/api-gateway-tests.ts index f8f78ce83df3df..0f42bb9f8e5aa0 100644 --- a/types/aws-lambda/test/api-gateway-tests.ts +++ b/types/aws-lambda/test/api-gateway-tests.ts @@ -353,7 +353,10 @@ const proxyHandlerv2WithJKTAuthorizer: APIGatewayProxyHandlerV2WithJWTAuthorizer authorizer.jwt.scopes; // All non-null or undefined types are converted to string. obj = authorizer.jwt.claims; - array = authorizer.jwt.scopes; + if (authorizer.jwt.scopes !== null) { + array = authorizer.jwt.scopes; + } + const nullableScopes: string[] | null = authorizer.jwt.scopes; // And these extra properties are added str = authorizer.principalId; num = authorizer.integrationLatency; diff --git a/types/aws-lambda/trigger/api-gateway-proxy.d.ts b/types/aws-lambda/trigger/api-gateway-proxy.d.ts index 7e5cde2a4af3e6..39e931e4143d20 100644 --- a/types/aws-lambda/trigger/api-gateway-proxy.d.ts +++ b/types/aws-lambda/trigger/api-gateway-proxy.d.ts @@ -258,7 +258,7 @@ export interface APIGatewayEventRequestContextJWTAuthorizer { integrationLatency: number; jwt: { claims: { [name: string]: string | number | boolean | string[] }; - scopes: string[]; + scopes: string[] | null; }; } From 5e9fcacf13abbfe902cc36cb2e22063e5655d98c Mon Sep 17 00:00:00 2001 From: Josh Berry Date: Tue, 1 Sep 2026 11:32:15 -0700 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#75460=20webe?= =?UTF-8?q?xtension-polyfill:=20Update=20to=20latest=20type=20definitions?= =?UTF-8?q?=20from=20Firefox=20by=20@josh-berry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/webextension-polyfill/index.d.ts | 16 ++ .../namespaces/contextualIdentities.d.ts | 141 ++++++++++++++++++ .../namespaces/events.d.ts | 2 +- .../namespaces/geckoProfiler.d.ts | 1 - .../namespaces/manifest.d.ts | 74 ++++++++- .../namespaces/proxy.d.ts | 12 ++ .../namespaces/publicSuffix.d.ts | 65 ++++++++ .../namespaces/runtime.d.ts | 24 ++- .../namespaces/scripting.d.ts | 14 +- .../namespaces/tabs.d.ts | 39 +++++ .../namespaces/userScripts.d.ts | 102 +++++++++++++ .../namespaces/webNavigation.d.ts | 113 +++++++++++++- .../namespaces/webRequest.d.ts | 108 ++++++++++++++ 13 files changed, 700 insertions(+), 11 deletions(-) create mode 100644 types/webextension-polyfill/namespaces/publicSuffix.d.ts diff --git a/types/webextension-polyfill/index.d.ts b/types/webextension-polyfill/index.d.ts index 7ee28890a82be7..fe2ab202af95e9 100644 --- a/types/webextension-polyfill/index.d.ts +++ b/types/webextension-polyfill/index.d.ts @@ -43,6 +43,7 @@ import { Permissions as ImportedPermissions } from "./namespaces/permissions"; import { Pkcs11 as ImportedPkcs11 } from "./namespaces/pkcs11"; import { Privacy as ImportedPrivacy } from "./namespaces/privacy"; import { Proxy as ImportedProxy } from "./namespaces/proxy"; +import { PublicSuffix as ImportedPublicSuffix } from "./namespaces/publicSuffix"; import { Runtime as ImportedRuntime } from "./namespaces/runtime"; import { Scripting as ImportedScripting } from "./namespaces/scripting"; import { Search as ImportedSearch } from "./namespaces/search"; @@ -321,6 +322,13 @@ declare namespace Browser { */ const proxy: Proxy.Static; + /** + * API to obtain the registrable domain / eTLD+1 from a domain name. + * + * Permissions: "publicSuffix" + */ + const publicSuffix: PublicSuffix.Static; + /** * Use the browser.runtime API to retrieve the background page, return details about the manifest, * and listen for and respond to events in the app or extension lifecycle. You can also use this API to convert the @@ -687,6 +695,13 @@ declare namespace Browser { */ proxy: Proxy.Static; + /** + * API to obtain the registrable domain / eTLD+1 from a domain name. + * + * Permissions: "publicSuffix" + */ + publicSuffix: PublicSuffix.Static; + /** * Use the browser.runtime API to retrieve the background page, return details about the manifest, * and listen for and respond to events in the app or extension lifecycle. You can also use this API to convert the @@ -834,6 +849,7 @@ declare namespace Browser { export import Pkcs11 = ImportedPkcs11; export import Privacy = ImportedPrivacy; export import Proxy = ImportedProxy; + export import PublicSuffix = ImportedPublicSuffix; export import Runtime = ImportedRuntime; export import Scripting = ImportedScripting; export import Search = ImportedSearch; diff --git a/types/webextension-polyfill/namespaces/contextualIdentities.d.ts b/types/webextension-polyfill/namespaces/contextualIdentities.d.ts index d4c6b3a6d5c289..6d28d53c4499d8 100644 --- a/types/webextension-polyfill/namespaces/contextualIdentities.d.ts +++ b/types/webextension-polyfill/namespaces/contextualIdentities.d.ts @@ -43,6 +43,21 @@ export namespace ContextualIdentities { cookieStoreId: string; } + /** + * Represents the association between a site and a contextual identity. + */ + interface SiteAssociation { + /** + * The associated host, normalized to lower case and encoded as ASCII. + */ + site: string; + + /** + * The cookie store ID of the contextual identity the host is associated with. + */ + cookieStoreId: string; + } + /** * Information to filter the contextual identities being retrieved. */ @@ -54,6 +69,30 @@ export namespace ContextualIdentities { name?: string; } + interface GetSupportedColorsCallbackColorsItemType { + /** + * The color name, as accepted by the color property of create and update. + */ + color: string; + + /** + * The color hash for this color name. + */ + colorCode: string; + } + + interface GetSupportedIconsCallbackIconsItemType { + /** + * The icon name, as accepted by the icon property of create and update. + */ + icon: string; + + /** + * The icon url for this icon name. + */ + iconUrl: string; + } + /** * Details about the contextual identity being created. */ @@ -97,6 +136,52 @@ export namespace ContextualIdentities { icon?: string; } + /** + * Details about the site association. + */ + interface SetSiteAssociationDetailsType { + /** + * The host to associate with the container (matched as an exact host). + */ + site: string; + + /** + * The cookie store ID of the container to associate the site with. + */ + cookieStoreId: string; + } + + /** + * Details about the site association to remove. + */ + interface RemoveSiteAssociationDetailsType { + /** + * The host whose container association should be removed. + */ + site: string; + } + + /** + * Details about the site to look up. + */ + interface GetSiteAssociationDetailsType { + /** + * The host to look up. + */ + site: string; + } + + /** + * Information to filter the associations being retrieved. + */ + interface QuerySiteAssociationsDetailsType { + /** + * If provided, only associations for this container are returned. + * Optional. + */ + cookieStoreId?: string; + } + interface OnUpdatedChangeInfoType { /** * Contextual identity that has been updated @@ -118,6 +203,19 @@ export namespace ContextualIdentities { contextualIdentity: ContextualIdentity; } + interface OnSiteAssociationChangedChangeInfoType { + /** + * The host whose association changed. + */ + site: string; + + /** + * The cookie store ID of the now-associated container, or omitted if the association was removed. + * Optional. + */ + cookieStoreId?: string; + } + interface Static { /** * Retrieves information about a single contextual identity. @@ -133,6 +231,16 @@ export namespace ContextualIdentities { */ query(details: QueryDetailsType): Promise; + /** + * Retrieves the list of colors supported by contextual identities. + */ + getSupportedColors(): Promise; + + /** + * Retrieves the list of icons supported by contextual identities. + */ + getSupportedIcons(): Promise; + /** * Creates a contextual identity with the given data. * @@ -163,6 +271,34 @@ export namespace ContextualIdentities { */ remove(cookieStoreId: string): Promise; + /** + * Associates a site with a container. Top-level navigations to that site will load in the given container. + * + * @param details Details about the site association. + */ + setSiteAssociation(details: SetSiteAssociationDetailsType): Promise; + + /** + * Removes the container association for a site. + * + * @param details Details about the site association to remove. + */ + removeSiteAssociation(details: RemoveSiteAssociationDetailsType): Promise; + + /** + * Retrieves the association of a site, or null if the site is not associated with any container. + * + * @param details Details about the site to look up. + */ + getSiteAssociation(details: GetSiteAssociationDetailsType): Promise; + + /** + * Retrieves the list of site-to-container associations. + * + * @param details Information to filter the associations being retrieved. + */ + querySiteAssociations(details: QuerySiteAssociationsDetailsType): Promise; + /** * Fired when a container is updated. */ @@ -177,5 +313,10 @@ export namespace ContextualIdentities { * Fired when a container is removed. */ onRemoved: Events.Event<(changeInfo: OnRemovedChangeInfoType) => void>; + + /** + * Fired when a site-to-container association is added, changed, or removed. + */ + onSiteAssociationChanged: Events.Event<(changeInfo: OnSiteAssociationChangedChangeInfoType) => void>; } } diff --git a/types/webextension-polyfill/namespaces/events.d.ts b/types/webextension-polyfill/namespaces/events.d.ts index b8e66ebb80c408..e8c539b753042d 100644 --- a/types/webextension-polyfill/namespaces/events.d.ts +++ b/types/webextension-polyfill/namespaces/events.d.ts @@ -48,7 +48,7 @@ export namespace Events { * Registers an event listener callback to an event. * * @param callback Called when an event occurs. The parameters of this function depend on the type of event. - * @param ...params Further parameters, depending on the event. + * @param params Further parameters, depending on the event. */ addListener(callback: T, ...params: unknown[]): void; diff --git a/types/webextension-polyfill/namespaces/geckoProfiler.d.ts b/types/webextension-polyfill/namespaces/geckoProfiler.d.ts index bbe4228b6b57e4..0dc29f8607639f 100644 --- a/types/webextension-polyfill/namespaces/geckoProfiler.d.ts +++ b/types/webextension-polyfill/namespaces/geckoProfiler.d.ts @@ -23,7 +23,6 @@ export namespace GeckoProfiler { | "nativeallocations" | "ipcmessages" | "audiocallbacktracing" - | "cpu" | "notimerresolutionchange" | "cpuallthreads" | "samplingallthreads" diff --git a/types/webextension-polyfill/namespaces/manifest.d.ts b/types/webextension-polyfill/namespaces/manifest.d.ts index f83d4b70b7b115..eaabc923372988 100644 --- a/types/webextension-polyfill/namespaces/manifest.d.ts +++ b/types/webextension-polyfill/namespaces/manifest.d.ts @@ -124,6 +124,11 @@ export namespace Manifest { */ content_security_policy?: string | WebExtensionManifestContentSecurityPolicyC2Type; + /** + * Optional. + */ + sandbox?: WebExtensionManifestSandboxType; + /** * Optional. */ @@ -285,6 +290,7 @@ export namespace Manifest { | "idle" | "cookies" | "menus.overrideContext" + | "publicSuffix" | "scripting" | "search" | "tabGroups" @@ -641,6 +647,21 @@ export namespace Manifest { properties?: ThemeExperimentPropertiesType; } + /** + * A CSS gradient that can be used as a theme background, in addition to image assets. + * The single property name selects the gradient function, and its value holds the gradient's arguments, e.g. + * `{ "linear-gradient": "to bottom, #FF6BBA, #FFC999" }`. + */ + type ThemeCSSGradient = + | ThemeCSSGradientC1Type + | ThemeCSSGradientC2Type + | ThemeCSSGradientC3Type + | ThemeCSSGradientC4Type + | ThemeCSSGradientC5Type + | ThemeCSSGradientC6Type; + + type ThemeBackground = ImageDataOrExtensionURL | ThemeCSSGradient; + interface ThemeType { /** * Optional. @@ -780,6 +801,19 @@ export namespace Manifest { sandbox?: string; } + interface WebExtensionManifestSandboxType { + /** + * The list of pages in the form of globs to serve as sandboxed extension pages. + */ + pages: string[]; + + /** + * The content security policy used for sandboxed extension pages. + * Optional. + */ + content_security_policy?: string; + } + interface WebExtensionManifestWebAccessibleResourcesC2ItemType { resources: string[]; @@ -1068,16 +1102,40 @@ export namespace Manifest { [s: string]: unknown; } + interface ThemeCSSGradientC1Type { + "linear-gradient": string; + } + + interface ThemeCSSGradientC2Type { + "radial-gradient": string; + } + + interface ThemeCSSGradientC3Type { + "conic-gradient": string; + } + + interface ThemeCSSGradientC4Type { + "repeating-linear-gradient": string; + } + + interface ThemeCSSGradientC5Type { + "repeating-radial-gradient": string; + } + + interface ThemeCSSGradientC6Type { + "repeating-conic-gradient": string; + } + interface ThemeTypeImagesType { /** * Optional. */ - additional_backgrounds?: ImageDataOrExtensionURL[]; + additional_backgrounds?: ThemeBackground[]; /** * Optional. */ - theme_frame?: ImageDataOrExtensionURL; + theme_frame?: ThemeBackground; } interface ThemeTypeColorsType { @@ -1278,6 +1336,8 @@ export namespace Manifest { toolbar_field_highlight_text?: ThemeColor; } + type ThemeTypePropertiesBackgroundsAreaEnum = "auto" | "window" | "top_toolbars"; + type ThemeTypePropertiesAdditionalBackgroundsAlignmentItemEnum = | "bottom" | "center" @@ -1301,6 +1361,11 @@ export namespace Manifest { type ThemeTypePropertiesContentColorSchemeEnum = "auto" | "light" | "dark" | "system"; interface ThemeTypePropertiesType { + /** + * Optional. + */ + backgrounds_area?: ThemeTypePropertiesBackgroundsAreaEnum; + /** * Optional. */ @@ -1311,6 +1376,11 @@ export namespace Manifest { */ additional_backgrounds_tiling?: ThemeTypePropertiesAdditionalBackgroundsTilingItemEnum[]; + /** + * Optional. + */ + additional_backgrounds_size?: string[]; + /** * Optional. */ diff --git a/types/webextension-polyfill/namespaces/proxy.d.ts b/types/webextension-polyfill/namespaces/proxy.d.ts index 8373bc35dea665..ab0c13aa9a7b73 100644 --- a/types/webextension-polyfill/namespaces/proxy.d.ts +++ b/types/webextension-polyfill/namespaces/proxy.d.ts @@ -111,6 +111,18 @@ export namespace Proxy { */ parentFrameId: number; + /** + * The UUID of the document making the request. + * Optional. + */ + documentId?: string; + + /** + * The UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * True for private browsing requests. * Optional. diff --git a/types/webextension-polyfill/namespaces/publicSuffix.d.ts b/types/webextension-polyfill/namespaces/publicSuffix.d.ts new file mode 100644 index 00000000000000..cd5bb5df402ae6 --- /dev/null +++ b/types/webextension-polyfill/namespaces/publicSuffix.d.ts @@ -0,0 +1,65 @@ +////////////////////////////////////////////////////// +// BEWARE: DO NOT EDIT MANUALLY! Changes will be lost! +////////////////////////////////////////////////////// + +/** + * Namespace: browser.publicSuffix + */ +export namespace PublicSuffix { + /** + * The available encoding types for the returned domain. + */ + type DomainEncoding = "punycode" | "display"; + + interface GetDomainOptionsType { + /** + * Determines how the returned domain should be encoded. + * Optional. + */ + encoding?: DomainEncoding; + + /** + * If true, and the input hostname is an IP address, then this is returned as-is. + * Optional. + */ + allowIPAddress?: boolean; + + /** + * If true, and the input hostname is itself a known eTLD (without a preceding label) then this is returned as-is. + * Optional. + */ + allowPlainSuffix?: boolean; + + /** + * If true, and the input hostname lacks a known eTLD, and is neither itself a known eTLD nor an IP address, + * then the returned domain consists of the penultimate two domain labels of the input. + * Optional. + */ + allowUnknownSuffix?: boolean; + } + + interface Static { + /** + * Checks if the given hostname is itself a known public suffix / eTLD (i.e. in the PSL). + * + * @returns True if the given hostname is itself a known eTLD. + */ + isKnownSuffix(hostname: string): boolean; + + /** + * Gets the known public suffix / eTLD (i.e. in the PSL), if any, of a given hostname. + * + * @returns The known eTLD of the given hostname, or null if no such known eTLD exists. + */ + getKnownSuffix(hostname: string): string; + + /** + * Gets the eTLD+1 of a given hostname, or a variant such as IP address if the options allow. + * + * @param options Optional. + * @returns The eTLD+1 (or a variant such as IP address if allowed) of the given hostname, + * or null if no such eTLD+1 (variant) exists. + */ + getDomain(hostname: string, options?: GetDomainOptionsType): string; + } +} diff --git a/types/webextension-polyfill/namespaces/runtime.d.ts b/types/webextension-polyfill/namespaces/runtime.d.ts index 83900f61109324..fc06ea3953783f 100644 --- a/types/webextension-polyfill/namespaces/runtime.d.ts +++ b/types/webextension-polyfill/namespaces/runtime.d.ts @@ -79,6 +79,12 @@ export namespace Runtime { */ contextType: ContextType; + /** + * An UUID for the document associated with this context, or undefined if it is not hosted in a document + * Optional. + */ + documentId?: string; + /** * The origin of the document associated with this context, or undefined if it is not hosted in a document * Optional. @@ -164,6 +170,12 @@ export namespace Runtime { */ frameId?: number; + /** + * A UUID of the document that opened the connection. + * Optional. + */ + documentId?: string; + /** * The ID of the extension or app that opened the connection, if any. * Optional. @@ -425,10 +437,20 @@ export namespace Runtime { */ getURL(path: string): string; + /** + * Get the documentId of any window global or frame element. Throws for invalid targets, such as unloaded frames. + * + * @param target A WindowProxy or a browsing context container Element (iframe, frame, embed, or object) + * for the target frame. + * @returns The documentId of the target document. + */ + getDocumentId(target: unknown): string; + /** * Get the frameId of any window global or frame element. * - * @param target A WindowProxy or a Browsing Context container element (IFrame, Frame, Embed, Object) for the target frame. + * @param target A WindowProxy or a browsing context container Element (iframe, frame, embed, or object) + * for the target frame. * @returns The frameId of the target frame, or -1 if it doesn't exist. */ getFrameId(target: unknown): number; diff --git a/types/webextension-polyfill/namespaces/scripting.d.ts b/types/webextension-polyfill/namespaces/scripting.d.ts index 30b816c3e8ccaf..1fc6183f734b8e 100644 --- a/types/webextension-polyfill/namespaces/scripting.d.ts +++ b/types/webextension-polyfill/namespaces/scripting.d.ts @@ -32,7 +32,7 @@ export namespace Scripting { * This means that any bound parameters and execution context will be lost. Exactly one of files and * func must be specified. * - * @param ...args The arguments + * @param args The arguments * @returns The return value */ func?(...args: unknown[]): unknown; @@ -58,6 +58,11 @@ export namespace Scripting { * Result of a script injection. */ interface InjectionResult { + /** + * The document associated with the injection. + */ + documentId: string; + /** * The frame ID associated with the injection. */ @@ -106,6 +111,13 @@ export namespace Scripting { * The ID of the tab into which to inject. */ tabId: number; + + /** + * The IDs of specific documents to inject into. This must not be set if frameIds or allFrames + * is set. + * Optional. + */ + documentIds?: string[]; } interface CSSInjection { diff --git a/types/webextension-polyfill/namespaces/tabs.d.ts b/types/webextension-polyfill/namespaces/tabs.d.ts index 0b50db8bed939e..7bb35fc4f23c7d 100644 --- a/types/webextension-polyfill/namespaces/tabs.d.ts +++ b/types/webextension-polyfill/namespaces/tabs.d.ts @@ -237,6 +237,13 @@ export namespace Tabs { */ groupId?: number; + /** + * The ID of the Split View that the tab belongs to. $(ref:tabs.SPLIT_VIEW_ID_NONE) if the tab does not belong to a split + * view. + * Optional. + */ + splitViewId?: number; + /** * The URL the tab is navigating to, before it has committed. This property is only present if the extension's manifest * includes the "tabs" permission and there is a pending navigation. @@ -466,6 +473,7 @@ export namespace Tabs { | "mutedInfo" | "pinned" | "sharingState" + | "splitViewId" | "status" | "title" | "url"; @@ -515,6 +523,12 @@ export namespace Tabs { * Optional. */ frameId?: number; + + /** + * Open a port to a specific document identified by documentId instead of all frames in the tab. + * Optional. + */ + documentId?: string; } interface SendMessageOptionsType { @@ -524,6 +538,12 @@ export namespace Tabs { * Optional. */ frameId?: number; + + /** + * Send a message to a specific document identified by documentId instead of all frames in the tab. + * Optional. + */ + documentId?: string; } interface CreateCreatePropertiesType { @@ -735,6 +755,13 @@ export namespace Tabs { */ groupId?: number; + /** + * The ID of the Split View that the tab belongs to. $(ref:tabs.SPLIT_VIEW_ID_NONE) if the tab does not belong to a split + * view. + * Optional. + */ + splitViewId?: number; + /** * True for any screen sharing, or a string to specify type of screen sharing. * Optional. @@ -961,6 +988,13 @@ export namespace Tabs { */ sharingState?: SharingState; + /** + * The ID of the Split View that the tab belongs to. $(ref:tabs.SPLIT_VIEW_ID_NONE) if the tab does not belong to a split + * view. + * Optional. + */ + splitViewId?: number; + /** * The status of the tab. Can be either loading or complete. * Optional. @@ -1475,5 +1509,10 @@ export namespace Tabs { * An ID which represents the absence of a browser tab. */ TAB_ID_NONE: -1; + + /** + * A value for use with splitViewId to represent that the tab is not a member of a Split View. + */ + SPLIT_VIEW_ID_NONE: -1; } } diff --git a/types/webextension-polyfill/namespaces/userScripts.d.ts b/types/webextension-polyfill/namespaces/userScripts.d.ts index 1dc0de3b67bf68..17b23f8682be77 100644 --- a/types/webextension-polyfill/namespaces/userScripts.d.ts +++ b/types/webextension-polyfill/namespaces/userScripts.d.ts @@ -179,6 +179,99 @@ export namespace UserScripts { messaging?: boolean; } + /** + * Details of a user script injection + */ + interface UserScriptInjection { + /** + * Whether the injection should be triggered in the target as soon as possible. Note that this is not a guarantee that + * injection will occur prior to page load, as the page may have already loaded by the time the script reaches the target. + * Optional. + */ + injectImmediately?: boolean; + + /** + * The list of ScriptSource objects defining sources of scripts to be injected into matching pages. + */ + js: ScriptSource[]; + + /** + * Details specifying the target into which to inject the script. + */ + target: InjectionTarget; + + /** + * The JavaScript "world" to run the script in. The default is `USER_SCRIPT`. + * Optional. + */ + world?: ExecutionWorld; + + /** + * A specific user script world ID to execute in. Only valid if `world` is omitted or is `USER_SCRIPT`. + * If `worldId` is omitted, the default value is an empty string ("") and the script will execute in the default world. + * Optional. + */ + worldId?: string; + } + + /** + * Details specifying the target into which to inject the script. + */ + interface InjectionTarget { + /** + * Whether the script should inject into all frames within the tab. Defaults to false. + * This must not be true if `frameIds` is specified. + * Optional. + */ + allFrames?: boolean; + + /** + * The IDs of specific documentIds to inject into. This must not be set if frameIds is set. + * Optional. + */ + documentIds?: string[]; + + /** + * The IDs of specific frames to inject into. + * Optional. + */ + frameIds?: number[]; + + /** + * The ID of the tab into which to inject. + */ + tabId: number; + } + + /** + * Result of a user script injection. + */ + interface InjectionResult { + /** + * Document ID associated with the injection. + */ + documentId: string; + + /** + * Frame ID associated with the injection. + */ + frameId: number; + + /** + * Result of the script injection if any. This is mutually exclusive with error. + * Optional. + */ + result?: unknown; + + /** + * Error message if any. This is mutually exclusive with result. The value is typically an (Error) + * object with a message property, but could be any value (including primitives and undefined) + * if the user script threw or rejected with such a value. + * Optional. + */ + error?: unknown; + } + /** * An object that represents a user script registered programmatically */ @@ -261,5 +354,14 @@ export namespace UserScripts { * Returns all registered USER_SCRIPT world configurations. */ getWorldConfigurations(): Promise; + + /** + * Executes one or more ephemeral user scripts into a specific tab. + * + * @param injection The details of the user script which to inject. + * @returns Invoked upon completion of the injection. The resulting array contains the result of execution for each frame + * where the injection succeeded. + */ + execute(injection: UserScriptInjection): Promise; } } diff --git a/types/webextension-polyfill/namespaces/webNavigation.d.ts b/types/webextension-polyfill/namespaces/webNavigation.d.ts index 021340185d024d..62d2c366d50a84 100644 --- a/types/webextension-polyfill/namespaces/webNavigation.d.ts +++ b/types/webextension-polyfill/namespaces/webNavigation.d.ts @@ -37,9 +37,10 @@ export namespace WebNavigation { */ interface GetFrameDetailsType { /** - * The ID of the tab in which the frame is. + * The ID of the tab in which the frame is. Must be specified if documentId is not set. + * Optional. */ - tabId: number; + tabId?: number; /** * The ID of the process runs the renderer for this tab. @@ -48,9 +49,17 @@ export namespace WebNavigation { processId?: number; /** - * The ID of the frame in the given tab. + * The ID of the frame in the given tab. Must be specified if documentId is not set. + * Optional. */ - frameId: number; + frameId?: number; + + /** + * The UUID of the document. If provided, tabId and frameId are optional. If all are provided, + * the frame is only returned if all properties match. + * Optional. + */ + documentId?: string; } /** @@ -83,6 +92,17 @@ export namespace WebNavigation { * ID of frame that wraps the frame. Set to -1 of no parent frame exists. */ parentFrameId: number; + + /** + * A UUID of the document loaded. + */ + documentId: string; + + /** + * A UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; } /** @@ -117,6 +137,17 @@ export namespace WebNavigation { */ parentFrameId: number; + /** + * A UUID of the document loaded. + */ + documentId: string; + + /** + * A UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * The URL currently associated with this frame. */ @@ -142,6 +173,12 @@ export namespace WebNavigation { */ parentFrameId: number; + /** + * A UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * The time when the browser was about to start the navigation, in milliseconds since the epoch. */ @@ -162,6 +199,17 @@ export namespace WebNavigation { */ frameId: number; + /** + * A UUID of the document loaded. + */ + documentId: string; + + /** + * A UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * Cause of the navigation. */ @@ -192,6 +240,17 @@ export namespace WebNavigation { */ frameId: number; + /** + * A UUID of the document loaded. + */ + documentId: string; + + /** + * A UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * The time when the page's DOM was fully constructed, in milliseconds since the epoch. */ @@ -212,6 +271,17 @@ export namespace WebNavigation { */ frameId: number; + /** + * A UUID of the document loaded. + */ + documentId: string; + + /** + * A UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * The time when the document finished loading, in milliseconds since the epoch. */ @@ -232,6 +302,17 @@ export namespace WebNavigation { */ frameId: number; + /** + * A UUID of the document loaded. + */ + documentId: string; + + /** + * A UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * The time when the error occurred, in milliseconds since the epoch. */ @@ -284,6 +365,17 @@ export namespace WebNavigation { */ frameId: number; + /** + * A UUID of the document loaded. + */ + documentId: string; + + /** + * A UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * Cause of the navigation. */ @@ -331,6 +423,17 @@ export namespace WebNavigation { */ frameId: number; + /** + * A UUID of the document loaded. + */ + documentId: string; + + /** + * A UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * Cause of the navigation. */ @@ -472,7 +575,7 @@ export namespace WebNavigation { interface Static { /** * Retrieves information about the given frame. A frame refers to an <iframe> or a <frame> of a web page and is - * identified by a tab ID and a frame ID. + * identified by a tab ID and a frame ID, or by its document ID. * * @param details Information about the frame to retrieve information about. */ diff --git a/types/webextension-polyfill/namespaces/webRequest.d.ts b/types/webextension-polyfill/namespaces/webRequest.d.ts index 0595e284926e96..bd737a76c3dc94 100644 --- a/types/webextension-polyfill/namespaces/webRequest.d.ts +++ b/types/webextension-polyfill/namespaces/webRequest.d.ts @@ -483,6 +483,18 @@ export namespace WebRequest { */ parentFrameId: number; + /** + * The UUID of the document making the request. + * Optional. + */ + documentId?: string; + + /** + * The UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * True for private browsing requests. * Optional. @@ -573,6 +585,18 @@ export namespace WebRequest { */ parentFrameId: number; + /** + * The UUID of the document making the request. + * Optional. + */ + documentId?: string; + + /** + * The UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * True for private browsing requests. * Optional. @@ -663,6 +687,18 @@ export namespace WebRequest { */ parentFrameId: number; + /** + * The UUID of the document making the request. + * Optional. + */ + documentId?: string; + + /** + * The UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * True for private browsing requests. * Optional. @@ -753,6 +789,18 @@ export namespace WebRequest { */ parentFrameId: number; + /** + * The UUID of the document making the request. + * Optional. + */ + documentId?: string; + + /** + * The UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * True for private browsing requests. * Optional. @@ -854,6 +902,18 @@ export namespace WebRequest { */ parentFrameId: number; + /** + * The UUID of the document making the request. + * Optional. + */ + documentId?: string; + + /** + * The UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * True for private browsing requests. * Optional. @@ -976,6 +1036,18 @@ export namespace WebRequest { */ parentFrameId: number; + /** + * The UUID of the document making the request. + * Optional. + */ + documentId?: string; + + /** + * The UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * True for private browsing requests. * Optional. @@ -1088,6 +1160,18 @@ export namespace WebRequest { */ parentFrameId: number; + /** + * The UUID of the document making the request. + * Optional. + */ + documentId?: string; + + /** + * The UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * True for private browsing requests. * Optional. @@ -1205,6 +1289,18 @@ export namespace WebRequest { */ parentFrameId: number; + /** + * The UUID of the document making the request. + * Optional. + */ + documentId?: string; + + /** + * The UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * True for private browsing requests. * Optional. @@ -1326,6 +1422,18 @@ export namespace WebRequest { */ parentFrameId: number; + /** + * The UUID of the document making the request. This value is not present if the request is a navigation of a frame. + * Optional. + */ + documentId?: string; + + /** + * The UUID of the parent document owning this frame. This is not set if there is no parent. + * Optional. + */ + parentDocumentId?: string; + /** * True for private browsing requests. * Optional. From 5ba0578eb62a37383130813310868a7ed9e04284 Mon Sep 17 00:00:00 2001 From: Erwan Jugand <47392755+erwanjugand@users.noreply.github.com> Date: Tue, 1 Sep 2026 20:49:36 +0200 Subject: [PATCH 03/10] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#75440=20[chr?= =?UTF-8?q?ome]=20update=20since=20Chrome=20152=20by=20@erwanjugand?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/chrome/index.d.ts | 52 ++++++++++++++++++++++++++++++-------- types/chrome/test/index.ts | 48 +++++++++++++++++++++++++++++++---- 2 files changed, 84 insertions(+), 16 deletions(-) diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 9ee4111d42d442..a59c0a1a979fa1 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -394,6 +394,11 @@ declare namespace chrome { export namespace alarms { type AlarmCreateInfo = & { + /** + * Name of this alarm. + * @since Chrome 152 + */ + name?: string | undefined; /** * Whether the alarm should persist across sessions (browser restarts). In Chrome, this defaults to true to match historical behavior, but you should set this explicitly to maximize compatibility across browsers. * @since Chrome 150 @@ -453,9 +458,18 @@ declare namespace chrome { * Can return its result via Promise in Manifest V3 or later since Chrome 111. */ function create(alarmInfo: AlarmCreateInfo): Promise; - function create(name: string | undefined, alarmInfo: AlarmCreateInfo): Promise; + function create(name: undefined, alarmInfo: AlarmCreateInfo): Promise; + function create( + name: string, + alarmInfo: T & (T extends { name: string } ? never : unknown), + ): Promise; function create(alarmInfo: AlarmCreateInfo, callback: () => void): void; - function create(name: string | undefined, alarmInfo: AlarmCreateInfo, callback: () => void): void; + function create(name: undefined, alarmInfo: AlarmCreateInfo, callback: () => void): void; + function create( + name: string, + alarmInfo: T & (T extends { name: string } ? never : unknown), + callback: () => void, + ): void; /** * Gets an array of all the alarms. @@ -3074,10 +3088,13 @@ declare namespace chrome { /** * Creates a pane within panel's sidebar. * @param title Text that is displayed in sidebar caption. + * + * Can return its result via Promise in Manifest V3 or later since Chrome 152. */ + createSidebarPane(title: string): Promise; createSidebarPane( title: string, - callback?: ( + callback: ( /** An ExtensionSidebarPane object for created sidebar pane. */ result: ExtensionSidebarPane, ) => void, @@ -3091,10 +3108,13 @@ declare namespace chrome { /** * Creates a pane within panel's sidebar. * @param title Text that is displayed in sidebar caption. + * + * Can return its result via Promise in Manifest V3 or later since Chrome 152. */ + createSidebarPane(title: string): Promise; createSidebarPane( title: string, - callback?: ( + callback: ( /** An ExtensionSidebarPane object for created sidebar pane. */ result: ExtensionSidebarPane, ) => void, @@ -3114,19 +3134,23 @@ declare namespace chrome { * Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane. * @param expression An expression to be evaluated in context of the inspected page. JavaScript objects and DOM nodes are displayed in an expandable tree similar to the console/watch. * @param rootTitle An optional title for the root of the expression tree. + * + * Can return its result via Promise in Manifest V3 or later since Chrome 152. */ - setExpression(expression: string, callback?: () => void): void; - setExpression(expression: string, rootTitle: string | undefined, callback?: () => void): void; + setExpression(expression: string, rootTitle?: string): Promise; + setExpression(expression: string, rootTitle: string | undefined, callback: () => void): void; /** * Sets a JSON-compliant object to be displayed in the sidebar pane. * @param jsonObject An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client). * @param rootTitle An optional title for the root of the expression tree. + * + * Can return its result via Promise in Manifest V3 or later since Chrome 152. */ - setObject(jsonObject: { [key: string]: unknown }, callback?: () => void): void; + setObject(jsonObject: { [key: string]: unknown }, rootTitle?: string): Promise; setObject( jsonObject: { [key: string]: unknown }, rootTitle: string | undefined, - callback?: () => void, + callback: () => void, ): void; /** * Sets an HTML page to be displayed in the sidebar pane. @@ -3156,12 +3180,15 @@ declare namespace chrome { * @param title Title that is displayed next to the extension icon in the Developer Tools toolbar. * @param iconPath Path of the panel's icon relative to the extension directory. * @param pagePath Path of the panel's HTML page relative to the extension directory. + * + * Can return its result via Promise in Manifest V3 or later since Chrome 152. */ + function create(title: string, iconPath: string, pagePath: string): Promise; function create( title: string, iconPath: string, pagePath: string, - callback?: ( + callback: ( /** An ExtensionPanel object representing the created panel. */ panel: ExtensionPanel, ) => void, @@ -3188,13 +3215,16 @@ declare namespace chrome { * @param url The URL of the resource to open. * @param lineNumber Specifies the line number to scroll to when the resource is loaded. * @param columnNumber Specifies the column number to scroll to when the resource is loaded. + * + * Can return its result via Promise in Manifest V3 or later since Chrome 152. */ - function openResource(url: string, lineNumber: number, callback?: () => void): void; + function openResource(url: string, lineNumber: number, columnNumber?: number): Promise; + function openResource(url: string, lineNumber: number, callback: () => void): void; function openResource( url: string, lineNumber: number, columnNumber: number | undefined, - callback?: () => void, + callback: () => void, ): void; /** diff --git a/types/chrome/test/index.ts b/types/chrome/test/index.ts index 9ae33b5cd16457..fd9dbf08e7c0cc 100644 --- a/types/chrome/test/index.ts +++ b/types/chrome/test/index.ts @@ -1903,40 +1903,76 @@ function testDevtoolsPanels() { const title = "title"; const iconPath = "iconPath"; const pagePath = "pagePath"; + const expression = "expression"; + const rootTitle = "rootTitle"; chrome.devtools.panels.elements; // $ExpectType ElementsPanel - chrome.devtools.panels.elements.createSidebarPane(title); // $ExpectType void + chrome.devtools.panels.elements.createSidebarPane(title); // $ExpectType Promise chrome.devtools.panels.elements.createSidebarPane(title, result => { // $ExpectType void result; // $ExpectType ExtensionSidebarPane + + checkChromeEvent(result.onHidden, () => void 0); + checkChromeEvent(result.onShown, () => void 0); + + result.setExpression(expression); // $ExpectType Promise + // @ts-expect-error Uncaught DataCloneError: Failed to execute 'postMessage' on 'MessagePort' + result.setExpression(expression, () => void 0); + result.setExpression(expression, undefined, () => void 0); // $ExpectType void + result.setExpression(expression, rootTitle); // $ExpectType Promise + result.setExpression(expression, rootTitle, () => void 0); // $ExpectType void + // @ts-expect-error + result.setExpression(expression, rootTitle, () => {}).then(() => {}); + + result.setHeight("100px"); // $ExpectType void + + result.setObject({}); // $ExpectType Promise + // @ts-expect-error Uncaught DataCloneError: Failed to execute 'postMessage' on 'MessagePort' + result.setObject({}, () => void 0); + result.setObject({}, undefined, () => void 0); // $ExpectType void + result.setObject({}, rootTitle); // $ExpectType Promise + result.setObject({}, rootTitle, () => void 0); // $ExpectType void + // @ts-expect-error + result.setObject({}, rootTitle, () => {}).then(() => {}); + + result.setPage("path"); // $ExpectType void }); + // @ts-expect-error + chrome.devtools.panels.elements.createSidebarPane(title, () => {}).then(() => {}); checkChromeEvent(chrome.devtools.panels.elements.onSelectionChanged, () => void 0); chrome.devtools.panels.sources; // $ExpectType SourcesPanel - chrome.devtools.panels.sources.createSidebarPane(title); // $ExpectType void + chrome.devtools.panels.sources.createSidebarPane(title); // $ExpectType Promise chrome.devtools.panels.sources.createSidebarPane(title, result => { // $ExpectType void result; // $ExpectType ExtensionSidebarPane }); + // @ts-expect-error + chrome.devtools.panels.sources.createSidebarPane(title, () => {}).then(() => {}); checkChromeEvent(chrome.devtools.panels.sources.onSelectionChanged, () => void 0); chrome.devtools.panels.themeName; // $ExpectType Theme - chrome.devtools.panels.create(title, iconPath, pagePath); // $ExpectType void + chrome.devtools.panels.create(title, iconPath, pagePath); // $ExpectType Promise chrome.devtools.panels.create(title, iconPath, pagePath, panel => { // $ExpectType void + panel; // ExpectType ExtensionPanel checkChromeEvent(panel.onHidden, () => void 0); checkChromeEvent(panel.onSearch, () => void 0); checkChromeEvent(panel.onShown, () => void 0); panel.createStatusBarButton("iconPath", "tooltipText", true); // $ExpectType Button panel.show(); // $ExpectType void }); + // @ts-expect-error + chrome.devtools.panels.create(title, iconPath, pagePath, () => {}).then(() => {}); const url = "url"; const lineNumber = 10; const columnNumber = 10; - chrome.devtools.panels.openResource(url, lineNumber); // $ExpectType void - chrome.devtools.panels.openResource(url, lineNumber, columnNumber); // $ExpectType void + chrome.devtools.panels.openResource(url, lineNumber); // $ExpectType Promise + chrome.devtools.panels.openResource(url, lineNumber, columnNumber); // $ExpectType Promise chrome.devtools.panels.openResource(url, lineNumber, columnNumber, () => void 0); // $ExpectType void chrome.devtools.panels.openResource(url, lineNumber, () => void 0); // $ExpectType void + // @ts-expect-error + chrome.devtools.panels.openResource(url, lineNumber, () => {}).then(() => {}); chrome.devtools.panels.setOpenResourceHandler(); // $ExpectType void chrome.devtools.panels.setOpenResourceHandler((resource, lineNumber) => { // $ExpectType void @@ -2708,6 +2744,8 @@ async function testAlarms() { chrome.alarms.create("name", { persistAcrossSessions: true }, () => {}); // @ts-expect-error Cannot set both when and delayInMinutes. chrome.alarms.create("name", { when: 1, delayInMinutes: 1, periodInMinutes: 1 }, () => {}); + // @ts-expect-error Cannot set alarm name in both separate argument and object form. + chrome.alarms.create("name", { delayInMinutes: 1, name: "name" }, () => {}); // @ts-expect-error chrome.alarms.create("name", alarmCreateInfo, () => {}).then(() => {}); From 4e150648e6e5c629a5ce10db302613704c4da225 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 1 Sep 2026 11:51:25 -0700 Subject: [PATCH 04/10] Remove contributors with deleted accounts (#75461) Co-authored-by: typescript-automation[bot] <290192711+typescript-automation[bot]@users.noreply.github.com> --- types/entropy__winston-elasticsearch-apm/package.json | 7 +------ types/react-router-hash-link/package.json | 4 ---- types/stegcloak/package.json | 7 +------ 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/types/entropy__winston-elasticsearch-apm/package.json b/types/entropy__winston-elasticsearch-apm/package.json index 9e61c311dca1aa..062f0f7d170e81 100644 --- a/types/entropy__winston-elasticsearch-apm/package.json +++ b/types/entropy__winston-elasticsearch-apm/package.json @@ -14,10 +14,5 @@ "devDependencies": { "@types/entropy__winston-elasticsearch-apm": "workspace:." }, - "owners": [ - { - "name": "Michael Vasyliv", - "githubUsername": "michael-vasyliv" - } - ] + "owners": [] } diff --git a/types/react-router-hash-link/package.json b/types/react-router-hash-link/package.json index a4a94a09647b93..30147548380ee4 100644 --- a/types/react-router-hash-link/package.json +++ b/types/react-router-hash-link/package.json @@ -19,10 +19,6 @@ "name": "Sam Baeck", "githubUsername": "zoompie" }, - { - "name": "Michael Vasyliv", - "githubUsername": "michael-vasyliv" - }, { "name": "Eli Robinson", "githubUsername": "EliRobinson" diff --git a/types/stegcloak/package.json b/types/stegcloak/package.json index 4451a44e41814e..86a10c3a3893b6 100644 --- a/types/stegcloak/package.json +++ b/types/stegcloak/package.json @@ -8,10 +8,5 @@ "devDependencies": { "@types/stegcloak": "workspace:." }, - "owners": [ - { - "name": "Will Ockmore", - "githubUsername": "ktjd123" - } - ] + "owners": [] } From ba53a5b050dbbef74c48d5ff23dff87e46ceee97 Mon Sep 17 00:00:00 2001 From: Remco Haszing Date: Tue, 1 Sep 2026 21:09:26 +0200 Subject: [PATCH 05/10] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#75465=20Add?= =?UTF-8?q?=20type=20definitions=20for=20express-interceptor=20by=20@remco?= =?UTF-8?q?haszing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/express-interceptor/.npmignore | 5 +++ .../express-interceptor-tests.ts | 41 +++++++++++++++++++ types/express-interceptor/index.d.ts | 31 ++++++++++++++ types/express-interceptor/package.json | 20 +++++++++ types/express-interceptor/tsconfig.json | 19 +++++++++ 5 files changed, 116 insertions(+) create mode 100644 types/express-interceptor/.npmignore create mode 100644 types/express-interceptor/express-interceptor-tests.ts create mode 100644 types/express-interceptor/index.d.ts create mode 100644 types/express-interceptor/package.json create mode 100644 types/express-interceptor/tsconfig.json diff --git a/types/express-interceptor/.npmignore b/types/express-interceptor/.npmignore new file mode 100644 index 00000000000000..93e307400a5456 --- /dev/null +++ b/types/express-interceptor/.npmignore @@ -0,0 +1,5 @@ +* +!**/*.d.ts +!**/*.d.cts +!**/*.d.mts +!**/*.d.*.ts diff --git a/types/express-interceptor/express-interceptor-tests.ts b/types/express-interceptor/express-interceptor-tests.ts new file mode 100644 index 00000000000000..549a7fff363d88 --- /dev/null +++ b/types/express-interceptor/express-interceptor-tests.ts @@ -0,0 +1,41 @@ +import express = require("express"); +import interceptor = require("express-interceptor"); + +const app = express(); + +app.use(interceptor((req, res) => { + req satisfies express.Request; + res satisfies express.Response; + + return { + isInterceptable() { + return false; + }, + }; +})); + +app.use(interceptor((req, res) => { + return { + isInterceptable() { + return true; + }, + + intercept(body, send) { + body satisfies string; + send(body); + }, + }; +})); + +app.use(interceptor((req, res) => { + return { + isInterceptable() { + return true; + }, + + afterSend(oldBody, newBody) { + oldBody satisfies string; + newBody satisfies string; + }, + }; +})); diff --git a/types/express-interceptor/index.d.ts b/types/express-interceptor/index.d.ts new file mode 100644 index 00000000000000..7b277d0c23612c --- /dev/null +++ b/types/express-interceptor/index.d.ts @@ -0,0 +1,31 @@ +import { Request, RequestHandler, Response } from "express"; + +declare namespace interceptor { + interface Methods { + /** + * A predicate function where you define a condition whether or not to intercept a response. Returning `true` buffers the request, and proceeds calling `intercept()` as well as `afterSend()`. + * Typically, you want to check for this condition in the `res` object in the definition of the middleware. + */ + isInterceptable: () => boolean; + + /** + * Parse the body as an encoded string. After processing the body, call `send(newBody)` with the content to be sent back to the client. + */ + intercept?: ((body: string, send: (body: string) => void) => void) | undefined; + + /** + * This method will be called after sending the response to the client – after the `done()` callback in the `send()` method is executed. This method would typically be used to cache something, + * log stats, fire a job, among other things. + */ + afterSend?: ((oldBody: string, newBody: string) => void) | undefined; + } +} + +/** + * Express-interceptor allows you to define a previous step before sending a response. This allows you to do anything you want with the response, such as processing, transforming, replacing, or + * logging it. Express-interceptor allows you to avoid calling `next()` over and over. Further more, you can avoid managing nested scopes. Using a declarative API, it’s simple to use and + * maintain. + */ +declare function interceptor(fn: (req: Request, res: Response) => interceptor.Methods): RequestHandler; + +export = interceptor; diff --git a/types/express-interceptor/package.json b/types/express-interceptor/package.json new file mode 100644 index 00000000000000..9cc86b745f335c --- /dev/null +++ b/types/express-interceptor/package.json @@ -0,0 +1,20 @@ +{ + "private": true, + "name": "@types/express-interceptor", + "version": "1.2.9999", + "projects": [ + "https://github.com/axiomzen/express-interceptor#readme" + ], + "dependencies": { + "@types/express": "*" + }, + "devDependencies": { + "@types/express-interceptor": "workspace:." + }, + "owners": [ + { + "name": "Remco Haszing", + "githubUsername": "remcohaszing" + } + ] +} diff --git a/types/express-interceptor/tsconfig.json b/types/express-interceptor/tsconfig.json new file mode 100644 index 00000000000000..5810ca4fa88f74 --- /dev/null +++ b/types/express-interceptor/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "node16", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "express-interceptor-tests.ts" + ] +} From 3c3171474aa84b97674549a2a3f03f5e2a3c8a3b Mon Sep 17 00:00:00 2001 From: Jimmy Leung <43258070+hkleungai@users.noreply.github.com> Date: Wed, 2 Sep 2026 03:26:47 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#75467=20feat?= =?UTF-8?q?(nanoassert):=20remove=20types=20by=20@hkleungai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notNeededPackages.json | 4 ++++ types/nanoassert/.npmignore | 5 ----- types/nanoassert/index.d.ts | 18 ------------------ types/nanoassert/nanoassert-tests.ts | 17 ----------------- types/nanoassert/package.json | 21 --------------------- types/nanoassert/tsconfig.json | 19 ------------------- 6 files changed, 4 insertions(+), 80 deletions(-) delete mode 100644 types/nanoassert/.npmignore delete mode 100644 types/nanoassert/index.d.ts delete mode 100644 types/nanoassert/nanoassert-tests.ts delete mode 100644 types/nanoassert/package.json delete mode 100644 types/nanoassert/tsconfig.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 2f7cb4a741f520..bb63355d8089ad 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -4729,6 +4729,10 @@ "libraryName": "nano", "asOfVersion": "7.0.0" }, + "nanoassert": { + "libraryName": "nanoassert", + "asOfVersion": "3.0.0" + }, "nanoevents": { "libraryName": "nanoevents", "asOfVersion": "3.0.0" diff --git a/types/nanoassert/.npmignore b/types/nanoassert/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/nanoassert/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/nanoassert/index.d.ts b/types/nanoassert/index.d.ts deleted file mode 100644 index 25ec520d66b674..00000000000000 --- a/types/nanoassert/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Assert that `declaration` is truthy otherwise throw `AssertionError`. - * In JavaScript runtimes that use v8, you will get a nicer - * stack trace with this error. - * - * If you want friendlier messages you can use template strings to show the - * assertion made. - * - * @throws {AssertionError} with optional `message`. - * - * @example - * import assert = require('nanoassert') - * - * assert(a !== b, `${a} !== ${b}`) - */ -declare function assert(declaration: unknown, message?: string): asserts declaration; - -export = assert; diff --git a/types/nanoassert/nanoassert-tests.ts b/types/nanoassert/nanoassert-tests.ts deleted file mode 100644 index edf76b97007ee1..00000000000000 --- a/types/nanoassert/nanoassert-tests.ts +++ /dev/null @@ -1,17 +0,0 @@ -import assert = require("nanoassert"); - -assert(true); // $ExpectType void -try { - assert(false, "error"); // $ExpectType void -} catch (e) { - if (e instanceof Error && e.name === "AssertionError") { - } -} -assert("yes"); // $ExpectType void -assert(0, "error"); // $ExpectType void - -// @ts-expect-error -assert(true, 1); - -// @ts-expect-error -assert(true, false); diff --git a/types/nanoassert/package.json b/types/nanoassert/package.json deleted file mode 100644 index 9b1892debc2d43..00000000000000 --- a/types/nanoassert/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "private": true, - "name": "@types/nanoassert", - "version": "2.0.9999", - "projects": [ - "https://github.com/emilbayes/nanoassert" - ], - "devDependencies": { - "@types/nanoassert": "workspace:." - }, - "owners": [ - { - "name": "Junxiao Shi", - "githubUsername": "yoursunny" - }, - { - "name": "BendingBender", - "githubUsername": "BendingBender" - } - ] -} diff --git a/types/nanoassert/tsconfig.json b/types/nanoassert/tsconfig.json deleted file mode 100644 index 73026a28d0dc24..00000000000000 --- a/types/nanoassert/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "nanoassert-tests.ts" - ] -} From 9dae6701e2b3c1f2ef7b6a8e57137a9ceb28ad74 Mon Sep 17 00:00:00 2001 From: Jimmy Leung <43258070+hkleungai@users.noreply.github.com> Date: Wed, 2 Sep 2026 03:27:09 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#75468=20feat?= =?UTF-8?q?(bwip-js):=20remove=20types=20by=20@hkleungai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- attw.json | 1 - notNeededPackages.json | 4 + types/bwip-js/.eslintrc.json | 5 - types/bwip-js/.npmignore | 5 - types/bwip-js/bwip-js-tests.ts | 172 ----------------------------- types/bwip-js/index.d.ts | 192 --------------------------------- types/bwip-js/package.json | 28 ----- types/bwip-js/tsconfig.json | 20 ---- 8 files changed, 4 insertions(+), 423 deletions(-) delete mode 100644 types/bwip-js/.eslintrc.json delete mode 100644 types/bwip-js/.npmignore delete mode 100644 types/bwip-js/bwip-js-tests.ts delete mode 100644 types/bwip-js/index.d.ts delete mode 100644 types/bwip-js/package.json delete mode 100644 types/bwip-js/tsconfig.json diff --git a/attw.json b/attw.json index 41bf9f33cc38a8..05d71bff568b4c 100644 --- a/attw.json +++ b/attw.json @@ -26,7 +26,6 @@ "brainhubeu__react-carousel", "bramus__pagination-sequence", "browserify", - "bwip-js", "byte-size", "call-bind", "casperjs", diff --git a/notNeededPackages.json b/notNeededPackages.json index bb63355d8089ad..ee2f6cf0a6e211 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -620,6 +620,10 @@ "libraryName": "burns", "asOfVersion": "2.1.0" }, + "bwip-js": { + "libraryName": "bwip-js", + "asOfVersion": "4.0.0" + }, "cache-manager": { "libraryName": "cache-manager", "asOfVersion": "5.0.0" diff --git a/types/bwip-js/.eslintrc.json b/types/bwip-js/.eslintrc.json deleted file mode 100644 index 5805df8e2413ed..00000000000000 --- a/types/bwip-js/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rules": { - "@definitelytyped/strict-export-declare-modifiers": "off" - } -} diff --git a/types/bwip-js/.npmignore b/types/bwip-js/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/bwip-js/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/bwip-js/bwip-js-tests.ts b/types/bwip-js/bwip-js-tests.ts deleted file mode 100644 index a2cccc711c0098..00000000000000 --- a/types/bwip-js/bwip-js-tests.ts +++ /dev/null @@ -1,172 +0,0 @@ -import bwipjs = require("bwip-js"); -import * as fs from "fs"; -import * as http from "http"; - -bwipjs.loadFont("Inconsolata", 108, fs.readFileSync("fonts/Inconsolata.otf", "binary")); - -http.createServer(function(req, res) { - // If the url does not begin /?bcid= then 404. Otherwise, we end up - // returning 400 on requests like favicon.ico. - if (req.url!.indexOf("/?bcid=") != 0) { - res.writeHead(404, { "Content-Type": "text/plain" }); - res.end("BWIPJS: Unknown request format.", "utf8"); - } else { - bwipjs(req, res); - } -}).listen(3030); - -bwipjs.toBuffer( - { - bcid: "code128", // Barcode type - text: "0123456789", // Text to encode - scale: 3, // 3x scaling factor - height: 10, // Bar height, in millimeters - includetext: true, // Show human-readable text - textxalign: "center", // Always good to set this - textfont: "Inconsolata", // Use your custom font - textsize: 13, // Font size, in points - }, - function(err: string | Error, png: Buffer) { - if (err) { - console.log(err); - } else { - // `png` is a Buffer - // png.length : PNG file length - // png.readUInt32BE(16) : PNG image width - // png.readUInt32BE(20) : PNG image height - } - }, -); - -bwipjs - .toBuffer({ - bcid: "code128", // Barcode type - text: "0123456789", // Text to encode - scale: 3, // 3x scaling factor - height: 10, // Bar height, in millimeters - includetext: true, // Show human-readable text - textxalign: "center", // Always good to set this - textfont: "Inconsolata", // Use your custom font - textsize: 13, // Font size, in points - }) - .then((png: Buffer) => { - // `png` is a Buffer - // png.length : PNG file length - // png.readUInt32BE(16) : PNG image width - // png.readUInt32BE(20) : PNG image height - }) - .catch((err: Error) => { - console.log(err); - }); - -bwipjs - .toDataURL({ - bcid: "code128", // Barcode type - text: "0123456789", // Text to encode - scale: 3, // 3x scaling factor - height: 10, // Bar height, in millimeters - includetext: true, // Show human-readable text - textxalign: "center", // Always good to set this - textfont: "Inconsolata", // Use your custom font - textsize: 13, // Font size, in points - }) - .then((data: { width: number; height: number; uri: string }) => {}) - .catch((err: Error) => { - console.log(err); - }); - -const testRender: bwipjs.DrawingOption = { - scale(sx: number, sy: number): [number, number] | null { - return null; - }, - measure( - str: string, - font: string, - fwidth: number, - fheight: number, - ): { width: number; ascent: number; descent: number } { - return { - width: 0, - ascent: 0, - descent: 0, - }; - }, - init(width: number, height: number): void {}, - line(x0: number, y0: number, x1: number, y1: number, lw: number, rgb: string): void {}, - polygon(pts: Array<[number, number]>): void {}, - hexagon(pts: [[number, number], [number, number], [number, number], [number, number], [number, number]]): void {}, - ellipse(x: number, y: number, rx: number, ry: number, ccw: boolean): void {}, - fill(rgb: string): void {}, - text( - x: number, - y: number, - str: string, - rgb: string, - font: { name: string; width: number; height: number; dx: number }, - ): void {}, - end(): void {}, -}; - -bwipjs.render( - { - bcid: "code128", // Barcode type - text: "0123456789", // Text to encode - scale: 3, // 3x scaling factor - height: 10, // Bar height, in millimeters - includetext: true, // Show human-readable text - textxalign: "center", // Always good to set this - textfont: "Inconsolata", // Use your custom font - textsize: 13, // Font size, in points - }, - testRender, -); - -const rawRes = bwipjs.raw({ - bcid: "code128", // Barcode type - text: "0123456789", // Text to encode -}); -if ("bbs" in rawRes[0]) { - rawRes[0].bbs; -} - -bwipjs.fixupOptions({ - bcid: "code128", // Barcode type - text: "0123456789", // Text to encode -}); - -// Browser canvas implementation -const canvas = document.createElement("canvas") as HTMLCanvasElement; -bwipjs( - canvas, - { - bcid: "qrcode", - text: "example", - }, - (err?: string | Error, cvs?: HTMLCanvasElement): void => { - if (err) { - err; // $ExpectType string | Error - } else if (cvs) { - cvs; // $ExpectType HTMLCanvasElement - } - }, -); - -// Browser canvas implementation using .toCanvas() -// See: https://github.com/metafloor/bwip-js#browser-usage -const canvasElement = document.createElement("canvas") as HTMLCanvasElement; -canvasElement.setAttribute("id", "canvas2"); -const toCanvas = bwipjs.toCanvas("canvas2", { - bcid: "code128", - text: "testing", -}); -toCanvas; // $ExpectType HTMLCanvasElement - -// Test the alttext fix as a browser implementation -const canvasElement2 = document.createElement("canvasTextTest") as HTMLCanvasElement; -canvasElement2.setAttribute("id", "canvasTextTest"); -const toCanvasText = bwipjs.toCanvas("canvasTextTest", { - bcid: "code128", - text: "1123581321345589", - alttext: "Alternative text", -}); -toCanvasText; // $ExpectType HTMLCanvasElement diff --git a/types/bwip-js/index.d.ts b/types/bwip-js/index.d.ts deleted file mode 100644 index 1654f2e80055e9..00000000000000 --- a/types/bwip-js/index.d.ts +++ /dev/null @@ -1,192 +0,0 @@ -/// - -import { IncomingMessage as Request, ServerResponse as Response } from "http"; - -declare namespace BwipJs { - export interface BwippOptions { - includecheck?: boolean | undefined; - includecheckintext?: boolean | undefined; - - parse?: boolean | undefined; - parsefnc?: boolean | undefined; - - height?: number | undefined; - width?: number | undefined; - - inkspread?: number | undefined; - inkspreadh?: number | undefined; - inkspreadv?: number | undefined; - dotty?: boolean | undefined; - - includetext?: boolean | undefined; - textfont?: string | undefined; - textsize?: number | undefined; - textgaps?: number | undefined; - alttext?: string | undefined; - - textxalign?: "offleft" | "left" | "center" | "right" | "offright" | "justify" | undefined; - textyalign?: "below" | "center" | "above" | undefined; - textxoffset?: number | undefined; - textyoffset?: number | undefined; - - showborder?: boolean | undefined; - borderwidth?: number | undefined; - borderleft?: number | undefined; - borderright?: number | undefined; - bordertop?: number | undefined; - boraderbottom?: number | undefined; - - barcolor?: string | undefined; - backgroundcolor?: string | undefined; - bordercolor?: string | undefined; - textcolor?: string | undefined; - - addontextxoffset?: number | undefined; - addontextyoffset?: number | undefined; - addontextfont?: string | undefined; - addontextsize?: number | undefined; - - guardwhitespace?: boolean | undefined; - guardwidth?: number | undefined; - guardheight?: number | undefined; - guardleftpos?: number | undefined; - guardrightpos?: number | undefined; - guardleftypos?: number | undefined; - guardrightypos?: number | undefined; - } - export interface RenderOptions extends BwippOptions { - bcid: string; - text: string; - - scaleX?: number | undefined; - scaleY?: number | undefined; - scale?: number | undefined; - - rotate?: "N" | "R" | "L" | "I" | undefined; - - paddingwidth?: number | undefined; - paddingheight?: number | undefined; - - paddingleft?: number | undefined; - paddingright?: number | undefined; - paddingtop?: number | undefined; - paddingbottom?: number | undefined; - - monochrome?: boolean | undefined; - - sizelimit?: number | undefined; - } - export interface RawOptions extends BwippOptions { - bcid: string; - text: string; - } - export type ToBufferOptions = RenderOptions; - export interface DrawingOption { - scale(sx: number, sy: number): [number, number] | null; - measure( - str: string, - font: string, - fwidth: number, - fheight: number, - ): { width: number; ascent: number; descent: number }; - init(width: number, height: number): void; - line(x0: number, y0: number, x1: number, y1: number, lw: number, rgb: string): void; - polygon(pts: Array<[number, number]>): void; - hexagon(pts: [[number, number], [number, number], [number, number], [number, number], [number, number]]): void; - ellipse(x: number, y: number, rx: number, ry: number, ccw: boolean): void; - fill(rgb: string): void; - text( - x: number, - y: number, - str: string, - rgb: string, - font: { name: string; width: number; height: number; dx: number }, - ): void; - end(): T; - } - export function loadFont(fontName: string, sizeMulti: number, fontFile: string | Uint8Array): void; - export function toBuffer(opts: RenderOptions, callback: (err: string | Error, png: Buffer) => void): void; - export function toBuffer(opts: RenderOptions): Promise; - export function toCanvas(canvas: string | HTMLCanvasElement, opts: RenderOptions): HTMLCanvasElement; - export function toDataURL( - opts: RenderOptions, - callback: (err: string | Error, png: { width: number; height: number; uri: string }) => void, - ): void; - export function toDataURL(opts: RenderOptions): Promise<{ width: number; height: number; uri: string }>; - export function fixupOptions(opts: RenderOptions): RenderOptions; - export function render(params: RenderOptions, drawing: DrawingOption): T; - export function raw( - options: RawOptions, - ): - | Array<{ bbs: number[]; bhs: number[]; sbs: number[] }> - | Array<{ pixs: number[]; pixx: number; pixy: number; height: number; width: number }>; - export function raw( - bcid: string, - text: string, - opts: string, - ): - | Array<{ bbs: number[]; bhs: number[]; sbs: number[] }> - | Array<{ pixs: number[]; pixx: number; pixy: number; height: number; width: number }>; - export function raw( - bcid: string, - text: string, - opts?: BwippOptions, - ): - | Array<{ bbs: number[]; bhs: number[]; sbs: number[] }> - | Array<{ pixs: number[]; pixx: number; pixy: number; height: number; width: number }>; - export function request(req: Request, res: Response, opts?: RenderOptions): void; - - export namespace FontLib { - export interface PathData extends - Array< - | { type: "M"; x: number; y: number } - | { type: "L"; x: number; y: number } - | { type: "Q"; x: number; y: number; cx: number; cy: number } - | { type: "C"; x: number; y: number; cx1: number; cy1: number; cx2: number; cy2: number } - > - { - ascent: number; - descent: number; - advance: number; - } - export function lookup(font: string): number; - export function monochrome(mono: boolean): void; - export function getglyph( - fontid: number, - charcode: number, - width: number, - height: number, - ): { - glyph: number; - top: number; - left: number; - width: number; - height: number; - advance: number; - pixels: Uint8Array; - bytes: Uint8Array; - cachekey: string; - offset: number; - }; - export function getpaths(fontid: number, charcode: number, width: number, height: number): PathData; - export function loadFont(name: string, data: string | Uint8Array): void; - export function loadFont(name: string, mult: number, data: string | Uint8Array): void; - export function loadFont(name: string, multy: number, multx: number, data: string | Uint8Array): void; - } -} - -declare function BwipJs(req: Request, res: Response, opts?: BwipJs.RenderOptions): void; - -/** - * The Browser version of the library's functionality, which makes use of an HTMLCanvasElement for rendering. - * @param canvas ID string or HTML element of the canvas to render within - * @param opts Options to use for rendering - * @param callback Function to execute when rendering has completed or failed - */ -declare function BwipJs( - canvas: string | HTMLCanvasElement, - opts: BwipJs.ToBufferOptions, - callback: (err: undefined | string | Error, canvas?: HTMLCanvasElement) => void, -): void; - -export = BwipJs; diff --git a/types/bwip-js/package.json b/types/bwip-js/package.json deleted file mode 100644 index 245c39fd0994db..00000000000000 --- a/types/bwip-js/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "private": true, - "name": "@types/bwip-js", - "version": "3.2.9999", - "projects": [ - "https://github.com/metafloor/bwip-js" - ], - "dependencies": { - "@types/node": "*" - }, - "devDependencies": { - "@types/bwip-js": "workspace:." - }, - "owners": [ - { - "name": "TANAKA Koichi", - "githubUsername": "MugeSo" - }, - { - "name": "Guillaume VanderEst", - "githubUsername": "gvanderest" - }, - { - "name": "Ryan Jentzsch", - "githubUsername": "RyanNerd" - } - ] -} diff --git a/types/bwip-js/tsconfig.json b/types/bwip-js/tsconfig.json deleted file mode 100644 index a6f4761ea06f2d..00000000000000 --- a/types/bwip-js/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "bwip-js-tests.ts" - ] -} From c3c9009e571a78f0c45813140565ee70265f500c Mon Sep 17 00:00:00 2001 From: Jimmy Leung <43258070+hkleungai@users.noreply.github.com> Date: Wed, 2 Sep 2026 03:27:24 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#75469=20feat?= =?UTF-8?q?(moc-better-sqlite3):=20remove=20types=20by=20@hkleungai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notNeededPackages.json | 4 + types/moc-better-sqlite3/.eslintrc.json | 5 - types/moc-better-sqlite3/.npmignore | 5 - types/moc-better-sqlite3/index.d.ts | 132 ------------------ .../moc-better-sqlite3-tests.ts | 107 -------------- types/moc-better-sqlite3/package.json | 40 ------ types/moc-better-sqlite3/tsconfig.json | 20 --- 7 files changed, 4 insertions(+), 309 deletions(-) delete mode 100644 types/moc-better-sqlite3/.eslintrc.json delete mode 100644 types/moc-better-sqlite3/.npmignore delete mode 100644 types/moc-better-sqlite3/index.d.ts delete mode 100644 types/moc-better-sqlite3/moc-better-sqlite3-tests.ts delete mode 100644 types/moc-better-sqlite3/package.json delete mode 100644 types/moc-better-sqlite3/tsconfig.json diff --git a/notNeededPackages.json b/notNeededPackages.json index ee2f6cf0a6e211..2325aba66245ed 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -4605,6 +4605,10 @@ "libraryName": "mobx-task", "asOfVersion": "2.0.0" }, + "moc-better-sqlite3": { + "libraryName": "moc-better-sqlite3", + "asOfVersion": "7.0.2" + }, "mock-property": { "libraryName": "mock-property", "asOfVersion": "1.1.0" diff --git a/types/moc-better-sqlite3/.eslintrc.json b/types/moc-better-sqlite3/.eslintrc.json deleted file mode 100644 index 79ee5b5a1a5836..00000000000000 --- a/types/moc-better-sqlite3/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rules": { - "@definitelytyped/no-single-element-tuple-type": "off" - } -} diff --git a/types/moc-better-sqlite3/.npmignore b/types/moc-better-sqlite3/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/moc-better-sqlite3/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/moc-better-sqlite3/index.d.ts b/types/moc-better-sqlite3/index.d.ts deleted file mode 100644 index 9ceca2756b555d..00000000000000 --- a/types/moc-better-sqlite3/index.d.ts +++ /dev/null @@ -1,132 +0,0 @@ -import Integer = require("integer"); - -type VariableArgFunction = (...params: any[]) => any; -type ArgumentTypes = F extends (...args: infer A) => any ? A : never; - -declare namespace MocBetterSqlite3 { - interface Statement { - database: Database; - source: string; - reader: boolean; - - run(...params: BindParameters): Database.RunResult; - get(...params: BindParameters): any; - all(...params: BindParameters): any[]; - iterate(...params: BindParameters): IterableIterator; - pluck(toggleState?: boolean): this; - expand(toggleState?: boolean): this; - raw(toggleState?: boolean): this; - bind(...params: BindParameters): this; - columns(): ColumnDefinition[]; - safeIntegers(toggleState?: boolean): this; - } - - interface ColumnDefinition { - name: string; - column: string | null; - table: string | null; - database: string | null; - type: string | null; - } - - interface Transaction { - (...params: ArgumentTypes): ReturnType; - default(...params: ArgumentTypes): ReturnType; - deferred(...params: ArgumentTypes): ReturnType; - immediate(...params: ArgumentTypes): ReturnType; - exclusive(...params: ArgumentTypes): ReturnType; - } - - interface Database { - memory: boolean; - readonly: boolean; - name: string; - open: boolean; - inTransaction: boolean; - - prepare( - source: string, - ): BindParameters extends any[] ? Statement : Statement<[BindParameters]>; - transaction(fn: F): Transaction; - exec(source: string): this; - pragma(source: string, options?: Database.PragmaOptions): any; - checkpoint(databaseName?: string): this; - function(name: string, cb: (...params: any[]) => any): this; - function(name: string, options: Database.RegistrationOptions, cb: (...params: any[]) => any): this; - aggregate(name: string, options: Database.AggregateOptions): this; - loadExtension(path: string): this; - close(): this; - defaultSafeIntegers(toggleState?: boolean): this; - backup(destinationFile: string, options?: Database.BackupOptions): Promise; - } - - interface DatabaseConstructor { - new(filename: string, options?: Database.Options): Database; - (filename: string, options?: Database.Options): Database; - prototype: Database; - - Integer: typeof Integer; - SqliteError: SqliteErrorType; - } -} - -declare class SqliteErrorClass implements Error { - name: string; - message: string; - code: string; - constructor(message: string, code: string); -} - -type SqliteErrorType = typeof SqliteErrorClass; - -declare namespace Database { - interface RunResult { - changes: number; - lastInsertRowid: Integer.IntLike; - } - - interface Options { - memory?: boolean | undefined; - readonly?: boolean | undefined; - fileMustExist?: boolean | undefined; - timeout?: number | undefined; - verbose?: ((message?: any, ...additionalArgs: any[]) => void) | undefined; - } - - interface PragmaOptions { - simple?: boolean | undefined; - } - - interface RegistrationOptions { - varargs?: boolean | undefined; - deterministic?: boolean | undefined; - safeIntegers?: boolean | undefined; - } - - interface AggregateOptions extends RegistrationOptions { - start?: any; - step: (total: any, next: any) => any; - inverse?: ((total: any, dropped: any) => any) | undefined; - result?: ((total: any) => any) | undefined; - } - - interface BackupMetadata { - totalPages: number; - remainingPages: number; - } - interface BackupOptions { - progress: (info: BackupMetadata) => number; - } - - type Integer = typeof Integer; - type SqliteError = SqliteErrorType; - type Statement = BindParameters extends any[] - ? MocBetterSqlite3.Statement - : MocBetterSqlite3.Statement<[BindParameters]>; - type ColumnDefinition = MocBetterSqlite3.ColumnDefinition; - type Transaction = MocBetterSqlite3.Transaction; - type Database = MocBetterSqlite3.Database; -} - -declare const Database: MocBetterSqlite3.DatabaseConstructor; -export = Database; diff --git a/types/moc-better-sqlite3/moc-better-sqlite3-tests.ts b/types/moc-better-sqlite3/moc-better-sqlite3-tests.ts deleted file mode 100644 index a1e13058a6fc8c..00000000000000 --- a/types/moc-better-sqlite3/moc-better-sqlite3-tests.ts +++ /dev/null @@ -1,107 +0,0 @@ -import Sqlite = require("moc-better-sqlite3"); - -const integer = Sqlite.Integer(1); -const err = new Sqlite.SqliteError("ok", "ok"); -const result: Sqlite.RunResult = { changes: 1, lastInsertRowid: 1 }; -const options: Sqlite.Options = { fileMustExist: true, memory: true, readonly: true }; -const registrationOptions: Sqlite.RegistrationOptions = { - deterministic: true, - safeIntegers: true, - varargs: true, -}; - -let db: Sqlite.Database = Sqlite("."); -db = new Sqlite(".", { memory: true, verbose: () => {} }); -db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL);"); -db.exec("INSERT INTO test(name) VALUES(\"name\");"); -db.pragma("data_version", { simple: true }); -db.checkpoint(); -db.checkpoint("main"); -db.function("noop", () => {}); -db.function("noop", { deterministic: true, varargs: true }, () => {}); -db.aggregate("add", { - start: 0, - step: (t, n) => t + n, - deterministic: true, - varargs: true, -}); -db.aggregate("getAverage", { - start: () => [], - step: (array, nextValue) => { - array.push(nextValue); - }, - result: array => array.reduce((t: any, v: any) => t + v) / array.length, -}); -db.aggregate("addAll", { - start: 0, - step: (total, nextValue) => total + nextValue, - inverse: (total, droppedValue) => total - droppedValue, - result: total => Math.round(total), -}); -db.defaultSafeIntegers(); -db.defaultSafeIntegers(true); - -const stmt: Sqlite.Statement = db.prepare("SELECT * FROM test WHERE name == ?;"); -stmt.get(["name"]); -stmt.all({ name: "name" }); -for (const row of stmt.iterate("name")) { -} -stmt.pluck(); -stmt.pluck(true); -stmt.expand(); -stmt.expand(true); -stmt.bind("name"); -stmt.safeIntegers(); -stmt.safeIntegers(true); -stmt.raw(); -stmt.raw(true); -stmt.raw(false); -let col: Sqlite.ColumnDefinition; -for (col of stmt.columns()) { - col.name; - col.column; - col.type; -} -type BindParameters = [string, number]; -const stmtWithBindTyped = db.prepare("SELECT * FROM test WHERE name == ? and age = ?"); -stmtWithBindTyped.run("alice", 20); -// note the following is technically legal according to the docs, but we do not have a way to express both typed args -// and variable tuples in typescript. If you want to group tuples, you must specify it that way in the prepare function -// https://github.com/vazra/better-sqlite3/blob/master/docs/api.md#binding-parameters -// @ts-expect-error -stmtWithBindTyped.run(["alice", 20]); -interface NamedBindParameters { - name: string; - age: number; -} -const stmtWithNamedBind = db.prepare("INSERT INTO test VALUES (@name, @age)"); -stmtWithNamedBind.run({ name: "bob", age: 20 }); - -const trans: Sqlite.Transaction = db.transaction(param => stmt.all(param)); -trans("name"); -trans(1); -trans.default("name"); -trans.deferred("name"); -trans.immediate("name"); -trans.exclusive("name"); - -const transTyped = db.transaction((param: number) => stmt.all(param)); -transTyped(1); -trans.default(1); -trans.deferred(1); -trans.immediate(1); -trans.exclusive(1); -// @ts-expect-error -transTyped("name"); - -const transReturn = db.transaction(() => 1); -// $ExpectType number -transReturn(); - -db.backup("backup-today.db").then(({ totalPages, remainingPages }) => {}); -const paused = false; -db.backup("backup-today.db", { - progress({ totalPages: t, remainingPages: r }) { - return paused ? 0 : 200; - }, -}); diff --git a/types/moc-better-sqlite3/package.json b/types/moc-better-sqlite3/package.json deleted file mode 100644 index d939e28ad25bea..00000000000000 --- a/types/moc-better-sqlite3/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "private": true, - "name": "@types/moc-better-sqlite3", - "version": "6.2.9999", - "projects": [ - "https://github.com/vazra/better-sqlite3" - ], - "dependencies": { - "@types/integer": "*" - }, - "devDependencies": { - "@types/moc-better-sqlite3": "workspace:." - }, - "owners": [ - { - "name": "Ben Davies", - "githubUsername": "Morfent" - }, - { - "name": "Mathew Rumsey", - "githubUsername": "matrumz" - }, - { - "name": "Santiago Aguilar", - "githubUsername": "sant123" - }, - { - "name": "Alessandro Vergani", - "githubUsername": "loghorn" - }, - { - "name": "Andrew Kaiser", - "githubUsername": "andykais" - }, - { - "name": "Mark Stewart", - "githubUsername": "mrkstwrt" - } - ] -} diff --git a/types/moc-better-sqlite3/tsconfig.json b/types/moc-better-sqlite3/tsconfig.json deleted file mode 100644 index 8d806b1e51b253..00000000000000 --- a/types/moc-better-sqlite3/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "target": "es6", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "moc-better-sqlite3-tests.ts" - ] -} From b4158ff671b9e0e8f599af9ca51655d8b771898c Mon Sep 17 00:00:00 2001 From: Alexandre Gomes Gaigalas Date: Tue, 1 Sep 2026 16:59:52 -0300 Subject: [PATCH 09/10] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#75459=20[ems?= =?UTF-8?q?cripten]=20Add=20FS=20node=20lookup=20cache=20functions=20and?= =?UTF-8?q?=20FSNode.name=5Fnext=20by=20@alganet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Claude Opus 5 (1M context) --- types/emscripten/emscripten-tests.ts | 27 +++++++++++++++++++++++++++ types/emscripten/index.d.ts | 14 ++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/types/emscripten/emscripten-tests.ts b/types/emscripten/emscripten-tests.ts index 81854c3e1c1356..1344a9f26f4e86 100644 --- a/types/emscripten/emscripten-tests.ts +++ b/types/emscripten/emscripten-tests.ts @@ -172,6 +172,33 @@ function FSTest(): void { const analyze = FS.analyzePath("path"); // $ExpectType boolean analyze.exists; + + // Test hashAddNode - adds a node to the cache lookupNode reads before node_ops.lookup + const dir = FS.lookupPath("/", { follow: true }).node; + const node = new FS.FSNode(dir, "file", parseInt("0100644", 8), 0); + FS.hashAddNode(node); + // $ExpectType FSNode + FS.lookupNode(dir, "file"); + // $ExpectType number + FS.hashName(dir.id, "file"); + // $ExpectType FSNode | undefined + FS.nameTable[FS.hashName(dir.id, "file")]; + // $ExpectType FSNode | undefined + node.name_next; + + // Test hashRemoveNode and destroyNode - takes a node back out of the cache + FS.hashRemoveNode(node); + FS.destroyNode(node); + + // Test createNode - NODEFS and WORKERFS build their root with a null parent and no rdev + // $ExpectType FSNode + FS.createNode(dir, "other", parseInt("0100644", 8), 0); + // $ExpectType number | undefined + FS.createNode(null, "/", parseInt("0040777", 8)).rdev; + + // Test FSNode - the constructor takes the same root case createNode passes it + // $ExpectType FSNode + new FS.FSNode(null, "/", parseInt("0040777", 8)); } /// String conversions diff --git a/types/emscripten/index.d.ts b/types/emscripten/index.d.ts index 6a5b2b96917fd3..80119a54fd529a 100644 --- a/types/emscripten/index.d.ts +++ b/types/emscripten/index.d.ts @@ -167,11 +167,13 @@ declare namespace FS { contents?: any; id: number; name: string; + // Next node in the nameTable bucket + name_next?: FSNode; mode: number; - rdev: number; + rdev: number | undefined; readMode: number; writeMode: number; - constructor(parent: FSNode, name: string, mode: number, rdev: number); + constructor(parent: FSNode | null, name: string, mode: number, rdev?: number); read: boolean; write: boolean; readonly isFolder: boolean; @@ -254,6 +256,14 @@ declare namespace FS { // // nodes // + let nameTable: Array; + function hashName(parentid: number, name: string): number; + function hashAddNode(node: FSNode): void; + function hashRemoveNode(node: FSNode): void; + function lookupNode(parent: FSNode, name: string): FSNode; + function createNode(parent: FSNode | null, name: string, mode: number, rdev?: number): FSNode; + function destroyNode(node: FSNode): void; + function isFile(mode: number): boolean; function isDir(mode: number): boolean; function isLink(mode: number): boolean; From 5558e760ea4e5ce794088c9c1d3d2b19a35634c5 Mon Sep 17 00:00:00 2001 From: theexponenta <58531873+theexponenta@users.noreply.github.com> Date: Tue, 1 Sep 2026 23:00:40 +0300 Subject: [PATCH 10/10] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#75447=20[nod?= =?UTF-8?q?e:ffi]=20Fix=20ReturnTypeMap=20for=20pointer=20type=20by=20@the?= =?UTF-8?q?exponenta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/node/ffi.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/node/ffi.d.ts b/types/node/ffi.d.ts index ba5806f08c291a..8e760e545e7c9c 100644 --- a/types/node/ffi.d.ts +++ b/types/node/ffi.d.ts @@ -459,7 +459,7 @@ declare module "node:ffi" { "void": void; "number": number; "bigint": bigint; - "pointer": bigint | null; + "pointer": bigint; } enum types { VOID = "void",