@intlayer/config 8.6.3 → 8.6.4

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 (60) hide show
  1. package/dist/cjs/built.browser.cjs +26 -1
  2. package/dist/cjs/built.browser.cjs.map +1 -1
  3. package/dist/cjs/built.cjs +26 -1
  4. package/dist/cjs/built.cjs.map +1 -1
  5. package/dist/cjs/client.cjs +2 -0
  6. package/dist/cjs/configFile/buildBrowserConfiguration.cjs +1 -10
  7. package/dist/cjs/configFile/buildBrowserConfiguration.cjs.map +1 -1
  8. package/dist/cjs/configFile/buildConfigurationFields.cjs +0 -1
  9. package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
  10. package/dist/cjs/envVars/envVars.cjs +8 -8
  11. package/dist/cjs/envVars/envVars.cjs.map +1 -1
  12. package/dist/cjs/logger.cjs.map +1 -1
  13. package/dist/cjs/node.cjs +4 -0
  14. package/dist/cjs/utils/getStorageAttributes.cjs +13 -8
  15. package/dist/cjs/utils/getStorageAttributes.cjs.map +1 -1
  16. package/dist/cjs/utils/importMap.cjs +73 -0
  17. package/dist/cjs/utils/importMap.cjs.map +1 -0
  18. package/dist/cjs/utils/index.cjs +6 -0
  19. package/dist/cjs/utils/setIntlayerIdentifier.cjs +14 -0
  20. package/dist/cjs/utils/setIntlayerIdentifier.cjs.map +1 -0
  21. package/dist/esm/built.browser.mjs +13 -1
  22. package/dist/esm/built.browser.mjs.map +1 -1
  23. package/dist/esm/built.mjs +13 -1
  24. package/dist/esm/built.mjs.map +1 -1
  25. package/dist/esm/client.mjs +2 -1
  26. package/dist/esm/configFile/buildBrowserConfiguration.mjs +1 -8
  27. package/dist/esm/configFile/buildBrowserConfiguration.mjs.map +1 -1
  28. package/dist/esm/configFile/buildConfigurationFields.mjs +0 -1
  29. package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
  30. package/dist/esm/envVars/envVars.mjs +8 -8
  31. package/dist/esm/envVars/envVars.mjs.map +1 -1
  32. package/dist/esm/logger.mjs.map +1 -1
  33. package/dist/esm/node.mjs +2 -1
  34. package/dist/esm/utils/getStorageAttributes.mjs +13 -8
  35. package/dist/esm/utils/getStorageAttributes.mjs.map +1 -1
  36. package/dist/esm/utils/importMap.mjs +70 -0
  37. package/dist/esm/utils/importMap.mjs.map +1 -0
  38. package/dist/esm/utils/index.mjs +3 -1
  39. package/dist/esm/utils/setIntlayerIdentifier.mjs +12 -0
  40. package/dist/esm/utils/setIntlayerIdentifier.mjs.map +1 -0
  41. package/dist/types/built.browser.d.ts +15 -1
  42. package/dist/types/built.browser.d.ts.map +1 -1
  43. package/dist/types/built.d.ts +15 -1
  44. package/dist/types/built.d.ts.map +1 -1
  45. package/dist/types/client.d.ts +2 -1
  46. package/dist/types/configFile/buildBrowserConfiguration.d.ts +0 -1
  47. package/dist/types/configFile/buildBrowserConfiguration.d.ts.map +1 -1
  48. package/dist/types/configFile/configurationSchema.d.ts +2 -2
  49. package/dist/types/envVars/envVars.d.ts +1 -1
  50. package/dist/types/envVars/envVars.d.ts.map +1 -1
  51. package/dist/types/logger.d.ts +1 -1
  52. package/dist/types/logger.d.ts.map +1 -1
  53. package/dist/types/node.d.ts +2 -1
  54. package/dist/types/utils/getStorageAttributes.d.ts.map +1 -1
  55. package/dist/types/utils/importMap.d.ts +85 -0
  56. package/dist/types/utils/importMap.d.ts.map +1 -0
  57. package/dist/types/utils/index.d.ts +3 -1
  58. package/dist/types/utils/setIntlayerIdentifier.d.ts +15 -0
  59. package/dist/types/utils/setIntlayerIdentifier.d.ts.map +1 -0
  60. package/package.json +2 -2
@@ -52,10 +52,10 @@ const processStorageEntry = (entry) => {
52
52
  };
53
53
  };
54
54
  const mergeStorageAttributes = (accumulated, partial) => ({
55
- cookies: [...accumulated.cookies, ...partial.cookies ?? []],
56
- localStorage: [...accumulated.localStorage, ...partial.localStorage ?? []],
57
- sessionStorage: [...accumulated.sessionStorage, ...partial.sessionStorage ?? []],
58
- headers: [...accumulated.headers, ...partial.headers ?? []]
55
+ cookies: [...accumulated.cookies ?? [], ...partial.cookies ?? []],
56
+ localStorage: [...accumulated.localStorage ?? [], ...partial.localStorage ?? []],
57
+ sessionStorage: [...accumulated.sessionStorage ?? [], ...partial.sessionStorage ?? []],
58
+ headers: [...accumulated.headers ?? [], ...partial.headers ?? []]
59
59
  });
60
60
  /**
61
61
  * Extracts and normalizes storage configuration into separate arrays for each storage type.
@@ -71,11 +71,16 @@ const getStorageAttributes = (options) => {
71
71
  sessionStorage: [],
72
72
  headers: []
73
73
  };
74
- if (options === false || options === void 0) return emptyResult;
75
- if (Array.isArray(options)) return options.reduce((acc, entry) => {
74
+ if (options === false || options === void 0) return {};
75
+ const result = Array.isArray(options) ? options.reduce((acc, entry) => {
76
76
  return mergeStorageAttributes(acc, processStorageEntry(entry));
77
- }, emptyResult);
78
- return mergeStorageAttributes(emptyResult, processStorageEntry(options));
77
+ }, emptyResult) : mergeStorageAttributes(emptyResult, processStorageEntry(options));
78
+ const cleanedResult = {};
79
+ if (result.cookies && result.cookies.length > 0) cleanedResult.cookies = result.cookies;
80
+ if (result.localStorage && result.localStorage.length > 0) cleanedResult.localStorage = result.localStorage;
81
+ if (result.sessionStorage && result.sessionStorage.length > 0) cleanedResult.sessionStorage = result.sessionStorage;
82
+ if (result.headers && result.headers.length > 0) cleanedResult.headers = result.headers;
83
+ return cleanedResult;
79
84
  };
80
85
 
81
86
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"getStorageAttributes.mjs","names":[],"sources":["../../../src/utils/getStorageAttributes.ts"],"sourcesContent":["import type {\n CookiesAttributes,\n ProcessedStorageAttributes,\n RoutingStorageInput,\n StorageAttributes,\n} from '@intlayer/types/config';\nimport {\n COOKIE_NAME,\n HEADER_NAME,\n LOCALE_STORAGE_NAME,\n} from '../defaultValues/routing';\n\n// ============================================================================\n// Types\n// ============================================================================\n\ntype CookieEntry = {\n name: string;\n attributes: Omit<CookiesAttributes, 'type' | 'name'>;\n};\n\ntype WebStorageEntry = {\n name: string;\n};\n\ntype HeaderEntry = {\n name: string;\n};\n\ntype StorageEntry =\n | 'cookie'\n | 'localStorage'\n | 'sessionStorage'\n | 'header'\n | CookiesAttributes\n | StorageAttributes;\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\nconst createCookieEntry = (\n options?: Partial<CookiesAttributes>\n): CookieEntry => {\n const { name, path, expires, domain, secure, sameSite, httpOnly } =\n options ?? {};\n return {\n name: name ?? COOKIE_NAME,\n attributes: { path, expires, domain, secure, sameSite, httpOnly },\n };\n};\n\nconst createWebStorageEntry = (\n options?: Partial<StorageAttributes>\n): WebStorageEntry => ({\n name: options?.name ?? LOCALE_STORAGE_NAME,\n});\n\nconst createHeaderEntry = (\n options?: Partial<StorageAttributes>\n): HeaderEntry => ({\n name: options?.name ?? HEADER_NAME,\n});\n\nconst isCookieEntry = (entry: unknown): boolean => {\n if (typeof entry !== 'object' || entry === null) return false;\n const e = entry as Record<string, unknown>;\n return (\n e['type'] === 'cookie' ||\n 'sameSite' in e ||\n 'httpOnly' in e ||\n 'secure' in e\n );\n};\n\nconst isStorageType = (\n value: string\n): value is 'cookie' | 'localStorage' | 'sessionStorage' | 'header' =>\n value === 'cookie' ||\n value === 'localStorage' ||\n value === 'sessionStorage' ||\n value === 'header';\n\n// ============================================================================\n// Main Function\n// ============================================================================\n\nconst processStorageEntry = (\n entry: StorageEntry\n): Partial<ProcessedStorageAttributes> => {\n if (typeof entry === 'string') {\n if (!isStorageType(entry)) {\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n }\n if (entry === 'cookie') return { cookies: [createCookieEntry()] };\n if (entry === 'localStorage')\n return { localStorage: [createWebStorageEntry()] };\n if (entry === 'sessionStorage')\n return { sessionStorage: [createWebStorageEntry()] };\n if (entry === 'header') return { headers: [createHeaderEntry()] };\n }\n\n if (typeof entry === 'object' && entry !== null) {\n const typedEntry = entry as CookiesAttributes | StorageAttributes;\n\n if (isCookieEntry(typedEntry)) {\n return { cookies: [createCookieEntry(typedEntry as CookiesAttributes)] };\n }\n if ('type' in typedEntry && typedEntry.type === 'localStorage') {\n return {\n localStorage: [createWebStorageEntry(typedEntry as StorageAttributes)],\n };\n }\n if ('type' in typedEntry && typedEntry.type === 'sessionStorage') {\n return {\n sessionStorage: [\n createWebStorageEntry(typedEntry as StorageAttributes),\n ],\n };\n }\n if ('type' in typedEntry && typedEntry.type === 'header') {\n return { headers: [createHeaderEntry(typedEntry as StorageAttributes)] };\n }\n // Default to localStorage for ambiguous objects\n return {\n localStorage: [\n createWebStorageEntry(typedEntry as Omit<StorageAttributes, 'type'>),\n ],\n };\n }\n\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n};\n\nconst mergeStorageAttributes = (\n accumulated: ProcessedStorageAttributes,\n partial: Partial<ProcessedStorageAttributes>\n): ProcessedStorageAttributes => ({\n cookies: [...accumulated.cookies, ...(partial.cookies ?? [])],\n localStorage: [...accumulated.localStorage, ...(partial.localStorage ?? [])],\n sessionStorage: [\n ...accumulated.sessionStorage,\n ...(partial.sessionStorage ?? []),\n ],\n headers: [...accumulated.headers, ...(partial.headers ?? [])],\n});\n\n/**\n * Extracts and normalizes storage configuration into separate arrays for each storage type.\n * Called at config-build time so the result is pre-computed and stored in the config.\n *\n * @param options - The storage configuration from IntlayerConfig\n * @returns An object containing arrays for cookies, localStorage, sessionStorage and headers\n */\nexport const getStorageAttributes = (\n options: RoutingStorageInput\n): ProcessedStorageAttributes => {\n const emptyResult: ProcessedStorageAttributes = {\n cookies: [],\n localStorage: [],\n sessionStorage: [],\n headers: [],\n };\n\n if (options === false || options === undefined) return emptyResult;\n\n if (Array.isArray(options)) {\n return options.reduce<ProcessedStorageAttributes>((acc, entry) => {\n const partial = processStorageEntry(entry);\n return mergeStorageAttributes(acc, partial);\n }, emptyResult);\n }\n\n return mergeStorageAttributes(emptyResult, processStorageEntry(options));\n};\n"],"mappings":";;;AAyCA,MAAM,qBACJ,YACgB;CAChB,MAAM,EAAE,MAAM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AAgC,CACvD,EACF;AAEH,MAAI,UAAU,cAAc,WAAW,SAAS,SAC9C,QAAO,EAAE,SAAS,CAAC,kBAAkB,WAAgC,CAAC,EAAE;AAG1E,SAAO,EACL,cAAc,CACZ,sBAAsB,WAA8C,CACrE,EACF;;AAGH,QAAO;EAAE,SAAS,EAAE;EAAE,cAAc,EAAE;EAAE,gBAAgB,EAAE;EAAE,SAAS,EAAE;EAAE;;AAG3E,MAAM,0BACJ,aACA,aACgC;CAChC,SAAS,CAAC,GAAG,YAAY,SAAS,GAAI,QAAQ,WAAW,EAAE,CAAE;CAC7D,cAAc,CAAC,GAAG,YAAY,cAAc,GAAI,QAAQ,gBAAgB,EAAE,CAAE;CAC5E,gBAAgB,CACd,GAAG,YAAY,gBACf,GAAI,QAAQ,kBAAkB,EAAE,CACjC;CACD,SAAS,CAAC,GAAG,YAAY,SAAS,GAAI,QAAQ,WAAW,EAAE,CAAE;CAC9D;;;;;;;;AASD,MAAa,wBACX,YAC+B;CAC/B,MAAM,cAA0C;EAC9C,SAAS,EAAE;EACX,cAAc,EAAE;EAChB,gBAAgB,EAAE;EAClB,SAAS,EAAE;EACZ;AAED,KAAI,YAAY,SAAS,YAAY,OAAW,QAAO;AAEvD,KAAI,MAAM,QAAQ,QAAQ,CACxB,QAAO,QAAQ,QAAoC,KAAK,UAAU;AAEhE,SAAO,uBAAuB,KADd,oBAAoB,MAAM,CACC;IAC1C,YAAY;AAGjB,QAAO,uBAAuB,aAAa,oBAAoB,QAAQ,CAAC"}
1
+ {"version":3,"file":"getStorageAttributes.mjs","names":[],"sources":["../../../src/utils/getStorageAttributes.ts"],"sourcesContent":["import type {\n CookiesAttributes,\n ProcessedStorageAttributes,\n RoutingStorageInput,\n StorageAttributes,\n} from '@intlayer/types/config';\nimport {\n COOKIE_NAME,\n HEADER_NAME,\n LOCALE_STORAGE_NAME,\n} from '../defaultValues/routing';\n\n// ============================================================================\n// Types\n// ============================================================================\n\ntype CookieEntry = {\n name: string;\n attributes: Omit<CookiesAttributes, 'type' | 'name'>;\n};\n\ntype WebStorageEntry = {\n name: string;\n};\n\ntype HeaderEntry = {\n name: string;\n};\n\ntype StorageEntry =\n | 'cookie'\n | 'localStorage'\n | 'sessionStorage'\n | 'header'\n | CookiesAttributes\n | StorageAttributes;\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\nconst createCookieEntry = (\n options?: Partial<CookiesAttributes>\n): CookieEntry => {\n const { name, path, expires, domain, secure, sameSite, httpOnly } =\n options ?? {};\n return {\n name: name ?? COOKIE_NAME,\n attributes: { path, expires, domain, secure, sameSite, httpOnly },\n };\n};\n\nconst createWebStorageEntry = (\n options?: Partial<StorageAttributes>\n): WebStorageEntry => ({\n name: options?.name ?? LOCALE_STORAGE_NAME,\n});\n\nconst createHeaderEntry = (\n options?: Partial<StorageAttributes>\n): HeaderEntry => ({\n name: options?.name ?? HEADER_NAME,\n});\n\nconst isCookieEntry = (entry: unknown): boolean => {\n if (typeof entry !== 'object' || entry === null) return false;\n const e = entry as Record<string, unknown>;\n return (\n e['type'] === 'cookie' ||\n 'sameSite' in e ||\n 'httpOnly' in e ||\n 'secure' in e\n );\n};\n\nconst isStorageType = (\n value: string\n): value is 'cookie' | 'localStorage' | 'sessionStorage' | 'header' =>\n value === 'cookie' ||\n value === 'localStorage' ||\n value === 'sessionStorage' ||\n value === 'header';\n\n// ============================================================================\n// Main Function\n// ============================================================================\n\nconst processStorageEntry = (\n entry: StorageEntry\n): Partial<ProcessedStorageAttributes> => {\n if (typeof entry === 'string') {\n if (!isStorageType(entry)) {\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n }\n if (entry === 'cookie') return { cookies: [createCookieEntry()] };\n if (entry === 'localStorage')\n return { localStorage: [createWebStorageEntry()] };\n if (entry === 'sessionStorage')\n return { sessionStorage: [createWebStorageEntry()] };\n if (entry === 'header') return { headers: [createHeaderEntry()] };\n }\n\n if (typeof entry === 'object' && entry !== null) {\n const typedEntry = entry as CookiesAttributes | StorageAttributes;\n\n if (isCookieEntry(typedEntry)) {\n return { cookies: [createCookieEntry(typedEntry as CookiesAttributes)] };\n }\n if ('type' in typedEntry && typedEntry.type === 'localStorage') {\n return {\n localStorage: [createWebStorageEntry(typedEntry as StorageAttributes)],\n };\n }\n if ('type' in typedEntry && typedEntry.type === 'sessionStorage') {\n return {\n sessionStorage: [\n createWebStorageEntry(typedEntry as StorageAttributes),\n ],\n };\n }\n if ('type' in typedEntry && typedEntry.type === 'header') {\n return { headers: [createHeaderEntry(typedEntry as StorageAttributes)] };\n }\n // Default to localStorage for ambiguous objects\n return {\n localStorage: [\n createWebStorageEntry(typedEntry as Omit<StorageAttributes, 'type'>),\n ],\n };\n }\n\n return { cookies: [], localStorage: [], sessionStorage: [], headers: [] };\n};\n\nconst mergeStorageAttributes = (\n accumulated: ProcessedStorageAttributes,\n partial: Partial<ProcessedStorageAttributes>\n): ProcessedStorageAttributes => ({\n cookies: [...(accumulated.cookies ?? []), ...(partial.cookies ?? [])],\n localStorage: [\n ...(accumulated.localStorage ?? []),\n ...(partial.localStorage ?? []),\n ],\n sessionStorage: [\n ...(accumulated.sessionStorage ?? []),\n ...(partial.sessionStorage ?? []),\n ],\n headers: [...(accumulated.headers ?? []), ...(partial.headers ?? [])],\n});\n\n/**\n * Extracts and normalizes storage configuration into separate arrays for each storage type.\n * Called at config-build time so the result is pre-computed and stored in the config.\n *\n * @param options - The storage configuration from IntlayerConfig\n * @returns An object containing arrays for cookies, localStorage, sessionStorage and headers\n */\nexport const getStorageAttributes = (\n options: RoutingStorageInput\n): ProcessedStorageAttributes => {\n const emptyResult: ProcessedStorageAttributes = {\n cookies: [],\n localStorage: [],\n sessionStorage: [],\n headers: [],\n };\n\n if (options === false || options === undefined) return {};\n\n const result = Array.isArray(options)\n ? options.reduce<ProcessedStorageAttributes>((acc, entry) => {\n const partial = processStorageEntry(entry);\n return mergeStorageAttributes(acc, partial);\n }, emptyResult)\n : mergeStorageAttributes(emptyResult, processStorageEntry(options));\n\n // Remove empty arrays\n const cleanedResult: ProcessedStorageAttributes = {};\n\n if (result.cookies && result.cookies.length > 0) {\n cleanedResult.cookies = result.cookies;\n }\n\n if (result.localStorage && result.localStorage.length > 0) {\n cleanedResult.localStorage = result.localStorage;\n }\n\n if (result.sessionStorage && result.sessionStorage.length > 0) {\n cleanedResult.sessionStorage = result.sessionStorage;\n }\n\n if (result.headers && result.headers.length > 0) {\n cleanedResult.headers = result.headers;\n }\n\n return cleanedResult;\n};\n"],"mappings":";;;AAyCA,MAAM,qBACJ,YACgB;CAChB,MAAM,EAAE,MAAM,MAAM,SAAS,QAAQ,QAAQ,UAAU,aACrD,WAAW,EAAE;AACf,QAAO;EACL,MAAM;EACN,YAAY;GAAE;GAAM;GAAS;GAAQ;GAAQ;GAAU;GAAU;EAClE;;AAGH,MAAM,yBACJ,aACqB,EACrB,MAAM,SAAS,2BAChB;AAED,MAAM,qBACJ,aACiB,EACjB,MAAM,SAAS,6BAChB;AAED,MAAM,iBAAiB,UAA4B;AACjD,KAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;CACxD,MAAM,IAAI;AACV,QACE,EAAE,YAAY,YACd,cAAc,KACd,cAAc,KACd,YAAY;;AAIhB,MAAM,iBACJ,UAEA,UAAU,YACV,UAAU,kBACV,UAAU,oBACV,UAAU;AAMZ,MAAM,uBACJ,UACwC;AACxC,KAAI,OAAO,UAAU,UAAU;AAC7B,MAAI,CAAC,cAAc,MAAM,CACvB,QAAO;GAAE,SAAS,EAAE;GAAE,cAAc,EAAE;GAAE,gBAAgB,EAAE;GAAE,SAAS,EAAE;GAAE;AAE3E,MAAI,UAAU,SAAU,QAAO,EAAE,SAAS,CAAC,mBAAmB,CAAC,EAAE;AACjE,MAAI,UAAU,eACZ,QAAO,EAAE,cAAc,CAAC,uBAAuB,CAAC,EAAE;AACpD,MAAI,UAAU,iBACZ,QAAO,EAAE,gBAAgB,CAAC,uBAAuB,CAAC,EAAE;AACtD,MAAI,UAAU,SAAU,QAAO,EAAE,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U;AAEzD,SAAO,uBAAuB,KADd,oBAAoB,MAAM,CACC;IAC1C,YAAY,GACf,uBAAuB,aAAa,oBAAoB,QAAQ,CAAC;CAGrE,MAAM,gBAA4C,EAAE;AAEpD,KAAI,OAAO,WAAW,OAAO,QAAQ,SAAS,EAC5C,eAAc,UAAU,OAAO;AAGjC,KAAI,OAAO,gBAAgB,OAAO,aAAa,SAAS,EACtD,eAAc,eAAe,OAAO;AAGtC,KAAI,OAAO,kBAAkB,OAAO,eAAe,SAAS,EAC1D,eAAc,iBAAiB,OAAO;AAGxC,KAAI,OAAO,WAAW,OAAO,QAAQ,SAAS,EAC5C,eAAc,UAAU,OAAO;AAGjC,QAAO"}
@@ -0,0 +1,70 @@
1
+ import { getAlias } from "./alias.mjs";
2
+
3
+ //#region src/utils/importMap.ts
4
+ /**
5
+ * Generates a browser-native import map object from the Intlayer configuration.
6
+ *
7
+ * The import map resolves bare module specifiers (e.g. `@intlayer/dictionaries-entry`)
8
+ * to their physical `.mjs` file paths relative to the project root, replicating
9
+ * what a bundler's `alias` plugin would do.
10
+ *
11
+ * Paths are always forced to ESM (`.mjs`) and prefixed with `./` so they are
12
+ * valid relative URL references for the browser.
13
+ *
14
+ * @example
15
+ * ```json
16
+ * {
17
+ * "imports": {
18
+ * "@intlayer/dictionaries-entry": "./.intlayer/main/dictionaries.mjs",
19
+ * "@intlayer/unmerged-dictionaries-entry": "./.intlayer/main/unmerged_dictionaries.mjs",
20
+ * "@intlayer/remote-dictionaries-entry": "./.intlayer/main/remote_dictionaries.mjs",
21
+ * "@intlayer/dynamic-dictionaries-entry": "./.intlayer/main/dynamic_dictionaries.mjs",
22
+ * "@intlayer/fetch-dictionaries-entry": "./.intlayer/main/fetch_dictionaries.mjs",
23
+ * "@intlayer/config/built": "./.intlayer/config/configuration.mjs"
24
+ * }
25
+ * }
26
+ * ```
27
+ */
28
+ const getImportMap = ({ configuration, extraImports = {} }) => {
29
+ return { imports: {
30
+ ...getAlias({
31
+ configuration,
32
+ format: "esm",
33
+ formatter: (value) => `./${value}`
34
+ }),
35
+ ...extraImports
36
+ } };
37
+ };
38
+ /**
39
+ * Returns the JSON string representation of the import map.
40
+ *
41
+ * Can be embedded directly as the content of a `<script type="importmap">` tag,
42
+ * or written to a standalone `.importmap` file and referenced via
43
+ * `<script type="importmap" src="./importmap.json">`.
44
+ */
45
+ const getImportMapContent = (options) => JSON.stringify(getImportMap(options), null, 2);
46
+ /**
47
+ * Generates a complete `<script type="importmap">` HTML element string.
48
+ *
49
+ * Inject this into your HTML `<head>` **before** any `<script type="module">`
50
+ * tags to enable bare module specifier resolution without a bundler.
51
+ *
52
+ * Prerequisites:
53
+ * - Run `npx intlayer build` so the `.intlayer` folder is populated.
54
+ * - Your static server must serve the `.intlayer` directory.
55
+ *
56
+ * @example
57
+ * ```html
58
+ * <!DOCTYPE html>
59
+ * <html lang="en">
60
+ * <head>
61
+ * <!-- generated output goes here, before any module scripts -->
62
+ * <script type="module" src="./src/main.js"><\/script>
63
+ * </head>
64
+ * ```
65
+ */
66
+ const getImportMapScript = (options) => `<script type="importmap">\n${getImportMapContent(options)}\n<\/script>`;
67
+
68
+ //#endregion
69
+ export { getImportMap, getImportMapContent, getImportMapScript };
70
+ //# sourceMappingURL=importMap.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importMap.mjs","names":[],"sources":["../../../src/utils/importMap.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\nimport { getAlias } from './alias';\n\nexport type GetImportMapOptions = {\n configuration: IntlayerConfig;\n /**\n * Extra module specifier → URL mappings to merge into the import map.\n * Use this to add paths for top-level packages (e.g. `intlayer`, `vanilla-intlayer`)\n * that are not generated by Intlayer's build step.\n *\n * @example\n * ```ts\n * {\n * extraImports: {\n * 'intlayer': './node_modules/intlayer/dist/index.mjs',\n * 'vanilla-intlayer': './node_modules/vanilla-intlayer/dist/index.mjs',\n * }\n * }\n * ```\n */\n extraImports?: Record<string, string>;\n};\n\nexport type ImportMap = {\n imports: Record<string, string>;\n};\n\n/**\n * Generates a browser-native import map object from the Intlayer configuration.\n *\n * The import map resolves bare module specifiers (e.g. `@intlayer/dictionaries-entry`)\n * to their physical `.mjs` file paths relative to the project root, replicating\n * what a bundler's `alias` plugin would do.\n *\n * Paths are always forced to ESM (`.mjs`) and prefixed with `./` so they are\n * valid relative URL references for the browser.\n *\n * @example\n * ```json\n * {\n * \"imports\": {\n * \"@intlayer/dictionaries-entry\": \"./.intlayer/main/dictionaries.mjs\",\n * \"@intlayer/unmerged-dictionaries-entry\": \"./.intlayer/main/unmerged_dictionaries.mjs\",\n * \"@intlayer/remote-dictionaries-entry\": \"./.intlayer/main/remote_dictionaries.mjs\",\n * \"@intlayer/dynamic-dictionaries-entry\": \"./.intlayer/main/dynamic_dictionaries.mjs\",\n * \"@intlayer/fetch-dictionaries-entry\": \"./.intlayer/main/fetch_dictionaries.mjs\",\n * \"@intlayer/config/built\": \"./.intlayer/config/configuration.mjs\"\n * }\n * }\n * ```\n */\nexport const getImportMap = ({\n configuration,\n extraImports = {},\n}: GetImportMapOptions): ImportMap => {\n const aliases = getAlias({\n configuration,\n format: 'esm',\n formatter: (value) => `./${value}`,\n });\n\n return {\n imports: {\n ...aliases,\n ...extraImports,\n },\n };\n};\n\n/**\n * Returns the JSON string representation of the import map.\n *\n * Can be embedded directly as the content of a `<script type=\"importmap\">` tag,\n * or written to a standalone `.importmap` file and referenced via\n * `<script type=\"importmap\" src=\"./importmap.json\">`.\n */\nexport const getImportMapContent = (options: GetImportMapOptions): string =>\n JSON.stringify(getImportMap(options), null, 2);\n\n/**\n * Generates a complete `<script type=\"importmap\">` HTML element string.\n *\n * Inject this into your HTML `<head>` **before** any `<script type=\"module\">`\n * tags to enable bare module specifier resolution without a bundler.\n *\n * Prerequisites:\n * - Run `npx intlayer build` so the `.intlayer` folder is populated.\n * - Your static server must serve the `.intlayer` directory.\n *\n * @example\n * ```html\n * <!DOCTYPE html>\n * <html lang=\"en\">\n * <head>\n * <!-- generated output goes here, before any module scripts -->\n * <script type=\"module\" src=\"./src/main.js\"></script>\n * </head>\n * ```\n */\nexport const getImportMapScript = (options: GetImportMapOptions): string =>\n `<script type=\"importmap\">\\n${getImportMapContent(options)}\\n</script>`;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAa,gBAAgB,EAC3B,eACA,eAAe,EAAE,OACmB;AAOpC,QAAO,EACL,SAAS;EACP,GARY,SAAS;GACvB;GACA,QAAQ;GACR,YAAY,UAAU,KAAK;GAC5B,CAAC;EAKE,GAAG;EACJ,EACF;;;;;;;;;AAUH,MAAa,uBAAuB,YAClC,KAAK,UAAU,aAAa,QAAQ,EAAE,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;AAsBhD,MAAa,sBAAsB,YACjC,8BAA8B,oBAAoB,QAAQ,CAAC"}
@@ -9,13 +9,15 @@ import { clearModuleCache } from "./clearModuleCache.mjs";
9
9
  import { compareVersions } from "./compareVersions.mjs";
10
10
  import { extractErrorMessage } from "./extractErrorMessage.mjs";
11
11
  import { getStorageAttributes } from "./getStorageAttributes.mjs";
12
+ import { getImportMap, getImportMapContent, getImportMapScript } from "./importMap.mjs";
12
13
  import { getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync } from "./getUsedNodeTypes.mjs";
13
14
  import { logStack } from "./logStack.mjs";
14
15
  import { parseFilePathPattern, parseStringPattern } from "./parseFilePathPattern.mjs";
15
16
  import { retryManager } from "./retryManager.mjs";
17
+ import { setIntlayerIdentifier } from "./setIntlayerIdentifier.mjs";
16
18
  import { camelCaseToKebabCase } from "./stringFormatter/camelCaseToKebabCase.mjs";
17
19
  import { camelCaseToSentence } from "./stringFormatter/camelCaseToSentence.mjs";
18
20
  import { kebabCaseToCamelCase } from "./stringFormatter/kebabCaseToCamelCase.mjs";
19
21
  import { toLowerCamelCase } from "./stringFormatter/toLowerCamelCase.mjs";
20
22
 
21
- export { cacheDisk, cacheMemory, camelCaseToKebabCase, camelCaseToSentence, clearAllCache, clearCache, clearDiskCacheMemory, clearModuleCache, compareVersions, computeKeyId, configESMxCJSRequire, extractErrorMessage, getAlias, getCache, getExtension, getPackageJsonPath, getProjectRequire, getStorageAttributes, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync, isESModule, kebabCaseToCamelCase, logStack, normalizePath, parseFilePathPattern, parseStringPattern, retryManager, setCache, stableStringify, toLowerCamelCase };
23
+ export { cacheDisk, cacheMemory, camelCaseToKebabCase, camelCaseToSentence, clearAllCache, clearCache, clearDiskCacheMemory, clearModuleCache, compareVersions, computeKeyId, configESMxCJSRequire, extractErrorMessage, getAlias, getCache, getExtension, getImportMap, getImportMapContent, getImportMapScript, getPackageJsonPath, getProjectRequire, getStorageAttributes, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync, isESModule, kebabCaseToCamelCase, logStack, normalizePath, parseFilePathPattern, parseStringPattern, retryManager, setCache, setIntlayerIdentifier, stableStringify, toLowerCamelCase };
@@ -0,0 +1,12 @@
1
+ //#region src/utils/setIntlayerIdentifier.ts
2
+ /**
3
+ * Sets the version of Intlayer in the window object.
4
+ * This is used for Intlayer detection in the browser.
5
+ */
6
+ const setIntlayerIdentifier = () => {
7
+ if (typeof window !== "undefined") window.intlayer = { enabled: true };
8
+ };
9
+
10
+ //#endregion
11
+ export { setIntlayerIdentifier };
12
+ //# sourceMappingURL=setIntlayerIdentifier.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setIntlayerIdentifier.mjs","names":[],"sources":["../../../src/utils/setIntlayerIdentifier.ts"],"sourcesContent":["type Meta = {\n enabled: true;\n};\n\nexport type WindowsWithIntlayer = typeof window & {\n intlayer?: Meta;\n};\n\n/**\n * Sets the version of Intlayer in the window object.\n * This is used for Intlayer detection in the browser.\n */\nexport const setIntlayerIdentifier = (): void => {\n if (typeof window !== 'undefined') {\n (window as WindowsWithIntlayer).intlayer = {\n enabled: true,\n };\n }\n};\n"],"mappings":";;;;;AAYA,MAAa,8BAAoC;AAC/C,KAAI,OAAO,WAAW,YACpB,CAAC,OAA+B,WAAW,EACzC,SAAS,MACV"}
@@ -1,4 +1,6 @@
1
+ import * as _$_intlayer_types_config0 from "@intlayer/types/config";
1
2
  import { IntlayerConfig } from "@intlayer/types/config";
3
+ import * as _$_intlayer_types_plugin0 from "@intlayer/types/plugin";
2
4
 
3
5
  //#region src/built.browser.d.ts
4
6
  /**
@@ -8,6 +10,18 @@ import { IntlayerConfig } from "@intlayer/types/config";
8
10
  * only read when a property is first accessed.
9
11
  */
10
12
  declare const configuration: IntlayerConfig;
13
+ declare const internationalization: _$_intlayer_types_config0.InternationalizationConfig;
14
+ declare const dictionary: Partial<_$_intlayer_types_config0.DictionaryConfig>;
15
+ declare const routing: _$_intlayer_types_config0.RoutingConfig;
16
+ declare const content: _$_intlayer_types_config0.ContentConfig;
17
+ declare const system: _$_intlayer_types_config0.SystemConfig;
18
+ declare const editor: _$_intlayer_types_config0.EditorConfig;
19
+ declare const log: _$_intlayer_types_config0.LogConfig;
20
+ declare const ai: Partial<_$_intlayer_types_config0.AiConfig>;
21
+ declare const build: _$_intlayer_types_config0.BuildConfig;
22
+ declare const compiler: _$_intlayer_types_config0.CompilerConfig;
23
+ declare const schemas: Record<string, _$_intlayer_types_config0.Schema>;
24
+ declare const plugins: _$_intlayer_types_plugin0.Plugin[];
11
25
  //#endregion
12
- export { configuration as default };
26
+ export { ai, build, compiler, content, configuration as default, dictionary, editor, internationalization, log, plugins, routing, schemas, system };
13
27
  //# sourceMappingURL=built.browser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"built.browser.d.ts","names":[],"sources":["../../src/built.browser.ts"],"mappings":";;;;;;;;;cAwBM,aAAA,EAAa,cAAA"}
1
+ {"version":3,"file":"built.browser.d.ts","names":[],"sources":["../../src/built.browser.ts"],"mappings":";;;;;AAsCA;;;;;AACA;AADA,cAdM,aAAA,EAAa,cAAA;AAAA,cAaN,oBAAA,EAAyD,yBAAA,CAArC,0BAAA;AAAA,cACpB,UAAA,EAAU,OAAA,CAA2B,yBAAA,CAA3B,gBAAA;AAAA,cACV,OAAA,EAA+B,yBAAA,CAAxB,aAAA;AAAA,cACP,OAAA,EAA+B,yBAAA,CAAxB,aAAA;AAAA,cACP,MAAA,EAA6B,yBAAA,CAAvB,YAAA;AAAA,cACN,MAAA,EAA6B,yBAAA,CAAvB,YAAA;AAAA,cACN,GAAA,EAAuB,yBAAA,CAApB,SAAA;AAAA,cACH,EAAA,EAAE,OAAA,CAAmB,yBAAA,CAAnB,QAAA;AAAA,cACF,KAAA,EAA2B,yBAAA,CAAtB,WAAA;AAAA,cACL,QAAA,EAAiC,yBAAA,CAAzB,cAAA;AAAA,cACR,OAAA,EAAO,MAAA,SAAwB,yBAAA,CAAxB,MAAA;AAAA,cACP,OAAA,EAA+B,yBAAA,CAAxB,MAAA"}
@@ -1,7 +1,21 @@
1
+ import * as _$_intlayer_types_config0 from "@intlayer/types/config";
1
2
  import { IntlayerConfig } from "@intlayer/types/config";
3
+ import * as _$_intlayer_types_plugin0 from "@intlayer/types/plugin";
2
4
 
3
5
  //#region src/built.d.ts
4
6
  declare const configuration: IntlayerConfig;
7
+ declare const internationalization: _$_intlayer_types_config0.InternationalizationConfig;
8
+ declare const dictionary: Partial<_$_intlayer_types_config0.DictionaryConfig>;
9
+ declare const routing: _$_intlayer_types_config0.RoutingConfig;
10
+ declare const content: _$_intlayer_types_config0.ContentConfig;
11
+ declare const system: _$_intlayer_types_config0.SystemConfig;
12
+ declare const editor: _$_intlayer_types_config0.EditorConfig;
13
+ declare const log: _$_intlayer_types_config0.LogConfig;
14
+ declare const ai: Partial<_$_intlayer_types_config0.AiConfig>;
15
+ declare const build: _$_intlayer_types_config0.BuildConfig;
16
+ declare const compiler: _$_intlayer_types_config0.CompilerConfig;
17
+ declare const schemas: Record<string, _$_intlayer_types_config0.Schema>;
18
+ declare const plugins: _$_intlayer_types_plugin0.Plugin[];
5
19
  //#endregion
6
- export { configuration as default };
20
+ export { ai, build, compiler, content, configuration as default, dictionary, editor, internationalization, log, plugins, routing, schemas, system };
7
21
  //# sourceMappingURL=built.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"built.d.ts","names":[],"sources":["../../src/built.ts"],"mappings":";;;cAQM,aAAA,EAAe,cAAA"}
1
+ {"version":3,"file":"built.d.ts","names":[],"sources":["../../src/built.ts"],"mappings":";;;;;cAQM,aAAA,EAAe,cAAA;AAAA,cAER,oBAAA,EAAyD,yBAAA,CAArC,0BAAA;AAAA,cACpB,UAAA,EAAU,OAAA,CAA2B,yBAAA,CAA3B,gBAAA;AAAA,cACV,OAAA,EAA+B,yBAAA,CAAxB,aAAA;AAAA,cACP,OAAA,EAA+B,yBAAA,CAAxB,aAAA;AAAA,cACP,MAAA,EAA6B,yBAAA,CAAvB,YAAA;AAAA,cACN,MAAA,EAA6B,yBAAA,CAAvB,YAAA;AAAA,cACN,GAAA,EAAuB,yBAAA,CAApB,SAAA;AAAA,cACH,EAAA,EAAE,OAAA,CAAmB,yBAAA,CAAnB,QAAA;AAAA,cACF,KAAA,EAA2B,yBAAA,CAAtB,WAAA;AAAA,cACL,QAAA,EAAiC,yBAAA,CAAzB,cAAA;AAAA,cACR,OAAA,EAAO,MAAA,SAAwB,yBAAA,CAAxB,MAAA;AAAA,cACP,OAAA,EAA+B,yBAAA,CAAxB,MAAA"}
@@ -2,8 +2,9 @@ import { BrowserIntlayerConfig, buildBrowserConfiguration, buildEditorFields, bu
2
2
  import { extractErrorMessage } from "./utils/extractErrorMessage.js";
3
3
  import { logStack } from "./utils/logStack.js";
4
4
  import { normalizePath } from "./utils/normalizePath.js";
5
+ import { WindowsWithIntlayer, setIntlayerIdentifier } from "./utils/setIntlayerIdentifier.js";
5
6
  import { camelCaseToKebabCase } from "./utils/stringFormatter/camelCaseToKebabCase.js";
6
7
  import { camelCaseToSentence } from "./utils/stringFormatter/camelCaseToSentence.js";
7
8
  import { kebabCaseToCamelCase } from "./utils/stringFormatter/kebabCaseToCamelCase.js";
8
9
  import { toLowerCamelCase } from "./utils/stringFormatter/toLowerCamelCase.js";
9
- export { BrowserIntlayerConfig, buildBrowserConfiguration, buildEditorFields, buildInternationalizationFields, buildLogFields, buildRoutingFields, camelCaseToKebabCase, camelCaseToSentence, extractBrowserConfiguration, extractErrorMessage, kebabCaseToCamelCase, logStack, normalizePath, toLowerCamelCase };
10
+ export { BrowserIntlayerConfig, WindowsWithIntlayer, buildBrowserConfiguration, buildEditorFields, buildInternationalizationFields, buildLogFields, buildRoutingFields, camelCaseToKebabCase, camelCaseToSentence, extractBrowserConfiguration, extractErrorMessage, kebabCaseToCamelCase, logStack, normalizePath, setIntlayerIdentifier, toLowerCamelCase };
@@ -13,7 +13,6 @@ type BrowserIntlayerConfig = {
13
13
  routing: RoutingConfig;
14
14
  editor: Omit<EditorConfig, 'clientId' | 'clientSecret'>;
15
15
  log: Pick<LogConfig, 'mode' | 'prefix'>;
16
- metadata: IntlayerConfig['metadata'];
17
16
  };
18
17
  declare global {
19
18
  interface Window {
@@ -1 +1 @@
1
- {"version":3,"file":"buildBrowserConfiguration.d.ts","names":[],"sources":["../../../src/configFile/buildBrowserConfiguration.ts"],"mappings":";;;;;AA2CA;;;;;KAAY,qBAAA;EACV,oBAAA,EAAsB,IAAA,CACpB,0BAAA;EAGF,OAAA,EAAS,aAAA;EACT,MAAA,EAAQ,IAAA,CAAK,YAAA;EACb,GAAA,EAAK,IAAA,CAAK,SAAA;EACV,QAAA,EAAU,cAAA;AAAA;AAAA,QAGJ,MAAA;EAAA,UACI,MAAA;IAXY;IAapB,eAAA,GAAkB,qBAAA;EAAA;AAAA;;;;;;;cAiBT,+BAAA,GACX,mBAAA,GAAsB,OAAA,CAAQ,0BAAA,MAC7B,0BAAA;;;;AAxBD;;;cAuEW,kBAAA,GACX,mBAAA,GAAsB,OAAA,CAAQ,mBAAA,MAC7B,aAAA;;;;;;;;AAnDH;;;cAgJa,iBAAA,GACX,mBAAA,GAAsB,OAAA,CAAQ,YAAA,MAC7B,YAAA;;;;;;;;cAmIU,cAAA,GACX,mBAAA,GAAsB,OAAA,CAAQ,SAAA,GAC9B,YAAA,GAAe,YAAA,KACd,SAAA;;;AAvOH;;;;;;;;;;;;;;AA+FA;;;;;;cAgMa,yBAAA,GACX,YAAA,GAAe,oBAAA,KACd,qBAAA;;;;;;;;AA7DH;;;;cAiGa,2BAAA,GACX,MAAA,EAAQ,cAAA,KACP,qBAAA"}
1
+ {"version":3,"file":"buildBrowserConfiguration.d.ts","names":[],"sources":["../../../src/configFile/buildBrowserConfiguration.ts"],"mappings":";;;;;AA0CA;;;;;KAAY,qBAAA;EACV,oBAAA,EAAsB,IAAA,CACpB,0BAAA;EAGF,OAAA,EAAS,aAAA;EACT,MAAA,EAAQ,IAAA,CAAK,YAAA;EACb,GAAA,EAAK,IAAA,CAAK,SAAA;AAAA;AAAA,QAGJ,MAAA;EAAA,UACI,MAAA;IAVY;IAYpB,eAAA,GAAkB,qBAAA;EAAA;AAAA;;;;;;;cAiBT,+BAAA,GACX,mBAAA,GAAsB,OAAA,CAAQ,0BAAA,MAC7B,0BAAA;;AAxBD;;;;;cAuEW,kBAAA,GACX,mBAAA,GAAsB,OAAA,CAAQ,mBAAA,MAC7B,aAAA;;;;;;AAnDH;;;;;cAgJa,iBAAA,GACX,mBAAA,GAAsB,OAAA,CAAQ,YAAA,MAC7B,YAAA;;;;;;;;cAmIU,cAAA,GACX,mBAAA,GAAsB,OAAA,CAAQ,SAAA,GAC9B,YAAA,GAAe,YAAA,KACd,SAAA;AAvOH;;;;;;;;;;;;;;AA+FA;;;;;;;;AA/FA,cA+Ra,yBAAA,GACX,YAAA,GAAe,oBAAA,KACd,qBAAA;;;;;;AA7DH;;;;;;cA4Fa,2BAAA,GACX,MAAA,EAAQ,cAAA,KACP,qBAAA"}
@@ -271,8 +271,8 @@ declare const buildSchema: z.ZodObject<{
271
271
  }>>;
272
272
  traversePattern: z.ZodOptional<z.ZodArray<z.ZodString>>;
273
273
  outputFormat: z.ZodOptional<z.ZodArray<z.ZodEnum<{
274
- cjs: "cjs";
275
274
  esm: "esm";
275
+ cjs: "cjs";
276
276
  }>>>;
277
277
  cache: z.ZodOptional<z.ZodBoolean>;
278
278
  require: z.ZodOptional<z.ZodUnknown>;
@@ -465,8 +465,8 @@ declare const intlayerConfigSchema: z.ZodObject<{
465
465
  }>>;
466
466
  traversePattern: z.ZodOptional<z.ZodArray<z.ZodString>>;
467
467
  outputFormat: z.ZodOptional<z.ZodArray<z.ZodEnum<{
468
- cjs: "cjs";
469
468
  esm: "esm";
469
+ cjs: "cjs";
470
470
  }>>>;
471
471
  cache: z.ZodOptional<z.ZodBoolean>;
472
472
  require: z.ZodOptional<z.ZodUnknown>;
@@ -25,7 +25,7 @@ declare const formatNodeTypeToEnvVar: (nodeTypes: string[], addProcessEnv?: bool
25
25
  * getConfigEnvVars(config, true)
26
26
  * // { 'process.env.INTLAYER_ROUTING_MODE': '"prefix-no-default"', ... }
27
27
  */
28
- declare const getConfigEnvVars: (config: IntlayerConfig, addProcessEnv?: boolean) => Record<string, string>;
28
+ declare const getConfigEnvVars: (config: IntlayerConfig, addProcessEnv?: boolean, wrapValue?: (value: string) => string) => Record<string, string>;
29
29
  //#endregion
30
30
  export { formatNodeTypeToEnvVar, getConfigEnvVars };
31
31
  //# sourceMappingURL=envVars.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"envVars.d.ts","names":[],"sources":["../../../src/envVars/envVars.ts"],"mappings":";;;;;AAaA;;;;;;;;;cAAa,sBAAA,GACX,SAAA,YACA,aAAA,eACC,MAAA;;;;;;;;;;;;;cAyBU,gBAAA,GACX,MAAA,EAAQ,cAAA,EACR,aAAA,eACC,MAAA"}
1
+ {"version":3,"file":"envVars.d.ts","names":[],"sources":["../../../src/envVars/envVars.ts"],"mappings":";;;;;AAaA;;;;;;;;;cAAa,sBAAA,GACX,SAAA,YACA,aAAA,eACC,MAAA;;;;;;;;;;;;;cAyBU,gBAAA,GACX,MAAA,EAAQ,cAAA,EACR,aAAA,YACA,SAAA,IAAY,KAAA,wBACX,MAAA"}
@@ -19,7 +19,7 @@ declare const spinnerFrames: string[];
19
19
  * It allows overriding the default configuration by passing a config object in the details parameter.
20
20
  * The configuration is merged with the default configuration from the intlayer config file.
21
21
  */
22
- declare const getAppLogger: (configuration?: IntlayerConfig, globalDetails?: Details) => (content: any, details?: Details) => void;
22
+ declare const getAppLogger: (configuration?: Pick<IntlayerConfig, "log">, globalDetails?: Details) => (content: any, details?: Details) => void;
23
23
  declare const colorize: (string: string, color?: ANSIColorsType, reset?: boolean | ANSIColorsType) => string;
24
24
  declare const colorizeLocales: (locales: Locale | Locale[], color?: ANSIColorsType, reset?: boolean | ANSIColorsType) => string;
25
25
  declare const colorizeKey: (keyPath: string | string[], color?: ANSIColorsType, reset?: boolean | ANSIColorsType) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","names":[],"sources":["../../src/logger.ts"],"mappings":";;;;;KAQY,cAAA,WACF,gBAAA,eAA8B,gBAAA;AAAA,KAE5B,OAAA;EACV,SAAA;EACA,KAAA;EACA,MAAA,GAAS,oBAAA;AAAA;AAAA,KAGC,MAAA,IAAU,OAAA,OAAc,OAAA,GAAU,OAAA;AAAA,cAIjC,SAAA,GAAa,MAAA;AAAA,cAIb,SAAA,GAAa,YAAA;AAAA,cAQb,MAAA,EAAQ,MAAA;AAAA,cAgBR,aAAA;;;;;;cAOA,YAAA,GACV,aAAA,GAAgB,cAAA,EAAgB,aAAA,GAAgB,OAAA,MAChD,OAAA,OAAc,OAAA,GAAU,OAAA;AAAA,cAUd,QAAA,GACX,MAAA,UACA,KAAA,GAAQ,cAAA,EACR,KAAA,aAAkB,cAAA;AAAA,cAMP,eAAA,GACX,OAAA,EAAS,MAAA,GAAS,MAAA,IAClB,KAAA,GAAO,cAAA,EACP,KAAA,aAAiB,cAAA;AAAA,cAON,WAAA,GACX,O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GACX,MAAA,mBACA,OAAA,GAAS,OAAA,CAAQ,MAAA,CAAO,IAAA,CAAK,cAAA,EAAgB,cAAA;AAAA,cAqBlC,WAAA,GAAe,IAAA;;;;AA7G5B;;;cAsJa,KAAA,GACX,IAAA,qBACA,OAAA;EACE,OAAA;EACA,OAAA;EACA,OAAA;EACA,GAAA;EACA,OAAA;AAAA;AAAA,cAyBS,CAAA;AAAA,cACA,CAAA;AAAA,cACA,KAAA"}
@@ -3,4 +3,5 @@ import { buildConfigurationFields } from "./configFile/buildConfigurationFields.
3
3
  import { aiSchema, buildSchema, compilerSchema, contentSchema, cookiesAttributesSchema, dictionarySchema, editorSchema, internationalizationSchema, intlayerConfigSchema, logSchema, rewriteObjectSchema, rewriteRuleSchema, rewriteRulesSchema, routingSchema, storageAttributesSchema, storageSchema, systemSchema } from "./configFile/configurationSchema.js";
4
4
  import { GetConfigurationAndFilePathResult, GetConfigurationOptions, getConfiguration, getConfigurationAndFilePath } from "./configFile/getConfiguration.js";
5
5
  import { configurationFilesCandidates, searchConfigurationFile } from "./configFile/searchConfigurationFile.js";
6
- export { BrowserIntlayerConfig, GetConfigurationAndFilePathResult, GetConfigurationOptions, aiSchema, buildBrowserConfiguration, buildConfigurationFields, buildEditorFields, buildInternationalizationFields, buildLogFields, buildRoutingFields, buildSchema, compilerSchema, configurationFilesCandidates, contentSchema, cookiesAttributesSchema, dictionarySchema, editorSchema, extractBrowserConfiguration, getConfiguration, getConfigurationAndFilePath, internationalizationSchema, intlayerConfigSchema, logSchema, rewriteObjectSchema, rewriteRuleSchema, rewriteRulesSchema, routingSchema, searchConfigurationFile, storageAttributesSchema, storageSchema, systemSchema };
6
+ import { GetImportMapOptions, ImportMap, getImportMap, getImportMapContent, getImportMapScript } from "./utils/importMap.js";
7
+ export { BrowserIntlayerConfig, GetConfigurationAndFilePathResult, GetConfigurationOptions, GetImportMapOptions, ImportMap, aiSchema, buildBrowserConfiguration, buildConfigurationFields, buildEditorFields, buildInternationalizationFields, buildLogFields, buildRoutingFields, buildSchema, compilerSchema, configurationFilesCandidates, contentSchema, cookiesAttributesSchema, dictionarySchema, editorSchema, extractBrowserConfiguration, getConfiguration, getConfigurationAndFilePath, getImportMap, getImportMapContent, getImportMapScript, internationalizationSchema, intlayerConfigSchema, logSchema, rewriteObjectSchema, rewriteRuleSchema, rewriteRulesSchema, routingSchema, searchConfigurationFile, storageAttributesSchema, storageSchema, systemSchema };
@@ -1 +1 @@
1
- {"version":3,"file":"getStorageAttributes.d.ts","names":[],"sources":["../../../src/utils/getStorageAttributes.ts"],"mappings":";;;;;AA0JA;;;;;cAAa,oBAAA,GACX,OAAA,EAAS,mBAAA,KACR,0BAAA"}
1
+ {"version":3,"file":"getStorageAttributes.d.ts","names":[],"sources":["../../../src/utils/getStorageAttributes.ts"],"mappings":";;;;;AA6JA;;;;;cAAa,oBAAA,GACX,OAAA,EAAS,mBAAA,KACR,0BAAA"}
@@ -0,0 +1,85 @@
1
+ import { IntlayerConfig } from "@intlayer/types/config";
2
+
3
+ //#region src/utils/importMap.d.ts
4
+ type GetImportMapOptions = {
5
+ configuration: IntlayerConfig;
6
+ /**
7
+ * Extra module specifier → URL mappings to merge into the import map.
8
+ * Use this to add paths for top-level packages (e.g. `intlayer`, `vanilla-intlayer`)
9
+ * that are not generated by Intlayer's build step.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * {
14
+ * extraImports: {
15
+ * 'intlayer': './node_modules/intlayer/dist/index.mjs',
16
+ * 'vanilla-intlayer': './node_modules/vanilla-intlayer/dist/index.mjs',
17
+ * }
18
+ * }
19
+ * ```
20
+ */
21
+ extraImports?: Record<string, string>;
22
+ };
23
+ type ImportMap = {
24
+ imports: Record<string, string>;
25
+ };
26
+ /**
27
+ * Generates a browser-native import map object from the Intlayer configuration.
28
+ *
29
+ * The import map resolves bare module specifiers (e.g. `@intlayer/dictionaries-entry`)
30
+ * to their physical `.mjs` file paths relative to the project root, replicating
31
+ * what a bundler's `alias` plugin would do.
32
+ *
33
+ * Paths are always forced to ESM (`.mjs`) and prefixed with `./` so they are
34
+ * valid relative URL references for the browser.
35
+ *
36
+ * @example
37
+ * ```json
38
+ * {
39
+ * "imports": {
40
+ * "@intlayer/dictionaries-entry": "./.intlayer/main/dictionaries.mjs",
41
+ * "@intlayer/unmerged-dictionaries-entry": "./.intlayer/main/unmerged_dictionaries.mjs",
42
+ * "@intlayer/remote-dictionaries-entry": "./.intlayer/main/remote_dictionaries.mjs",
43
+ * "@intlayer/dynamic-dictionaries-entry": "./.intlayer/main/dynamic_dictionaries.mjs",
44
+ * "@intlayer/fetch-dictionaries-entry": "./.intlayer/main/fetch_dictionaries.mjs",
45
+ * "@intlayer/config/built": "./.intlayer/config/configuration.mjs"
46
+ * }
47
+ * }
48
+ * ```
49
+ */
50
+ declare const getImportMap: ({
51
+ configuration,
52
+ extraImports
53
+ }: GetImportMapOptions) => ImportMap;
54
+ /**
55
+ * Returns the JSON string representation of the import map.
56
+ *
57
+ * Can be embedded directly as the content of a `<script type="importmap">` tag,
58
+ * or written to a standalone `.importmap` file and referenced via
59
+ * `<script type="importmap" src="./importmap.json">`.
60
+ */
61
+ declare const getImportMapContent: (options: GetImportMapOptions) => string;
62
+ /**
63
+ * Generates a complete `<script type="importmap">` HTML element string.
64
+ *
65
+ * Inject this into your HTML `<head>` **before** any `<script type="module">`
66
+ * tags to enable bare module specifier resolution without a bundler.
67
+ *
68
+ * Prerequisites:
69
+ * - Run `npx intlayer build` so the `.intlayer` folder is populated.
70
+ * - Your static server must serve the `.intlayer` directory.
71
+ *
72
+ * @example
73
+ * ```html
74
+ * <!DOCTYPE html>
75
+ * <html lang="en">
76
+ * <head>
77
+ * <!-- generated output goes here, before any module scripts -->
78
+ * <script type="module" src="./src/main.js"></script>
79
+ * </head>
80
+ * ```
81
+ */
82
+ declare const getImportMapScript: (options: GetImportMapOptions) => string;
83
+ //#endregion
84
+ export { GetImportMapOptions, ImportMap, getImportMap, getImportMapContent, getImportMapScript };
85
+ //# sourceMappingURL=importMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importMap.d.ts","names":[],"sources":["../../../src/utils/importMap.ts"],"mappings":";;;KAGY,mBAAA;EACV,aAAA,EAAe,cAAA;EADL;;;;;;;;;;AAoBZ;;;;;EAHE,YAAA,GAAe,MAAA;AAAA;AAAA,KAGL,SAAA;EACV,OAAA,EAAS,MAAA;AAAA;;;;;;;;;;;;;AAoDX;;;;;AAuBA;;;;;;;cAhDa,YAAA;EAAgB,aAAA;EAAA;AAAA,GAG1B,mBAAA,KAAsB,SAAA;;;;;;;;cAsBZ,mBAAA,GAAuB,OAAA,EAAS,mBAAA;;;;;;;;;;;;;;;;;;;;;cAuBhC,kBAAA,GAAsB,OAAA,EAAS,mBAAA"}
@@ -1,10 +1,12 @@
1
1
  import { extractErrorMessage } from "./extractErrorMessage.js";
2
2
  import { logStack } from "./logStack.js";
3
3
  import { normalizePath } from "./normalizePath.js";
4
+ import { WindowsWithIntlayer, setIntlayerIdentifier } from "./setIntlayerIdentifier.js";
4
5
  import { camelCaseToKebabCase } from "./stringFormatter/camelCaseToKebabCase.js";
5
6
  import { camelCaseToSentence } from "./stringFormatter/camelCaseToSentence.js";
6
7
  import { kebabCaseToCamelCase } from "./stringFormatter/kebabCaseToCamelCase.js";
7
8
  import { toLowerCamelCase } from "./stringFormatter/toLowerCamelCase.js";
9
+ import { GetImportMapOptions, ImportMap, getImportMap, getImportMapContent, getImportMapScript } from "./importMap.js";
8
10
  import { configESMxCJSRequire, getProjectRequire, isESModule } from "./ESMxCJSHelpers.js";
9
11
  import { GetAliasOptions, getAlias } from "./alias.js";
10
12
  import { CacheKey, cacheMemory, clearAllCache, clearCache, computeKeyId, getCache, setCache, stableStringify } from "./cacheMemory.js";
@@ -17,4 +19,4 @@ import { getStorageAttributes } from "./getStorageAttributes.js";
17
19
  import { PluginNodeType, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync } from "./getUsedNodeTypes.js";
18
20
  import { parseFilePathPattern, parseStringPattern } from "./parseFilePathPattern.js";
19
21
  import { RetryManagerOptions, retryManager } from "./retryManager.js";
20
- export { CacheKey, GetAliasOptions, PluginNodeType, RetryManagerOptions, cacheDisk, cacheMemory, camelCaseToKebabCase, camelCaseToSentence, clearAllCache, clearCache, clearDiskCacheMemory, clearModuleCache, compareVersions, computeKeyId, configESMxCJSRequire, extractErrorMessage, getAlias, getCache, getExtension, getPackageJsonPath, getProjectRequire, getStorageAttributes, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync, isESModule, kebabCaseToCamelCase, logStack, normalizePath, parseFilePathPattern, parseStringPattern, retryManager, setCache, stableStringify, toLowerCamelCase };
22
+ export { CacheKey, GetAliasOptions, GetImportMapOptions, ImportMap, PluginNodeType, RetryManagerOptions, WindowsWithIntlayer, cacheDisk, cacheMemory, camelCaseToKebabCase, camelCaseToSentence, clearAllCache, clearCache, clearDiskCacheMemory, clearModuleCache, compareVersions, computeKeyId, configESMxCJSRequire, extractErrorMessage, getAlias, getCache, getExtension, getImportMap, getImportMapContent, getImportMapScript, getPackageJsonPath, getProjectRequire, getStorageAttributes, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync, isESModule, kebabCaseToCamelCase, logStack, normalizePath, parseFilePathPattern, parseStringPattern, retryManager, setCache, setIntlayerIdentifier, stableStringify, toLowerCamelCase };
@@ -0,0 +1,15 @@
1
+ //#region src/utils/setIntlayerIdentifier.d.ts
2
+ type Meta = {
3
+ enabled: true;
4
+ };
5
+ type WindowsWithIntlayer = typeof window & {
6
+ intlayer?: Meta;
7
+ };
8
+ /**
9
+ * Sets the version of Intlayer in the window object.
10
+ * This is used for Intlayer detection in the browser.
11
+ */
12
+ declare const setIntlayerIdentifier: () => void;
13
+ //#endregion
14
+ export { WindowsWithIntlayer, setIntlayerIdentifier };
15
+ //# sourceMappingURL=setIntlayerIdentifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setIntlayerIdentifier.d.ts","names":[],"sources":["../../../src/utils/setIntlayerIdentifier.ts"],"mappings":";KAAK,IAAA;EACH,OAAA;AAAA;AAAA,KAGU,mBAAA,UAA6B,MAAA;EACvC,QAAA,GAAW,IAAA;AAAA;AADb;;;;AAAA,cAQa,qBAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/config",
3
- "version": "8.6.3",
3
+ "version": "8.6.4",
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": [
@@ -152,7 +152,7 @@
152
152
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
153
153
  },
154
154
  "dependencies": {
155
- "@intlayer/types": "8.6.3",
155
+ "@intlayer/types": "8.6.4",
156
156
  "defu": "6.1.4",
157
157
  "dotenv": "17.3.1",
158
158
  "esbuild": "0.27.4",