Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-i18n-routing

Package Overview
Dependencies
Maintainers
1
Versions
239
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-i18n-routing - npm Package Compare versions

Comparing version 0.3.0-3fd9ab5 to 0.3.0-f1d8567

36

dist/vue-i18n-routing.d.ts

@@ -108,2 +108,4 @@ import type { Composer } from '@intlify/vue-i18n-bridge';

export declare const DefaultPrefixable: typeof prefixable;
/**

@@ -224,3 +226,3 @@ * Direction

*/
export declare type I18nRoutingGlobalOptions<BaseUrl extends BaseUrlResolveHandler = BaseUrlResolveHandler> = Pick<I18nRoutingOptions<BaseUrl>, 'defaultLocale' | 'defaultDirection' | 'defaultLocaleRouteNameSuffix' | 'trailingSlash' | 'routesNameSeparator' | 'strategy'> & {
export declare type I18nRoutingGlobalOptions<BaseUrl extends BaseUrlResolveHandler = BaseUrlResolveHandler> = Pick<I18nRoutingOptions<BaseUrl>, 'defaultLocale' | 'defaultDirection' | 'defaultLocaleRouteNameSuffix' | 'trailingSlash' | 'routesNameSeparator' | 'strategy' | 'prefixable'> & {
localeCodes?: string[];

@@ -327,2 +329,8 @@ };

routeOptionsResolver?: RouteOptionsResolver;
/**
* Whether to prefix the route path with the locale or not
*
* @defaultValue default prefix judgement hook (see {@link DefaultPrefixable})
*/
prefixable?: Prefixable;
} & RouterOptions;

@@ -414,2 +422,27 @@

/**
* Route path prefix judgment logic in {@link resolveRoute} function
*/
export declare type Prefixable = (optons: PrefixableOptions) => boolean;
declare function prefixable(optons: PrefixableOptions): boolean;
/**
* Route path prefix judgment options used in {@link Prefixable}
*/
export declare interface PrefixableOptions {
/**
* Current locale
*/
currentLocale: Locale;
/**
* Default locale
*/
defaultLocale: Locale;
/**
* Curernt strategy
*/
strategy: Strategies;
}
export declare function proxyVueInstance(target: Function): Function;

@@ -491,2 +524,3 @@

routesNameSeparator?: string;
prefixable?: Prefixable;
}

@@ -493,0 +527,0 @@

26

dist/vue-i18n-routing.iife.js

@@ -443,2 +443,3 @@ var VueI18nRouting = function(exports, vueDemi, VueRouter3, vueI18nBridge) {

routes,
prefixable: prefixable2,
routeOptionsResolver: optionsResolver

@@ -468,3 +469,4 @@ } = asDefaultVueI18nRouterOptions(options);

defaultLocaleRouteNameSuffix,
defaultDirection
defaultDirection,
prefixable: prefixable2
});

@@ -523,3 +525,3 @@ router.beforeEach((to, from, next) => {

function asDefaultVueI18nRouterOptions(options) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
options.version = (_a = options.version) != null ? _a : 4;

@@ -535,2 +537,3 @@ options.defaultLocale = (_b = options.defaultLocale) != null ? _b : DEFAULT_LOCALE;

options.routes = (_j = options.routes) != null ? _j : [];
options.prefixable = (_k = options.prefixable) != null ? _k : DefaultPrefixable;
return options;

@@ -545,3 +548,4 @@ }

trailingSlash = DEFAULT_TRAILING_SLASH,
localeCodes = []
localeCodes = [],
prefixable: prefixable2 = DefaultPrefixable
} = {}) {

@@ -556,6 +560,13 @@ const options = getGlobalOptions(router);

trailingSlash: proxy.trailingSlash || options.trailingSlash || trailingSlash,
localeCodes: proxy.localeCodes || options.localeCodes || localeCodes
localeCodes: proxy.localeCodes || options.localeCodes || localeCodes,
prefixable: proxy.prefixable || options.prefixable || prefixable2
};
}
const RESOLVED_PREFIXED = /* @__PURE__ */ new Set(["prefix_and_default", "prefix_except_default"]);
function prefixable(optons) {
const { currentLocale, defaultLocale, strategy } = optons;
const isDefaultLocale = currentLocale === defaultLocale;
return !(isDefaultLocale && RESOLVED_PREFIXED.has(strategy)) && !(strategy === "no_prefix");
}
const DefaultPrefixable = prefixable;
function getRouteBaseName(givenRoute) {

@@ -587,3 +598,3 @@ const router = this.router;

const _locale = locale || getLocale(i18n);
const { routesNameSeparator, defaultLocale, defaultLocaleRouteNameSuffix, strategy, trailingSlash } = getI18nRoutingOptions(router, this);
const { routesNameSeparator, defaultLocale, defaultLocaleRouteNameSuffix, strategy, trailingSlash, prefixable: prefixable2 } = getI18nRoutingOptions(router, this);
let _route = route;

@@ -622,5 +633,3 @@ if (isString(route)) {

} else {
const isDefaultLocale = _locale === defaultLocale;
const isPrefixed = !(isDefaultLocale && RESOLVED_PREFIXED.has(strategy)) && !(strategy === "no_prefix");
if (isPrefixed) {
if (prefixable2({ currentLocale: _locale, defaultLocale, strategy })) {
localizedRoute.path = `/${_locale}${localizedRoute.path}`;

@@ -1015,2 +1024,3 @@ }

exports.DEFAULT_TRAILING_SLASH = DEFAULT_TRAILING_SLASH;
exports.DefaultPrefixable = DefaultPrefixable;
exports.STRATEGIES = STRATEGIES;

@@ -1017,0 +1027,0 @@ exports.VERSION = VERSION;

@@ -446,2 +446,3 @@ "use strict";

routes,
prefixable: prefixable2,
routeOptionsResolver: optionsResolver

@@ -471,3 +472,4 @@ } = asDefaultVueI18nRouterOptions(options);

defaultLocaleRouteNameSuffix,
defaultDirection
defaultDirection,
prefixable: prefixable2
});

@@ -526,3 +528,3 @@ router.beforeEach((to, from, next) => {

function asDefaultVueI18nRouterOptions(options) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
options.version = (_a = options.version) != null ? _a : 4;

@@ -538,2 +540,3 @@ options.defaultLocale = (_b = options.defaultLocale) != null ? _b : DEFAULT_LOCALE;

options.routes = (_j = options.routes) != null ? _j : [];
options.prefixable = (_k = options.prefixable) != null ? _k : DefaultPrefixable;
return options;

@@ -548,3 +551,4 @@ }

trailingSlash = DEFAULT_TRAILING_SLASH,
localeCodes = []
localeCodes = [],
prefixable: prefixable2 = DefaultPrefixable
} = {}) {

@@ -559,6 +563,13 @@ const options = getGlobalOptions(router);

trailingSlash: proxy.trailingSlash || options.trailingSlash || trailingSlash,
localeCodes: proxy.localeCodes || options.localeCodes || localeCodes
localeCodes: proxy.localeCodes || options.localeCodes || localeCodes,
prefixable: proxy.prefixable || options.prefixable || prefixable2
};
}
const RESOLVED_PREFIXED = /* @__PURE__ */ new Set(["prefix_and_default", "prefix_except_default"]);
function prefixable(optons) {
const { currentLocale, defaultLocale, strategy } = optons;
const isDefaultLocale = currentLocale === defaultLocale;
return !(isDefaultLocale && RESOLVED_PREFIXED.has(strategy)) && !(strategy === "no_prefix");
}
const DefaultPrefixable = prefixable;
function getRouteBaseName(givenRoute) {

@@ -590,3 +601,3 @@ const router = this.router;

const _locale = locale || getLocale(i18n);
const { routesNameSeparator, defaultLocale, defaultLocaleRouteNameSuffix, strategy, trailingSlash } = getI18nRoutingOptions(router, this);
const { routesNameSeparator, defaultLocale, defaultLocaleRouteNameSuffix, strategy, trailingSlash, prefixable: prefixable2 } = getI18nRoutingOptions(router, this);
let _route = route;

@@ -625,5 +636,3 @@ if (isString(route)) {

} else {
const isDefaultLocale = _locale === defaultLocale;
const isPrefixed = !(isDefaultLocale && RESOLVED_PREFIXED.has(strategy)) && !(strategy === "no_prefix");
if (isPrefixed) {
if (prefixable2({ currentLocale: _locale, defaultLocale, strategy })) {
localizedRoute.path = `/${_locale}${localizedRoute.path}`;

@@ -1018,2 +1027,3 @@ }

exports.DEFAULT_TRAILING_SLASH = DEFAULT_TRAILING_SLASH;
exports.DefaultPrefixable = DefaultPrefixable;
exports.STRATEGIES = STRATEGIES;

@@ -1020,0 +1030,0 @@ exports.VERSION = VERSION;

{
"name": "vue-i18n-routing",
"description": "The i18n routing with using vue-i18n",
"version": "0.3.0-3fd9ab5",
"version": "0.3.0-f1d8567",
"dependencies": {

@@ -6,0 +6,0 @@ "@intlify/shared": "next",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc