From 1c66e39f776166aa5365dd2cf40eacb389c345de Mon Sep 17 00:00:00 2001 From: oceanblue <36447840+Subilan@users.noreply.github.com> Date: Sun, 15 Feb 2026 13:27:58 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74488=20[ali?= =?UTF-8?q?-oss]=20Add=20ListV2ObjectResult=20definition=20&=20Fix=20READM?= =?UTF-8?q?E.zh-Hans=20typo=20by=20@Subilan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.zh-Hans.md | 2 +- types/ali-oss/ali-oss-tests.ts | 19 +++++++++++++++++++ types/ali-oss/index.d.ts | 13 +++++++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/README.zh-Hans.md b/README.zh-Hans.md index 5bdaf2416ecb1a..3341ec7751b8be 100644 --- a/README.zh-Hans.md +++ b/README.zh-Hans.md @@ -105,7 +105,7 @@ declare module "libname" { 你可直接编辑 `node_modules/@types/foo/index.d.ts` 来验证你的修改。接着,请使用下文所述的步骤将这些修改加入本仓库。 -你亦可以使用[模块扩充(Module Argumentation)](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation)来向 Definitely Typed 模块中添加类型,或使用上文所示的 `declare module` 方法来覆盖 `node_modules` 中的版本。 +你亦可以使用[模块扩充(Module Augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation)来向 Definitely Typed 模块中添加类型,或使用上文所示的 `declare module` 方法来覆盖 `node_modules` 中的版本。 #### 为新增的软件包添加测试 diff --git a/types/ali-oss/ali-oss-tests.ts b/types/ali-oss/ali-oss-tests.ts index 832a2e126869a4..ca74a4a5836687 100644 --- a/types/ali-oss/ali-oss-tests.ts +++ b/types/ali-oss/ali-oss-tests.ts @@ -23,6 +23,25 @@ client.getSymlink("newfile.png"); client.getSymlink("newfile.png", { versionId: "123" }); client.listV2({ "max-keys": 1000 }); + +async function listV2Exhaustive() { + let continuationToken = ""; + + while (true) { + let res = await client.listV2({ + "max-keys": 1000, + "continuation-token": continuationToken, + }); + + if (res.isTruncated) { + continuationToken = res.nextContinuationToken; + } else { + continuationToken = ""; + break; + } + } +} + client.copy("newfile.png", "sourcefile.png"); client.copy("newfile.png", "sourcefile.png", { timeout: 1000 }); client.copy("newfile.png", "sourcefile.png", "sourceBucket"); diff --git a/types/ali-oss/index.d.ts b/types/ali-oss/index.d.ts index a67b10a814f0b1..d2ed7cab5a02c9 100644 --- a/types/ali-oss/index.d.ts +++ b/types/ali-oss/index.d.ts @@ -317,6 +317,15 @@ declare namespace OSS { res: NormalSuccessResponse; } + interface ListV2ObjectResult { + objects: ObjectMeta[]; + prefixes: string[]; + isTruncated: boolean; + nextContinuationToken: string; + keyCount: number; + res: NormalSuccessResponse; + } + interface PutObjectOptions { /** the operation timeout */ timeout?: number | undefined; @@ -680,7 +689,7 @@ declare namespace OSS { /** * @since 6.12.0 */ - listV2(query: ListV2ObjectsQuery | null, options?: RequestOptions): Promise; + listV2(query: ListV2ObjectsQuery | null, options?: RequestOptions): Promise; put(name: string, file: any, options?: PutObjectOptions): Promise; @@ -1017,7 +1026,7 @@ declare class OSS { /** * List Objects in the bucket.(V2) */ - listV2(query: OSS.ListV2ObjectsQuery | null, options?: OSS.RequestOptions): Promise; + listV2(query: OSS.ListV2ObjectsQuery | null, options?: OSS.RequestOptions): Promise; /** * Add an object to the bucket. From 5010bad4a2b6ae97f9166e58b2f41f1c7307f8e7 Mon Sep 17 00:00:00 2001 From: Jimmy Leung <43258070+hkleungai@users.noreply.github.com> Date: Sun, 15 Feb 2026 13:38:11 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74527=20feat?= =?UTF-8?q?(file-entry-cache):=20remove=20types=20by=20@hkleungai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notNeededPackages.json | 4 + types/file-entry-cache/.npmignore | 5 -- .../file-entry-cache-tests.ts | 23 ------ types/file-entry-cache/index.d.ts | 78 ------------------- types/file-entry-cache/package.json | 20 ----- types/file-entry-cache/tsconfig.json | 19 ----- 6 files changed, 4 insertions(+), 145 deletions(-) delete mode 100644 types/file-entry-cache/.npmignore delete mode 100644 types/file-entry-cache/file-entry-cache-tests.ts delete mode 100644 types/file-entry-cache/index.d.ts delete mode 100644 types/file-entry-cache/package.json delete mode 100644 types/file-entry-cache/tsconfig.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 59f322df12e072..c3220b102dd9d3 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -2289,6 +2289,10 @@ "libraryName": "figures", "asOfVersion": "3.0.0" }, + "file-entry-cache": { + "libraryName": "file-entry-cache", + "asOfVersion": "10.0.0" + }, "file-type": { "libraryName": "file-type", "asOfVersion": "10.9.1" diff --git a/types/file-entry-cache/.npmignore b/types/file-entry-cache/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/file-entry-cache/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/file-entry-cache/file-entry-cache-tests.ts b/types/file-entry-cache/file-entry-cache-tests.ts deleted file mode 100644 index 0782e629971743..00000000000000 --- a/types/file-entry-cache/file-entry-cache-tests.ts +++ /dev/null @@ -1,23 +0,0 @@ -import fileEntryCache = require("file-entry-cache"); - -const cache = fileEntryCache.create("testCache"); -fileEntryCache.create("myCaceh", "./fixtures", false); // $ExpectType FileEntryCache -fileEntryCache.createFromFile("./fixtures/data.txt", true); // $ExpectType FileEntryCache -const files = ["./fixtures/*.txt"]; -let oFiles = cache.getUpdatedFiles(files); -cache.reconcile(); -const cache2 = fileEntryCache.create("testCache"); -oFiles = cache.getUpdatedFiles(files); -cache.removeEntry("path/to/file"); -const entries = cache.normalizeEntries(files); -cache.deleteCacheFile(); -cache.destroy(); -// entry = { -// key: 'some/name/file', the path to the file -// changed: true, // if the file was changed since previous run -// meta: { -// size: 3242, // the size of the file -// mtime: 231231231, // the modification time of the file -// data: {} // some extra field stored for this file (useful to save the result of a transformation on the file -// } -// }; diff --git a/types/file-entry-cache/index.d.ts b/types/file-entry-cache/index.d.ts deleted file mode 100644 index 72fbfbd755a026..00000000000000 --- a/types/file-entry-cache/index.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -/// - -/** - * @param pathToCache - the path to the cache file (this combines the cache name and directory - * @param useCheckSum - Whether to use md5 checksum to verify if file changed. - * If false the default will be to use the mtime and size of the file - */ -export function createFromFile(pathToCache: string, useCheckSum?: boolean): FileEntryCache; - -/** - * @param cacheName - the name of the cache to be created - * @param directory - the directory to load the cache from - * @param usecheckSum - Whether to use md5 checksum to verify if file changed. - * If false the default will be to use the mtime and size of the file - */ -export function create(cacheName: string, directory?: string, usecheckSum?: boolean): FileEntryCache; - -export interface FileEntryCache { - /** the flat cache storage used to persist the metadata of the `files */ - cache: object; - /** Given a buffer, calculate md5 hash of its content. */ - getHash(buffer: Buffer): string; - /** Return whether or not a file has changed since last time reconcile was called */ - hasFileChanged(file: string): boolean; - /** - * given an array of file paths it return and object with three arrays: - * - changedFiles: Files that changed since previous run - * - notChangedFiles: Files that haven't change - * - notFoundFiles: Files that were not found, probably deleted - */ - analyzeFiles(files?: string[]): AnalyzedFilesInfo; - getFileDescriptor(file: string): FileDescriptor; - /** - * Return the list o the files that changed compared - * against the ones stored in the cache - */ - getUpdatedFiles(files?: string[]): string[]; - /** - * return the list of file - */ - normalizeEntries(files?: string[]): FileDescriptor[]; - /** - * Remove an entry from the file-entry-cache. - * Useful to force the file to still be considered - * modified the next time the process is run - */ - removeEntry(entryName: string): void; - /** - * Delete the cache file from the disk - */ - deleteCacheFile(): void; - /** - * remove the cache from the file and clear the memory cache - */ - destroy(): void; - /** - * Sync the files and persist them to the cache - */ - reconcile(noPrune?: boolean): void; -} - -export interface AnalyzedFilesInfo { - readonly changedFiles: string[]; - readonly notFoundFiles: string[]; - readonly notChangedFiles: string[]; -} - -export interface FileDescriptor { - readonly key: string; - readonly notFound: boolean; - readonly err?: Error | undefined; - readonly changed?: boolean | undefined; - readonly meta?: { - readonly size?: number | undefined; - readonly mtime?: number | undefined; - readonly hash?: string | undefined; - } | undefined; -} diff --git a/types/file-entry-cache/package.json b/types/file-entry-cache/package.json deleted file mode 100644 index 72d98a894e06a4..00000000000000 --- a/types/file-entry-cache/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "private": true, - "name": "@types/file-entry-cache", - "version": "5.0.9999", - "projects": [ - "https://github.com/royriojas/file-entry-cache#readme" - ], - "dependencies": { - "@types/node": "*" - }, - "devDependencies": { - "@types/file-entry-cache": "workspace:." - }, - "owners": [ - { - "name": "Piotr Błażejewicz", - "githubUsername": "peterblazejewicz" - } - ] -} diff --git a/types/file-entry-cache/tsconfig.json b/types/file-entry-cache/tsconfig.json deleted file mode 100644 index 127536f9f95ab8..00000000000000 --- a/types/file-entry-cache/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "file-entry-cache-tests.ts" - ] -} From ac3d2ef8860df41802f7f34b5a1e5e34d8b18364 Mon Sep 17 00:00:00 2001 From: Jimmy Leung <43258070+hkleungai@users.noreply.github.com> Date: Sun, 15 Feb 2026 13:38:26 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74526=20feat?= =?UTF-8?q?(eslint-plugin-mocha):=20remove=20types=20by=20@hkleungai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notNeededPackages.json | 4 ++++ types/eslint-plugin-mocha/.npmignore | 5 ----- .../eslint-plugin-mocha-tests.ts | 20 ------------------- types/eslint-plugin-mocha/index.d.ts | 15 -------------- types/eslint-plugin-mocha/package.json | 20 ------------------- types/eslint-plugin-mocha/tsconfig.json | 19 ------------------ 6 files changed, 4 insertions(+), 79 deletions(-) delete mode 100644 types/eslint-plugin-mocha/.npmignore delete mode 100644 types/eslint-plugin-mocha/eslint-plugin-mocha-tests.ts delete mode 100644 types/eslint-plugin-mocha/index.d.ts delete mode 100644 types/eslint-plugin-mocha/package.json delete mode 100644 types/eslint-plugin-mocha/tsconfig.json diff --git a/notNeededPackages.json b/notNeededPackages.json index c3220b102dd9d3..01f1aed29b5838 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1969,6 +1969,10 @@ "libraryName": "escape-string-regexp", "asOfVersion": "2.0.0" }, + "eslint-plugin-mocha": { + "libraryName": "eslint-plugin-mocha", + "asOfVersion": "11.1.0" + }, "eslint-visitor-keys": { "libraryName": "eslint-visitor-keys", "asOfVersion": "3.3.0" diff --git a/types/eslint-plugin-mocha/.npmignore b/types/eslint-plugin-mocha/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/eslint-plugin-mocha/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/eslint-plugin-mocha/eslint-plugin-mocha-tests.ts b/types/eslint-plugin-mocha/eslint-plugin-mocha-tests.ts deleted file mode 100644 index 7bbd6fe262d35f..00000000000000 --- a/types/eslint-plugin-mocha/eslint-plugin-mocha-tests.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Linter } from "eslint"; -import mocha from "eslint-plugin-mocha"; - -const flatConfigs: Linter.FlatConfig[] = [ - mocha.configs.flat.recommended, - mocha.configs.flat.all, -]; - -const ownFlatConfig: Linter.FlatConfig = { - plugins: { mocha }, - rules: { - "mocha/no-skipped-tests": "error", - "mocha/no-exclusive-tests": "error", - }, -}; - -const legacyCOnfigs: Linter.Config[] = [ - mocha.configs.recommended, - mocha.configs.all, -]; diff --git a/types/eslint-plugin-mocha/index.d.ts b/types/eslint-plugin-mocha/index.d.ts deleted file mode 100644 index b1cd57db1b0b66..00000000000000 --- a/types/eslint-plugin-mocha/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ESLint, Linter } from "eslint"; - -interface ESLintMochaConfigs { - configs: { - recommended: Linter.Config; - all: Linter.Config; - flat: { - recommended: Linter.FlatConfig; - all: Linter.FlatConfig; - }; - }; -} - -declare const plugin: ESLintMochaConfigs & ESLint.Plugin; -export = plugin; diff --git a/types/eslint-plugin-mocha/package.json b/types/eslint-plugin-mocha/package.json deleted file mode 100644 index 53291014190084..00000000000000 --- a/types/eslint-plugin-mocha/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "private": true, - "name": "@types/eslint-plugin-mocha", - "version": "10.4.9999", - "projects": [ - "https://github.com/lo1tuma/eslint-plugin-mocha#readme" - ], - "dependencies": { - "@types/eslint": "*" - }, - "devDependencies": { - "@types/eslint-plugin-mocha": "workspace:." - }, - "owners": [ - { - "name": "rhysd", - "githubUsername": "rhysd" - } - ] -} diff --git a/types/eslint-plugin-mocha/tsconfig.json b/types/eslint-plugin-mocha/tsconfig.json deleted file mode 100644 index 8c7614e8a31a47..00000000000000 --- a/types/eslint-plugin-mocha/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "eslint-plugin-mocha-tests.ts" - ] -} From 60ad8dc861c95862d78a59d59cfa0909045cc40f Mon Sep 17 00:00:00 2001 From: Jimmy Leung <43258070+hkleungai@users.noreply.github.com> Date: Sun, 15 Feb 2026 13:38:37 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74525=20feat?= =?UTF-8?q?(tar):=20remove=20types=20by=20@hkleungai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notNeededPackages.json | 4 + types/tar/.npmignore | 5 - types/tar/index.d.ts | 965 ---------------------------------------- types/tar/package.json | 25 -- types/tar/tar-tests.ts | 194 -------- types/tar/tsconfig.json | 19 - 6 files changed, 4 insertions(+), 1208 deletions(-) delete mode 100644 types/tar/.npmignore delete mode 100644 types/tar/index.d.ts delete mode 100644 types/tar/package.json delete mode 100644 types/tar/tar-tests.ts delete mode 100644 types/tar/tsconfig.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 01f1aed29b5838..3e5c43b9c0038c 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -7567,6 +7567,10 @@ "libraryName": "tap", "asOfVersion": "18.0.0" }, + "tar": { + "libraryName": "tar", + "asOfVersion": "7.0.0" + }, "tcomb": { "libraryName": "tcomb", "asOfVersion": "2.6.0" diff --git a/types/tar/.npmignore b/types/tar/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/tar/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/tar/index.d.ts b/types/tar/index.d.ts deleted file mode 100644 index 6fd92465d8f53f..00000000000000 --- a/types/tar/index.d.ts +++ /dev/null @@ -1,965 +0,0 @@ -/// - -import stream = require("stream"); -import zlib = require("zlib"); -import MiniPass = require("minipass"); -import fs = require("fs"); - -// #region Interfaces - -export interface HeaderProperties { - path: string; - mode?: number | undefined; - noProprietary?: boolean | undefined; - uid?: number | undefined; - gid?: number | undefined; - size?: number | undefined; - mtime?: number | undefined; - type?: string | undefined; - uname?: string | undefined; - gname?: string | undefined; - devmaj?: number | undefined; - devmin?: number | undefined; -} - -export interface ParseStream extends NodeJS.ReadWriteStream { - position: number; - - _stream: stream.Stream; - _ended: boolean; - - _streamEnd(): void; - _process(c: Buffer): void; - _startEntry(c: Buffer): void; -} - -export interface PackStream extends NodeJS.ReadWriteStream { - writable: boolean; - readable: boolean; - - _noProprietary: boolean; - _global: HeaderProperties; - _buffer: stream.Stream[]; - _currentEntry: any; - _processing: boolean; - _pipeRoot: stream.Stream; - _needDrain: boolean; - _paused: boolean; - - addGlobal(props: HeaderProperties): void; - add(stream: stream.Stream): boolean; - destroy(): void; - - _process(): void; -} - -// #endregion - -// #region Enums - -export interface Fields { - path: number; - mode: number; - uid: number; - gid: number; - size: number; - mtime: number; - cksum: number; - type: number; - linkpath: number; - ustar: number; - ustarvar: number; - uname: number; - gname: number; - devmaj: number; - devmin: number; - prefix: number; - fill: number; -} - -export type fields = Fields; // alias for backwards compatbility - -export const fieldSize: number[]; -export const fieldOffs: number[]; -export const fieldEnds: number[]; - -/** - * Different values of the 'type' field - * paths match the values of Stats.isX() functions, where appropriate - */ -export const types: { - 0: string; - "\0": string; - "": string; - 1: string; - 2: string; - 3: string; - 4: string; - 5: string; - 6: string; - 7: string; - g: string; - x: string; - A: string; - D: string; - I: string; - K: string; - L: string; - M: string; - N: string; - S: string; - V: string; - X: string; - File: string; - OldFile: string; - Link: string; - SymbolicLick: string; - CharacterDevice: string; - BlockDevice: string; - Directory: string; - FIFO: string; - ContiguousFile: string; - GlobalExtendedHeader: string; - ExtendedHeader: string; - SolarisACL: string; - GNUDumpDir: string; - INode: string; - NextFileHasLonLinkPath: string; - NextFileHasLongPath: string; - ContinuationFile: string; - TapeVolumeHeader: string; - OldExtendedHeader: string; -}; - -/** - * Values for the mode field - */ -export const modes: { - suid: number; - sgid: number; - svtx: number; - uread: number; - uwrite: number; - uexec: number; - gread: number; - gwrite: number; - gexec: number; - oread: number; - owrite: number; - oexec: number; -}; - -export const numeric: { - mode: boolean; - uid: boolean; - gid: boolean; - size: boolean; - mtime: boolean; - devmaj: boolean; - devmin: boolean; - cksum: boolean; - atime: boolean; - ctime: boolean; - dev: boolean; - ino: boolean; - nlink: boolean; -}; - -export const knownExtended: { - atime: boolean; - charset: boolean; - comment: boolean; - ctime: boolean; - gid: boolean; - gname: boolean; - linkpat: boolean; - mtime: boolean; - path: boolean; - realtime: boolean; - security: boolean; - size: boolean; - uid: boolean; - uname: boolean; -}; - -export const headerSize: number; -export const blockSize: number; - -export interface ParseOptions { - strict?: boolean; - filter?: (path: string, entry: ReadEntry) => boolean; - onentry?: (entry: ReadEntry) => void; - onwarn?: (code: string, message: string, data: Buffer) => void; -} -/** - * A writable stream. Write tar data to it and it will emit entry events for each entry parsed from the tarball. This is used by tar.Extract. - */ -export interface Parse extends ParseStream { - on(event: "end" | "close", listener: () => void): this; - on(event: "entry", listener: (entry: ReadEntry) => void): this; -} - -export const Parse: { - new(opt?: ParseOptions): Parse; -}; -// #endregion - -// #region Global Methods - -export interface PackOptions { - /** - * A function that will get called with (code, message, data) for any - * warnings encountered. (See "Warnings and Errors") - */ - onwarn?(code: string, message: string, data: Buffer): void; - /** - * Treat warnings as crash-worthy errors. - * - * @default false - */ - strict?: boolean; - /** - * The current working directory for creating the archive. - * - * @default process.cwd() - */ - cwd?: string; - /** - * A path portion to prefix onto the entries in the archive. - */ - prefix?: string; - /** - * Set to any truthy value to create a gzipped archive, or an object with - * settings for zlib.Gzip() - */ - gzip?: boolean | zlib.ZlibOptions; - /** - * Set to any truthy value to create a brotli-compressed archive, - * or an object with settings for zlib.BrotliCompress() - */ - brotli?: boolean | zlib.BrotliOptions; - /** - * A function that gets called with (path, stat) for each entry being added. - * Return true to add the entry to the archive, or false to omit it. - */ - filter?(path: string, stat: fs.Stats): boolean; - /** - * Omit metadata that is system-specific: ctime, atime, uid, gid, uname, - * gname, dev, ino, and nlink. Note that mtime is still included, because - * this is necessary for other time-based operations. Additionally, mode is - * set to a "reasonable default" for most unix systems, based on a umask - * value of 0o22. - */ - portable?: boolean; - /** - * Allow absolute paths. By default, / is stripped from absolute paths. - */ - preservePaths?: boolean; - /** - * A Map object containing the device and inode value for any file whose - * nlink is > 1, to identify hard links. - */ - linkCache?: Map; - /** - * A Map object that caches calls lstat. - */ - statCache?: Map; - /** - * A Map object that caches calls to readdir. - */ - readdirCache?: Map; - /** - * A number specifying how many concurrent jobs to run. - * - * @default 4 - */ - jobs?: number; - /** - * The maximum buffer size for fs.read() operations. - * - * @default 16 MB - */ - maxReadSize?: number; - /** - * Do not recursively archive the contents of directories. - */ - noDirRecurse?: boolean; - /** - * Set to true to pack the targets of symbolic links. Without this option, - * symbolic links are archived as such. - */ - follow?: boolean; - /** - * Suppress pax extended headers. Note that this means that long paths and - * linkpaths will be truncated, and large or negative numeric values may be - * interpreted incorrectly. - */ - noPax?: boolean; - /** - * Set to true to omit writing mtime values for entries. Note that this - * prevents using other mtime-based features like tar.update or the - * keepNewer option with the resulting tar archive. - */ - noMtime?: boolean; - /** - * Set to a Date object to force a specific mtime for everything added to - * the archive. Overridden by noMtime. - */ - mtime?: Date; -} - -/** - * Returns a through stream. Use fstream to write files into the pack stream and you will receive tar archive data from the pack stream. - * This only works with directories, it does not work with individual files. - * The optional properties object are used to set properties in the tar 'Global Extended Header'. - */ -export class Pack extends MiniPass { - linkCache: PackOptions["linkCache"]; - readdirCache: PackOptions["readdirCache"]; - statCache: PackOptions["statCache"]; - - static Sync: typeof PackSync; - - constructor(opt?: PackOptions); - - add(path: string): this; -} - -declare class PackSync extends Pack { - constructor(opt: PackOptions); - - // pause/resume are no-ops in sync streams. - pause(): void; - resume(): void; -} - -declare class PackJob { - path: string; - absolute: string; - entry: unknown | null; - stat: unknown | null; - readdir: unknown | null; - pending: boolean; - ignore: boolean; - piped: boolean; - - constructor(path?: string, absolute?: string); -} - -/** - * Returns a through stream. Write tar data to the stream and the files in the tarball will be extracted onto the filesystem. - * options can be: - * ``` - * { - * path: '/path/to/extract/tar/into', - * strip: 0, // how many path segments to strip from the root when extracting - * } - * ``` - * options also get passed to the fstream.Writer instance that tar uses internally. - */ -export function Extract(opts: ExtractOptions | string): ParseStream; - -export interface FileStat extends stream.Readable, Fields { - header: HeaderProperties; - startBlockSize: number; - blockRemain: number; - remain: number; - meta: boolean; - ignore: boolean; - size: number; -} - -export interface ReadEntry extends MiniPass, HeaderProperties { - /** The extended metadata object provided to the constructor. */ - extended: any; - /** The global extended metadata object provided to the constructor. */ - globalExtended: any; - /** The number of bytes remaining to be written into the stream. */ - remain: number; - /** The number of 512-byte blocks remaining to be written into the stream. */ - blockRemain: number; - /** Whether this entry should be ignored. */ - ignore: boolean; - /** - * True if this represents metadata about the next entry, false if it - * represents a filesystem object. - */ - meta: boolean; -} - -export interface CreateOptions { - /** - * A function that will get called with (code, message, data) for any - * warnings encountered. (See "Warnings and Errors") - */ - onwarn?(code: string, message: string, data: Buffer): void; - - /** - * Treat warnings as crash-worthy errors. Default false. - */ - strict?: boolean | undefined; - - /** - * The current working directory for creating the archive. Defaults to process.cwd(). - */ - cwd?: string | undefined; - - /** - * Alias for cwd. - */ - C?: string | undefined; - - /** - * Set to any truthy value to create a gzipped archive, - * or an object with settings for zlib.Gzip() - */ - gzip?: boolean | zlib.ZlibOptions | undefined; - - /** - * Alias for gzip. - */ - z?: boolean | zlib.ZlibOptions | undefined; - - /** - * Set to any truthy value to create a brotli-compressed archive, - * or an object with settings for zlib.BrotliCompress() - */ - brotli?: boolean | zlib.BrotliOptions | undefined; - - /** - * A function that gets called with (path, stat) for each entry being - * added. Return true to add the entry to the archive, or false to omit it. - */ - filter?(path: string, stat: fs.Stats): boolean; - - /** - * Omit metadata that is system-specific: ctime, atime, uid, gid, uname, - * gname, dev, ino, and nlink. Note that mtime is still included, - * because this is necessary other time-based operations. - */ - portable?: boolean | undefined; - - /** - * Allow absolute paths. By default, / is stripped from absolute paths. - */ - preservePaths?: boolean | undefined; - - /** - * Alias for presevePaths. - */ - P?: boolean | undefined; - - /** - * The mode to set on the created file archive. - */ - mode?: number | undefined; - - /** - * Do not recursively archive the contents of directories. - */ - noDirRecurse?: boolean | undefined; - - /** - * Set to true to pack the targets of symbolic links. Without this - * option, symbolic links are archived as such. - */ - follow?: boolean | undefined; - - /** - * Alias for follow. - */ - L?: boolean | undefined; - - /** - * Alias for follow. - */ - h?: boolean | undefined; - - /** - * Suppress pax extended headers. Note that this means that long paths and - * linkpaths will be truncated, and large or negative numeric values - * may be interpreted incorrectly. - */ - noPax?: boolean | undefined; - - /** - * Set to true to omit writing mtime values for entries. Note that this prevents using other mtime-based features - * like `tar.update` or the `keepNewer` option with the resulting tar archive. [Alias: m, no-mtime] - */ - noMtime?: boolean | undefined; - m?: boolean | undefined; - "no-mtime"?: boolean | undefined; - - /** - * Set to a Date object to force a specific mtime for everything added to the archive. Overridden by noMtime. - */ - mtime?: Date; - - /** - * A path portion to prefix onto the entries in the archive. - */ - prefix?: string | undefined; -} - -export interface ExtractOptions { - /** - * A function that will get called with (code, message, data) for any - * warnings encountered. (See "Warnings and Errors") - */ - onwarn?(code: string, message: string, data: Buffer): void; - - /** - * Treat warnings as crash-worthy errors. Default false. - */ - strict?: boolean | undefined; - - /** - * Extract files relative to the specified directory. Defaults to - * process.cwd(). If provided, this must exist and must be a directory. - */ - cwd?: string | undefined; - - /** - * Alias for cwd. - */ - C?: string | undefined; - - /** - * A function that gets called with (path, stat) for each entry being - * added. Return true to emit the entry from the archive, or false to skip it. - */ - filter?(path: string, stat: FileStat): boolean; - - /** - * Set to true to keep the existing file on disk if it's newer than - * the file in the archive. - */ - newer?: boolean | undefined; - - /** - * Alias for newer. - */ - "keep-newer"?: boolean | undefined; - - /** - * Alias for newer. - */ - "keep-newer-files"?: boolean | undefined; - - /** - * Do not overwrite existing files. In particular, if a file appears more - * than once in an archive, later copies will not overwrite earlier copies - */ - keep?: boolean | undefined; - - /** - * Alias for keep. - */ - k?: boolean | undefined; - - /** - * Alias for keep. - */ - "keep-existing"?: boolean | undefined; - - /** - * Allow absolute paths, paths containing .., and extracting - * through symbolic links. By default, / is stripped from - * absolute paths, .. paths are not extracted, and any file - * whose location would be modified by a symbolic link is not - * extracted. - */ - preservePaths?: boolean | undefined; - - /** - * Alias for presevePaths. - */ - P?: boolean | undefined; - - /** - * Unlink files before creating them. Without this option, tar overwrites - * existing files, which preserves existing hardlinks. With this option, - * existing hardlinks will be broken, as will any symlink that would - * affect the location of an extracted file. - */ - unlink?: boolean | undefined; - - /** - * Remove the specified number of leading path elements. Pathnames with - * fewer elements will be silently skipped. Note that the pathname - * is edited after applying the filter, but before security checks. - */ - strip?: number | undefined; - - /** - * Alias for strip. - */ - "strip-components"?: number | undefined; - - /** - * Alias for strip. - */ - stripComponents?: number | undefined; - - /** - * If true, tar will set the uid and gid of extracted entries to the uid - * and gid fields in the archive. This defaults to true when run as root, - * and false otherwise. If false, then files and directories will be set - * with the owner and group of the user running the process. This is - * similar to -p in tar(1), but ACLs and other system-specific data is - * never unpacked in this implementation, and modes - * are set by default already. - */ - preserveOwner?: boolean | undefined; - - /** - * Alias for preserveOwner. - */ - p?: boolean | undefined; - - /** - * Set to a number to force ownership of all extracted files and folders, - * and all implicitly created directories, to be owned by the specified - * user id, regardless of the uid field in the archive. Cannot be used - * along with preserveOwner. Requires also setting a gid option. - */ - uid?: number | undefined; - - /** - * Set to a number to force ownership of all extracted files and folders, - * and all implicitly created directories, to be owned by the specified - * group id, regardless of the gid field in the archive. Cannot be used - * along with preserveOwner. Requires also setting a uid option - */ - gid?: number | undefined; - - /** - * Set to true to omit writing mtime value for extracted entries. - * [Alias: m, no-mtime] - */ - noMtime?: boolean | undefined; - m?: boolean | undefined; - "no-mtime"?: boolean | undefined; - - /** - * Provide a function that takes an entry object, and returns a stream, - * or any falsey value. If a stream is provided, then that stream's data - * will be written instead of the contents of the archive entry. If a - * falsey value is provided, then the entry is written to disk as normal. - * (To exclude items from extraction, use the filter option described above.) - */ - transform?(entry: ReadEntry): NodeJS.WritableStream | undefined | false | null; - - /** - * A function that gets called with (entry) for each entry that passes the - * filter. - */ - onentry?(entry: ReadEntry): void; - - /** - * Set to true to omit calling `fs.chmod()` to ensure that the extracted file - * matches the entry mode. This also suppresses the call to `process.umask()` - * to determine the default umask value, since tar will extract with whatever - * mode is provided, and let the process `umask` apply normally. - */ - noChmod?: boolean | undefined; - - // The following options are mostly internal, but can be modified in some - // advanced use cases, such as re-using caches between runs. - - /** - * The maximum buffer size for fs.read() operations (in bytes). Defaults to 16 MB. - */ - maxReadSize?: number | undefined; - - /** - * The maximum size of meta entries that is supported. Defaults to 1 MB. - */ - maxMetaEntrySize?: number | undefined; -} - -export interface ListOptions { - /** - * Treat warnings as crash-worthy errors. Default false. - */ - strict?: boolean | undefined; - - /** - * Extract files relative to the specified directory. Defaults to - * process.cwd(). If provided, this must exist and must be a directory. - */ - cwd?: string | undefined; - - /** - * Alias for cwd. - */ - C?: string | undefined; - - /** - * A function that gets called with (path, stat) for each entry being - * added. Return true to emit the entry from the archive, or false to skip it. - */ - filter?(path: string, entry: FileStat): boolean; - - /** - * A function that gets called with (entry) for each entry that passes the - * filter. This is important for when both file and sync are set, because - * it will be called synchronously. - */ - onentry?(entry: ReadEntry): void; - - /** - * The maximum buffer size for fs.read() operations. Defaults to 16 MB. - */ - maxReadSize?: number | undefined; - - /** - * By default, entry streams are resumed immediately after the call to - * onentry. Set noResume: true to suppress this behavior. Note that by - * opting into this, the stream will never complete until the entry - * data is consumed. - */ - noResume?: boolean | undefined; -} - -export interface ReplaceOptions { - /** - * Required. Write the tarball archive to the specified filename. - */ - file: string; - - /** - * Act synchronously. If this is set, then any provided file will be - * fully written after the call to tar.c. - */ - sync?: boolean | undefined; - - /** - * A function that will get called with (code, message, data) for any - * warnings encountered. (See "Warnings and Errors") - */ - onwarn?(code: string, message: string, data: Buffer): void; - - /** - * Treat warnings as crash-worthy errors. Default false. - */ - strict?: boolean | undefined; - - /** - * Extract files relative to the specified directory. Defaults to - * process.cwd(). If provided, this must exist and must be a directory. - */ - cwd?: string | undefined; - - /** - * Alias for cwd. - */ - C?: string | undefined; - - /** - * A path portion to prefix onto the entries in the archive. - */ - prefix?: string | undefined; - - /** - * A function that gets called with (path, stat) for each entry being - * added. Return true to emit the entry from the archive, or false to skip it. - */ - filter?(path: string, stat: fs.Stats): boolean; - - /** - * Allow absolute paths. By default, / is stripped from absolute paths. - */ - preservePaths?: boolean | undefined; - - /** - * The maximum buffer size for fs.read() operations. Defaults to 16 MB. - */ - maxReadSize?: number | undefined; - - /** - * Do not recursively archive the contents of directories. - */ - noDirRecurse?: boolean | undefined; - - /** - * Set to true to pack the targets of symbolic links. Without this - * option, symbolic links are archived as such. - */ - follow?: boolean | undefined; - - /** - * Alias for follow. - */ - L?: boolean | undefined; - - /** - * Alias for follow. - */ - h?: boolean | undefined; - - /** - * uppress pax extended headers. Note that this means that long paths and - * linkpaths will be truncated, and large or negative numeric values - * may be interpreted incorrectly. - */ - noPax?: boolean | undefined; -} - -export interface FileOptions { - /** - * Uses the given file as the input or output of this function. - */ - file?: string | undefined; - - /** - * Alias for file. - */ - f?: string | undefined; -} - -export type RequiredFileOptions = - | { - /** - * Uses the given file as the input or output of this function. - */ - file: string; - } - | { - /** - * Alias for file. - */ - f: string; - }; - -/** - * Create a tarball archive. The fileList is an array of paths to add to the - * tarball. Adding a directory also adds its children recursively. An entry in - * fileList that starts with an @ symbol is a tar archive whose entries will - * be added. To add a file that starts with @, prepend it with `./`. - * - * Archive data may be read from the returned stream. - */ -export function create( - options: CreateOptions, - fileList: readonly string[], - callback?: (err?: Error) => void, -): stream.Readable; - -/** - * Create a tarball archive. The fileList is an array of paths to add to the - * tarball. Adding a directory also adds its children recursively. An entry in - * fileList that starts with an @ symbol is a tar archive whose entries will - * be added. To add a file that starts with @, prepend it with `./`. - */ -export function create(options: CreateOptions & FileOptions, fileList: readonly string[]): Promise; -export function create(options: CreateOptions & FileOptions & { sync: true }, fileList: readonly string[]): void; -export function create( - options: CreateOptions & FileOptions, - fileList: readonly string[], - callback: (err?: Error) => void, -): void; - -/** - * Alias for create - */ -export const c: typeof create; - -/** - * Extract a tarball archive. The fileList is an array of paths to extract - * from the tarball. If no paths are provided, then all the entries are - * extracted. If the archive is gzipped, then tar will detect this and unzip - * it. Note that all directories that are created will be forced to be - * writable, readable, and listable by their owner, to avoid cases where a - * directory prevents extraction of child entries by virtue of its mode. Most - * extraction errors will cause a warn event to be emitted. If the cwd is - * missing, or not a directory, then the extraction will fail completely. - * - * Archive data should be written to the returned stream. - */ -export function extract( - options: ExtractOptions, - fileList?: readonly string[], - callback?: (err?: Error) => void, -): stream.Writable; - -/** - * Extract a tarball archive. The fileList is an array of paths to extract - * from the tarball. If no paths are provided, then all the entries are - * extracted. If the archive is gzipped, then tar will detect this and unzip - * it. Note that all directories that are created will be forced to be - * writable, readable, and listable by their owner, to avoid cases where a - * directory prevents extraction of child entries by virtue of its mode. Most - * extraction errors will cause a warn event to be emitted. If the cwd is - * missing, or not a directory, then the extraction will fail completely. - */ -export function extract(options: ExtractOptions & FileOptions, fileList?: readonly string[]): Promise; -export function extract(options: ExtractOptions & FileOptions & { sync: true }, fileList?: readonly string[]): void; -export function extract( - options: ExtractOptions & FileOptions, - fileList: readonly string[] | undefined, - callback: (err?: Error) => void, -): void; - -/** - * Alias for extract - */ -export const x: typeof extract; - -/** - * List the contents of a tarball archive. The fileList is an array of paths - * to list from the tarball. If no paths are provided, then all the entries - * are listed. If the archive is gzipped, then tar will detect this and unzip - * it. - */ -export function list(options: ListOptions & RequiredFileOptions, fileList?: readonly string[]): Promise; -export function list(options: ListOptions & RequiredFileOptions & { sync: true }, fileList?: readonly string[]): void; -export function list(callback?: (err?: Error) => void): Parse; -export function list(optionsOrFileList: ListOptions | readonly string[], callback?: (err?: Error) => void): Parse; -export function list(options: ListOptions, fileList: readonly string[], callback?: (err?: Error) => void): Parse; - -/** - * Alias for list - */ -export const t: typeof list; - -/** - * Add files to an existing archive. Because later entries override earlier - * entries, this effectively replaces any existing entries. The fileList is an - * array of paths to add to the tarball. Adding a directory also adds its - * children recursively. An entry in fileList that starts with an @ symbol is - * a tar archive whose entries will be added. To add a file that - * starts with @, prepend it with ./. - */ -export function replace(options: ReplaceOptions, fileList?: readonly string[]): Promise; -export function replace( - options: ReplaceOptions, - fileList: readonly string[] | undefined, - callback: (err?: Error) => void, -): Promise; - -/** - * Alias for replace - */ -export const r: typeof replace; - -/** - * Add files to an archive if they are newer than the entry already in the - * tarball archive. The fileList is an array of paths to add to the tarball. - * Adding a directory also adds its children recursively. An entry in fileList - * that starts with an @ symbol is a tar archive whose entries will be added. - * To add a file that starts with @, prepend it with ./. - */ -export function update(options: ReplaceOptions, fileList?: readonly string[]): Promise; -export function update( - options: ReplaceOptions, - fileList: readonly string[] | undefined, - callback: (err?: Error) => void, -): Promise; - -/** - * Alias for update - */ -export const u: typeof update; - -export {}; diff --git a/types/tar/package.json b/types/tar/package.json deleted file mode 100644 index 8a87d19a183d0d..00000000000000 --- a/types/tar/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "private": true, - "name": "@types/tar", - "version": "6.1.9999", - "projects": [ - "https://github.com/npm/node-tar" - ], - "dependencies": { - "@types/node": "*", - "minipass": "^4.0.0" - }, - "devDependencies": { - "@types/tar": "workspace:." - }, - "owners": [ - { - "name": "Maxime LUCE", - "githubUsername": "SomaticIT" - }, - { - "name": "Connor Peet", - "githubUsername": "connor4312" - } - ] -} diff --git a/types/tar/tar-tests.ts b/types/tar/tar-tests.ts deleted file mode 100644 index d393f1e429652a..00000000000000 --- a/types/tar/tar-tests.ts +++ /dev/null @@ -1,194 +0,0 @@ -/** - * Test suite created by Maxime LUCE - * - * Created by using code samples from https://github.com/npm/node-tar. - */ - -import tar = require("tar"); -import fs = require("fs"); -import path = require("path"); - -/** - * Quick Extract - */ -fs.createReadStream("path/to/file.tar").pipe(tar.Extract("path/to/extract")); - -/** - * Use with events - */ -const readStream = fs.createReadStream("/path/to/file.tar"); -const extract = tar.Extract("/path/to/target"); - -readStream.pipe(extract); - -extract.on("entry", (entry: any) => undefined); - -{ - const options: tar.PackOptions = { - cwd: __dirname, - portable: true, - // gzip: true, - gzip: { flush: 1 }, - prefix: "package/", - filter: (path, stat): boolean => { - // $ExpectType string - path; - // $ExpectType Stats - stat; - - return true; - }, - onwarn: (c, m, p) => { - // $ExpectType string - c; - // $ExpectType string - m; - // $ExpectType Buffer || Buffer - p; - }, - strict: false, - preservePaths: true, - noDirRecurse: true, - follow: true, - }; - - // @ts-expect-error - options.mtime = 1704391217691; - - options.mtime = undefined; - options.mtime; // $ExpectType undefined - - options.mtime = new Date(); - options.mtime; // $ExpectType Date - - // $ExpectType Pack - const pack = new tar.Pack(options) - .add("dir") - .end() - .end("") - .end("one-byte.txt") - .on("data", () => {}) - .on("data", c => { - // $ExpectType Buffer || Buffer - c; - }) - .on("end", () => { - new tar.Pack.Sync({ - ...options, - linkCache: pack.linkCache, - readdirCache: pack.readdirCache, - statCache: pack.statCache, - }) - .add("dir") - .end() - .read(); - }); - - // $ExpectType boolean - new tar.Pack(options).write("path"); - - // $ExpectType typeof PackSync - tar.Pack.Sync; -} - -/** - * Examples from tar docs: - */ - -tar.c( - { - gzip: true, - file: "my-tarball.tgz", - }, - ["some", "files", "and", "folders"], -).then(() => undefined); - -tar.c( - { - gzip: true, - }, - ["some", "files", "and", "folders"], -).pipe(fs.createWriteStream("my-tarball.tgz")); - -tar.c( - { - prefix: "some-prefix", - }, - ["some", "files", "and", "folders"], -).pipe(fs.createWriteStream("my-tarball.tgz")); - -tar.x( - { - file: "my-tarball.tgz", - noChmod: true, - }, -).then(() => undefined); - -fs.createReadStream("my-tarball.tgz").pipe( - tar.x({ - strip: 1, - C: "some-dir", // alias for cwd:'some-dir', also ok - }), -); - -tar.t({ - file: "my-tarball.tgz", - onentry: (entry) => console.log(entry.path, "was", entry.size), -}); - -tar.c( - { - gzip: true, - preservePaths: true, - }, - ["some", "files", "and", "folders"], -).pipe(fs.createWriteStream("my-tarball.tgz")); - -tar.x( - { - file: "my-tarball.tgz", - preservePaths: true, - }, -).then(() => undefined); - -tar.c( - { - brotli: true, - file: "my-tarball.tbr", - }, - ["some", "files", "and", "folders"], -).then(() => undefined); - -tar.c( - { - brotli: { - flush: 1, - finishFlush: 2, - chunkSize: 32 * 1024, - maxOutputLength: 1073741823, - }, - file: "my-tarball.tbr", - }, - ["some", "files", "and", "folders"], -).then(() => undefined); - -fs.createReadStream("my-tarball.tgz") - .pipe(tar.t()) - .on("entry", entry => console.log(entry.size)); - -fs.createReadStream("my-tarball.tgz") - .pipe(new tar.Parse()) - .on("entry", entry => entry.on("data", data => console.log(data))); - -tar.list({ - file: "my-tarball.tgz", - onentry: (entry) => entry.path.slice(1), - filter: (path, stat): boolean => { - // $ExpectType string - path; - // $ExpectType FileStat - stat; - - return true; - }, -}).then(() => console.log("after listing")); diff --git a/types/tar/tsconfig.json b/types/tar/tsconfig.json deleted file mode 100644 index f3bb6bfe0b5586..00000000000000 --- a/types/tar/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", - "tar-tests.ts" - ] -} From 9b94737fb0bcb4858ca42268eb877a25b08fc914 Mon Sep 17 00:00:00 2001 From: Jimmy Leung <43258070+hkleungai@users.noreply.github.com> Date: Sun, 15 Feb 2026 13:38:45 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74524=20feat?= =?UTF-8?q?(mapbox=5F=5Fpoint-geometry):=20remove=20types=20by=20@hkleunga?= =?UTF-8?q?i?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notNeededPackages.json | 4 + types/mapbox__point-geometry/.npmignore | 5 -- types/mapbox__point-geometry/index.d.ts | 40 ---------- .../mapbox__point-geometry-tests.ts | 78 ------------------- types/mapbox__point-geometry/package.json | 21 ----- types/mapbox__point-geometry/tsconfig.json | 19 ----- 6 files changed, 4 insertions(+), 163 deletions(-) delete mode 100644 types/mapbox__point-geometry/.npmignore delete mode 100644 types/mapbox__point-geometry/index.d.ts delete mode 100644 types/mapbox__point-geometry/mapbox__point-geometry-tests.ts delete mode 100644 types/mapbox__point-geometry/package.json delete mode 100644 types/mapbox__point-geometry/tsconfig.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 3e5c43b9c0038c..e35ac38e73464c 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -4069,6 +4069,10 @@ "libraryName": "map-obj", "asOfVersion": "3.1.0" }, + "mapbox__point-geometry": { + "libraryName": "@mapbox/point-geometry", + "asOfVersion": "1.0.0" + }, "mapbox__vector-tile": { "libraryName": "@mapbox/vector-tile", "asOfVersion": "2.0.0" diff --git a/types/mapbox__point-geometry/.npmignore b/types/mapbox__point-geometry/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/mapbox__point-geometry/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/mapbox__point-geometry/index.d.ts b/types/mapbox__point-geometry/index.d.ts deleted file mode 100644 index 7ae25ee45e5525..00000000000000 --- a/types/mapbox__point-geometry/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -declare class Point { - x: number; - y: number; - constructor(x: number, y: number); - clone(): Point; - add(p: Point): Point; - _add(p: Point): Point; - sub(p: Point): Point; - _sub(p: Point): Point; - multiByPoint(p: Point): Point; - divByPoint(p: Point): Point; - mult(k: number): Point; - _mult(k: number): Point; - div(k: number): Point; - _div(k: number): Point; - rotate(k: number): Point; - _rotate(k: number): Point; - rotateAround(k: number, p: Point): Point; - _rotateAround(k: number, p: Point): Point; - matMult(m: number[]): Point; - _matMult(m: number[]): Point; - unit(): Point; - _unit(): Point; - perp(): Point; - _perp(): Point; - round(): Point; - _round(): Point; - mag(): number; - equals(other: Point): boolean; - dist(p: Point): number; - distSqr(p: Point): number; - angle(): number; - angleTo(b: Point): number; - angleWith(b: Point): number; - angleWithSep(x: number, y: number): number; - - static convert(a: T): T extends number[] ? Point : T extends Point ? Point : T; -} - -export = Point; diff --git a/types/mapbox__point-geometry/mapbox__point-geometry-tests.ts b/types/mapbox__point-geometry/mapbox__point-geometry-tests.ts deleted file mode 100644 index 0a41efaafe92ff..00000000000000 --- a/types/mapbox__point-geometry/mapbox__point-geometry-tests.ts +++ /dev/null @@ -1,78 +0,0 @@ -import Point = require("@mapbox/point-geometry"); - -const point = new Point(9, 25); - -// $ExpectType number -point.x; - -// $ExpectType number -point.y; - -// $ExpectType Point -point.clone(); - -// $ExpectType Point -point.add(new Point(59, 6)); - -// $ExpectType Point -point.sub(new Point(59, 6)); - -// $ExpectType Point -point.multiByPoint(new Point(59, 6)); - -// $ExpectType Point -point.divByPoint(new Point(59, 6)); - -// $ExpectType Point -point.mult(2); - -// $ExpectType Point -point.div(2); - -// $ExpectType Point -point.rotate(45); - -// $ExpectType Point -point.rotateAround(45, new Point(2, 3)); - -// $ExpectType Point -point.matMult([2, 4, 8]); - -// $ExpectType Point -point.unit(); - -// $ExpectType Point -point.perp(); - -// $ExpectType Point -point.round(); - -// $ExpectType number -point.mag(); - -// $ExpectType boolean -point.equals(new Point(-1, 2)); - -// $ExpectType number -point.dist(new Point(-1, 2)); - -// $ExpectType number -point.distSqr(new Point(-1, 2)); - -// $ExpectType number -point.angle(); - -// $ExpectType number -point.angleTo(new Point(1, 2)); - -// $ExpectType number -point.angleWith(new Point(1, 2)); - -// $ExpectType number -point.angleWithSep(5, 45); - -// $ExpectType Point -Point.convert([1, 2]); - -// $ExpectType Point -Point.convert(new Point(-1, 2)); diff --git a/types/mapbox__point-geometry/package.json b/types/mapbox__point-geometry/package.json deleted file mode 100644 index 1fe61462d9ba3d..00000000000000 --- a/types/mapbox__point-geometry/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "private": true, - "name": "@types/mapbox__point-geometry", - "version": "0.1.9999", - "projects": [ - "https://github.com/mapbox/point-geometry" - ], - "devDependencies": { - "@types/mapbox__point-geometry": "workspace:." - }, - "owners": [ - { - "name": "Mathieu Maes", - "githubUsername": "webberig" - }, - { - "name": "Harel Mazor", - "githubUsername": "HarelM" - } - ] -} diff --git a/types/mapbox__point-geometry/tsconfig.json b/types/mapbox__point-geometry/tsconfig.json deleted file mode 100644 index ff11e3c316f448..00000000000000 --- a/types/mapbox__point-geometry/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "mapbox__point-geometry-tests.ts" - ] -} From 6d95ac383adeed372f07b959e579270e7725f319 Mon Sep 17 00:00:00 2001 From: Brandon Ros Date: Sun, 15 Feb 2026 00:50:01 -0500 Subject: [PATCH 06/11] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74522=20fix:?= =?UTF-8?q?=20expand=20types=20for=20@mathieuc/tradingview=20by=20@brandon?= =?UTF-8?q?ros?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/mathieuc__tradingview/index.d.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/types/mathieuc__tradingview/index.d.ts b/types/mathieuc__tradingview/index.d.ts index 28b7b5e6cd53f1..bf56aed3f666ce 100644 --- a/types/mathieuc__tradingview/index.d.ts +++ b/types/mathieuc__tradingview/index.d.ts @@ -688,12 +688,35 @@ export class QuoteMarket { */ constructor(symbol: MarketSymbol); + /** + * When quote market is loaded + * @param callback Callback + */ + onLoaded(callback: () => void): void; + /** * Subscribe to market data * @param callback Data callback */ onData(callback: (data: any) => void): void; + /** + * When quote event happens + * @param callback Callback + */ + onEvent(callback: (...data: any[]) => void): void; + + /** + * When quote error happens + * @param callback Callback + */ + onError(callback: (...data: any[]) => void): void; + + /** + * Close this listener + */ + close(): void; + /** * Unsubscribe from market data */ From a0ff3cfebae6a8d9ab5b8a8f9ea37d6c9c25a482 Mon Sep 17 00:00:00 2001 From: Adam Naji <110662505+Bashamega@users.noreply.github.com> Date: Sun, 15 Feb 2026 10:59:04 +0200 Subject: [PATCH 07/11] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74390=20Add?= =?UTF-8?q?=20Book=20interface=20to=20Kotobee=20types=20with=20detailed=20?= =?UTF-8?q?metadata=20structure=20by=20@Bashamega?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/kotobee/index.d.ts | 172 +++++++++++++++++++++++++++++++++ types/kotobee/kotobee-tests.ts | 85 ++++++++++++++++ 2 files changed, 257 insertions(+) diff --git a/types/kotobee/index.d.ts b/types/kotobee/index.d.ts index fe6c4e19493a13..0f7e3d9bd2efc7 100644 --- a/types/kotobee/index.d.ts +++ b/types/kotobee/index.d.ts @@ -24,6 +24,177 @@ type LanguageCode = type Directions = "ltr" | "rtl"; +/** + * Represents the current state and metadata of the loaded eBook in the Kotobee Reader. + */ +interface Book { + /** + * Information about the current chapter. + */ + chapter: { + /** + * Whether this is not the last chapter. + */ + notLastChapter: boolean; + /** + * Whether this is not the first chapter. + */ + notFirstChapter: boolean; + /** + * Relative URL path of the current chapter. + */ + url: string; + /** + * Fully qualified URL for the current chapter. + */ + absoluteURL: string; + /** + * Title of the current chapter. + */ + title: string; + /** + * Viewport settings or null if not specified. + */ + viewport: null; + /** + * Layout type of the current chapter (e.g., 'reflowable' or 'fixed'). + */ + layout: string; + /** + * Current view mode (e.g., 'single', 'double', 'scroll', etc.). + */ + view: string; + /** + * Indicates if the chapter is displayed in paged mode. + */ + paged: boolean; + }; + /** + * Metadata describing the book, compatible with various standards. + */ + meta: { + /** + * Dublin Core metadata fields. + */ + dc: { + /** + * The book's title. + */ + title: string; + /** + * Unique identifier for the book. + */ + identifier: string; + /** + * Publication identifier. + */ + "pub-id": string; + /** + * Book author/creator. + */ + creator: string; + /** + * Publisher's name. + */ + publisher: string; + /** + * Copyright or rights information. + */ + rights: string; + language: LanguageCode; + /** + * Book description or summary. + */ + description: string; + }; + /** + * Cover image URL or path. + */ + cover: string; + /** + * DCMI Terms metadata. + */ + dcterms: { + /** + * Date and time of the last modification (ISO 8601). + */ + modified: string; + }; + /** + * Epub3 'rendition' metadata. + */ + rendition: { + /** + * Rendering/layout mode ("reflowable", "pre-paginated", etc.). + */ + layout: string; + /** + * Device orientation ("portrait", "landscape", etc.). + */ + orientation: string; + }; + /** + * Apple Books (iBooks) specific metadata. + */ + ibooks: { + /** + * Whether the book is interactive ("true" or "false"). + */ + interactive: "true" | "false"; + /** + * Whether specified fonts are used ("true" or "false"). + */ + "specified-fonts": "true" | "false"; + }; + /** + * Kotobee-specific metadata. + */ + kotobee: { + /** + * Kotobee reader version. + */ + version: string; + /** + * Kotobee reader build number. + */ + build: string; + }; + /** + * Schema.org accessibility metadata. + */ + schema: { + /** + * The access mode (e.g., "textual", "visual"). + */ + accessmode: string; + /** + * Sufficient access modes ("textual", "visual", etc.). + */ + accessmodesufficient: string; + /** + * Accessibility feature (e.g., "structuralNavigation"). + */ + accessibilityfeature: string; + /** + * Accessibility hazards ("none", "flashing", etc.). + */ + accessibilityhazard: string; + /** + * Summary of the book's accessibility features. + */ + accessibilitysummary: string; + }; + }; + /** + * Kotobee Book structure version. + */ + version: number; + /** + * Book chapters serialized as a string (usually JSON or XML). + */ + chapters: string; +} + interface KotobeeReader { /** * Clears cached local data used by the reader. @@ -49,6 +220,7 @@ interface KotobeeReader { * Sets reading direction (left-to-right or right-to-left). */ setDirection: (direction: Directions) => void; + book: Book; } // Declare the global variable diff --git a/types/kotobee/kotobee-tests.ts b/types/kotobee/kotobee-tests.ts index 872382f6ae5a35..44d7b1395dcf91 100644 --- a/types/kotobee/kotobee-tests.ts +++ b/types/kotobee/kotobee-tests.ts @@ -66,3 +66,88 @@ validDirections.forEach(dir => { const fakeLang: LanguageCode = "madeup"; // @ts-expect-error const dirCenter: Directions = "center"; + +// ------------------- Book Interface Tests ------------------- + +const book: Book = { + chapter: { + notLastChapter: true, + notFirstChapter: false, + url: "chapter1.xhtml", + absoluteURL: "https://example.com/chapter1.xhtml", + title: "Introduction", + viewport: null, + layout: "reflowable", + view: "single", + paged: true, + }, + meta: { + dc: { + title: "Sample Book", + identifier: "abc-123", + "pub-id": "pub-456", + creator: "Jane Doe", + publisher: "Book Publisher", + rights: "© 2024 Jane Doe", + language: "en", + description: "A fascinating sample book.", + }, + cover: "cover.jpg", + dcterms: { + modified: "2023-07-01T12:00:00Z", + }, + rendition: { + layout: "reflowable", + orientation: "portrait", + }, + ibooks: { + interactive: "true", + "specified-fonts": "false", + }, + kotobee: { + version: "2.1.4", + build: "12384", + }, + schema: { + accessmode: "textual", + accessmodesufficient: "textual", + accessibilityfeature: "structuralNavigation", + accessibilityhazard: "none", + accessibilitysummary: "Accessible for screen readers.", + }, + }, + version: 2, + chapters: + `
  • Page 1
  • +
  • Page 2
  • `, +}; + +// Book with missing required properties - should error +// @ts-expect-error +const incompleteBook: Book = {}; + +// Invalid type in Book.meta.dc.language - should error +const bookWithInvalidLang: Book = { + ...book, + meta: { + ...book.meta, + dc: { + ...book.meta.dc, + // @ts-expect-error + language: "not-a-language", + }, + }, +}; + +// Invalid interactive field in ibooks - should error +const bookWithInvalidIbooks: Book = { + ...book, + meta: { + ...book.meta, + ibooks: { + // @ts-expect-error + interactive: "sometimes", + "specified-fonts": "true", + }, + }, +}; From 861a82a50004db359b904829c2128204435b6a58 Mon Sep 17 00:00:00 2001 From: Zephyr-Blessed Date: Sun, 15 Feb 2026 10:01:00 +0100 Subject: [PATCH 08/11] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74514=20Add?= =?UTF-8?q?=20type=20definitions=20for=20memorystorage=20by=20@Zephyr-Bles?= =?UTF-8?q?sed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zephyr-Blessed Co-authored-by: Zephyr-Blessed --- types/memorystorage/.npmignore | 5 ++ types/memorystorage/index.d.ts | 66 ++++++++++++++++++++++ types/memorystorage/memorystorage-tests.ts | 35 ++++++++++++ types/memorystorage/package.json | 17 ++++++ types/memorystorage/tsconfig.json | 19 +++++++ 5 files changed, 142 insertions(+) create mode 100644 types/memorystorage/.npmignore create mode 100644 types/memorystorage/index.d.ts create mode 100644 types/memorystorage/memorystorage-tests.ts create mode 100644 types/memorystorage/package.json create mode 100644 types/memorystorage/tsconfig.json diff --git a/types/memorystorage/.npmignore b/types/memorystorage/.npmignore new file mode 100644 index 00000000000000..93e307400a5456 --- /dev/null +++ b/types/memorystorage/.npmignore @@ -0,0 +1,5 @@ +* +!**/*.d.ts +!**/*.d.cts +!**/*.d.mts +!**/*.d.*.ts diff --git a/types/memorystorage/index.d.ts b/types/memorystorage/index.d.ts new file mode 100644 index 00000000000000..dd54205424bda0 --- /dev/null +++ b/types/memorystorage/index.d.ts @@ -0,0 +1,66 @@ +/** + * A memory-backed implementation of the Web Storage API. + * + * @see https://github.com/download/memorystorage + */ + +interface MemoryStorage { + /** The identifier for this storage instance. */ + readonly id: string; + + /** The number of key/value pairs currently present in the storage. */ + readonly length: number; + + /** + * Returns the value associated with the given key, or `null` if the key does not exist. + * @param key The name of the key to retrieve the value of. + */ + getItem(key: string): string | null; + + /** + * Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously. + * @param key The name of the key to create/update. + * @param value The value to set. + */ + setItem(key: string, value: string): void; + + /** + * Removes the key/value pair with the given key, if a key/value pair with the given key exists. + * @param key The name of the key to remove. + */ + removeItem(key: string): void; + + /** + * Returns the name of the nth key, or `null` if n is greater than or equal to the number of key/value pairs. + * @param index The index of the key to return. + */ + key(index: number): string | null; + + /** + * Removes all key/value pairs, if there are any. + */ + clear(): void; + + /** Index signature to allow accessing stored items as properties. */ + [key: string]: any; +} + +interface MemoryStorageConstructor { + /** + * Creates a new MemoryStorage object implementing the Web Storage API using memory. + * + * If no arguments are given, the created memory storage object will read from and write to the + * `global` memory storage. If a string argument is given, the new storage object will read from + * and write to its own segment of memory. + * + * Can be called with or without `new`. + * + * @param id Optional string argument used to isolate this memory storage object from others. + */ + new(id?: string): MemoryStorage; + (id?: string): MemoryStorage; +} + +declare const MemoryStorage: MemoryStorageConstructor; + +export = MemoryStorage; diff --git a/types/memorystorage/memorystorage-tests.ts b/types/memorystorage/memorystorage-tests.ts new file mode 100644 index 00000000000000..3573b1e40d145f --- /dev/null +++ b/types/memorystorage/memorystorage-tests.ts @@ -0,0 +1,35 @@ +import MemoryStorage = require("memorystorage"); + +// Can be called with new +const storage1 = new MemoryStorage("test-1"); + +// Can be called without new +const storage2 = MemoryStorage("test-2"); + +// Can be called with no arguments (uses global) +const globalStorage = new MemoryStorage(); + +// $ExpectType string +storage1.id; + +// $ExpectType number +storage1.length; + +// $ExpectType string | null +storage1.getItem("key"); + +// $ExpectType void +storage1.setItem("key", "value"); + +// $ExpectType void +storage1.removeItem("key"); + +// $ExpectType string | null +storage1.key(0); + +// $ExpectType void +storage1.clear(); + +// Can set/get properties directly via index signature +storage1["myKey"] = "myValue"; +const val: any = storage1["myKey"]; diff --git a/types/memorystorage/package.json b/types/memorystorage/package.json new file mode 100644 index 00000000000000..0650056fbbeac1 --- /dev/null +++ b/types/memorystorage/package.json @@ -0,0 +1,17 @@ +{ + "private": true, + "name": "@types/memorystorage", + "version": "0.12.9999", + "projects": [ + "https://github.com/download/memorystorage" + ], + "devDependencies": { + "@types/memorystorage": "workspace:." + }, + "owners": [ + { + "name": "Zephyr-Blessed", + "githubUsername": "Zephyr-Blessed" + } + ] +} diff --git a/types/memorystorage/tsconfig.json b/types/memorystorage/tsconfig.json new file mode 100644 index 00000000000000..882b8db1aed1e3 --- /dev/null +++ b/types/memorystorage/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "node16", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "memorystorage-tests.ts" + ] +} From 73ca7f6f8b5e8cccb9d48992c048b3256d22025a Mon Sep 17 00:00:00 2001 From: Emanuele Sacco Date: Sun, 15 Feb 2026 10:34:22 +0100 Subject: [PATCH 09/11] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74419=20Add?= =?UTF-8?q?=20types=20for=20k6/x/socketio=20by=20@XEmAX32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Emanuele Sacco --- types/k6__x__socketio/.npmignore | 5 + types/k6__x__socketio/index.d.ts | 114 ++++++++++++++++++ .../k6__x__socketio/k6__x__socketio-tests.ts | 29 +++++ types/k6__x__socketio/package.json | 20 +++ types/k6__x__socketio/tsconfig.json | 17 +++ 5 files changed, 185 insertions(+) create mode 100644 types/k6__x__socketio/.npmignore create mode 100644 types/k6__x__socketio/index.d.ts create mode 100644 types/k6__x__socketio/k6__x__socketio-tests.ts create mode 100644 types/k6__x__socketio/package.json create mode 100644 types/k6__x__socketio/tsconfig.json diff --git a/types/k6__x__socketio/.npmignore b/types/k6__x__socketio/.npmignore new file mode 100644 index 00000000000000..93e307400a5456 --- /dev/null +++ b/types/k6__x__socketio/.npmignore @@ -0,0 +1,5 @@ +* +!**/*.d.ts +!**/*.d.cts +!**/*.d.mts +!**/*.d.*.ts diff --git a/types/k6__x__socketio/index.d.ts b/types/k6__x__socketio/index.d.ts new file mode 100644 index 00000000000000..b47d29016ad6fc --- /dev/null +++ b/types/k6__x__socketio/index.d.ts @@ -0,0 +1,114 @@ + +declare module "k6/x/socketio" { + interface SocketIOOptions { + /** + * Socket.IO path (default: "/socket.io/") + */ + path?: string; + /** + * Namespace to connect to (default: "/") + * Example: "/chat" + */ + namespace?: string; + /** + * Auth payload sent in the connect packet + */ + auth?: Record; + /** + * Query parameters appended to the URL + */ + query?: Record; + /** + * Passed directly to k6/ws.connect + */ + params?: { + /** Request headers. */ + headers?: { [name: string]: string }; + + /** + * Compression algorithm. The only supported algorithm is `deflate`. + * If the option is left unset or empty, it defaults to no compression. + */ + compression?: string; + + /** Response time metric tags. */ + tags?: { [name: string]: string }; + }; + } + + /** + * Socket.IO socket wrapper + * + * Provides Socket.IO-like API on top of k6/ws WebSocket connection. + * Socket.IO-specific methods (on, emit, send) override the original k6/ws methods. + * All other k6/ws socket methods are available as-is via the wrapper. + */ + interface Socket { + /** + * Register an event handler (Socket.IO version) + * Overrides the original k6/ws on() method + * + * @param event - Event name ("connect", "disconnect", or custom event) + * @param handler - Handler function that receives event data + */ + on(event: string, handler: (data?: any) => void): void; + + /** + * Emit an event to the server (Socket.IO specific) + * + * @param event - Event name + * @param data - Optional data to send with the event + */ + emit(event: string, data?: any): void; + + /** + * Send data (Socket.IO version - alias for emit("message", data)) + * Overrides the original k6/ws send() method + * + * @param data - Data to send + */ + send(data: any): void; + + /** + * Close connection. + * https://grafana.com/docs/k6/latest/javascript-api/k6-ws/socket/socket-close/ + * + * @param code - WebSocket status code. + * @example + * socket.close(); + */ + close(code?: number): void; + } + + /** + * Connect to a Socket.IO server + * + * @param host - Base URL such as "http://localhost:4000" or "wss://example.com" + * @param options - Optional configuration + * @param handler - Optional callback function called with a Socket.IO-like socket wrapper + * @returns The underlying k6/ws.connect result + * + * @example + * ```typescript + * import { io } from "k6/x/socketio"; + * + * io("http://localhost:4000", {}, (socket) => { + * socket.on("connect", () => { + * socket.emit("hello", { payload: "hi from k6" }); + * }); + * }); + * ``` + */ + function io( + host: string, + options?: SocketIOOptions, + handler?: (socket: Socket) => void + ): any; + + export { io, Socket, SocketIOOptions }; +} + +declare module "xk6-socketio" { + import { io, Socket, SocketIOOptions } from "k6/x/socketio"; + export { io, Socket, SocketIOOptions }; +} \ No newline at end of file diff --git a/types/k6__x__socketio/k6__x__socketio-tests.ts b/types/k6__x__socketio/k6__x__socketio-tests.ts new file mode 100644 index 00000000000000..284974a20cecff --- /dev/null +++ b/types/k6__x__socketio/k6__x__socketio-tests.ts @@ -0,0 +1,29 @@ +import { io, type Socket, type SocketIOOptions } from "k6/x/socketio"; + +const opts: SocketIOOptions = { + path: "/socket.io/", + namespace: "/chat", + auth: { token: "abc" }, + query: { a: 1 }, + params: { + headers: { Authorization: "Bearer token" }, + compression: "deflate", + tags: { name: "socketio" }, + }, +}; + +io("http://localhost:4000", opts, (socket: Socket) => { + socket.on("connect", () => {}); + socket.on("hello", (data) => { + const _x: any = data; + }); + + socket.emit("hello", { payload: "hi from k6" }); + socket.send({ msg: "message" }); + + socket.close(); + +}); + +// also works without options/handler +io("wss://example.com"); diff --git a/types/k6__x__socketio/package.json b/types/k6__x__socketio/package.json new file mode 100644 index 00000000000000..8fba53b045686e --- /dev/null +++ b/types/k6__x__socketio/package.json @@ -0,0 +1,20 @@ +{ + "name": "@types/k6__x__socketio", + "version": "0.1.9999", + "private": true, + "nonNpm": true, + "nonNpmDescription": "Type definitions for xk6 extension providing Socket.IO support in k6, not distributed via npm", + "projects": ["https://github.com/XEmAX32/xk6-socket.io"], + "owners": [ + { + "name": "Emanuele Sacco", + "url": "https://github.com/xemax32" + } + ], + "dependencies": { + "@types/k6": "*" + }, + "devDependencies": { + "@types/k6__x__socketio": "workspace:." + } +} diff --git a/types/k6__x__socketio/tsconfig.json b/types/k6__x__socketio/tsconfig.json new file mode 100644 index 00000000000000..12bac26680c601 --- /dev/null +++ b/types/k6__x__socketio/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "node16", + "lib": ["es2015"], + "noEmit": true, + "types": [], + "forceConsistentCasingInFileNames": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "k6__x__socketio-tests.ts" + ] +} \ No newline at end of file From dcc7f5da90269bae4a216d24f016218cdf9af9f4 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Sun, 15 Feb 2026 09:35:04 +0000 Subject: [PATCH 10/11] =?UTF-8?q?=F0=9F=A4=96=20dprint=20fmt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/k6__x__socketio/index.d.ts | 189 +++++++++--------- .../k6__x__socketio/k6__x__socketio-tests.ts | 33 ++- types/k6__x__socketio/package.json | 34 ++-- types/k6__x__socketio/tsconfig.json | 32 +-- 4 files changed, 143 insertions(+), 145 deletions(-) diff --git a/types/k6__x__socketio/index.d.ts b/types/k6__x__socketio/index.d.ts index b47d29016ad6fc..6d2fc438ab78c1 100644 --- a/types/k6__x__socketio/index.d.ts +++ b/types/k6__x__socketio/index.d.ts @@ -1,114 +1,113 @@ - declare module "k6/x/socketio" { - interface SocketIOOptions { - /** - * Socket.IO path (default: "/socket.io/") - */ - path?: string; - /** - * Namespace to connect to (default: "/") - * Example: "/chat" - */ - namespace?: string; - /** - * Auth payload sent in the connect packet - */ - auth?: Record; - /** - * Query parameters appended to the URL - */ - query?: Record; - /** - * Passed directly to k6/ws.connect - */ - params?: { - /** Request headers. */ - headers?: { [name: string]: string }; + interface SocketIOOptions { + /** + * Socket.IO path (default: "/socket.io/") + */ + path?: string; + /** + * Namespace to connect to (default: "/") + * Example: "/chat" + */ + namespace?: string; + /** + * Auth payload sent in the connect packet + */ + auth?: Record; + /** + * Query parameters appended to the URL + */ + query?: Record; + /** + * Passed directly to k6/ws.connect + */ + params?: { + /** Request headers. */ + headers?: { [name: string]: string }; - /** - * Compression algorithm. The only supported algorithm is `deflate`. - * If the option is left unset or empty, it defaults to no compression. - */ - compression?: string; + /** + * Compression algorithm. The only supported algorithm is `deflate`. + * If the option is left unset or empty, it defaults to no compression. + */ + compression?: string; - /** Response time metric tags. */ - tags?: { [name: string]: string }; - }; - } + /** Response time metric tags. */ + tags?: { [name: string]: string }; + }; + } - /** - * Socket.IO socket wrapper - * - * Provides Socket.IO-like API on top of k6/ws WebSocket connection. - * Socket.IO-specific methods (on, emit, send) override the original k6/ws methods. - * All other k6/ws socket methods are available as-is via the wrapper. - */ - interface Socket { /** + * Socket.IO socket wrapper + * + * Provides Socket.IO-like API on top of k6/ws WebSocket connection. + * Socket.IO-specific methods (on, emit, send) override the original k6/ws methods. + * All other k6/ws socket methods are available as-is via the wrapper. + */ + interface Socket { + /** * Register an event handler (Socket.IO version) * Overrides the original k6/ws on() method * * @param event - Event name ("connect", "disconnect", or custom event) * @param handler - Handler function that receives event data */ - on(event: string, handler: (data?: any) => void): void; + on(event: string, handler: (data?: any) => void): void; - /** - * Emit an event to the server (Socket.IO specific) - * - * @param event - Event name - * @param data - Optional data to send with the event - */ - emit(event: string, data?: any): void; + /** + * Emit an event to the server (Socket.IO specific) + * + * @param event - Event name + * @param data - Optional data to send with the event + */ + emit(event: string, data?: any): void; - /** - * Send data (Socket.IO version - alias for emit("message", data)) - * Overrides the original k6/ws send() method - * - * @param data - Data to send - */ - send(data: any): void; + /** + * Send data (Socket.IO version - alias for emit("message", data)) + * Overrides the original k6/ws send() method + * + * @param data - Data to send + */ + send(data: any): void; - /** - * Close connection. - * https://grafana.com/docs/k6/latest/javascript-api/k6-ws/socket/socket-close/ - * - * @param code - WebSocket status code. - * @example - * socket.close(); - */ - close(code?: number): void; - } + /** + * Close connection. + * https://grafana.com/docs/k6/latest/javascript-api/k6-ws/socket/socket-close/ + * + * @param code - WebSocket status code. + * @example + * socket.close(); + */ + close(code?: number): void; + } - /** - * Connect to a Socket.IO server - * - * @param host - Base URL such as "http://localhost:4000" or "wss://example.com" - * @param options - Optional configuration - * @param handler - Optional callback function called with a Socket.IO-like socket wrapper - * @returns The underlying k6/ws.connect result - * - * @example - * ```typescript - * import { io } from "k6/x/socketio"; - * - * io("http://localhost:4000", {}, (socket) => { - * socket.on("connect", () => { - * socket.emit("hello", { payload: "hi from k6" }); - * }); - * }); - * ``` - */ - function io( - host: string, - options?: SocketIOOptions, - handler?: (socket: Socket) => void - ): any; + /** + * Connect to a Socket.IO server + * + * @param host - Base URL such as "http://localhost:4000" or "wss://example.com" + * @param options - Optional configuration + * @param handler - Optional callback function called with a Socket.IO-like socket wrapper + * @returns The underlying k6/ws.connect result + * + * @example + * ```typescript + * import { io } from "k6/x/socketio"; + * + * io("http://localhost:4000", {}, (socket) => { + * socket.on("connect", () => { + * socket.emit("hello", { payload: "hi from k6" }); + * }); + * }); + * ``` + */ + function io( + host: string, + options?: SocketIOOptions, + handler?: (socket: Socket) => void, + ): any; - export { io, Socket, SocketIOOptions }; + export { io, Socket, SocketIOOptions }; } declare module "xk6-socketio" { - import { io, Socket, SocketIOOptions } from "k6/x/socketio"; - export { io, Socket, SocketIOOptions }; -} \ No newline at end of file + import { io, Socket, SocketIOOptions } from "k6/x/socketio"; + export { io, Socket, SocketIOOptions }; +} diff --git a/types/k6__x__socketio/k6__x__socketio-tests.ts b/types/k6__x__socketio/k6__x__socketio-tests.ts index 284974a20cecff..9d5b2b42d4aa17 100644 --- a/types/k6__x__socketio/k6__x__socketio-tests.ts +++ b/types/k6__x__socketio/k6__x__socketio-tests.ts @@ -1,28 +1,27 @@ import { io, type Socket, type SocketIOOptions } from "k6/x/socketio"; const opts: SocketIOOptions = { - path: "/socket.io/", - namespace: "/chat", - auth: { token: "abc" }, - query: { a: 1 }, - params: { - headers: { Authorization: "Bearer token" }, - compression: "deflate", - tags: { name: "socketio" }, - }, + path: "/socket.io/", + namespace: "/chat", + auth: { token: "abc" }, + query: { a: 1 }, + params: { + headers: { Authorization: "Bearer token" }, + compression: "deflate", + tags: { name: "socketio" }, + }, }; io("http://localhost:4000", opts, (socket: Socket) => { - socket.on("connect", () => {}); - socket.on("hello", (data) => { - const _x: any = data; - }); + socket.on("connect", () => {}); + socket.on("hello", (data) => { + const _x: any = data; + }); - socket.emit("hello", { payload: "hi from k6" }); - socket.send({ msg: "message" }); - - socket.close(); + socket.emit("hello", { payload: "hi from k6" }); + socket.send({ msg: "message" }); + socket.close(); }); // also works without options/handler diff --git a/types/k6__x__socketio/package.json b/types/k6__x__socketio/package.json index 8fba53b045686e..f19c3e54d20dcd 100644 --- a/types/k6__x__socketio/package.json +++ b/types/k6__x__socketio/package.json @@ -1,20 +1,20 @@ { - "name": "@types/k6__x__socketio", - "version": "0.1.9999", - "private": true, - "nonNpm": true, - "nonNpmDescription": "Type definitions for xk6 extension providing Socket.IO support in k6, not distributed via npm", - "projects": ["https://github.com/XEmAX32/xk6-socket.io"], - "owners": [ - { - "name": "Emanuele Sacco", - "url": "https://github.com/xemax32" + "name": "@types/k6__x__socketio", + "version": "0.1.9999", + "private": true, + "nonNpm": true, + "nonNpmDescription": "Type definitions for xk6 extension providing Socket.IO support in k6, not distributed via npm", + "projects": ["https://github.com/XEmAX32/xk6-socket.io"], + "owners": [ + { + "name": "Emanuele Sacco", + "url": "https://github.com/xemax32" + } + ], + "dependencies": { + "@types/k6": "*" + }, + "devDependencies": { + "@types/k6__x__socketio": "workspace:." } - ], - "dependencies": { - "@types/k6": "*" - }, - "devDependencies": { - "@types/k6__x__socketio": "workspace:." - } } diff --git a/types/k6__x__socketio/tsconfig.json b/types/k6__x__socketio/tsconfig.json index 12bac26680c601..22a6d8e1b752fe 100644 --- a/types/k6__x__socketio/tsconfig.json +++ b/types/k6__x__socketio/tsconfig.json @@ -1,17 +1,17 @@ { - "compilerOptions": { - "module": "node16", - "lib": ["es2015"], - "noEmit": true, - "types": [], - "forceConsistentCasingInFileNames": true, - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true - }, - "files": [ - "index.d.ts", - "k6__x__socketio-tests.ts" - ] -} \ No newline at end of file + "compilerOptions": { + "module": "node16", + "lib": ["es2015"], + "noEmit": true, + "types": [], + "forceConsistentCasingInFileNames": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "k6__x__socketio-tests.ts" + ] +} From 006ffd04ae1f71441d37199cd6a0e1f2eb1df6d8 Mon Sep 17 00:00:00 2001 From: Uladzislau Hramyka Date: Sun, 15 Feb 2026 12:55:30 +0300 Subject: [PATCH 11/11] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74530=20[tel?= =?UTF-8?q?egram-web-app]=20fix=20typo=20for=20BiometricManager.biometricT?= =?UTF-8?q?ype=20unknown=20value=20by=20@SecondThundeR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/telegram-web-app/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/telegram-web-app/index.d.ts b/types/telegram-web-app/index.d.ts index 2d6a29fb2cd49a..50218753c7167d 100644 --- a/types/telegram-web-app/index.d.ts +++ b/types/telegram-web-app/index.d.ts @@ -1197,7 +1197,7 @@ export interface BiometricManager { * - face, face-based biometrics, * - unknown, biometrics of an unknown type. */ - biometricType: "finger" | "face" | "unkown"; + biometricType: "finger" | "face" | "unknown"; /** * Shows whether permission to use biometrics has been requested. */