intor 2.3.21 → 2.3.23

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.
@@ -7,8 +7,8 @@ export { clearLoggerPool } from '../src/core/logger/global-logger-pool.js';
7
7
  export { isValidMessages } from '../src/core/messages/utils/is-valid-messages.js';
8
8
  export { clearMessagesPool } from '../src/core/messages/global-messages-pool.js';
9
9
  export { mergeMessages } from '../src/core/messages/merge-messages.js';
10
+ export { INTOR_MESSAGES_KIND, INTOR_MESSAGES_KIND_KEY, getMessagesKind } from '../src/core/messages/internal-metadata.js';
10
11
  export { defineIntorConfig } from '../src/config/define-intor-config.js';
11
12
  import '../src/config/constants/cookie.js';
12
- export { INTOR_CONFIG_SYMBOL } from '../src/config/symbol.js';
13
13
  export { localizePathname } from '../src/routing/pathname/localize-pathname.js';
14
14
  export { Translator, tokenize } from 'intor-translator';
@@ -1,7 +1,6 @@
1
1
  import { resolveCookieOptions } from './resolvers/resolve-cookie-options.js';
2
2
  import { resolveFallbackLocales } from './resolvers/resolve-fallback-locales.js';
3
3
  import { resolveRoutingOptions } from './resolvers/resolve-routing-options.js';
4
- import { INTOR_CONFIG_SYMBOL } from './symbol.js';
5
4
  import { validateDefaultLocale } from './validators/validate-default-locale.js';
6
5
  import { validateId } from './validators/validate-id.js';
7
6
  import { validateSupportedLocales } from './validators/validate-supported-locales.js';
@@ -43,7 +42,6 @@ const defineIntorConfig = (config) => {
43
42
  logger: { id, ...config.logger },
44
43
  client: config.client,
45
44
  server: config.server,
46
- [INTOR_CONFIG_SYMBOL]: true,
47
45
  };
48
46
  };
49
47
 
@@ -0,0 +1,16 @@
1
+ const INTOR_INTERNAL_PREFIX = "__intor_";
2
+ const INTOR_MESSAGES_KIND_KEY = `${INTOR_INTERNAL_PREFIX}kind`;
3
+ const INTOR_MESSAGES_KIND = {
4
+ markdown: "markdown",
5
+ };
6
+ /**
7
+ * Read the Intor internal kind from a message container.
8
+ */
9
+ function getMessagesKind(value) {
10
+ if (!value || typeof value !== "object")
11
+ return;
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ return value[INTOR_MESSAGES_KIND_KEY];
14
+ }
15
+
16
+ export { INTOR_MESSAGES_KIND, INTOR_MESSAGES_KIND_KEY, getMessagesKind };
@@ -1,4 +1,4 @@
1
- export { PREFIX_PLACEHOLDER, IntorError, IntorErrorCode, deepMerge, type DeepMergeOverrideEvent, resolveLoaderOptions, clearLoggerPool, clearMessagesPool, mergeMessages, isValidMessages, type MessagesReader, type MessagesReaders, } from "../src/core";
2
- export { defineIntorConfig, type IntorRawConfig, type IntorResolvedConfig, INTOR_CONFIG_SYMBOL, } from "../src/config";
1
+ export { PREFIX_PLACEHOLDER, IntorError, IntorErrorCode, deepMerge, type DeepMergeOverrideEvent, resolveLoaderOptions, clearLoggerPool, clearMessagesPool, mergeMessages, isValidMessages, type MessagesReader, type MessagesReaders, INTOR_MESSAGES_KIND_KEY, INTOR_MESSAGES_KIND, getMessagesKind, type IntorMessagesKind, } from "../src/core";
2
+ export { defineIntorConfig, type IntorRawConfig, type IntorResolvedConfig, } from "../src/config";
3
3
  export { localizePathname } from "../src/routing";
4
4
  export { Translator, type TranslatorPlugin, type TranslateContext, type TranslateHook, type TranslateHandlers, type HandlerContext, type FormatHandler, type LoadingHandler, type MissingHandler, type LocaleMessages, type MessageObject, type MessageValue, tokenize, type Token, } from "intor-translator";
@@ -1,4 +1,4 @@
1
- import type { IntorRawConfig, IntorResolvedConfig } from ".";
1
+ import type { IntorRawConfig, IntorResolvedConfig } from "../config";
2
2
  /**
3
3
  * Defines the canonical Intor configuration.
4
4
  *
@@ -1,4 +1,3 @@
1
1
  export { defineIntorConfig } from "./define-intor-config";
2
2
  export { DEFAULT_ROUTING_OPTIONS, DEFAULT_COOKIE_OPTIONS } from "./constants";
3
3
  export type { IntorRawConfig, IntorResolvedConfig, LoaderOptions, RemoteHeaders, TranslatorOptions, RoutingResolvedOptions, CookieResolvedOptions, LoggerOptions, } from "./types";
4
- export { INTOR_CONFIG_SYMBOL } from "./symbol";
@@ -2,7 +2,6 @@ import type { CookieRawOptions, CookieResolvedOptions } from "./cookie";
2
2
  import type { ClientLoaderOptions, LoaderOptions, ServerLoaderOptions } from "./loader";
3
3
  import type { LoggerOptions } from "./logger";
4
4
  import type { RoutingRawOptions, RoutingResolvedOptions } from "./routing";
5
- import type { INTOR_CONFIG_SYMBOL } from "../symbol";
6
5
  import type { TranslatorOptions } from "./translator";
7
6
  import type { FallbackLocalesMap, Locale, LocaleMessages } from "intor-translator";
8
7
  /** Raw configuration object used to define Intor behavior. */
@@ -54,6 +53,4 @@ export type IntorResolvedConfig = {
54
53
  loader?: ClientLoaderOptions;
55
54
  };
56
55
  readonly logger: LoggerOptions;
57
- /** Internal identity marker. */
58
- [INTOR_CONFIG_SYMBOL]?: true;
59
56
  };
@@ -2,5 +2,5 @@ export { PREFIX_PLACEHOLDER, INTOR_HEADERS } from "./constants";
2
2
  export { IntorError, IntorErrorCode } from "./error";
3
3
  export { deepMerge, type PlainObject, type DeepMergeOverrideEvent, resolveLoaderOptions, normalizePathname, normalizeCacheKey, normalizeLocale, normalizeQuery, } from "./utils";
4
4
  export { getLogger, clearLoggerPool } from "./logger";
5
- export { loadRemoteMessages, type MessagesPool, getGlobalMessagesPool, clearMessagesPool, mergeMessages, isValidMessages, type MessagesReader, type MessagesReaders, } from "./messages";
5
+ export { loadRemoteMessages, type MessagesPool, getGlobalMessagesPool, clearMessagesPool, mergeMessages, isValidMessages, type MessagesReader, type MessagesReaders, INTOR_MESSAGES_KIND_KEY, INTOR_MESSAGES_KIND, getMessagesKind, type IntorMessagesKind, } from "./messages";
6
6
  export type { INTOR_GENERATED_KEY, IfGen, GenConfigKeys, GenConfig, GenMessages, GenLocale, GenReplacements, GenRich, TranslatorInstance, RoutingLocaleSource, RoutingLocaleCarrier, LocalePathPrefix, } from "./types";
@@ -3,3 +3,4 @@ export { type MessagesPool, getGlobalMessagesPool, clearMessagesPool, } from "./
3
3
  export { mergeMessages } from "./merge-messages";
4
4
  export { isValidMessages } from "./utils/is-valid-messages";
5
5
  export type { MessagesReader, MessagesReaders } from "./types";
6
+ export { INTOR_MESSAGES_KIND_KEY, INTOR_MESSAGES_KIND, getMessagesKind, type IntorMessagesKind, } from "./internal-metadata";
@@ -0,0 +1,9 @@
1
+ export declare const INTOR_MESSAGES_KIND_KEY = "__intor_kind";
2
+ export declare const INTOR_MESSAGES_KIND: {
3
+ readonly markdown: "markdown";
4
+ };
5
+ export type IntorMessagesKind = (typeof INTOR_MESSAGES_KIND)[keyof typeof INTOR_MESSAGES_KIND];
6
+ /**
7
+ * Read the Intor internal kind from a message container.
8
+ */
9
+ export declare function getMessagesKind(value: unknown): IntorMessagesKind | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intor",
3
- "version": "2.3.21",
3
+ "version": "2.3.23",
4
4
  "description": "The i18n library for modern JavaScript",
5
5
  "author": "Yiming Liao",
6
6
  "homepage": "https://github.com/yiming-liao/intor#readme",
@@ -1,3 +0,0 @@
1
- const INTOR_CONFIG_SYMBOL = Symbol.for("intor.config");
2
-
3
- export { INTOR_CONFIG_SYMBOL };
@@ -1 +0,0 @@
1
- export declare const INTOR_CONFIG_SYMBOL: unique symbol;