admin felület fejlesztése garázs, előfizeztési csomagok
This commit is contained in:
65
frontend_admin/.output/server/node_modules/@intlify/h3/dist/index.mjs
generated
vendored
Normal file
65
frontend_admin/.output/server/node_modules/@intlify/h3/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
import { createCoreContext, parseTranslateArgs, translate, NOT_REOSLVED } from '@intlify/core';
|
||||
import { getHeaderLocale } from '@intlify/utils/h3';
|
||||
export * from '@intlify/utils/h3';
|
||||
|
||||
/**
|
||||
* @author kazuya kawaguchi (a.k.a. kazupon)
|
||||
* @license MIT
|
||||
*/
|
||||
function defineI18nMiddleware(options) {
|
||||
const i18n = createCoreContext(options);
|
||||
const orgLocale = i18n.locale;
|
||||
let staticLocaleDetector = null;
|
||||
if (typeof orgLocale === "string") {
|
||||
console.warn(
|
||||
`defineI18nMiddleware 'locale' option is static ${orgLocale} locale! you should specify dynamic locale detector function.`
|
||||
);
|
||||
staticLocaleDetector = () => orgLocale;
|
||||
}
|
||||
const getLocaleDetector = (event, i18n2) => {
|
||||
return typeof orgLocale === "function" ? orgLocale.bind(null, event, i18n2) : staticLocaleDetector == null ? detectLocaleFromAcceptLanguageHeader.bind(null, event) : staticLocaleDetector.bind(null, event, i18n2);
|
||||
};
|
||||
return {
|
||||
onRequest(event) {
|
||||
event.context._i18nLocale = getLocaleDetector(event, i18n);
|
||||
i18n.locale = event.context._i18nLocale;
|
||||
event.context.i18n = i18n;
|
||||
},
|
||||
onAfterResponse(event) {
|
||||
i18n.locale = orgLocale;
|
||||
delete event.context.i18n;
|
||||
}
|
||||
};
|
||||
}
|
||||
const detectLocaleFromAcceptLanguageHeader = (event) => getHeaderLocale(event).toString();
|
||||
async function useTranslation(event) {
|
||||
if (event.context.i18n == null) {
|
||||
throw new Error(
|
||||
"middleware not initialized, please setup `onRequest` and `onAfterResponse` options of `createApp` with the middleware obtained with `defineI18nMiddleware`"
|
||||
);
|
||||
}
|
||||
const localeDetector = event.context._i18nLocale;
|
||||
let locale;
|
||||
if (localeDetector.constructor.name === "AsyncFunction") {
|
||||
locale = await localeDetector(event);
|
||||
event.context.i18n.locale = locale;
|
||||
}
|
||||
function translate$1(key, ...args) {
|
||||
const [_, options] = parseTranslateArgs(key, ...args);
|
||||
const [arg2] = args;
|
||||
const result = Reflect.apply(translate, null, [
|
||||
event.context.i18n,
|
||||
key,
|
||||
arg2,
|
||||
{
|
||||
// bind to request locale
|
||||
locale,
|
||||
...options
|
||||
}
|
||||
]);
|
||||
return NOT_REOSLVED === result ? key : result;
|
||||
}
|
||||
return translate$1;
|
||||
}
|
||||
|
||||
export { defineI18nMiddleware, detectLocaleFromAcceptLanguageHeader, useTranslation };
|
||||
122
frontend_admin/.output/server/node_modules/@intlify/h3/package.json
generated
vendored
Normal file
122
frontend_admin/.output/server/node_modules/@intlify/h3/package.json
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"name": "@intlify/h3",
|
||||
"description": "Internationalization middleware & utilities for h3",
|
||||
"version": "0.7.4",
|
||||
"author": {
|
||||
"name": "kazuya kawaguchi",
|
||||
"email": "kawakazu80@gmail.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/kazupon",
|
||||
"bugs": {
|
||||
"url": "https://github.com/intlify/h3/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/intlify/h3.git"
|
||||
},
|
||||
"keywords": [
|
||||
"i18n",
|
||||
"h3",
|
||||
"internationalization",
|
||||
"intlify",
|
||||
"utilities",
|
||||
"middleware"
|
||||
],
|
||||
"homepage": "https://github.com/intlify/h3#readme",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 20"
|
||||
},
|
||||
"type": "module",
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"main": "dist/index.cjs",
|
||||
"module": "dist/index.mjs",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
},
|
||||
"./dist/*": "./dist/*",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"types": "dist/index.d.ts",
|
||||
"dependencies": {
|
||||
"@intlify/core": "^11.1.12",
|
||||
"@intlify/utils": "^0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.4.1",
|
||||
"@eslint/markdown": "^7.5.0",
|
||||
"@kazupon/eslint-config": "^0.38.0",
|
||||
"@kazupon/prettier-config": "^0.1.1",
|
||||
"@types/node": "^24.9.2",
|
||||
"@types/supertest": "^6.0.3",
|
||||
"@typescript/native-preview": "7.0.0-dev.20251025.1",
|
||||
"@vitest/coverage-v8": "^4.0.6",
|
||||
"@vitest/eslint-plugin": "^1.4.0",
|
||||
"bumpp": "^10.3.1",
|
||||
"eslint": "^9.39.0",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-import-resolver-typescript": "^4.4.4",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-jsdoc": "^61.1.11",
|
||||
"eslint-plugin-jsonc": "^2.21.0",
|
||||
"eslint-plugin-markdown-preferences": "^0.36.2",
|
||||
"eslint-plugin-module-interop": "^0.3.1",
|
||||
"eslint-plugin-promise": "^7.2.1",
|
||||
"eslint-plugin-regexp": "^2.10.0",
|
||||
"eslint-plugin-unicorn": "^62.0.0",
|
||||
"eslint-plugin-unused-imports": "^4.3.0",
|
||||
"eslint-plugin-yml": "^1.19.0",
|
||||
"gh-changelogen": "^0.2.8",
|
||||
"h3": "^1.15.4",
|
||||
"knip": "^5.66.4",
|
||||
"lint-staged": "^16.2.6",
|
||||
"prettier": "^3.6.2",
|
||||
"supertest": "^7.1.4",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.46.2",
|
||||
"unbuild": "^3.6.1",
|
||||
"vitest": "^4.0.6"
|
||||
},
|
||||
"prettier": "@kazupon/prettier-config",
|
||||
"lint-staged": {
|
||||
"*.ts?(x)": [
|
||||
"prettier --parser=typescript --write",
|
||||
"eslint --fix"
|
||||
],
|
||||
"*.{js,mjs,cjs}": [
|
||||
"prettier --write",
|
||||
"eslint --fix"
|
||||
],
|
||||
"*.{json,jsonc,json5,md,yml,yaml}": [
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"changelog": "gh-changelogen --repo=intlify/h3",
|
||||
"dev:eslint": "pnpx @eslint/config-inspector --config eslint.config.ts",
|
||||
"fix": "pnpm run --color \"/^fix:/\"",
|
||||
"fix:eslint": "eslint . --fix",
|
||||
"fix:knip": "knip --fix --no-exit-code",
|
||||
"fix:prettier": "prettier . --write --experimental-cli",
|
||||
"lint": "pnpm run --color \"/^lint:/\"",
|
||||
"lint:eslint": "eslint . --cache",
|
||||
"lint:knip": "knip",
|
||||
"lint:prettier": "prettier . --check --experimental-cli",
|
||||
"lint:typecheck": "tsgo --noEmit --diagnostics",
|
||||
"play:basic": "pnpx tsx ./playground/basic/index.ts",
|
||||
"release": "bumpp --commit \"release: v%s\" --push --tag",
|
||||
"test": "pnpm run test:unit",
|
||||
"test:coverage": "pnpm test --reporter verbose --coverage",
|
||||
"test:unit": "vitest run --typecheck"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user