Add internationalization support with astro-i18next integration

- Implemented astro-i18next for multi-language support, including English, Dutch, and Italian.
- Configured default locale and language fallback settings.
- Defined routes for localized content in the configuration.
- Updated package.json and package-lock.json to include new dependencies for i18next and related plugins.
This commit is contained in:
becarta
2025-05-23 15:10:00 +02:00
parent 8a3507dce0
commit 3168826fa8
581 changed files with 88691 additions and 494 deletions

23
node_modules/pathe/dist/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,23 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const index = require('./shared/pathe.1f0a373c.cjs');
exports.basename = index.basename;
exports.default = index.path;
exports.delimiter = index.delimiter;
exports.dirname = index.dirname;
exports.extname = index.extname;
exports.format = index.format;
exports.isAbsolute = index.isAbsolute;
exports.join = index.join;
exports.normalize = index.normalize;
exports.normalizeString = index.normalizeString;
exports.parse = index.parse;
exports.relative = index.relative;
exports.resolve = index.resolve;
exports.sep = index.sep;
exports.toNamespacedPath = index.toNamespacedPath;

36
node_modules/pathe/dist/index.d.cts generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import path$1 from 'node:path';
declare const sep = "/";
declare const delimiter = ":";
declare const normalize: typeof path$1.normalize;
declare const join: typeof path$1.join;
declare const resolve: typeof path$1.resolve;
declare function normalizeString(path: string, allowAboveRoot: boolean): string;
declare const isAbsolute: typeof path$1.isAbsolute;
declare const toNamespacedPath: typeof path$1.toNamespacedPath;
declare const extname: typeof path$1.extname;
declare const relative: typeof path$1.relative;
declare const dirname: typeof path$1.dirname;
declare const format: typeof path$1.format;
declare const basename: typeof path$1.basename;
declare const parse: typeof path$1.parse;
declare const path_basename: typeof basename;
declare const path_delimiter: typeof delimiter;
declare const path_dirname: typeof dirname;
declare const path_extname: typeof extname;
declare const path_format: typeof format;
declare const path_isAbsolute: typeof isAbsolute;
declare const path_join: typeof join;
declare const path_normalize: typeof normalize;
declare const path_normalizeString: typeof normalizeString;
declare const path_parse: typeof parse;
declare const path_relative: typeof relative;
declare const path_resolve: typeof resolve;
declare const path_sep: typeof sep;
declare const path_toNamespacedPath: typeof toNamespacedPath;
declare namespace path {
export { path_basename as basename, path_delimiter as delimiter, path_dirname as dirname, path_extname as extname, path_format as format, path_isAbsolute as isAbsolute, path_join as join, path_normalize as normalize, path_normalizeString as normalizeString, path_parse as parse, path_relative as relative, path_resolve as resolve, path_sep as sep, path_toNamespacedPath as toNamespacedPath };
}
export { basename, path as default, delimiter, dirname, extname, format, isAbsolute, join, normalize, normalizeString, parse, relative, resolve, sep, toNamespacedPath };

36
node_modules/pathe/dist/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import path$1 from 'node:path';
declare const sep = "/";
declare const delimiter = ":";
declare const normalize: typeof path$1.normalize;
declare const join: typeof path$1.join;
declare const resolve: typeof path$1.resolve;
declare function normalizeString(path: string, allowAboveRoot: boolean): string;
declare const isAbsolute: typeof path$1.isAbsolute;
declare const toNamespacedPath: typeof path$1.toNamespacedPath;
declare const extname: typeof path$1.extname;
declare const relative: typeof path$1.relative;
declare const dirname: typeof path$1.dirname;
declare const format: typeof path$1.format;
declare const basename: typeof path$1.basename;
declare const parse: typeof path$1.parse;
declare const path_basename: typeof basename;
declare const path_delimiter: typeof delimiter;
declare const path_dirname: typeof dirname;
declare const path_extname: typeof extname;
declare const path_format: typeof format;
declare const path_isAbsolute: typeof isAbsolute;
declare const path_join: typeof join;
declare const path_normalize: typeof normalize;
declare const path_normalizeString: typeof normalizeString;
declare const path_parse: typeof parse;
declare const path_relative: typeof relative;
declare const path_resolve: typeof resolve;
declare const path_sep: typeof sep;
declare const path_toNamespacedPath: typeof toNamespacedPath;
declare namespace path {
export { path_basename as basename, path_delimiter as delimiter, path_dirname as dirname, path_extname as extname, path_format as format, path_isAbsolute as isAbsolute, path_join as join, path_normalize as normalize, path_normalizeString as normalizeString, path_parse as parse, path_relative as relative, path_resolve as resolve, path_sep as sep, path_toNamespacedPath as toNamespacedPath };
}
export { basename, path as default, delimiter, dirname, extname, format, isAbsolute, join, normalize, normalizeString, parse, relative, resolve, sep, toNamespacedPath };

36
node_modules/pathe/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,36 @@
import path$1 from 'node:path';
declare const sep = "/";
declare const delimiter = ":";
declare const normalize: typeof path$1.normalize;
declare const join: typeof path$1.join;
declare const resolve: typeof path$1.resolve;
declare function normalizeString(path: string, allowAboveRoot: boolean): string;
declare const isAbsolute: typeof path$1.isAbsolute;
declare const toNamespacedPath: typeof path$1.toNamespacedPath;
declare const extname: typeof path$1.extname;
declare const relative: typeof path$1.relative;
declare const dirname: typeof path$1.dirname;
declare const format: typeof path$1.format;
declare const basename: typeof path$1.basename;
declare const parse: typeof path$1.parse;
declare const path_basename: typeof basename;
declare const path_delimiter: typeof delimiter;
declare const path_dirname: typeof dirname;
declare const path_extname: typeof extname;
declare const path_format: typeof format;
declare const path_isAbsolute: typeof isAbsolute;
declare const path_join: typeof join;
declare const path_normalize: typeof normalize;
declare const path_normalizeString: typeof normalizeString;
declare const path_parse: typeof parse;
declare const path_relative: typeof relative;
declare const path_resolve: typeof resolve;
declare const path_sep: typeof sep;
declare const path_toNamespacedPath: typeof toNamespacedPath;
declare namespace path {
export { path_basename as basename, path_delimiter as delimiter, path_dirname as dirname, path_extname as extname, path_format as format, path_isAbsolute as isAbsolute, path_join as join, path_normalize as normalize, path_normalizeString as normalizeString, path_parse as parse, path_relative as relative, path_resolve as resolve, path_sep as sep, path_toNamespacedPath as toNamespacedPath };
}
export { basename, path as default, delimiter, dirname, extname, format, isAbsolute, join, normalize, normalizeString, parse, relative, resolve, sep, toNamespacedPath };

1
node_modules/pathe/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1 @@
export { h as basename, p as default, d as delimiter, f as dirname, e as extname, g as format, i as isAbsolute, j as join, a as normalize, b as normalizeString, k as parse, c as relative, r as resolve, s as sep, t as toNamespacedPath } from './shared/pathe.ff20891b.mjs';

238
node_modules/pathe/dist/shared/pathe.1f0a373c.cjs generated vendored Normal file
View File

@@ -0,0 +1,238 @@
'use strict';
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
function normalizeWindowsPath(input = "") {
if (!input) {
return input;
}
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
}
const _UNC_REGEX = /^[/\\]{2}/;
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
const sep = "/";
const delimiter = ":";
const normalize = function(path) {
if (path.length === 0) {
return ".";
}
path = normalizeWindowsPath(path);
const isUNCPath = path.match(_UNC_REGEX);
const isPathAbsolute = isAbsolute(path);
const trailingSeparator = path[path.length - 1] === "/";
path = normalizeString(path, !isPathAbsolute);
if (path.length === 0) {
if (isPathAbsolute) {
return "/";
}
return trailingSeparator ? "./" : ".";
}
if (trailingSeparator) {
path += "/";
}
if (_DRIVE_LETTER_RE.test(path)) {
path += "/";
}
if (isUNCPath) {
if (!isPathAbsolute) {
return `//./${path}`;
}
return `//${path}`;
}
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
};
const join = function(...arguments_) {
if (arguments_.length === 0) {
return ".";
}
let joined;
for (const argument of arguments_) {
if (argument && argument.length > 0) {
if (joined === void 0) {
joined = argument;
} else {
joined += `/${argument}`;
}
}
}
if (joined === void 0) {
return ".";
}
return normalize(joined.replace(/\/\/+/g, "/"));
};
function cwd() {
if (typeof process !== "undefined" && typeof process.cwd === "function") {
return process.cwd().replace(/\\/g, "/");
}
return "/";
}
const resolve = function(...arguments_) {
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
let resolvedPath = "";
let resolvedAbsolute = false;
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
const path = index >= 0 ? arguments_[index] : cwd();
if (!path || path.length === 0) {
continue;
}
resolvedPath = `${path}/${resolvedPath}`;
resolvedAbsolute = isAbsolute(path);
}
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
return `/${resolvedPath}`;
}
return resolvedPath.length > 0 ? resolvedPath : ".";
};
function normalizeString(path, allowAboveRoot) {
let res = "";
let lastSegmentLength = 0;
let lastSlash = -1;
let dots = 0;
let char = null;
for (let index = 0; index <= path.length; ++index) {
if (index < path.length) {
char = path[index];
} else if (char === "/") {
break;
} else {
char = "/";
}
if (char === "/") {
if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
if (res.length > 2) {
const lastSlashIndex = res.lastIndexOf("/");
if (lastSlashIndex === -1) {
res = "";
lastSegmentLength = 0;
} else {
res = res.slice(0, lastSlashIndex);
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
}
lastSlash = index;
dots = 0;
continue;
} else if (res.length > 0) {
res = "";
lastSegmentLength = 0;
lastSlash = index;
dots = 0;
continue;
}
}
if (allowAboveRoot) {
res += res.length > 0 ? "/.." : "..";
lastSegmentLength = 2;
}
} else {
if (res.length > 0) {
res += `/${path.slice(lastSlash + 1, index)}`;
} else {
res = path.slice(lastSlash + 1, index);
}
lastSegmentLength = index - lastSlash - 1;
}
lastSlash = index;
dots = 0;
} else if (char === "." && dots !== -1) {
++dots;
} else {
dots = -1;
}
}
return res;
}
const isAbsolute = function(p) {
return _IS_ABSOLUTE_RE.test(p);
};
const toNamespacedPath = function(p) {
return normalizeWindowsPath(p);
};
const _EXTNAME_RE = /.(\.[^./]+)$/;
const extname = function(p) {
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
return match && match[1] || "";
};
const relative = function(from, to) {
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
return _to.join("/");
}
const _fromCopy = [..._from];
for (const segment of _fromCopy) {
if (_to[0] !== segment) {
break;
}
_from.shift();
_to.shift();
}
return [..._from.map(() => ".."), ..._to].join("/");
};
const dirname = function(p) {
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
segments[0] += "/";
}
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
};
const format = function(p) {
const segments = [p.root, p.dir, p.base ?? p.name + p.ext].filter(Boolean);
return normalizeWindowsPath(
p.root ? resolve(...segments) : segments.join("/")
);
};
const basename = function(p, extension) {
const lastSegment = normalizeWindowsPath(p).split("/").pop();
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
};
const parse = function(p) {
const root = normalizeWindowsPath(p).split("/").shift() || "/";
const base = basename(p);
const extension = extname(base);
return {
root,
dir: dirname(p),
base,
ext: extension,
name: base.slice(0, base.length - extension.length)
};
};
const path = {
__proto__: null,
basename: basename,
delimiter: delimiter,
dirname: dirname,
extname: extname,
format: format,
isAbsolute: isAbsolute,
join: join,
normalize: normalize,
normalizeString: normalizeString,
parse: parse,
relative: relative,
resolve: resolve,
sep: sep,
toNamespacedPath: toNamespacedPath
};
exports.basename = basename;
exports.delimiter = delimiter;
exports.dirname = dirname;
exports.extname = extname;
exports.format = format;
exports.isAbsolute = isAbsolute;
exports.join = join;
exports.normalize = normalize;
exports.normalizeString = normalizeString;
exports.normalizeWindowsPath = normalizeWindowsPath;
exports.parse = parse;
exports.path = path;
exports.relative = relative;
exports.resolve = resolve;
exports.sep = sep;
exports.toNamespacedPath = toNamespacedPath;

221
node_modules/pathe/dist/shared/pathe.ff20891b.mjs generated vendored Normal file
View File

@@ -0,0 +1,221 @@
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
function normalizeWindowsPath(input = "") {
if (!input) {
return input;
}
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
}
const _UNC_REGEX = /^[/\\]{2}/;
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
const sep = "/";
const delimiter = ":";
const normalize = function(path) {
if (path.length === 0) {
return ".";
}
path = normalizeWindowsPath(path);
const isUNCPath = path.match(_UNC_REGEX);
const isPathAbsolute = isAbsolute(path);
const trailingSeparator = path[path.length - 1] === "/";
path = normalizeString(path, !isPathAbsolute);
if (path.length === 0) {
if (isPathAbsolute) {
return "/";
}
return trailingSeparator ? "./" : ".";
}
if (trailingSeparator) {
path += "/";
}
if (_DRIVE_LETTER_RE.test(path)) {
path += "/";
}
if (isUNCPath) {
if (!isPathAbsolute) {
return `//./${path}`;
}
return `//${path}`;
}
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
};
const join = function(...arguments_) {
if (arguments_.length === 0) {
return ".";
}
let joined;
for (const argument of arguments_) {
if (argument && argument.length > 0) {
if (joined === void 0) {
joined = argument;
} else {
joined += `/${argument}`;
}
}
}
if (joined === void 0) {
return ".";
}
return normalize(joined.replace(/\/\/+/g, "/"));
};
function cwd() {
if (typeof process !== "undefined" && typeof process.cwd === "function") {
return process.cwd().replace(/\\/g, "/");
}
return "/";
}
const resolve = function(...arguments_) {
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
let resolvedPath = "";
let resolvedAbsolute = false;
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
const path = index >= 0 ? arguments_[index] : cwd();
if (!path || path.length === 0) {
continue;
}
resolvedPath = `${path}/${resolvedPath}`;
resolvedAbsolute = isAbsolute(path);
}
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
return `/${resolvedPath}`;
}
return resolvedPath.length > 0 ? resolvedPath : ".";
};
function normalizeString(path, allowAboveRoot) {
let res = "";
let lastSegmentLength = 0;
let lastSlash = -1;
let dots = 0;
let char = null;
for (let index = 0; index <= path.length; ++index) {
if (index < path.length) {
char = path[index];
} else if (char === "/") {
break;
} else {
char = "/";
}
if (char === "/") {
if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
if (res.length > 2) {
const lastSlashIndex = res.lastIndexOf("/");
if (lastSlashIndex === -1) {
res = "";
lastSegmentLength = 0;
} else {
res = res.slice(0, lastSlashIndex);
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
}
lastSlash = index;
dots = 0;
continue;
} else if (res.length > 0) {
res = "";
lastSegmentLength = 0;
lastSlash = index;
dots = 0;
continue;
}
}
if (allowAboveRoot) {
res += res.length > 0 ? "/.." : "..";
lastSegmentLength = 2;
}
} else {
if (res.length > 0) {
res += `/${path.slice(lastSlash + 1, index)}`;
} else {
res = path.slice(lastSlash + 1, index);
}
lastSegmentLength = index - lastSlash - 1;
}
lastSlash = index;
dots = 0;
} else if (char === "." && dots !== -1) {
++dots;
} else {
dots = -1;
}
}
return res;
}
const isAbsolute = function(p) {
return _IS_ABSOLUTE_RE.test(p);
};
const toNamespacedPath = function(p) {
return normalizeWindowsPath(p);
};
const _EXTNAME_RE = /.(\.[^./]+)$/;
const extname = function(p) {
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
return match && match[1] || "";
};
const relative = function(from, to) {
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
return _to.join("/");
}
const _fromCopy = [..._from];
for (const segment of _fromCopy) {
if (_to[0] !== segment) {
break;
}
_from.shift();
_to.shift();
}
return [..._from.map(() => ".."), ..._to].join("/");
};
const dirname = function(p) {
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
segments[0] += "/";
}
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
};
const format = function(p) {
const segments = [p.root, p.dir, p.base ?? p.name + p.ext].filter(Boolean);
return normalizeWindowsPath(
p.root ? resolve(...segments) : segments.join("/")
);
};
const basename = function(p, extension) {
const lastSegment = normalizeWindowsPath(p).split("/").pop();
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
};
const parse = function(p) {
const root = normalizeWindowsPath(p).split("/").shift() || "/";
const base = basename(p);
const extension = extname(base);
return {
root,
dir: dirname(p),
base,
ext: extension,
name: base.slice(0, base.length - extension.length)
};
};
const path = {
__proto__: null,
basename: basename,
delimiter: delimiter,
dirname: dirname,
extname: extname,
format: format,
isAbsolute: isAbsolute,
join: join,
normalize: normalize,
normalizeString: normalizeString,
parse: parse,
relative: relative,
resolve: resolve,
sep: sep,
toNamespacedPath: toNamespacedPath
};
export { normalize as a, normalizeString as b, relative as c, delimiter as d, extname as e, dirname as f, format as g, basename as h, isAbsolute as i, join as j, parse as k, normalizeWindowsPath as n, path as p, resolve as r, sep as s, toNamespacedPath as t };

58
node_modules/pathe/dist/utils.cjs generated vendored Normal file
View File

@@ -0,0 +1,58 @@
'use strict';
const index = require('./shared/pathe.1f0a373c.cjs');
const pathSeparators = /* @__PURE__ */ new Set(["/", "\\", void 0]);
const normalizedAliasSymbol = Symbol.for("pathe:normalizedAlias");
function normalizeAliases(_aliases) {
if (_aliases[normalizedAliasSymbol]) {
return _aliases;
}
const aliases = Object.fromEntries(
Object.entries(_aliases).sort(([a], [b]) => _compareAliases(a, b))
);
for (const key in aliases) {
for (const alias in aliases) {
if (alias === key || key.startsWith(alias)) {
continue;
}
if (aliases[key].startsWith(alias) && pathSeparators.has(aliases[key][alias.length])) {
aliases[key] = aliases[alias] + aliases[key].slice(alias.length);
}
}
}
Object.defineProperty(aliases, normalizedAliasSymbol, {
value: true,
enumerable: false
});
return aliases;
}
function resolveAlias(path, aliases) {
const _path = index.normalizeWindowsPath(path);
aliases = normalizeAliases(aliases);
for (const [alias, to] of Object.entries(aliases)) {
if (!_path.startsWith(alias)) {
continue;
}
const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
if (hasTrailingSlash(_path[_alias.length])) {
return index.join(to, _path.slice(alias.length));
}
}
return _path;
}
const FILENAME_RE = /(^|[/\\])([^/\\]+?)(?=(\.[^.]+)?$)/;
function filename(path) {
return path.match(FILENAME_RE)?.[2];
}
function _compareAliases(a, b) {
return b.split("/").length - a.split("/").length;
}
function hasTrailingSlash(path = "/") {
const lastChar = path[path.length - 1];
return lastChar === "/" || lastChar === "\\";
}
exports.filename = filename;
exports.normalizeAliases = normalizeAliases;
exports.resolveAlias = resolveAlias;

5
node_modules/pathe/dist/utils.d.cts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
declare function normalizeAliases(_aliases: Record<string, string>): Record<string, string>;
declare function resolveAlias(path: string, aliases: Record<string, string>): string;
declare function filename(path: string): string;
export { filename, normalizeAliases, resolveAlias };

5
node_modules/pathe/dist/utils.d.mts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
declare function normalizeAliases(_aliases: Record<string, string>): Record<string, string>;
declare function resolveAlias(path: string, aliases: Record<string, string>): string;
declare function filename(path: string): string;
export { filename, normalizeAliases, resolveAlias };

5
node_modules/pathe/dist/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
declare function normalizeAliases(_aliases: Record<string, string>): Record<string, string>;
declare function resolveAlias(path: string, aliases: Record<string, string>): string;
declare function filename(path: string): string;
export { filename, normalizeAliases, resolveAlias };

54
node_modules/pathe/dist/utils.mjs generated vendored Normal file
View File

@@ -0,0 +1,54 @@
import { n as normalizeWindowsPath, j as join } from './shared/pathe.ff20891b.mjs';
const pathSeparators = /* @__PURE__ */ new Set(["/", "\\", void 0]);
const normalizedAliasSymbol = Symbol.for("pathe:normalizedAlias");
function normalizeAliases(_aliases) {
if (_aliases[normalizedAliasSymbol]) {
return _aliases;
}
const aliases = Object.fromEntries(
Object.entries(_aliases).sort(([a], [b]) => _compareAliases(a, b))
);
for (const key in aliases) {
for (const alias in aliases) {
if (alias === key || key.startsWith(alias)) {
continue;
}
if (aliases[key].startsWith(alias) && pathSeparators.has(aliases[key][alias.length])) {
aliases[key] = aliases[alias] + aliases[key].slice(alias.length);
}
}
}
Object.defineProperty(aliases, normalizedAliasSymbol, {
value: true,
enumerable: false
});
return aliases;
}
function resolveAlias(path, aliases) {
const _path = normalizeWindowsPath(path);
aliases = normalizeAliases(aliases);
for (const [alias, to] of Object.entries(aliases)) {
if (!_path.startsWith(alias)) {
continue;
}
const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
if (hasTrailingSlash(_path[_alias.length])) {
return join(to, _path.slice(alias.length));
}
}
return _path;
}
const FILENAME_RE = /(^|[/\\])([^/\\]+?)(?=(\.[^.]+)?$)/;
function filename(path) {
return path.match(FILENAME_RE)?.[2];
}
function _compareAliases(a, b) {
return b.split("/").length - a.split("/").length;
}
function hasTrailingSlash(path = "/") {
const lastChar = path[path.length - 1];
return lastChar === "/" || lastChar === "\\";
}
export { filename, normalizeAliases, resolveAlias };