@intlayer/config 9.1.3 → 9.3.0

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.
Files changed (43) hide show
  1. package/dist/cjs/bundle/index.cjs +1 -1
  2. package/dist/cjs/configFile/buildBrowserConfiguration.cjs +17 -13
  3. package/dist/cjs/configFile/buildBrowserConfiguration.cjs.map +1 -1
  4. package/dist/cjs/configFile/buildConfigurationFields.cjs +2 -7
  5. package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
  6. package/dist/cjs/configFile/getConfiguration.cjs +2 -10
  7. package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
  8. package/dist/cjs/defaultValues/routing.cjs +7 -1
  9. package/dist/cjs/defaultValues/routing.cjs.map +1 -1
  10. package/dist/cjs/envVars/envVars.cjs +24 -0
  11. package/dist/cjs/envVars/envVars.cjs.map +1 -1
  12. package/dist/cjs/envVars/index.cjs +1 -0
  13. package/dist/cjs/utils/retryManager.cjs +12 -1
  14. package/dist/cjs/utils/retryManager.cjs.map +1 -1
  15. package/dist/esm/bundle/index.mjs +1 -1
  16. package/dist/esm/configFile/buildBrowserConfiguration.mjs +17 -13
  17. package/dist/esm/configFile/buildBrowserConfiguration.mjs.map +1 -1
  18. package/dist/esm/configFile/buildConfigurationFields.mjs +2 -7
  19. package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
  20. package/dist/esm/configFile/getConfiguration.mjs +2 -10
  21. package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
  22. package/dist/esm/defaultValues/routing.mjs +7 -1
  23. package/dist/esm/defaultValues/routing.mjs.map +1 -1
  24. package/dist/esm/envVars/envVars.mjs +24 -1
  25. package/dist/esm/envVars/envVars.mjs.map +1 -1
  26. package/dist/esm/envVars/index.mjs +2 -2
  27. package/dist/esm/utils/retryManager.mjs +12 -1
  28. package/dist/esm/utils/retryManager.mjs.map +1 -1
  29. package/dist/types/configFile/buildBrowserConfiguration.d.ts +8 -9
  30. package/dist/types/configFile/buildBrowserConfiguration.d.ts.map +1 -1
  31. package/dist/types/configFile/buildConfigurationFields.d.ts +1 -6
  32. package/dist/types/configFile/buildConfigurationFields.d.ts.map +1 -1
  33. package/dist/types/configFile/getConfiguration.d.ts.map +1 -1
  34. package/dist/types/defaultValues/routing.d.ts +7 -1
  35. package/dist/types/defaultValues/routing.d.ts.map +1 -1
  36. package/dist/types/envVars/envVars.d.ts +23 -1
  37. package/dist/types/envVars/envVars.d.ts.map +1 -1
  38. package/dist/types/envVars/index.d.ts +2 -2
  39. package/dist/types/loadExternalFile/bundleJSFile.d.ts +1 -0
  40. package/dist/types/loadExternalFile/bundleJSFile.d.ts.map +1 -1
  41. package/dist/types/utils/retryManager.d.ts +7 -1
  42. package/dist/types/utils/retryManager.d.ts.map +1 -1
  43. package/package.json +4 -4
@@ -41,19 +41,18 @@ declare const buildRoutingFields: (customConfiguration?: Partial<CustomRoutingCo
41
41
  * (`clientId`, `clientSecret`). The browser-safe {@link BrowserIntlayerConfig}
42
42
  * omits those fields when exposing config to the client.
43
43
  *
44
- * When the user does not explicitly set `clientId` / `clientSecret` in the
45
- * configuration file, they fall back to the `INTLAYER_CLIENT_ID` /
46
- * `INTLAYER_CLIENT_SECRET` environment variables read from `env`. This lets
47
- * users authenticate purely through their `.env` file (including files passed
48
- * via the CLI `--env-file` flag) without having to wire `process.env` into the
49
- * configuration manually.
44
+ * `clientId` / `clientSecret` are never inferred from the environment: the
45
+ * configuration file is the single source of truth. A project that wants to
46
+ * authenticate from its `.env` file must wire the variables explicitly, e.g.
47
+ * `clientId: process.env.INTLAYER_CLIENT_ID`. Commenting those lines out is
48
+ * therefore enough to disable every credentialed behaviour (remote dictionary
49
+ * fetching, CMS access) even when the variables remain defined in the
50
+ * environment.
50
51
  *
51
52
  * @param customConfiguration - Partial user-supplied editor config.
52
- * @param env - Environment variables used to resolve credential fallbacks.
53
- * Defaults to `process.env`.
54
53
  * @returns A fully-defaulted {@link EditorConfig}.
55
54
  */
56
- declare const buildEditorFields: (customConfiguration?: Partial<EditorConfig>, env?: NodeJS.ProcessEnv) => EditorConfig;
55
+ declare const buildEditorFields: (customConfiguration?: Partial<EditorConfig>) => EditorConfig;
57
56
  /**
58
57
  * Build the analytics section of the Intlayer configuration.
59
58
  *
@@ -1 +1 @@
1
- {"version":3,"file":"buildBrowserConfiguration.d.ts","names":[],"sources":["../../../src/configFile/buildBrowserConfiguration.ts"],"mappings":";;;;;;;;;KAqDY;EACV,sBAAsB,KACpB;EAGF,SAAS;EACT,QAAQ,KAAK;EACb,WAAW;EACX,KAAK,KAAK;;QAGJ;YACI;;IAER,kBAAkB;;;;;;;;;cAiBT,kCAA+B,sBACpB,QAAQ,gCAC7B;;;;;;;cA+CU,qBAAkB,sBACP,QAAQ,yBAC7B;;;;;;;;;;;;;;;;;;;;cAwHU,oBAAiB,sBACN,QAAQ,eAAa,MACtC,OAAO,eACX;;;;;;;;;;;cAuIU,uBAAoB,sBACT,QAAQ,qBAC7B;;;;;;;;cA8BU,iBAAc,sBACH,QAAQ,YAAU,eACzB,iBACd;;;;;;;;;;;;;;;;;;;;;;;cAwDU,4BAAyB,eACrB,yBACd;;;;;;;;;;;;cAiCU,8BAA2B,QAC9B,mBACP"}
1
+ {"version":3,"file":"buildBrowserConfiguration.d.ts","names":[],"sources":["../../../src/configFile/buildBrowserConfiguration.ts"],"mappings":";;;;;;;;;KAqDY;EACV,sBAAsB,KACpB;EAGF,SAAS;EACT,QAAQ,KAAK;EACb,WAAW;EACX,KAAK,KAAK;;QAGJ;YACI;;IAER,kBAAkB;;;;;;;;;cAiBT,kCAA+B,sBACpB,QAAQ,gCAC7B;;;;;;;cA+CU,qBAAkB,sBACP,QAAQ,yBAC7B;;;;;;;;;;;;;;;;;;;cA4HU,oBAAiB,sBACN,QAAQ,kBAC7B;;;;;;;;;;;cAsIU,uBAAoB,sBACT,QAAQ,qBAC7B;;;;;;;;cA8BU,iBAAc,sBACH,QAAQ,YAAU,eACzB,iBACd;;;;;;;;;;;;;;;;;;;;;;;cAwDU,4BAAyB,eACrB,yBACd;;;;;;;;;;;;cAiCU,8BAA2B,QAC9B,mBACP"}
@@ -17,14 +17,9 @@ import { CustomIntlayerConfig, IntlayerConfig, LogFunctions } from "@intlayer/ty
17
17
  * @param customConfiguration - Optional user-supplied configuration object.
18
18
  * @param baseDir - Project root directory. Defaults to `process.cwd()`.
19
19
  * @param logFunctions - Optional custom logging functions.
20
- * @param env - Environment variables used to resolve credential fallbacks
21
- * (e.g. `INTLAYER_CLIENT_ID` / `INTLAYER_CLIENT_SECRET`). Defaults to
22
- * `process.env`. Callers loading a custom env file (such as the CLI
23
- * `--env-file` flag) should pass the merged env so credentials defined there
24
- * are picked up without polluting `process.env`.
25
20
  * @returns A fully-built {@link IntlayerConfig}.
26
21
  */
27
- declare const buildConfigurationFields: (customConfiguration?: CustomIntlayerConfig, baseDir?: string, logFunctions?: LogFunctions, env?: NodeJS.ProcessEnv) => IntlayerConfig;
22
+ declare const buildConfigurationFields: (customConfiguration?: CustomIntlayerConfig, baseDir?: string, logFunctions?: LogFunctions) => IntlayerConfig;
28
23
  //#endregion
29
24
  export { type BrowserIntlayerConfig, buildAnalyticsFields, buildBrowserConfiguration, buildConfigurationFields, buildEditorFields, buildInternationalizationFields, buildLogFields, buildRoutingFields, extractBrowserConfiguration };
30
25
  //# sourceMappingURL=buildConfigurationFields.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildConfigurationFields.d.ts","names":[],"sources":["../../../src/configFile/buildConfigurationFields.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;cAivBa,2BAAwB,sBACb,sBAAoB,kBAC1B,eACD,cAAY,MACtB,OAAO,eACX"}
1
+ {"version":3,"file":"buildConfigurationFields.d.ts","names":[],"sources":["../../../src/configFile/buildConfigurationFields.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;cA4uBa,2BAAwB,sBACb,sBAAoB,kBAC1B,eACD,iBACd"}
@@ -1 +1 @@
1
- {"version":3,"file":"getConfiguration.d.ts","names":[],"sources":["../../../src/configFile/getConfiguration.ts"],"mappings":";;;;KAeY;EACV;EACA,WAAW;EAEX;EACA;EAEA,eAAe;EAEf,UAAU,OAAO;EAEjB;EAEA,eAAe;IACb,KAAK;KAEG;EACV,eAAe;EACf,qBAAqB;EACrB;EACA;;;;;cAMW,8BAA2B,UAC5B,4BACT;;;;cAiHU,mBAAgB,UACjB,4BACT"}
1
+ {"version":3,"file":"getConfiguration.d.ts","names":[],"sources":["../../../src/configFile/getConfiguration.ts"],"mappings":";;;;KAcY;EACV;EACA,WAAW;EAEX;EACA;EAEA,eAAe;EAEf,UAAU,OAAO;EAEjB;EAEA,eAAe;IACb,KAAK;KAEG;EACV,eAAe;EACf,qBAAqB;EACrB;EACA;;;;;cAMW,8BAA2B,UAC5B,4BACT;;;;cAqGU,mBAAgB,UACjB,4BACT"}
@@ -6,7 +6,13 @@ declare const LOCALE_STORAGE_NAME = "INTLAYER_LOCALE";
6
6
  declare const BASE_PATH = "";
7
7
  declare const SERVER_SET_COOKIE = "always";
8
8
  declare const ROUTING_MODE = "prefix-no-default";
9
- declare const ENABLE_PROXY = true;
9
+ /**
10
+ * Left `undefined` on purpose: it selects the proxy's *auto* mode, which keeps
11
+ * locale routing URL-driven on development and preview servers while behaving
12
+ * like `true` in production. `true` and `false` are the explicit opt-in and
13
+ * opt-out. See `resolveProxyMode` in `@intlayer/core/localization`.
14
+ */
15
+ declare const ENABLE_PROXY: boolean | undefined;
10
16
  declare const STORAGE: RoutingStorageInput;
11
17
  //#endregion
12
18
  export { BASE_PATH, COOKIE_NAME, ENABLE_PROXY, HEADER_NAME, LOCALE_STORAGE_NAME, ROUTING_MODE, SERVER_SET_COOKIE, STORAGE };
@@ -1 +1 @@
1
- {"version":3,"file":"routing.d.ts","names":[],"sources":["../../../src/defaultValues/routing.ts"],"mappings":";;cAEa;cAEA;cACA;cAEA;cAEA;cAEA;cAEA;cAEA,SAAS"}
1
+ {"version":3,"file":"routing.d.ts","names":[],"sources":["../../../src/defaultValues/routing.ts"],"mappings":";;cAEa;cAEA;cACA;cAEA;cAEA;cAEA;;;;;;;cAQA;cAEA,SAAS"}
@@ -31,6 +31,28 @@ declare const formatNodeTypeToEnvVar: (nodeTypes: string[], wrapKey?: (key: stri
31
31
  * // { 'process.env.INTLAYER_DICTIONARY_SELECTOR': '"false"' }
32
32
  */
33
33
  declare const formatDictionarySelectorEnvVar: (hasDictionarySelector: boolean, wrapKey?: (key: string) => string, wrapValue?: (value: string) => string) => Record<string, string>;
34
+ /**
35
+ * Returns the env-var definition selecting the local `nest()` resolver, which
36
+ * reads the nest targets the optimizer attached to each dictionary instead of
37
+ * looking them up in the global registry.
38
+ *
39
+ * Emit it only when the optimize transform actually runs, since it is that
40
+ * transform which injects the attachment. Setting it to `"true"` lets bundlers
41
+ * dead-code-eliminate the registry-based resolver, and with it the
42
+ * `@intlayer/dictionaries-entry` import — which is what allows the dictionaries
43
+ * entry to be emptied while nesting keeps working.
44
+ *
45
+ * @example
46
+ * formatOptimizedNestingEnvVar(true)
47
+ * // { INTLAYER_OPTIMIZED_NESTING: '"true"' }
48
+ *
49
+ * formatOptimizedNestingEnvVar(false)
50
+ * // {}
51
+ *
52
+ * formatOptimizedNestingEnvVar(true, (k) => `process.env.${k}`, (v) => `"${v}"`)
53
+ * // { 'process.env.INTLAYER_OPTIMIZED_NESTING': '"true"' }
54
+ */
55
+ declare const formatOptimizedNestingEnvVar: (isOptimized: boolean, wrapKey?: (key: string) => string, wrapValue?: (value: string) => string) => Record<string, string>;
34
56
  /**
35
57
  * Returns env-var definitions for the full Intlayer config to be injected at
36
58
  * build time. Allows bundlers to dead-code-eliminate unused routing modes,
@@ -45,5 +67,5 @@ declare const formatDictionarySelectorEnvVar: (hasDictionarySelector: boolean, w
45
67
  */
46
68
  declare const getConfigEnvVars: (config: IntlayerConfig, wrapKey?: (key: string) => string, wrapValue?: (value: string) => string) => Record<string, string>;
47
69
  //#endregion
48
- export { formatDictionarySelectorEnvVar, formatNodeTypeToEnvVar, getConfigEnvVars };
70
+ export { formatDictionarySelectorEnvVar, formatNodeTypeToEnvVar, formatOptimizedNestingEnvVar, getConfigEnvVars };
49
71
  //# sourceMappingURL=envVars.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"envVars.d.ts","names":[],"sources":["../../../src/envVars/envVars.ts"],"mappings":";;;;;;;;;;;;;cA2Ba,yBAAsB,qBACd,WAAA,wBACG,aAAA,6BAErB;;;;;;;;;;;;;;;;;;;cA4BU,iCAA8B,gCACX,WAAA,wBACR,aAAA,6BAErB;;;;;;;;;;;;;cAiBU,mBAAgB,QACnB,gBAAc,WAAA,wBACA,aAAA,6BAErB"}
1
+ {"version":3,"file":"envVars.d.ts","names":[],"sources":["../../../src/envVars/envVars.ts"],"mappings":";;;;;;;;;;;;;cA2Ba,yBAAsB,qBACd,WAAA,wBACG,aAAA,6BAErB;;;;;;;;;;;;;;;;;;;cA4BU,iCAA8B,gCACX,WAAA,wBACR,aAAA,6BAErB;;;;;;;;;;;;;;;;;;;;;;cA0BU,+BAA4B,sBACnB,WAAA,wBACE,aAAA,6BAErB;;;;;;;;;;;;;cAiBU,mBAAgB,QACnB,gBAAc,WAAA,wBACA,aAAA,6BAErB"}
@@ -1,2 +1,2 @@
1
- import { formatDictionarySelectorEnvVar, formatNodeTypeToEnvVar, getConfigEnvVars } from "./envVars.js";
2
- export { formatDictionarySelectorEnvVar, formatNodeTypeToEnvVar, getConfigEnvVars };
1
+ import { formatDictionarySelectorEnvVar, formatNodeTypeToEnvVar, formatOptimizedNestingEnvVar, getConfigEnvVars } from "./envVars.js";
2
+ export { formatDictionarySelectorEnvVar, formatNodeTypeToEnvVar, formatOptimizedNestingEnvVar, getConfigEnvVars };
@@ -35,6 +35,7 @@ declare const bundleJSFile: (buildOptions: BuildOptions) => Promise<import("esbu
35
35
  color?: boolean;
36
36
  logLimit?: number;
37
37
  logOverride?: Record<string, import("esbuild").LogLevel>;
38
+ logStyle?: import("esbuild").LogStyle;
38
39
  tsconfigRaw?: string | import("esbuild").TsconfigRaw;
39
40
  splitting?: boolean;
40
41
  preserveSymlinks?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"bundleJSFile.d.ts","names":[],"sources":["../../../src/loadExternalFile/bundleJSFile.ts"],"mappings":";;cAyBa,eAAY,cAAwB,iBAAY,0BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAZlD;aACC;aACA;aACD;aACC;aACA;aACC;aACF;aACC"}
1
+ {"version":3,"file":"bundleJSFile.d.ts","names":[],"sources":["../../../src/loadExternalFile/bundleJSFile.ts"],"mappings":";;cAyBa,eAAY,cAAwB,iBAAY,0BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAZlD;aACC;aACA;aACD;aACC;aACA;aACC;aACF;aACC"}
@@ -4,6 +4,12 @@ type RetryManagerOptions = {
4
4
  maxRetry?: number;
5
5
  /** delay between attempts, in milliseconds */
6
6
  delay?: number;
7
+ /**
8
+ * Decides whether a given error is worth another attempt. Returning `false`
9
+ * gives up immediately, which avoids replaying a request that can only fail
10
+ * again (ex: a `404`). Every error is retried when omitted.
11
+ */
12
+ shouldRetry?: (error: unknown) => boolean;
7
13
  /** function to call when an error occurs */
8
14
  onError?: (details: {
9
15
  error: string;
@@ -24,7 +30,7 @@ type RetryManagerOptions = {
24
30
  * @param options { maxRetry, delay }
25
31
  * @returns A new function with the same signature as `fn`
26
32
  */
27
- declare const retryManager: <Args extends any[], R>(fn: (...args: Args) => Promise<R>, { maxRetry, delay, onError, onMaxTryReached }?: RetryManagerOptions) => ((...args: Args) => Promise<R>);
33
+ declare const retryManager: <Args extends any[], R>(fn: (...args: Args) => Promise<R>, { maxRetry, delay, shouldRetry, onError, onMaxTryReached }?: RetryManagerOptions) => ((...args: Args) => Promise<R>);
28
34
  //#endregion
29
35
  export { RetryManagerOptions, retryManager };
30
36
  //# sourceMappingURL=retryManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"retryManager.d.ts","names":[],"sources":["../../../src/utils/retryManager.ts"],"mappings":";KAGY;;EAEV;;EAEA;;EAEA,WAAW;IACT;IACA;IACA;;;EAGF,mBAAmB;IACjB;IACA;IACA;;;;;;;;;;cAcS,eACV,oBAAoB,GAAC,QACZ,MAAM,SAAS,QAAQ,MAAE,UAAA,OAAA,SAAA,oBAM9B,6BACG,MAAM,SAAS,QAAQ"}
1
+ {"version":3,"file":"retryManager.d.ts","names":[],"sources":["../../../src/utils/retryManager.ts"],"mappings":";KAGY;;EAEV;;EAEA;;;;;;EAMA,eAAe;;EAEf,WAAW;IACT;IACA;IACA;;;EAGF,mBAAmB;IACjB;IACA;IACA;;;;;;;;;;cAcS,eACV,oBAAoB,GAAC,QACZ,MAAM,SAAS,QAAQ,MAAE,UAAA,OAAA,aAAA,SAAA,oBAO9B,6BACG,MAAM,SAAS,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/config",
3
- "version": "9.1.3",
3
+ "version": "9.3.0",
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": [
@@ -164,15 +164,15 @@
164
164
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
165
165
  },
166
166
  "dependencies": {
167
- "@intlayer/types": "9.1.3",
167
+ "@intlayer/types": "9.3.0",
168
168
  "defu": "6.1.7",
169
169
  "dotenv": "17.4.2",
170
- "esbuild": "0.28.1",
170
+ "esbuild": "0.28.2",
171
171
  "json5": "2.2.3",
172
172
  "zod": "4.4.3"
173
173
  },
174
174
  "devDependencies": {
175
- "@types/node": "26.1.2",
175
+ "@types/node": "26.2.0",
176
176
  "@utils/ts-config": "1.0.4",
177
177
  "@utils/ts-config-types": "1.0.4",
178
178
  "@utils/tsdown-config": "1.0.4",