Skip to content

Commit

Permalink
feat: add support for cjs
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiin committed Dec 12, 2022
1 parent 18292f7 commit 15d8877
Show file tree
Hide file tree
Showing 5 changed files with 909 additions and 663 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p float="left">
<a href="https://www.npmjs.com/package/url-minify"><img src="https://badgen.net/npm/v/url-minify" alt="NPM version" /></a>
<a href="https://www.npmjs.com/package/url-minify"><img src="https://github.com/rubiin/tweeny-weeny/workflows/CI/badge.svg" alt="CI" /></a>
<a href="https://www.npmjs.com/package/url-minify"><img src="https://img.shields.io/npm/dm/url-minify" alt="Downloads" /></a>
<a href="https://www.npmjs.com/package/url-minify"><img src="https://github.com/rubiin/tweeny-weeny/workflows/CI/badge.svg" alt="CI" /></a>
<a href="https://www.npmjs.com/package/url-minify"><img src="https://img.shields.io/npm/dm/url-minify" alt="Downloads" /></a>
</p>

# Minify Url
Expand Down Expand Up @@ -33,6 +33,20 @@ import minify from 'url-minify';
})();
```



```js
const minify = require('url-minify').default;

~(async function () {
console.log(
await minify('https://rubiin.vercel.app', { provider: 'isgd' }),
);

// ==> {longUrl: 'https://rubiin.vercel.app',shortUrl: 'https://is.gd/PTkruq'}
})();
```

## API

### minify(link,options)
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.js",
Expand All @@ -44,22 +44,22 @@
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@antfu/eslint-config": "^0.26.1",
"@antfu/ni": "^0.17.2",
"@types/node": "^18.7.13",
"@antfu/eslint-config": "^0.33.1",
"@antfu/ni": "^0.18.8",
"@types/node": "^18.11.13",
"bumpp": "^8.2.1",
"clean-publish": "^4.0.1",
"eslint": "^8.22.0",
"clean-publish": "^4.0.2",
"eslint": "^8.29.0",
"esno": "^0.16.3",
"rimraf": "^3.0.2",
"tsup": "^6.2.3",
"typescript": "^4.8.2",
"unbuild": "^0.8.9",
"vite": "^3.0.9",
"vitest": "^0.22.1"
"tsup": "^6.5.0",
"typescript": "^4.9.4",
"unbuild": "^1.0.2",
"vite": "^4.0.0",
"vitest": "^0.25.7"
},
"dependencies": {
"axios": "^0.27.2"
"axios": "^1.2.1"
},
"clean-publish": {
"cleanDocs": true,
Expand Down
Loading

0 comments on commit 15d8877

Please sign in to comment.