Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodenext compatibility #71

Merged
merged 1 commit into from
Dec 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const { format } = require('util')

function build () {
function processWarning () {
const codes = {}
const emitted = new Map()

Expand Down Expand Up @@ -59,4 +59,6 @@ function build () {
}
}

module.exports = build
module.exports = processWarning
module.exports.default = processWarning
module.exports.processWarning = processWarning
30 changes: 18 additions & 12 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
declare function warning (): Warning
type ProcessWarning = () => processWarning.Warning

export declare class WarnOpts {
code: string;
name: string;
message: string;
}
declare namespace processWarning {
export interface Warning {
create(name: string, code: string, message: string): BuildWarnOptsFn,
emit(cod: string, a?: any, b?: any, c?: any): void,
emitted: Map<string, boolean>
}

export type BuildWarnOptsFn = (a?: any, b?: any, c?: any) => WarnOpts

export type BuildWarnOptsFn = (a?: any, b?: any, c?: any) => WarnOpts
export interface WarnOpts {
code: string;
name: string;
message: string;
}

interface Warning {
create(name: string, code: string, message: string): BuildWarnOptsFn,
emit(cod: string, a?: any, b?: any, c?: any): void,
emitted: Map<string, boolean>
export const processWarning: ProcessWarning
export { processWarning as default }
}

export default warning
declare function processWarning(...params: Parameters<ProcessWarning>): ReturnType<ProcessWarning>
export = processWarning