i18next-http-middleware 3.9.0 → 3.9.1
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/cjs/index.d.ts +2 -0
- package/cjs/index.js +3 -3
- package/esm/index.d.ts +2 -0
- package/esm/index.js +3 -3
- package/index.d.ts +2 -0
- package/lib/index.js +2 -2
- package/package.json +1 -1
package/cjs/index.d.ts
CHANGED
|
@@ -76,6 +76,8 @@ export function handle(i18next: I18next, options?: HandleOptions): Handler;
|
|
|
76
76
|
|
|
77
77
|
export function koaPlugin(i18next: I18next, options?: HandleOptions): (context: unknown, next: Function) => any;
|
|
78
78
|
|
|
79
|
+
export function freshPlugin(i18next:I18next, options?: HandleOptions): Promise<any>;
|
|
80
|
+
|
|
79
81
|
export function plugin(
|
|
80
82
|
instance: any,
|
|
81
83
|
options: HandleOptions & { i18next?: I18next },
|
package/cjs/index.js
CHANGED
|
@@ -171,16 +171,16 @@ function koaPlugin(i18next, options) {
|
|
|
171
171
|
return koaMiddleware;
|
|
172
172
|
}();
|
|
173
173
|
}
|
|
174
|
-
function freshPlugin(i18next) {
|
|
174
|
+
function freshPlugin(i18next, options) {
|
|
175
175
|
return function () {
|
|
176
176
|
var _ref = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2(ctx) {
|
|
177
177
|
var placeholder, resp;
|
|
178
178
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
179
179
|
while (1) switch (_context2.prev = _context2.next) {
|
|
180
180
|
case 0:
|
|
181
|
-
handle(i18next, {
|
|
181
|
+
handle(i18next, _objectSpread(_objectSpread({}, options), {}, {
|
|
182
182
|
attachLocals: true
|
|
183
|
-
})(ctx);
|
|
183
|
+
}))(ctx);
|
|
184
184
|
ctx.state.t = ctx.req.t;
|
|
185
185
|
ctx.state.i18n = ctx.req.i18n;
|
|
186
186
|
ctx.state.lng = ctx.req.lng;
|
package/esm/index.d.ts
CHANGED
|
@@ -76,6 +76,8 @@ export function handle(i18next: I18next, options?: HandleOptions): Handler;
|
|
|
76
76
|
|
|
77
77
|
export function koaPlugin(i18next: I18next, options?: HandleOptions): (context: unknown, next: Function) => any;
|
|
78
78
|
|
|
79
|
+
export function freshPlugin(i18next:I18next, options?: HandleOptions): Promise<any>;
|
|
80
|
+
|
|
79
81
|
export function plugin(
|
|
80
82
|
instance: any,
|
|
81
83
|
options: HandleOptions & { i18next?: I18next },
|
package/esm/index.js
CHANGED
|
@@ -153,16 +153,16 @@ export function koaPlugin(i18next, options) {
|
|
|
153
153
|
return koaMiddleware;
|
|
154
154
|
}();
|
|
155
155
|
}
|
|
156
|
-
export function freshPlugin(i18next) {
|
|
156
|
+
export function freshPlugin(i18next, options) {
|
|
157
157
|
return function () {
|
|
158
158
|
var _ref = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2(ctx) {
|
|
159
159
|
var placeholder, resp;
|
|
160
160
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
161
161
|
while (1) switch (_context2.prev = _context2.next) {
|
|
162
162
|
case 0:
|
|
163
|
-
handle(i18next, {
|
|
163
|
+
handle(i18next, _objectSpread(_objectSpread({}, options), {}, {
|
|
164
164
|
attachLocals: true
|
|
165
|
-
})(ctx);
|
|
165
|
+
}))(ctx);
|
|
166
166
|
ctx.state.t = ctx.req.t;
|
|
167
167
|
ctx.state.i18n = ctx.req.i18n;
|
|
168
168
|
ctx.state.lng = ctx.req.lng;
|
package/index.d.ts
CHANGED
|
@@ -76,6 +76,8 @@ export function handle(i18next: I18next, options?: HandleOptions): Handler;
|
|
|
76
76
|
|
|
77
77
|
export function koaPlugin(i18next: I18next, options?: HandleOptions): (context: unknown, next: Function) => any;
|
|
78
78
|
|
|
79
|
+
export function freshPlugin(i18next:I18next, options?: HandleOptions): Promise<any>;
|
|
80
|
+
|
|
79
81
|
export function plugin(
|
|
80
82
|
instance: any,
|
|
81
83
|
options: HandleOptions & { i18next?: I18next },
|
package/lib/index.js
CHANGED
|
@@ -150,9 +150,9 @@ export function koaPlugin (i18next, options) {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
export function freshPlugin (i18next) {
|
|
153
|
+
export function freshPlugin (i18next, options) {
|
|
154
154
|
return async (ctx) => {
|
|
155
|
-
handle(i18next, { attachLocals: true })(ctx)
|
|
155
|
+
handle(i18next, { ...options, attachLocals: true })(ctx)
|
|
156
156
|
ctx.state.t = ctx.req.t
|
|
157
157
|
ctx.state.i18n = ctx.req.i18n
|
|
158
158
|
ctx.state.lng = ctx.req.lng
|