6.7.0 - Alpha6 - Scrapers 工具 JSDoc @typedef 转换为 TypeScript 声明文件
This commit is contained in:
@@ -1,17 +1,5 @@
|
||||
// utils/anchors.mjs
|
||||
|
||||
/**
|
||||
* @typedef {Object} AnchoredBlockUpdateOption
|
||||
* @property {'map' | 'list' | 'custom'} type
|
||||
* @property {string} anchorTag
|
||||
* @property {string} [mapName]
|
||||
* @property {string} [listName]
|
||||
* @property {string[]} lines
|
||||
* @property {number} [linesIndent=4]
|
||||
* @property {string} [updatedLabel]
|
||||
* @property {(srcInBlock: string, options: { toUpdatedStamp?: (date?: Date) => string }) => { newBlock: string, changed: boolean }} [replacer]
|
||||
*/
|
||||
|
||||
import * as fsp from 'node:fs/promises';
|
||||
import * as path from 'node:path';
|
||||
import { escapeRegExp } from './format.mjs';
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// utils/fetch.mjs
|
||||
|
||||
/** @typedef {import('@octokit/types').Endpoints['GET /repos/{owner}/{repo}/commits']['response']['data']} CommitsData */
|
||||
|
||||
import * as dotenv from 'dotenv';
|
||||
import * as https from 'https';
|
||||
import nodeFetch from 'node-fetch';
|
||||
|
||||
@@ -1,33 +1,5 @@
|
||||
// utils/puppeteer-helpers.mjs
|
||||
|
||||
/** @typedef {import('puppeteer').Page} Page */
|
||||
/** @typedef {string | RegExp | ((s: string) => boolean)} FindTargetRowsFilter */
|
||||
/** @typedef {string} TableDataStructureItemName */
|
||||
/** @typedef {RegExp | ((s: string) => boolean | string)} TableDataStructureItem */
|
||||
/** @typedef {string | RegExp | ((s: string) => boolean | string)} TableDataStructureItemForPageEvaluate */
|
||||
/**
|
||||
* @typedef {object} FindTargetRowsOptions
|
||||
* @property {string} [tableSelector='table']
|
||||
* @property {{ [selector: string]: FindTargetRowsFilter | FindTargetRowsFilter[] }}[tableFilter={}]
|
||||
* @property {string} [tableRowSelector='tbody tr']
|
||||
* @property {string} [tableDataSelector='td']
|
||||
* @property {Array<{ [dataItemName: TableDataStructureItemName]: TableDataStructureItem } | TableDataStructureItemName>} [tableDataStructure=[]]
|
||||
*/
|
||||
/**
|
||||
* @typedef {object} FindTargetRowsOptionsForPageEvaluate
|
||||
* @property {string} [tableSelector='table']
|
||||
* @property {{ [selector: string]: FindTargetRowsFilter | FindTargetRowsFilter[] }}[tableFilter={}]
|
||||
* @property {string} [tableRowSelector='tbody tr']
|
||||
* @property {string} [tableDataSelector='td']
|
||||
* @property {Array<{ [dataItemName: TableDataStructureItemName]: TableDataStructureItemForPageEvaluate } | TableDataStructureItemName>} [tableDataStructure=[]]
|
||||
*/
|
||||
/**
|
||||
* @typedef {object} PuppeteerOptions
|
||||
* @property {string} url
|
||||
* @property {number} [pageGoToTimeout=120000]
|
||||
* @property {number} [findTargetRowsTimeout=30000]
|
||||
*/
|
||||
|
||||
import puppeteer from 'puppeteer';
|
||||
import { sleep } from './async.mjs';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user