@eggjs/jsonp 4.0.0-beta.33 → 4.0.0-beta.34
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/README.md +8 -11
- package/dist/index.d.ts +17 -0
- package/dist/index.js +22 -1
- package/package.json +6 -12
package/README.md
CHANGED
|
@@ -15,25 +15,16 @@
|
|
|
15
15
|
|
|
16
16
|
An egg plugin for jsonp support.
|
|
17
17
|
|
|
18
|
-
## Requirements
|
|
19
|
-
|
|
20
|
-
- egg >= 4.x
|
|
21
|
-
|
|
22
|
-
## Install
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npm i @eggjs/jsonp
|
|
26
|
-
```
|
|
27
|
-
|
|
28
18
|
## Usage
|
|
29
19
|
|
|
20
|
+
egg built-in plugin `jsonp` is enabled by default.
|
|
21
|
+
|
|
30
22
|
```ts
|
|
31
23
|
// {app_root}/config/plugin.ts
|
|
32
24
|
|
|
33
25
|
export default {
|
|
34
26
|
jsonp: {
|
|
35
27
|
enable: true,
|
|
36
|
-
package: '@eggjs/jsonp',
|
|
37
28
|
},
|
|
38
29
|
};
|
|
39
30
|
```
|
|
@@ -109,6 +100,8 @@ see [config/config.default.ts](https://github.com/eggjs/egg/blob/master/plugins/
|
|
|
109
100
|
|
|
110
101
|
## Example
|
|
111
102
|
|
|
103
|
+
### Standard Application Usage
|
|
104
|
+
|
|
112
105
|
In `app/router.ts`
|
|
113
106
|
|
|
114
107
|
```ts
|
|
@@ -122,6 +115,10 @@ app.get('/another', jsonp, 'jsonp.another');
|
|
|
122
115
|
app.get('/customize', app.jsonp({ callback: 'fn' }), 'jsonp.customize');
|
|
123
116
|
```
|
|
124
117
|
|
|
118
|
+
### tegg HttpController Usage
|
|
119
|
+
|
|
120
|
+
TODO: TBD
|
|
121
|
+
|
|
125
122
|
## Questions & Suggestions
|
|
126
123
|
|
|
127
124
|
Please open an issue [here](https://github.com/eggjs/egg/issues).
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
1
|
import './types.ts';
|
|
2
|
+
import { type EggPluginFactory } from 'egg';
|
|
3
|
+
/**
|
|
4
|
+
* JSONP plugin
|
|
5
|
+
*
|
|
6
|
+
* @since 4.1.0
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```ts
|
|
9
|
+
* // config/plugin.ts
|
|
10
|
+
* import jsonpPlugin from '@eggjs/jsonp';
|
|
11
|
+
*
|
|
12
|
+
* export default {
|
|
13
|
+
* ...jsonpPlugin(),
|
|
14
|
+
* };
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
declare const _default: EggPluginFactory;
|
|
18
|
+
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,23 @@
|
|
|
1
1
|
import "./types.js";
|
|
2
|
-
|
|
2
|
+
import { definePluginFactory } from 'egg';
|
|
3
|
+
/**
|
|
4
|
+
* JSONP plugin
|
|
5
|
+
*
|
|
6
|
+
* @since 4.1.0
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```ts
|
|
9
|
+
* // config/plugin.ts
|
|
10
|
+
* import jsonpPlugin from '@eggjs/jsonp';
|
|
11
|
+
*
|
|
12
|
+
* export default {
|
|
13
|
+
* ...jsonpPlugin(),
|
|
14
|
+
* };
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export default definePluginFactory({
|
|
18
|
+
name: 'jsonp',
|
|
19
|
+
enable: true,
|
|
20
|
+
path: import.meta.dirname,
|
|
21
|
+
optionalDependencies: ['security'],
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxZQUFZLENBQUM7QUFFcEIsT0FBTyxFQUFFLG1CQUFtQixFQUF5QixNQUFNLEtBQUssQ0FBQztBQUVqRTs7Ozs7Ozs7Ozs7OztHQWFHO0FBQ0gsZUFBZSxtQkFBbUIsQ0FBQztJQUNqQyxJQUFJLEVBQUUsT0FBTztJQUNiLE1BQU0sRUFBRSxJQUFJO0lBQ1osSUFBSSxFQUFFLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTztJQUN6QixvQkFBb0IsRUFBRSxDQUFDLFVBQVUsQ0FBQztDQUNuQyxDQUFxQixDQUFDIn0=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/jsonp",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.34",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -19,12 +19,6 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"description": "jsonp support for egg",
|
|
22
|
-
"eggPlugin": {
|
|
23
|
-
"name": "jsonp",
|
|
24
|
-
"optionalDependencies": [
|
|
25
|
-
"security"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
22
|
"keywords": [
|
|
29
23
|
"egg",
|
|
30
24
|
"egg-plugin",
|
|
@@ -49,16 +43,16 @@
|
|
|
49
43
|
"jsonp-body": "^2.0.0"
|
|
50
44
|
},
|
|
51
45
|
"peerDependencies": {
|
|
52
|
-
"egg": "4.1.0-beta.
|
|
46
|
+
"egg": "4.1.0-beta.34"
|
|
53
47
|
},
|
|
54
48
|
"devDependencies": {
|
|
55
49
|
"@types/node": "^24.9.1",
|
|
56
50
|
"tsdown": "0.15.11",
|
|
57
51
|
"typescript": "^5.9.3",
|
|
58
|
-
"vitest": "4.0.
|
|
59
|
-
"@eggjs/
|
|
60
|
-
"@eggjs/
|
|
61
|
-
"egg": "4.1.0-beta.
|
|
52
|
+
"vitest": "4.0.5",
|
|
53
|
+
"@eggjs/mock": "7.0.0-beta.34",
|
|
54
|
+
"@eggjs/tsconfig": "3.1.0-beta.34",
|
|
55
|
+
"egg": "4.1.0-beta.34"
|
|
62
56
|
},
|
|
63
57
|
"main": "./dist/index.js",
|
|
64
58
|
"module": "./dist/index.js",
|