@intlayer/config 9.0.0-canary.7 → 9.0.0-canary.8
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.
- package/dist/cjs/configFile/buildConfigurationFields.cjs +1 -1
- package/dist/cjs/defaultValues/compiler.cjs +1 -1
- package/dist/cjs/defaultValues/compiler.cjs.map +1 -1
- package/dist/cjs/envVars/envVars.cjs +1 -1
- package/dist/cjs/envVars/envVars.cjs.map +1 -1
- package/dist/cjs/utils/getDictionarySelectorUsage.cjs +1 -1
- package/dist/cjs/utils/getDictionarySelectorUsage.cjs.map +1 -1
- package/dist/esm/bundle/index.mjs +1 -1
- package/dist/esm/configFile/buildConfigurationFields.mjs +1 -1
- package/dist/esm/defaultValues/compiler.mjs +1 -1
- package/dist/esm/defaultValues/compiler.mjs.map +1 -1
- package/dist/esm/envVars/envVars.mjs +1 -1
- package/dist/esm/envVars/envVars.mjs.map +1 -1
- package/dist/esm/utils/getDictionarySelectorUsage.mjs +1 -1
- package/dist/esm/utils/getDictionarySelectorUsage.mjs.map +1 -1
- package/dist/types/configFile/configurationSchema.d.ts +4 -4
- package/dist/types/defaultValues/compiler.d.ts +1 -1
- package/dist/types/envVars/envVars.d.ts +1 -1
- package/dist/types/utils/getDictionarySelectorUsage.d.ts +1 -1
- package/package.json +2 -2
|
@@ -311,7 +311,7 @@ const buildCompilerFields = (customConfiguration) => ({
|
|
|
311
311
|
/**
|
|
312
312
|
* Indicates if the compiler should be enabled
|
|
313
313
|
*/
|
|
314
|
-
enabled: customConfiguration?.enabled ??
|
|
314
|
+
enabled: customConfiguration?.enabled ?? false,
|
|
315
315
|
/**
|
|
316
316
|
* Prefix for the extracted dictionary keys
|
|
317
317
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
3
|
//#region src/defaultValues/compiler.ts
|
|
4
|
-
const COMPILER_ENABLED =
|
|
4
|
+
const COMPILER_ENABLED = false;
|
|
5
5
|
const COMPILER_DICTIONARY_KEY_PREFIX = "";
|
|
6
6
|
const COMPILER_NO_METADATA = false;
|
|
7
7
|
const COMPILER_SAVE_COMPONENTS = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.cjs","names":[],"sources":["../../../src/defaultValues/compiler.ts"],"sourcesContent":["export const COMPILER_ENABLED =
|
|
1
|
+
{"version":3,"file":"compiler.cjs","names":[],"sources":["../../../src/defaultValues/compiler.ts"],"sourcesContent":["export const COMPILER_ENABLED = false;\n\nexport const COMPILER_DICTIONARY_KEY_PREFIX = '';\n\nexport const COMPILER_NO_METADATA = false;\n\nexport const COMPILER_SAVE_COMPONENTS = false;\n"],"mappings":";;;AAAA,MAAa,mBAAmB;AAEhC,MAAa,iCAAiC;AAE9C,MAAa,uBAAuB;AAEpC,MAAa,2BAA2B"}
|
|
@@ -27,7 +27,7 @@ const formatNodeTypeToEnvVar = (nodeTypes, wrapKey = (key) => key, wrapValue = (
|
|
|
27
27
|
}, {});
|
|
28
28
|
/**
|
|
29
29
|
* Returns the env-var definition disabling the dictionary-selector resolution
|
|
30
|
-
* path (collections, variants
|
|
30
|
+
* path (collections, variants) when no built dictionary declares
|
|
31
31
|
* a qualifier. Set to `"false"` so bundlers can dead-code-eliminate the
|
|
32
32
|
* selector branch in `getIntlayer` / `useIntlayer`.
|
|
33
33
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envVars.cjs","names":[],"sources":["../../../src/envVars/envVars.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\n\n/**\n * Converts a camelCase node-type string to SCREAMING_SNAKE_CASE so that\n * the generated env-var name matches what the plugin source files check.\n *\n * @example\n * toScreamingSnakeCase('reactNode') // 'REACT_NODE'\n * toScreamingSnakeCase('markdown') // 'MARKDOWN'\n */\nconst toScreamingSnakeCase = (str: string): string =>\n str\n .replace(/([A-Z])/g, '_$1')\n .toUpperCase()\n .replace(/^_/, ''); // strip any leading underscore\n\n/**\n * Converts a list of unused NodeType keys into env-var definitions.\n * Set to `\"false\"` so bundlers can eliminate the corresponding plugin code.\n *\n * @example\n * formatNodeTypeToEnvVar(['enumeration'])\n * // { 'INTLAYER_NODE_TYPE_ENUMERATION': '\"false\"' }\n *\n * formatNodeTypeToEnvVar(['reactNode'], (k) => `process.env.${k}`, (v) => `\"${v}\"`)\n * // { 'process.env.INTLAYER_NODE_TYPE_REACT_NODE': '\"false\"' }\n */\nexport const formatNodeTypeToEnvVar = (\n nodeTypes: string[],\n wrapKey = (key: string) => key,\n wrapValue = (value: string) => value\n): Record<string, string> =>\n nodeTypes.reduce(\n (acc, nodeType) => {\n acc[wrapKey(`INTLAYER_NODE_TYPE_${toScreamingSnakeCase(nodeType)}`)] =\n wrapValue('false');\n return acc;\n },\n {} as Record<string, string>\n );\n\n/**\n * Returns the env-var definition disabling the dictionary-selector resolution\n * path (collections, variants
|
|
1
|
+
{"version":3,"file":"envVars.cjs","names":[],"sources":["../../../src/envVars/envVars.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\n\n/**\n * Converts a camelCase node-type string to SCREAMING_SNAKE_CASE so that\n * the generated env-var name matches what the plugin source files check.\n *\n * @example\n * toScreamingSnakeCase('reactNode') // 'REACT_NODE'\n * toScreamingSnakeCase('markdown') // 'MARKDOWN'\n */\nconst toScreamingSnakeCase = (str: string): string =>\n str\n .replace(/([A-Z])/g, '_$1')\n .toUpperCase()\n .replace(/^_/, ''); // strip any leading underscore\n\n/**\n * Converts a list of unused NodeType keys into env-var definitions.\n * Set to `\"false\"` so bundlers can eliminate the corresponding plugin code.\n *\n * @example\n * formatNodeTypeToEnvVar(['enumeration'])\n * // { 'INTLAYER_NODE_TYPE_ENUMERATION': '\"false\"' }\n *\n * formatNodeTypeToEnvVar(['reactNode'], (k) => `process.env.${k}`, (v) => `\"${v}\"`)\n * // { 'process.env.INTLAYER_NODE_TYPE_REACT_NODE': '\"false\"' }\n */\nexport const formatNodeTypeToEnvVar = (\n nodeTypes: string[],\n wrapKey = (key: string) => key,\n wrapValue = (value: string) => value\n): Record<string, string> =>\n nodeTypes.reduce(\n (acc, nodeType) => {\n acc[wrapKey(`INTLAYER_NODE_TYPE_${toScreamingSnakeCase(nodeType)}`)] =\n wrapValue('false');\n return acc;\n },\n {} as Record<string, string>\n );\n\n/**\n * Returns the env-var definition disabling the dictionary-selector resolution\n * path (collections, variants) when no built dictionary declares\n * a qualifier. Set to `\"false\"` so bundlers can dead-code-eliminate the\n * selector branch in `getIntlayer` / `useIntlayer`.\n *\n * Emits nothing when selectors are used, leaving the runtime default in place.\n *\n * @example\n * formatDictionarySelectorEnvVar(false)\n * // { INTLAYER_DICTIONARY_SELECTOR: '\"false\"' }\n *\n * formatDictionarySelectorEnvVar(true)\n * // {}\n *\n * formatDictionarySelectorEnvVar(false, (k) => `process.env.${k}`, (v) => `\"${v}\"`)\n * // { 'process.env.INTLAYER_DICTIONARY_SELECTOR': '\"false\"' }\n */\nexport const formatDictionarySelectorEnvVar = (\n hasDictionarySelector: boolean,\n wrapKey = (key: string) => key,\n wrapValue = (value: string) => value\n): Record<string, string> =>\n hasDictionarySelector\n ? {}\n : { [wrapKey('INTLAYER_DICTIONARY_SELECTOR')]: wrapValue('false') };\n\n/**\n * Returns env-var definitions for the full Intlayer config to be injected at\n * build time. Allows bundlers to dead-code-eliminate unused routing modes,\n * rewrite logic, storage mechanisms, and editor code.\n *\n * @example\n * getConfigEnvVars(config)\n * // { INTLAYER_ROUTING_MODE: '\"prefix-no-default\"', INTLAYER_ROUTING_REWRITE_RULES: '\"false\"', ... }\n *\n * getConfigEnvVars(config, true)\n * // { 'process.env.INTLAYER_ROUTING_MODE': '\"prefix-no-default\"', ... }\n */\nexport const getConfigEnvVars = (\n config: IntlayerConfig,\n wrapKey = (key: string) => key,\n wrapValue = (value: string) => value\n): Record<string, string> => {\n const { routing, editor } = config;\n\n const envVars: Record<string, string> = {\n [wrapKey('INTLAYER_ROUTING_MODE')]: wrapValue(routing.mode),\n };\n\n if (routing.enableProxy === false) {\n envVars[wrapKey('INTLAYER_ROUTING_ENABLE_PROXY')] = wrapValue('false');\n }\n\n if (!routing.rewrite) {\n envVars[wrapKey('INTLAYER_ROUTING_REWRITE_RULES')] = wrapValue('false');\n }\n\n if (!routing.domains || Object.keys(routing.domains).length === 0) {\n envVars[wrapKey('INTLAYER_ROUTING_DOMAINS')] = wrapValue('false');\n }\n\n if (!routing.storage.cookies || routing.storage.cookies.length === 0) {\n envVars[wrapKey('INTLAYER_ROUTING_STORAGE_COOKIES')] = wrapValue('false');\n }\n\n if (\n !routing.storage.localStorage ||\n routing.storage.localStorage.length === 0\n ) {\n envVars[wrapKey('INTLAYER_ROUTING_STORAGE_LOCALSTORAGE')] =\n wrapValue('false');\n }\n\n if (\n !routing.storage.sessionStorage ||\n routing.storage.sessionStorage.length === 0\n ) {\n envVars[wrapKey('INTLAYER_ROUTING_STORAGE_SESSIONSTORAGE')] =\n wrapValue('false');\n }\n\n if (!routing.storage.headers || routing.storage.headers.length === 0) {\n envVars[wrapKey('INTLAYER_ROUTING_STORAGE_HEADERS')] = wrapValue('false');\n }\n\n if (editor?.enabled === false) {\n envVars[wrapKey('INTLAYER_EDITOR_ENABLED')] = wrapValue('false');\n }\n\n return envVars;\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAM,wBAAwB,QAC5B,IACG,QAAQ,YAAY,MAAM,CAC1B,aAAa,CACb,QAAQ,MAAM,GAAG;;;;;;;;;;;;AAatB,MAAa,0BACX,WACA,WAAW,QAAgB,KAC3B,aAAa,UAAkB,UAE/B,UAAU,QACP,KAAK,aAAa;AACjB,KAAI,QAAQ,sBAAsB,qBAAqB,SAAS,GAAG,IACjE,UAAU,QAAQ;AACpB,QAAO;GAET,EAAE,CACH;;;;;;;;;;;;;;;;;;;AAoBH,MAAa,kCACX,uBACA,WAAW,QAAgB,KAC3B,aAAa,UAAkB,UAE/B,wBACI,EAAE,GACF,GAAG,QAAQ,+BAA+B,GAAG,UAAU,QAAQ,EAAE;;;;;;;;;;;;;AAcvE,MAAa,oBACX,QACA,WAAW,QAAgB,KAC3B,aAAa,UAAkB,UACJ;CAC3B,MAAM,EAAE,SAAS,WAAW;CAE5B,MAAM,UAAkC,GACrC,QAAQ,wBAAwB,GAAG,UAAU,QAAQ,KAAK,EAC5D;AAED,KAAI,QAAQ,gBAAgB,MAC1B,SAAQ,QAAQ,gCAAgC,IAAI,UAAU,QAAQ;AAGxE,KAAI,CAAC,QAAQ,QACX,SAAQ,QAAQ,iCAAiC,IAAI,UAAU,QAAQ;AAGzE,KAAI,CAAC,QAAQ,WAAW,OAAO,KAAK,QAAQ,QAAQ,CAAC,WAAW,EAC9D,SAAQ,QAAQ,2BAA2B,IAAI,UAAU,QAAQ;AAGnE,KAAI,CAAC,QAAQ,QAAQ,WAAW,QAAQ,QAAQ,QAAQ,WAAW,EACjE,SAAQ,QAAQ,mCAAmC,IAAI,UAAU,QAAQ;AAG3E,KACE,CAAC,QAAQ,QAAQ,gBACjB,QAAQ,QAAQ,aAAa,WAAW,EAExC,SAAQ,QAAQ,wCAAwC,IACtD,UAAU,QAAQ;AAGtB,KACE,CAAC,QAAQ,QAAQ,kBACjB,QAAQ,QAAQ,eAAe,WAAW,EAE1C,SAAQ,QAAQ,0CAA0C,IACxD,UAAU,QAAQ;AAGtB,KAAI,CAAC,QAAQ,QAAQ,WAAW,QAAQ,QAAQ,QAAQ,WAAW,EACjE,SAAQ,QAAQ,mCAAmC,IAAI,UAAU,QAAQ;AAG3E,KAAI,QAAQ,YAAY,MACtB,SAAQ,QAAQ,0BAA0B,IAAI,UAAU,QAAQ;AAGlE,QAAO"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3
3
|
//#region src/utils/getDictionarySelectorUsage.ts
|
|
4
4
|
/**
|
|
5
5
|
* Detects whether any built dictionary declares qualifier dimensions
|
|
6
|
-
* (collections
|
|
6
|
+
* (collections or variants).
|
|
7
7
|
*
|
|
8
8
|
* The merge step emits a {@link QualifiedDictionaryGroup} — carrying a
|
|
9
9
|
* non-empty `qualifierTypes` array — for every key whose declarations use a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionarySelectorUsage.cjs","names":[],"sources":["../../../src/utils/getDictionarySelectorUsage.ts"],"sourcesContent":["import type {\n Dictionary,\n QualifiedDictionaryGroup,\n} from '@intlayer/types/dictionary';\n\ntype DictionaryOrGroup = Dictionary | QualifiedDictionaryGroup;\n\n/**\n * Detects whether any built dictionary declares qualifier dimensions\n * (collections
|
|
1
|
+
{"version":3,"file":"getDictionarySelectorUsage.cjs","names":[],"sources":["../../../src/utils/getDictionarySelectorUsage.ts"],"sourcesContent":["import type {\n Dictionary,\n QualifiedDictionaryGroup,\n} from '@intlayer/types/dictionary';\n\ntype DictionaryOrGroup = Dictionary | QualifiedDictionaryGroup;\n\n/**\n * Detects whether any built dictionary declares qualifier dimensions\n * (collections or variants).\n *\n * The merge step emits a {@link QualifiedDictionaryGroup} — carrying a\n * non-empty `qualifierTypes` array — for every key whose declarations use a\n * selector. When no group is present, the selector-object resolution path in\n * `getIntlayer` / `useIntlayer` is dead code, and bundlers can eliminate it via\n * the `INTLAYER_DICTIONARY_SELECTOR` env var.\n *\n * @example\n * getHasDictionarySelector(getDictionaries(config));\n * // true → at least one collection / variant / meta dictionary\n * // false → only plain dictionaries (selector logic can be stripped)\n */\nexport const getHasDictionarySelector = (\n dictionaries: Record<string, DictionaryOrGroup> | DictionaryOrGroup[]\n): boolean => {\n const dictionariesArray = Array.isArray(dictionaries)\n ? dictionaries\n : Object.values(dictionaries);\n\n return dictionariesArray.some((dictionary) => {\n const { qualifierTypes } = dictionary as QualifiedDictionaryGroup;\n\n return Array.isArray(qualifierTypes) && qualifierTypes.length > 0;\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,MAAa,4BACX,iBACY;AAKZ,SAJ0B,MAAM,QAAQ,aAAa,GACjD,eACA,OAAO,OAAO,aAAa,EAEN,MAAM,eAAe;EAC5C,MAAM,EAAE,mBAAmB;AAE3B,SAAO,MAAM,QAAQ,eAAe,IAAI,eAAe,SAAS;GAChE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAlias } from "../utils/alias.mjs";
|
|
2
2
|
import { getConfiguration } from "../configFile/getConfiguration.mjs";
|
|
3
|
-
import { BundleLogger } from "./logBundle.mjs";
|
|
4
3
|
import { getConfigEnvVars } from "../envVars/envVars.mjs";
|
|
4
|
+
import { BundleLogger } from "./logBundle.mjs";
|
|
5
5
|
import { isAbsolute, join, resolve } from "node:path";
|
|
6
6
|
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
7
7
|
import packageJSON from "@intlayer/types/package.json" with { type: "json" };
|
|
@@ -310,7 +310,7 @@ const buildCompilerFields = (customConfiguration) => ({
|
|
|
310
310
|
/**
|
|
311
311
|
* Indicates if the compiler should be enabled
|
|
312
312
|
*/
|
|
313
|
-
enabled: customConfiguration?.enabled ??
|
|
313
|
+
enabled: customConfiguration?.enabled ?? false,
|
|
314
314
|
/**
|
|
315
315
|
* Prefix for the extracted dictionary keys
|
|
316
316
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.mjs","names":[],"sources":["../../../src/defaultValues/compiler.ts"],"sourcesContent":["export const COMPILER_ENABLED =
|
|
1
|
+
{"version":3,"file":"compiler.mjs","names":[],"sources":["../../../src/defaultValues/compiler.ts"],"sourcesContent":["export const COMPILER_ENABLED = false;\n\nexport const COMPILER_DICTIONARY_KEY_PREFIX = '';\n\nexport const COMPILER_NO_METADATA = false;\n\nexport const COMPILER_SAVE_COMPONENTS = false;\n"],"mappings":";AAAA,MAAa,mBAAmB;AAEhC,MAAa,iCAAiC;AAE9C,MAAa,uBAAuB;AAEpC,MAAa,2BAA2B"}
|
|
@@ -25,7 +25,7 @@ const formatNodeTypeToEnvVar = (nodeTypes, wrapKey = (key) => key, wrapValue = (
|
|
|
25
25
|
}, {});
|
|
26
26
|
/**
|
|
27
27
|
* Returns the env-var definition disabling the dictionary-selector resolution
|
|
28
|
-
* path (collections, variants
|
|
28
|
+
* path (collections, variants) when no built dictionary declares
|
|
29
29
|
* a qualifier. Set to `"false"` so bundlers can dead-code-eliminate the
|
|
30
30
|
* selector branch in `getIntlayer` / `useIntlayer`.
|
|
31
31
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envVars.mjs","names":[],"sources":["../../../src/envVars/envVars.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\n\n/**\n * Converts a camelCase node-type string to SCREAMING_SNAKE_CASE so that\n * the generated env-var name matches what the plugin source files check.\n *\n * @example\n * toScreamingSnakeCase('reactNode') // 'REACT_NODE'\n * toScreamingSnakeCase('markdown') // 'MARKDOWN'\n */\nconst toScreamingSnakeCase = (str: string): string =>\n str\n .replace(/([A-Z])/g, '_$1')\n .toUpperCase()\n .replace(/^_/, ''); // strip any leading underscore\n\n/**\n * Converts a list of unused NodeType keys into env-var definitions.\n * Set to `\"false\"` so bundlers can eliminate the corresponding plugin code.\n *\n * @example\n * formatNodeTypeToEnvVar(['enumeration'])\n * // { 'INTLAYER_NODE_TYPE_ENUMERATION': '\"false\"' }\n *\n * formatNodeTypeToEnvVar(['reactNode'], (k) => `process.env.${k}`, (v) => `\"${v}\"`)\n * // { 'process.env.INTLAYER_NODE_TYPE_REACT_NODE': '\"false\"' }\n */\nexport const formatNodeTypeToEnvVar = (\n nodeTypes: string[],\n wrapKey = (key: string) => key,\n wrapValue = (value: string) => value\n): Record<string, string> =>\n nodeTypes.reduce(\n (acc, nodeType) => {\n acc[wrapKey(`INTLAYER_NODE_TYPE_${toScreamingSnakeCase(nodeType)}`)] =\n wrapValue('false');\n return acc;\n },\n {} as Record<string, string>\n );\n\n/**\n * Returns the env-var definition disabling the dictionary-selector resolution\n * path (collections, variants
|
|
1
|
+
{"version":3,"file":"envVars.mjs","names":[],"sources":["../../../src/envVars/envVars.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\n\n/**\n * Converts a camelCase node-type string to SCREAMING_SNAKE_CASE so that\n * the generated env-var name matches what the plugin source files check.\n *\n * @example\n * toScreamingSnakeCase('reactNode') // 'REACT_NODE'\n * toScreamingSnakeCase('markdown') // 'MARKDOWN'\n */\nconst toScreamingSnakeCase = (str: string): string =>\n str\n .replace(/([A-Z])/g, '_$1')\n .toUpperCase()\n .replace(/^_/, ''); // strip any leading underscore\n\n/**\n * Converts a list of unused NodeType keys into env-var definitions.\n * Set to `\"false\"` so bundlers can eliminate the corresponding plugin code.\n *\n * @example\n * formatNodeTypeToEnvVar(['enumeration'])\n * // { 'INTLAYER_NODE_TYPE_ENUMERATION': '\"false\"' }\n *\n * formatNodeTypeToEnvVar(['reactNode'], (k) => `process.env.${k}`, (v) => `\"${v}\"`)\n * // { 'process.env.INTLAYER_NODE_TYPE_REACT_NODE': '\"false\"' }\n */\nexport const formatNodeTypeToEnvVar = (\n nodeTypes: string[],\n wrapKey = (key: string) => key,\n wrapValue = (value: string) => value\n): Record<string, string> =>\n nodeTypes.reduce(\n (acc, nodeType) => {\n acc[wrapKey(`INTLAYER_NODE_TYPE_${toScreamingSnakeCase(nodeType)}`)] =\n wrapValue('false');\n return acc;\n },\n {} as Record<string, string>\n );\n\n/**\n * Returns the env-var definition disabling the dictionary-selector resolution\n * path (collections, variants) when no built dictionary declares\n * a qualifier. Set to `\"false\"` so bundlers can dead-code-eliminate the\n * selector branch in `getIntlayer` / `useIntlayer`.\n *\n * Emits nothing when selectors are used, leaving the runtime default in place.\n *\n * @example\n * formatDictionarySelectorEnvVar(false)\n * // { INTLAYER_DICTIONARY_SELECTOR: '\"false\"' }\n *\n * formatDictionarySelectorEnvVar(true)\n * // {}\n *\n * formatDictionarySelectorEnvVar(false, (k) => `process.env.${k}`, (v) => `\"${v}\"`)\n * // { 'process.env.INTLAYER_DICTIONARY_SELECTOR': '\"false\"' }\n */\nexport const formatDictionarySelectorEnvVar = (\n hasDictionarySelector: boolean,\n wrapKey = (key: string) => key,\n wrapValue = (value: string) => value\n): Record<string, string> =>\n hasDictionarySelector\n ? {}\n : { [wrapKey('INTLAYER_DICTIONARY_SELECTOR')]: wrapValue('false') };\n\n/**\n * Returns env-var definitions for the full Intlayer config to be injected at\n * build time. Allows bundlers to dead-code-eliminate unused routing modes,\n * rewrite logic, storage mechanisms, and editor code.\n *\n * @example\n * getConfigEnvVars(config)\n * // { INTLAYER_ROUTING_MODE: '\"prefix-no-default\"', INTLAYER_ROUTING_REWRITE_RULES: '\"false\"', ... }\n *\n * getConfigEnvVars(config, true)\n * // { 'process.env.INTLAYER_ROUTING_MODE': '\"prefix-no-default\"', ... }\n */\nexport const getConfigEnvVars = (\n config: IntlayerConfig,\n wrapKey = (key: string) => key,\n wrapValue = (value: string) => value\n): Record<string, string> => {\n const { routing, editor } = config;\n\n const envVars: Record<string, string> = {\n [wrapKey('INTLAYER_ROUTING_MODE')]: wrapValue(routing.mode),\n };\n\n if (routing.enableProxy === false) {\n envVars[wrapKey('INTLAYER_ROUTING_ENABLE_PROXY')] = wrapValue('false');\n }\n\n if (!routing.rewrite) {\n envVars[wrapKey('INTLAYER_ROUTING_REWRITE_RULES')] = wrapValue('false');\n }\n\n if (!routing.domains || Object.keys(routing.domains).length === 0) {\n envVars[wrapKey('INTLAYER_ROUTING_DOMAINS')] = wrapValue('false');\n }\n\n if (!routing.storage.cookies || routing.storage.cookies.length === 0) {\n envVars[wrapKey('INTLAYER_ROUTING_STORAGE_COOKIES')] = wrapValue('false');\n }\n\n if (\n !routing.storage.localStorage ||\n routing.storage.localStorage.length === 0\n ) {\n envVars[wrapKey('INTLAYER_ROUTING_STORAGE_LOCALSTORAGE')] =\n wrapValue('false');\n }\n\n if (\n !routing.storage.sessionStorage ||\n routing.storage.sessionStorage.length === 0\n ) {\n envVars[wrapKey('INTLAYER_ROUTING_STORAGE_SESSIONSTORAGE')] =\n wrapValue('false');\n }\n\n if (!routing.storage.headers || routing.storage.headers.length === 0) {\n envVars[wrapKey('INTLAYER_ROUTING_STORAGE_HEADERS')] = wrapValue('false');\n }\n\n if (editor?.enabled === false) {\n envVars[wrapKey('INTLAYER_EDITOR_ENABLED')] = wrapValue('false');\n }\n\n return envVars;\n};\n"],"mappings":";;;;;;;;;AAUA,MAAM,wBAAwB,QAC5B,IACG,QAAQ,YAAY,MAAM,CAC1B,aAAa,CACb,QAAQ,MAAM,GAAG;;;;;;;;;;;;AAatB,MAAa,0BACX,WACA,WAAW,QAAgB,KAC3B,aAAa,UAAkB,UAE/B,UAAU,QACP,KAAK,aAAa;AACjB,KAAI,QAAQ,sBAAsB,qBAAqB,SAAS,GAAG,IACjE,UAAU,QAAQ;AACpB,QAAO;GAET,EAAE,CACH;;;;;;;;;;;;;;;;;;;AAoBH,MAAa,kCACX,uBACA,WAAW,QAAgB,KAC3B,aAAa,UAAkB,UAE/B,wBACI,EAAE,GACF,GAAG,QAAQ,+BAA+B,GAAG,UAAU,QAAQ,EAAE;;;;;;;;;;;;;AAcvE,MAAa,oBACX,QACA,WAAW,QAAgB,KAC3B,aAAa,UAAkB,UACJ;CAC3B,MAAM,EAAE,SAAS,WAAW;CAE5B,MAAM,UAAkC,GACrC,QAAQ,wBAAwB,GAAG,UAAU,QAAQ,KAAK,EAC5D;AAED,KAAI,QAAQ,gBAAgB,MAC1B,SAAQ,QAAQ,gCAAgC,IAAI,UAAU,QAAQ;AAGxE,KAAI,CAAC,QAAQ,QACX,SAAQ,QAAQ,iCAAiC,IAAI,UAAU,QAAQ;AAGzE,KAAI,CAAC,QAAQ,WAAW,OAAO,KAAK,QAAQ,QAAQ,CAAC,WAAW,EAC9D,SAAQ,QAAQ,2BAA2B,IAAI,UAAU,QAAQ;AAGnE,KAAI,CAAC,QAAQ,QAAQ,WAAW,QAAQ,QAAQ,QAAQ,WAAW,EACjE,SAAQ,QAAQ,mCAAmC,IAAI,UAAU,QAAQ;AAG3E,KACE,CAAC,QAAQ,QAAQ,gBACjB,QAAQ,QAAQ,aAAa,WAAW,EAExC,SAAQ,QAAQ,wCAAwC,IACtD,UAAU,QAAQ;AAGtB,KACE,CAAC,QAAQ,QAAQ,kBACjB,QAAQ,QAAQ,eAAe,WAAW,EAE1C,SAAQ,QAAQ,0CAA0C,IACxD,UAAU,QAAQ;AAGtB,KAAI,CAAC,QAAQ,QAAQ,WAAW,QAAQ,QAAQ,QAAQ,WAAW,EACjE,SAAQ,QAAQ,mCAAmC,IAAI,UAAU,QAAQ;AAG3E,KAAI,QAAQ,YAAY,MACtB,SAAQ,QAAQ,0BAA0B,IAAI,UAAU,QAAQ;AAGlE,QAAO"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/utils/getDictionarySelectorUsage.ts
|
|
2
2
|
/**
|
|
3
3
|
* Detects whether any built dictionary declares qualifier dimensions
|
|
4
|
-
* (collections
|
|
4
|
+
* (collections or variants).
|
|
5
5
|
*
|
|
6
6
|
* The merge step emits a {@link QualifiedDictionaryGroup} — carrying a
|
|
7
7
|
* non-empty `qualifierTypes` array — for every key whose declarations use a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDictionarySelectorUsage.mjs","names":[],"sources":["../../../src/utils/getDictionarySelectorUsage.ts"],"sourcesContent":["import type {\n Dictionary,\n QualifiedDictionaryGroup,\n} from '@intlayer/types/dictionary';\n\ntype DictionaryOrGroup = Dictionary | QualifiedDictionaryGroup;\n\n/**\n * Detects whether any built dictionary declares qualifier dimensions\n * (collections
|
|
1
|
+
{"version":3,"file":"getDictionarySelectorUsage.mjs","names":[],"sources":["../../../src/utils/getDictionarySelectorUsage.ts"],"sourcesContent":["import type {\n Dictionary,\n QualifiedDictionaryGroup,\n} from '@intlayer/types/dictionary';\n\ntype DictionaryOrGroup = Dictionary | QualifiedDictionaryGroup;\n\n/**\n * Detects whether any built dictionary declares qualifier dimensions\n * (collections or variants).\n *\n * The merge step emits a {@link QualifiedDictionaryGroup} — carrying a\n * non-empty `qualifierTypes` array — for every key whose declarations use a\n * selector. When no group is present, the selector-object resolution path in\n * `getIntlayer` / `useIntlayer` is dead code, and bundlers can eliminate it via\n * the `INTLAYER_DICTIONARY_SELECTOR` env var.\n *\n * @example\n * getHasDictionarySelector(getDictionaries(config));\n * // true → at least one collection / variant / meta dictionary\n * // false → only plain dictionaries (selector logic can be stripped)\n */\nexport const getHasDictionarySelector = (\n dictionaries: Record<string, DictionaryOrGroup> | DictionaryOrGroup[]\n): boolean => {\n const dictionariesArray = Array.isArray(dictionaries)\n ? dictionaries\n : Object.values(dictionaries);\n\n return dictionariesArray.some((dictionary) => {\n const { qualifierTypes } = dictionary as QualifiedDictionaryGroup;\n\n return Array.isArray(qualifierTypes) && qualifierTypes.length > 0;\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,MAAa,4BACX,iBACY;AAKZ,SAJ0B,MAAM,QAAQ,aAAa,GACjD,eACA,OAAO,OAAO,aAAa,EAEN,MAAM,eAAe;EAC5C,MAAM,EAAE,mBAAmB;AAE3B,SAAO,MAAM,QAAQ,eAAe,IAAI,eAAe,SAAS;GAChE"}
|
|
@@ -243,8 +243,8 @@ declare const editorSchema: z.ZodObject<{
|
|
|
243
243
|
}, z.core.$strip>;
|
|
244
244
|
declare const logSchema: z.ZodObject<{
|
|
245
245
|
mode: z.ZodOptional<z.ZodEnum<{
|
|
246
|
-
verbose: "verbose";
|
|
247
246
|
default: "default";
|
|
247
|
+
verbose: "verbose";
|
|
248
248
|
disabled: "disabled";
|
|
249
249
|
}>>;
|
|
250
250
|
prefix: z.ZodOptional<z.ZodString>;
|
|
@@ -278,8 +278,8 @@ declare const buildSchema: z.ZodObject<{
|
|
|
278
278
|
}>>;
|
|
279
279
|
traversePattern: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
280
280
|
outputFormat: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
281
|
-
esm: "esm";
|
|
282
281
|
cjs: "cjs";
|
|
282
|
+
esm: "esm";
|
|
283
283
|
}>>>;
|
|
284
284
|
cache: z.ZodOptional<z.ZodBoolean>;
|
|
285
285
|
require: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -441,8 +441,8 @@ declare const intlayerConfigSchema: z.ZodObject<{
|
|
|
441
441
|
}, z.core.$strip>>;
|
|
442
442
|
log: z.ZodOptional<z.ZodObject<{
|
|
443
443
|
mode: z.ZodOptional<z.ZodEnum<{
|
|
444
|
-
verbose: "verbose";
|
|
445
444
|
default: "default";
|
|
445
|
+
verbose: "verbose";
|
|
446
446
|
disabled: "disabled";
|
|
447
447
|
}>>;
|
|
448
448
|
prefix: z.ZodOptional<z.ZodString>;
|
|
@@ -476,8 +476,8 @@ declare const intlayerConfigSchema: z.ZodObject<{
|
|
|
476
476
|
}>>;
|
|
477
477
|
traversePattern: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
478
478
|
outputFormat: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
479
|
-
esm: "esm";
|
|
480
479
|
cjs: "cjs";
|
|
480
|
+
esm: "esm";
|
|
481
481
|
}>>>;
|
|
482
482
|
cache: z.ZodOptional<z.ZodBoolean>;
|
|
483
483
|
require: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/defaultValues/compiler.d.ts
|
|
2
|
-
declare const COMPILER_ENABLED =
|
|
2
|
+
declare const COMPILER_ENABLED = false;
|
|
3
3
|
declare const COMPILER_DICTIONARY_KEY_PREFIX = "";
|
|
4
4
|
declare const COMPILER_NO_METADATA = false;
|
|
5
5
|
declare const COMPILER_SAVE_COMPONENTS = false;
|
|
@@ -15,7 +15,7 @@ import { IntlayerConfig } from "@intlayer/types/config";
|
|
|
15
15
|
declare const formatNodeTypeToEnvVar: (nodeTypes: string[], wrapKey?: (key: string) => string, wrapValue?: (value: string) => string) => Record<string, string>;
|
|
16
16
|
/**
|
|
17
17
|
* Returns the env-var definition disabling the dictionary-selector resolution
|
|
18
|
-
* path (collections, variants
|
|
18
|
+
* path (collections, variants) when no built dictionary declares
|
|
19
19
|
* a qualifier. Set to `"false"` so bundlers can dead-code-eliminate the
|
|
20
20
|
* selector branch in `getIntlayer` / `useIntlayer`.
|
|
21
21
|
*
|
|
@@ -4,7 +4,7 @@ import { Dictionary, QualifiedDictionaryGroup } from "@intlayer/types/dictionary
|
|
|
4
4
|
type DictionaryOrGroup = Dictionary | QualifiedDictionaryGroup;
|
|
5
5
|
/**
|
|
6
6
|
* Detects whether any built dictionary declares qualifier dimensions
|
|
7
|
-
* (collections
|
|
7
|
+
* (collections or variants).
|
|
8
8
|
*
|
|
9
9
|
* The merge step emits a {@link QualifiedDictionaryGroup} — carrying a
|
|
10
10
|
* non-empty `qualifierTypes` array — for every key whose declarations use a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/config",
|
|
3
|
-
"version": "9.0.0-canary.
|
|
3
|
+
"version": "9.0.0-canary.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Retrieve Intlayer configurations and manage environment variables for both server-side and client-side environments.",
|
|
6
6
|
"keywords": [
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
161
161
|
},
|
|
162
162
|
"dependencies": {
|
|
163
|
-
"@intlayer/types": "9.0.0-canary.
|
|
163
|
+
"@intlayer/types": "9.0.0-canary.8",
|
|
164
164
|
"defu": "6.1.7",
|
|
165
165
|
"dotenv": "17.4.2",
|
|
166
166
|
"esbuild": "0.28.1",
|