next-multilingual
Advanced tools
Comparing version 0.3.1 to 0.3.2
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -36,6 +45,2 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
class MultilingualRoute { | ||
/** A unique multilingual route identifier. */ | ||
identifier; | ||
/** An array of localized URL path objects. */ | ||
localizedUrlPaths = []; | ||
/** | ||
@@ -47,2 +52,4 @@ * A unique route entry, including its localized URL paths. | ||
constructor(identifier) { | ||
/** An array of localized URL path objects. */ | ||
this.localizedUrlPaths = []; | ||
this.identifier = identifier; | ||
@@ -64,18 +71,2 @@ } | ||
class MulConfig { | ||
/** The unique application identifier that will be used as a messages key prefix. */ | ||
applicationIdentifier; | ||
/** The actual desired locales of the multilingual application. */ | ||
actualLocales; | ||
/** The locales used by the Next.js configuration. */ | ||
locales; | ||
/** The default locale used by the Next.js configuration. */ | ||
defaultLocale; | ||
/** The directory path where the Next.js pages can be found. */ | ||
pagesDirectoryPath; | ||
/** The file extensions of the Next.js pages. */ | ||
pagesExtensions; | ||
/** The files to exclude within the pages directory path. */ | ||
excludedPages; | ||
/** The Next.js application's multilingual routes. */ | ||
routes; | ||
/** | ||
@@ -115,3 +106,3 @@ * A multilingual configuration handler. | ||
this.pagesDirectoryPath = (0, path_1.resolve)(pagesDirectoryPath); | ||
if (pagesExtensions?.length) { | ||
if (pagesExtensions === null || pagesExtensions === void 0 ? void 0 : pagesExtensions.length) { | ||
this.pagesExtensions = pagesExtensions.map((extension) => extension.startsWith('.') ? extension : `.${extension}`); | ||
@@ -419,11 +410,11 @@ } | ||
// Sets localized URLs as rewrites rules. | ||
config.rewrites = async () => { | ||
config.rewrites = () => __awaiter(this, void 0, void 0, function* () { | ||
return mulConfig.getRewrites(); | ||
}; | ||
}); | ||
// Sets redirect rules to normalize URL encoding. | ||
config.redirects = async () => { | ||
config.redirects = () => __awaiter(this, void 0, void 0, function* () { | ||
return mulConfig.getRedirects(); | ||
}; | ||
}); | ||
return config; | ||
} | ||
exports.getMulConfig = getMulConfig; |
"use strict"; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -21,3 +32,4 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
*/ | ||
function MulLink({ children, href, locale, ...props }) { | ||
function MulLink(_a) { | ||
var { children, href, locale } = _a, props = __rest(_a, ["children", "href", "locale"]); | ||
const router = (0, router_1.useRouter)(); | ||
@@ -24,0 +36,0 @@ locale = locale ? locale : router.locale; |
"use strict"; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -27,3 +38,4 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
*/ | ||
function MulLink({ href, locale, ...props }) { | ||
function MulLink(_a) { | ||
var { href, locale } = _a, props = __rest(_a, ["href", "locale"]); | ||
const router = (0, router_1.useRouter)(); | ||
@@ -30,0 +42,0 @@ locale = locale ? locale : router.locale; |
@@ -24,2 +24,3 @@ "use strict"; | ||
}; | ||
var _a, _b; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -36,4 +37,4 @@ exports.getMessages = exports.BabelifiedMessages = void 0; | ||
const isImportSpecifier = BabelTypes.isImportSpecifier; | ||
const isInNextJs = process?.env?.__NEXT_PROCESSED_ENV === 'true'; | ||
const applicationIdentifier = process?.env?.nextMultilingualApplicationIdentifier; | ||
const isInNextJs = ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.__NEXT_PROCESSED_ENV) === 'true'; | ||
const applicationIdentifier = (_b = process === null || process === void 0 ? void 0 : process.env) === null || _b === void 0 ? void 0 : _b.nextMultilingualApplicationIdentifier; | ||
if (isInNextJs && | ||
@@ -51,9 +52,7 @@ (applicationIdentifier === undefined || !_1.keySegmentRegExp.test(applicationIdentifier))) { | ||
class BabelifiedMessages { | ||
/** This property is used to confirm that the messages have been "babelified". */ | ||
babelified = true; | ||
/** The path of the source file that is invoking `useMessages`. */ | ||
sourceFilePath; | ||
/** A collection of "key/value" objects for for all locales. */ | ||
keyValueObjectCollection = {}; | ||
constructor(sourceFilePath) { | ||
/** This property is used to confirm that the messages have been "babelified". */ | ||
this.babelified = true; | ||
/** A collection of "key/value" objects for for all locales. */ | ||
this.keyValueObjectCollection = {}; | ||
this.sourceFilePath = sourceFilePath; | ||
@@ -190,10 +189,2 @@ } | ||
class Messages { | ||
/** The program node path associated with the class. */ | ||
programNodePath; | ||
/** The source file path associated with the class. */ | ||
sourceFilePath; | ||
/** The number of time the `getVariableName` was called. */ | ||
getVariableNameCount = 0; | ||
/** The unique variable name used relative to the program node path. */ | ||
variableName; | ||
/** | ||
@@ -206,2 +197,4 @@ * Object used to inject "babelified" messages. | ||
constructor(programNodePath, pluginPass) { | ||
/** The number of time the `getVariableName` was called. */ | ||
this.getVariableNameCount = 0; | ||
this.programNodePath = programNodePath; | ||
@@ -208,0 +201,0 @@ this.sourceFilePath = pluginPass.file.opts.filename; |
@@ -46,10 +46,2 @@ "use strict"; | ||
class Message { | ||
/** The parent messages object. */ | ||
parent; | ||
/** The message key. */ | ||
key; | ||
/** The localized message. */ | ||
message; | ||
/** The IntlMessageFormat objet, if required. */ | ||
intlMessageFormat; | ||
/** | ||
@@ -90,10 +82,2 @@ * Create an object used to format localized messages of a local scope. | ||
class Messages { | ||
/** Localized messages of a local scope. */ | ||
messages = []; | ||
/** The current locale from Next.js. */ | ||
locale; | ||
/** The source (the file calling `useMessages`) file path. */ | ||
sourceFilePath; | ||
/** The messages file path. */ | ||
messagesFilePath; | ||
/** | ||
@@ -108,2 +92,4 @@ * Create an object used to format localized messages of a local scope. | ||
constructor(keyValueObject, locale, sourceFilePath, messagesFilePath) { | ||
/** Localized messages of a local scope. */ | ||
this.messages = []; | ||
if (keyValueObject) { | ||
@@ -110,0 +96,0 @@ Object.keys(keyValueObject).forEach((key) => { |
{ | ||
"name": "next-multilingual", | ||
"description": "An opinionated end-to-end multilingual solution for Next.js.", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
131368
2081