nextjs-cors 2.2.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +0 -5
- package/package.json +1 -10
- package/dist/index.d.mts +0 -13
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -21
- package/dist/index.mjs +0 -15
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
CORS middleware for Next.js API routes.
|
|
4
4
|
|
|
5
|
-
[](https://github.com/yonycalsin/nextjs-cors/actions/workflows/ci.yml)
|
|
6
|
-
[](https://www.npmjs.com/package/nextjs-cors)
|
|
7
|
-
[](https://www.npmjs.com/package/nextjs-cors)
|
|
8
|
-
[](LICENSE)
|
|
9
|
-
|
|
10
5
|
## Installation
|
|
11
6
|
|
|
12
7
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextjs-cors",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Nextjs-Cors is a node.js package to provide a middleware that can be used to enable CORS with various options in nextjs applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nextjs-cors",
|
|
@@ -8,16 +8,7 @@
|
|
|
8
8
|
"cors",
|
|
9
9
|
"nextjs"
|
|
10
10
|
],
|
|
11
|
-
"homepage": "https://github.com/yonycalsin/nextjs-cors#readme",
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/yonycalsin/nextjs-cors/issues"
|
|
14
|
-
},
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/yonycalsin/nextjs-cors.git"
|
|
18
|
-
},
|
|
19
11
|
"license": "MIT",
|
|
20
|
-
"author": "Yony",
|
|
21
12
|
"main": "dist/index.js",
|
|
22
13
|
"module": "dist/index.mjs",
|
|
23
14
|
"types": "dist/index.d.ts",
|
package/dist/index.d.mts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CorsOptions, CorsOptionsDelegate } from 'cors';
|
|
2
|
-
import { NextApiRequest, NextApiResponse } from 'next';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* CORS middleware for Next.js API routes
|
|
6
|
-
* @param req - Next.js API request object
|
|
7
|
-
* @param res - Next.js API response object
|
|
8
|
-
* @param options - CORS configuration options (see https://github.com/expressjs/cors#configuration-options)
|
|
9
|
-
* @returns Promise that resolves when CORS middleware completes
|
|
10
|
-
*/
|
|
11
|
-
declare function NextCors(req: NextApiRequest, res: NextApiResponse, options?: CorsOptions | CorsOptionsDelegate): Promise<void>;
|
|
12
|
-
|
|
13
|
-
export { NextCors as default };
|
package/dist/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CorsOptions, CorsOptionsDelegate } from 'cors';
|
|
2
|
-
import { NextApiRequest, NextApiResponse } from 'next';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* CORS middleware for Next.js API routes
|
|
6
|
-
* @param req - Next.js API request object
|
|
7
|
-
* @param res - Next.js API response object
|
|
8
|
-
* @param options - CORS configuration options (see https://github.com/expressjs/cors#configuration-options)
|
|
9
|
-
* @returns Promise that resolves when CORS middleware completes
|
|
10
|
-
*/
|
|
11
|
-
declare function NextCors(req: NextApiRequest, res: NextApiResponse, options?: CorsOptions | CorsOptionsDelegate): Promise<void>;
|
|
12
|
-
|
|
13
|
-
export { NextCors as default };
|
package/dist/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var cors = require('cors');
|
|
4
|
-
|
|
5
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
-
|
|
7
|
-
var cors__default = /*#__PURE__*/_interopDefault(cors);
|
|
8
|
-
|
|
9
|
-
// src/index.ts
|
|
10
|
-
function NextCors(req, res, options) {
|
|
11
|
-
return new Promise((resolve, reject) => {
|
|
12
|
-
cors__default.default(options)(req, res, (result) => {
|
|
13
|
-
if (result instanceof Error) {
|
|
14
|
-
return reject(result);
|
|
15
|
-
}
|
|
16
|
-
resolve();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = NextCors;
|
package/dist/index.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import cors from 'cors';
|
|
2
|
-
|
|
3
|
-
// src/index.ts
|
|
4
|
-
function NextCors(req, res, options) {
|
|
5
|
-
return new Promise((resolve, reject) => {
|
|
6
|
-
cors(options)(req, res, (result) => {
|
|
7
|
-
if (result instanceof Error) {
|
|
8
|
-
return reject(result);
|
|
9
|
-
}
|
|
10
|
-
resolve();
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { NextCors as default };
|