Skip to content

Commit

Permalink
Refactor to use @imports
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 28, 2024
1 parent f9a646e commit ec623ad
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion script/build-top-dependent.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import('./crawl-top-dependent.js').Result} Result
* @import {Result} from './crawl-top-dependent.js'
*/

import fs from 'node:fs/promises'
Expand Down
2 changes: 1 addition & 1 deletion script/build-top-download.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import('./crawl-top-download-scoped.js').Result} Result
* @import {Result} from './crawl-top-download-unscoped.js'
*/

import fs from 'node:fs/promises'
Expand Down
4 changes: 2 additions & 2 deletions script/build-top.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @typedef {import('./crawl-top-dependent.js').Result} DependentResult
* @typedef {import('./crawl-top-download-unscoped.js').Result} DownloadResult
* @import {Result as DependentResult} from './crawl-top-dependent.js'
* @import {Result as DownloadResult} from './crawl-top-download-unscoped.js'
*/

import fs from 'node:fs/promises'
Expand Down
6 changes: 4 additions & 2 deletions script/crawl-packages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* @typedef {import('node:stream').Readable} Readable
*
* @import {Readable} from 'node:stream'
*/

/**
* @typedef Database
* @property {number} update_seq
*
Expand Down
7 changes: 4 additions & 3 deletions script/crawl-top-download-scoped.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/**
* @typedef {import('./crawl-top-download-unscoped.js').Result} Result
* @typedef {import('./crawl-top-download-unscoped.js').NpmDownloadResult} NpmDownloadResult
*
* @import {NpmDownloadResult, Result} from './crawl-top-download-unscoped.js'
*/

/**
* @typedef NpmDownloadError
* @property {string} error
*/
Expand Down
6 changes: 5 additions & 1 deletion script/crawl-top-download-unscoped.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @import {Response} from 'undici'
*/

/**
* @typedef {Record<string, NpmDownloadResult | null>} NpmDownloadBulkResult
*
Expand Down Expand Up @@ -63,7 +67,7 @@ while (true) {
)

/* eslint-disable no-await-in-loop */
/** @type {import('undici').Response | undefined} */
/** @type {Response | undefined} */
let response
/** @type {NpmDownloadBulkResult} */
let results
Expand Down

0 comments on commit ec623ad

Please sign in to comment.