Skip to content

Commit

Permalink
refactor: update repo
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 15, 2022
1 parent 4cfe2e9 commit f27660e
Show file tree
Hide file tree
Showing 19 changed files with 591 additions and 580 deletions.
9 changes: 7 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"extends": [
"@nuxtjs/eslint-config-typescript"
]
"eslint-config-unjs"
],
"rules": {
"no-undef": 0,
"unicorn/consistent-destructuring": 0,
"unicorn/no-await-expression-member": 0,
}
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 - UnJS
Copyright (c) Pooya Parsa <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 8 additions & 6 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { defineBuildConfig } from 'unbuild'
import { defineBuildConfig } from "unbuild";

export default defineBuildConfig({
declaration: true,
emitCJS: false,
rollup: {
emitCJS: true
},
entries: [
'src/index',
'src/node',
'src/undici'
"src/index",
"src/node",
"src/undici"
]
})
});
2 changes: 1 addition & 1 deletion node.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './dist/node'
export * from "./dist/node";
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,25 @@
"test": "pnpm lint && vitest run --coverage"
},
"dependencies": {
"destr": "^1.2.0",
"node-fetch-native": "^0.1.8",
"ufo": "^0.8.6",
"destr": "^1.2.1",
"node-fetch-native": "^1.0.1",
"ufo": "^1.0.0",
"undici": "^5.12.0"
},
"devDependencies": {
"@nuxtjs/eslint-config-typescript": "^11.0.0",
"@types/node": "^18.11.9",
"@vitest/coverage-c8": "^0.25.1",
"@vitest/coverage-c8": "^0.25.2",
"eslint": "^8.27.0",
"eslint-config-unjs": "^0.0.2",
"fetch-blob": "^3.2.0",
"formdata-polyfill": "^4.0.10",
"h3": "^0.8.6",
"h3": "^1.0.1",
"jiti": "^1.16.0",
"listhen": "^0.3.5",
"listhen": "^1.0.0",
"standard-version": "^9.5.0",
"typescript": "^4.8.4",
"unbuild": "^0.9.4",
"vitest": "^0.25.1"
"vitest": "^0.25.2"
},
"packageManager": "[email protected]"
}
16 changes: 9 additions & 7 deletions playground/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { $fetch } from '../src/node'
import { $fetch } from "../src/node";

async function main () {
// const r = await $fetch<string>('http://google.com/404')
const r = await $fetch<string>('http://httpstat.us/500')
const r = await $fetch<string>("http://httpstat.us/500");
// const r = await $fetch<string>('http://httpstat/500')
// eslint-disable-next-line no-console
console.log(r)
console.log(r);
}

main().catch((err) => {
// eslint-disable-next-line unicorn/prefer-top-level-await
main().catch((error) => {
// eslint-disable-next-line no-console
console.error(err)
process.exit(1)
})
console.error(error);
// eslint-disable-next-line unicorn/no-process-exit
process.exit(1);
});
16 changes: 9 additions & 7 deletions playground/undici.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { $fetch } from '../src/undici'
import { $fetch } from "../src/undici";

async function main () {
const r = await $fetch<string>('http://google.com/404')
const r = await $fetch<string>("http://google.com/404");
// eslint-disable-next-line no-console
console.log(r)
console.log(r);
}

main().catch((err) => {
// eslint-disable-next-line unicorn/prefer-top-level-await
main().catch((error) => {
// eslint-disable-next-line no-console
console.error(err)
process.exit(1)
})
console.error(error);
// eslint-disable-next-line unicorn/no-process-exit
process.exit(1);
});
Loading

0 comments on commit f27660e

Please sign in to comment.