@intlayer/config 8.4.4 → 8.4.5
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/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/cjs/built.cjs +7 -1
- package/dist/cjs/built.cjs.map +1 -1
- package/dist/cjs/client.cjs +16 -1
- package/dist/cjs/colors.cjs +33 -1
- package/dist/cjs/colors.cjs.map +1 -1
- package/dist/cjs/configFile/buildConfigurationFields.cjs +199 -1
- package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
- package/dist/cjs/configFile/configurationSchema.cjs +210 -1
- package/dist/cjs/configFile/configurationSchema.cjs.map +1 -1
- package/dist/cjs/configFile/getConfiguration.cjs +69 -1
- package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
- package/dist/cjs/configFile/index.cjs +28 -1
- package/dist/cjs/configFile/loadConfigurationFile.cjs +30 -1
- package/dist/cjs/configFile/loadConfigurationFile.cjs.map +1 -1
- package/dist/cjs/configFile/searchConfigurationFile.cjs +53 -1
- package/dist/cjs/configFile/searchConfigurationFile.cjs.map +1 -1
- package/dist/cjs/defaultValues/build.cjs +35 -1
- package/dist/cjs/defaultValues/build.cjs.map +1 -1
- package/dist/cjs/defaultValues/compiler.cjs +13 -1
- package/dist/cjs/defaultValues/compiler.cjs.map +1 -1
- package/dist/cjs/defaultValues/content.cjs +40 -1
- package/dist/cjs/defaultValues/content.cjs.map +1 -1
- package/dist/cjs/defaultValues/dictionary.cjs +13 -1
- package/dist/cjs/defaultValues/dictionary.cjs.map +1 -1
- package/dist/cjs/defaultValues/editor.cjs +23 -1
- package/dist/cjs/defaultValues/editor.cjs.map +1 -1
- package/dist/cjs/defaultValues/index.cjs +66 -1
- package/dist/cjs/defaultValues/internationalization.cjs +15 -1
- package/dist/cjs/defaultValues/internationalization.cjs.map +1 -1
- package/dist/cjs/defaultValues/log.cjs +10 -1
- package/dist/cjs/defaultValues/log.cjs.map +1 -1
- package/dist/cjs/defaultValues/routing.cjs +19 -1
- package/dist/cjs/defaultValues/routing.cjs.map +1 -1
- package/dist/cjs/defaultValues/system.cjs +29 -1
- package/dist/cjs/defaultValues/system.cjs.map +1 -1
- package/dist/cjs/loadEnvFile.cjs +31 -1
- package/dist/cjs/loadEnvFile.cjs.map +1 -1
- package/dist/cjs/loadExternalFile/bundleFile.cjs +71 -1
- package/dist/cjs/loadExternalFile/bundleFile.cjs.map +1 -1
- package/dist/cjs/loadExternalFile/bundleJSFile.cjs +33 -1
- package/dist/cjs/loadExternalFile/bundleJSFile.cjs.map +1 -1
- package/dist/cjs/loadExternalFile/index.cjs +17 -1
- package/dist/cjs/loadExternalFile/loadExternalFile.cjs +77 -1
- package/dist/cjs/loadExternalFile/loadExternalFile.cjs.map +1 -1
- package/dist/cjs/loadExternalFile/parseFileContent.cjs +77 -1
- package/dist/cjs/loadExternalFile/parseFileContent.cjs.map +1 -1
- package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs +67 -1
- package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs.map +1 -1
- package/dist/cjs/logger.cjs +133 -1
- package/dist/cjs/logger.cjs.map +1 -1
- package/dist/cjs/node.cjs +28 -1
- package/dist/cjs/utils/ESMxCJSHelpers.cjs +27 -1
- package/dist/cjs/utils/ESMxCJSHelpers.cjs.map +1 -1
- package/dist/cjs/utils/alias.cjs +29 -1
- package/dist/cjs/utils/alias.cjs.map +1 -1
- package/dist/cjs/utils/cacheDisk.cjs +173 -1
- package/dist/cjs/utils/cacheDisk.cjs.map +1 -1
- package/dist/cjs/utils/cacheMemory.cjs +269 -1
- package/dist/cjs/utils/cacheMemory.cjs.map +1 -1
- package/dist/cjs/utils/clearModuleCache.cjs +26 -1
- package/dist/cjs/utils/clearModuleCache.cjs.map +1 -1
- package/dist/cjs/utils/compareVersions.cjs +38 -1
- package/dist/cjs/utils/compareVersions.cjs.map +1 -1
- package/dist/cjs/utils/extractErrorMessage.cjs +95 -1
- package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -1
- package/dist/cjs/utils/getExtension.cjs +14 -1
- package/dist/cjs/utils/getExtension.cjs.map +1 -1
- package/dist/cjs/utils/getPackageJsonPath.cjs +33 -1
- package/dist/cjs/utils/getPackageJsonPath.cjs.map +1 -1
- package/dist/cjs/utils/index.cjs +45 -1
- package/dist/cjs/utils/logStack.cjs +17 -1
- package/dist/cjs/utils/logStack.cjs.map +1 -1
- package/dist/cjs/utils/normalizePath.cjs +17 -1
- package/dist/cjs/utils/normalizePath.cjs.map +1 -1
- package/dist/cjs/utils/parseFilePathPattern.cjs +24 -1
- package/dist/cjs/utils/parseFilePathPattern.cjs.map +1 -1
- package/dist/cjs/utils/retryManager.cjs +45 -1
- package/dist/cjs/utils/retryManager.cjs.map +1 -1
- package/dist/cjs/utils/stringFormatter/camelCaseToKebabCase.cjs +13 -1
- package/dist/cjs/utils/stringFormatter/camelCaseToKebabCase.cjs.map +1 -1
- package/dist/cjs/utils/stringFormatter/camelCaseToSentence.cjs +16 -1
- package/dist/cjs/utils/stringFormatter/camelCaseToSentence.cjs.map +1 -1
- package/dist/cjs/utils/stringFormatter/index.cjs +10 -1
- package/dist/cjs/utils/stringFormatter/kebabCaseToCamelCase.cjs +14 -1
- package/dist/cjs/utils/stringFormatter/kebabCaseToCamelCase.cjs.map +1 -1
- package/dist/cjs/utils/stringFormatter/toLowerCamelCase.cjs +19 -1
- package/dist/cjs/utils/stringFormatter/toLowerCamelCase.cjs.map +1 -1
- package/dist/esm/_virtual/_rolldown/runtime.mjs +8 -0
- package/dist/esm/built.mjs +7 -1
- package/dist/esm/built.mjs.map +1 -1
- package/dist/esm/client.mjs +9 -1
- package/dist/esm/colors.mjs +18 -1
- package/dist/esm/colors.mjs.map +1 -1
- package/dist/esm/configFile/buildConfigurationFields.mjs +197 -1
- package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
- package/dist/esm/configFile/configurationSchema.mjs +191 -1
- package/dist/esm/configFile/configurationSchema.mjs.map +1 -1
- package/dist/esm/configFile/getConfiguration.mjs +66 -1
- package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
- package/dist/esm/configFile/index.mjs +6 -1
- package/dist/esm/configFile/loadConfigurationFile.mjs +29 -1
- package/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -1
- package/dist/esm/configFile/searchConfigurationFile.mjs +50 -1
- package/dist/esm/configFile/searchConfigurationFile.mjs.map +1 -1
- package/dist/esm/defaultValues/build.mjs +28 -1
- package/dist/esm/defaultValues/build.mjs.map +1 -1
- package/dist/esm/defaultValues/compiler.mjs +8 -1
- package/dist/esm/defaultValues/compiler.mjs.map +1 -1
- package/dist/esm/defaultValues/content.mjs +32 -1
- package/dist/esm/defaultValues/content.mjs.map +1 -1
- package/dist/esm/defaultValues/dictionary.mjs +8 -1
- package/dist/esm/defaultValues/dictionary.mjs.map +1 -1
- package/dist/esm/defaultValues/editor.mjs +13 -1
- package/dist/esm/defaultValues/editor.mjs.map +1 -1
- package/dist/esm/defaultValues/index.mjs +11 -1
- package/dist/esm/defaultValues/internationalization.mjs +10 -1
- package/dist/esm/defaultValues/internationalization.mjs.map +1 -1
- package/dist/esm/defaultValues/log.mjs +8 -1
- package/dist/esm/defaultValues/log.mjs.map +1 -1
- package/dist/esm/defaultValues/routing.mjs +11 -1
- package/dist/esm/defaultValues/routing.mjs.map +1 -1
- package/dist/esm/defaultValues/system.mjs +16 -1
- package/dist/esm/defaultValues/system.mjs.map +1 -1
- package/dist/esm/loadEnvFile.mjs +27 -1
- package/dist/esm/loadEnvFile.mjs.map +1 -1
- package/dist/esm/loadExternalFile/bundleFile.mjs +67 -1
- package/dist/esm/loadExternalFile/bundleFile.mjs.map +1 -1
- package/dist/esm/loadExternalFile/bundleJSFile.mjs +31 -1
- package/dist/esm/loadExternalFile/bundleJSFile.mjs.map +1 -1
- package/dist/esm/loadExternalFile/index.mjs +7 -1
- package/dist/esm/loadExternalFile/loadExternalFile.mjs +73 -1
- package/dist/esm/loadExternalFile/loadExternalFile.mjs.map +1 -1
- package/dist/esm/loadExternalFile/parseFileContent.mjs +73 -1
- package/dist/esm/loadExternalFile/parseFileContent.mjs.map +1 -1
- package/dist/esm/loadExternalFile/transpileTSToCJS.mjs +64 -1
- package/dist/esm/loadExternalFile/transpileTSToCJS.mjs.map +1 -1
- package/dist/esm/logger.mjs +118 -1
- package/dist/esm/logger.mjs.map +1 -1
- package/dist/esm/node.mjs +6 -1
- package/dist/esm/utils/ESMxCJSHelpers.mjs +25 -1
- package/dist/esm/utils/ESMxCJSHelpers.mjs.map +1 -0
- package/dist/esm/utils/alias.mjs +27 -1
- package/dist/esm/utils/alias.mjs.map +1 -1
- package/dist/esm/utils/cacheDisk.mjs +170 -1
- package/dist/esm/utils/cacheDisk.mjs.map +1 -1
- package/dist/esm/utils/cacheMemory.mjs +261 -1
- package/dist/esm/utils/cacheMemory.mjs.map +1 -1
- package/dist/esm/utils/clearModuleCache.mjs +25 -1
- package/dist/esm/utils/clearModuleCache.mjs.map +1 -1
- package/dist/esm/utils/compareVersions.mjs +36 -1
- package/dist/esm/utils/compareVersions.mjs.map +1 -1
- package/dist/esm/utils/extractErrorMessage.mjs +93 -1
- package/dist/esm/utils/extractErrorMessage.mjs.map +1 -1
- package/dist/esm/utils/getExtension.mjs +12 -1
- package/dist/esm/utils/getExtension.mjs.map +1 -1
- package/dist/esm/utils/getPackageJsonPath.mjs +31 -1
- package/dist/esm/utils/getPackageJsonPath.mjs.map +1 -1
- package/dist/esm/utils/index.mjs +19 -1
- package/dist/esm/utils/logStack.mjs +16 -1
- package/dist/esm/utils/logStack.mjs.map +1 -1
- package/dist/esm/utils/normalizePath.mjs +15 -1
- package/dist/esm/utils/normalizePath.mjs.map +1 -1
- package/dist/esm/utils/parseFilePathPattern.mjs +21 -1
- package/dist/esm/utils/parseFilePathPattern.mjs.map +1 -1
- package/dist/esm/utils/retryManager.mjs +44 -1
- package/dist/esm/utils/retryManager.mjs.map +1 -1
- package/dist/esm/utils/stringFormatter/camelCaseToKebabCase.mjs +11 -1
- package/dist/esm/utils/stringFormatter/camelCaseToKebabCase.mjs.map +1 -1
- package/dist/esm/utils/stringFormatter/camelCaseToSentence.mjs +14 -1
- package/dist/esm/utils/stringFormatter/camelCaseToSentence.mjs.map +1 -1
- package/dist/esm/utils/stringFormatter/index.mjs +6 -1
- package/dist/esm/utils/stringFormatter/kebabCaseToCamelCase.mjs +12 -1
- package/dist/esm/utils/stringFormatter/kebabCaseToCamelCase.mjs.map +1 -1
- package/dist/esm/utils/stringFormatter/toLowerCamelCase.mjs +17 -1
- package/dist/esm/utils/stringFormatter/toLowerCamelCase.mjs.map +1 -1
- package/dist/types/client.d.ts +4 -4
- package/dist/types/colors.d.ts +20 -2
- package/dist/types/colors.d.ts.map +1 -0
- package/dist/types/configFile/buildConfigurationFields.d.ts.map +1 -1
- package/dist/types/configFile/configurationSchema.d.ts +1 -1
- package/dist/types/configFile/getConfiguration.d.ts +2 -2
- package/dist/types/configFile/loadConfigurationFile.d.ts +1 -1
- package/dist/types/configFile/loadConfigurationFile.d.ts.map +1 -1
- package/dist/types/loadEnvFile.d.ts +10 -2
- package/dist/types/loadEnvFile.d.ts.map +1 -0
- package/dist/types/loadExternalFile/index.d.ts +3 -3
- package/dist/types/loadExternalFile/loadExternalFile.d.ts +25 -2
- package/dist/types/loadExternalFile/loadExternalFile.d.ts.map +1 -0
- package/dist/types/loadExternalFile/parseFileContent.d.ts +29 -2
- package/dist/types/loadExternalFile/parseFileContent.d.ts.map +1 -0
- package/dist/types/loadExternalFile/transpileTSToCJS.d.ts +19 -2
- package/dist/types/loadExternalFile/transpileTSToCJS.d.ts.map +1 -0
- package/dist/types/logger.d.ts +1 -1
- package/dist/types/utils/index.d.ts +4 -4
- package/dist/types/utils/stringFormatter/camelCaseToKebabCase.d.ts +9 -2
- package/dist/types/utils/stringFormatter/camelCaseToKebabCase.d.ts.map +1 -0
- package/dist/types/utils/stringFormatter/camelCaseToSentence.d.ts +9 -2
- package/dist/types/utils/stringFormatter/camelCaseToSentence.d.ts.map +1 -0
- package/dist/types/utils/stringFormatter/index.d.ts +4 -4
- package/dist/types/utils/stringFormatter/kebabCaseToCamelCase.d.ts +5 -2
- package/dist/types/utils/stringFormatter/kebabCaseToCamelCase.d.ts.map +1 -0
- package/dist/types/utils/stringFormatter/toLowerCamelCase.d.ts +10 -2
- package/dist/types/utils/stringFormatter/toLowerCamelCase.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/cjs/chunk-Bmb41Sf3.cjs +0 -1
- package/dist/esm/ESMxCJSHelpers-BAuqwNXV.mjs +0 -2
- package/dist/esm/ESMxCJSHelpers-BAuqwNXV.mjs.map +0 -1
- package/dist/types/camelCaseToKebabCase-BV_lLJHR.d.ts +0 -9
- package/dist/types/camelCaseToKebabCase-BV_lLJHR.d.ts.map +0 -1
- package/dist/types/camelCaseToSentence-DAbbkwe6.d.ts +0 -9
- package/dist/types/camelCaseToSentence-DAbbkwe6.d.ts.map +0 -1
- package/dist/types/colors-BbZeGWYU.d.ts +0 -20
- package/dist/types/colors-BbZeGWYU.d.ts.map +0 -1
- package/dist/types/kebabCaseToCamelCase-h9PkNVuO.d.ts +0 -5
- package/dist/types/kebabCaseToCamelCase-h9PkNVuO.d.ts.map +0 -1
- package/dist/types/loadEnvFile-BiTBX4fe.d.ts +0 -10
- package/dist/types/loadEnvFile-BiTBX4fe.d.ts.map +0 -1
- package/dist/types/loadExternalFile-DmM_TGcA.d.ts +0 -25
- package/dist/types/loadExternalFile-DmM_TGcA.d.ts.map +0 -1
- package/dist/types/parseFileContent--o_QlW5j.d.ts +0 -29
- package/dist/types/parseFileContent--o_QlW5j.d.ts.map +0 -1
- package/dist/types/toLowerCamelCase-DUdT00I1.d.ts +0 -10
- package/dist/types/toLowerCamelCase-DUdT00I1.d.ts.map +0 -1
- package/dist/types/transpileTSToCJS-OifpV3zk.d.ts +0 -19
- package/dist/types/transpileTSToCJS-OifpV3zk.d.ts.map +0 -1
|
@@ -1,2 +1,192 @@
|
|
|
1
|
-
import{AiProviders
|
|
1
|
+
import { AiProviders } from "@intlayer/types/config";
|
|
2
|
+
import z from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/configFile/configurationSchema.ts
|
|
5
|
+
const internationalizationSchema = z.object({
|
|
6
|
+
locales: z.array(z.string()).min(1),
|
|
7
|
+
requiredLocales: z.array(z.string()).optional(),
|
|
8
|
+
strictMode: z.enum([
|
|
9
|
+
"strict",
|
|
10
|
+
"inclusive",
|
|
11
|
+
"loose"
|
|
12
|
+
]).optional(),
|
|
13
|
+
defaultLocale: z.string().optional()
|
|
14
|
+
});
|
|
15
|
+
const cookiesAttributesSchema = z.object({
|
|
16
|
+
type: z.literal("cookie"),
|
|
17
|
+
name: z.string().optional(),
|
|
18
|
+
domain: z.string().optional(),
|
|
19
|
+
path: z.string().optional(),
|
|
20
|
+
secure: z.boolean().optional(),
|
|
21
|
+
httpOnly: z.boolean().optional(),
|
|
22
|
+
sameSite: z.enum([
|
|
23
|
+
"strict",
|
|
24
|
+
"lax",
|
|
25
|
+
"none"
|
|
26
|
+
]).optional(),
|
|
27
|
+
expires: z.union([z.date(), z.number()]).optional()
|
|
28
|
+
});
|
|
29
|
+
const storageAttributesSchema = z.object({
|
|
30
|
+
type: z.enum([
|
|
31
|
+
"localStorage",
|
|
32
|
+
"sessionStorage",
|
|
33
|
+
"header"
|
|
34
|
+
]),
|
|
35
|
+
name: z.string().optional()
|
|
36
|
+
});
|
|
37
|
+
const storageSchema = z.union([
|
|
38
|
+
z.literal(false),
|
|
39
|
+
z.enum([
|
|
40
|
+
"cookie",
|
|
41
|
+
"localStorage",
|
|
42
|
+
"sessionStorage",
|
|
43
|
+
"header"
|
|
44
|
+
]),
|
|
45
|
+
cookiesAttributesSchema,
|
|
46
|
+
storageAttributesSchema,
|
|
47
|
+
z.array(z.union([
|
|
48
|
+
z.enum([
|
|
49
|
+
"cookie",
|
|
50
|
+
"localStorage",
|
|
51
|
+
"sessionStorage",
|
|
52
|
+
"header"
|
|
53
|
+
]),
|
|
54
|
+
cookiesAttributesSchema,
|
|
55
|
+
storageAttributesSchema
|
|
56
|
+
]))
|
|
57
|
+
]);
|
|
58
|
+
const rewriteRuleSchema = z.object({
|
|
59
|
+
canonical: z.string(),
|
|
60
|
+
localized: z.record(z.string(), z.string())
|
|
61
|
+
});
|
|
62
|
+
const rewriteRulesSchema = z.object({ rules: z.array(rewriteRuleSchema) });
|
|
63
|
+
const rewriteObjectSchema = z.object({
|
|
64
|
+
url: rewriteRulesSchema,
|
|
65
|
+
nextjs: rewriteRulesSchema.optional(),
|
|
66
|
+
vite: rewriteRulesSchema.optional()
|
|
67
|
+
});
|
|
68
|
+
const routingSchema = z.object({
|
|
69
|
+
rewrite: z.union([z.record(z.string(), z.record(z.string(), z.string())), rewriteObjectSchema]).optional(),
|
|
70
|
+
mode: z.enum([
|
|
71
|
+
"prefix-no-default",
|
|
72
|
+
"prefix-all",
|
|
73
|
+
"no-prefix",
|
|
74
|
+
"search-params"
|
|
75
|
+
]).optional(),
|
|
76
|
+
storage: storageSchema.optional(),
|
|
77
|
+
basePath: z.string().optional()
|
|
78
|
+
});
|
|
79
|
+
const systemSchema = z.object({
|
|
80
|
+
baseDir: z.string().optional(),
|
|
81
|
+
moduleAugmentationDir: z.string().optional(),
|
|
82
|
+
unmergedDictionariesDir: z.string().optional(),
|
|
83
|
+
remoteDictionariesDir: z.string().optional(),
|
|
84
|
+
dictionariesDir: z.string().optional(),
|
|
85
|
+
dynamicDictionariesDir: z.string().optional(),
|
|
86
|
+
fetchDictionariesDir: z.string().optional(),
|
|
87
|
+
typesDir: z.string().optional(),
|
|
88
|
+
mainDir: z.string().optional(),
|
|
89
|
+
configDir: z.string().optional(),
|
|
90
|
+
cacheDir: z.string().optional(),
|
|
91
|
+
tempDir: z.string().optional()
|
|
92
|
+
});
|
|
93
|
+
const contentSchema = z.object({
|
|
94
|
+
fileExtensions: z.array(z.string()).optional(),
|
|
95
|
+
contentDir: z.array(z.string()).optional(),
|
|
96
|
+
codeDir: z.array(z.string()).optional(),
|
|
97
|
+
excludedPath: z.array(z.string()).optional(),
|
|
98
|
+
watch: z.boolean().optional(),
|
|
99
|
+
formatCommand: z.string().optional()
|
|
100
|
+
});
|
|
101
|
+
const editorSchema = z.object({
|
|
102
|
+
applicationURL: z.union([z.url(), z.literal("")]).optional(),
|
|
103
|
+
editorURL: z.union([z.url(), z.literal("")]).optional(),
|
|
104
|
+
cmsURL: z.union([z.url(), z.literal("")]).optional(),
|
|
105
|
+
backendURL: z.union([z.url(), z.literal("")]).optional(),
|
|
106
|
+
port: z.number().int().positive().max(65535).optional(),
|
|
107
|
+
enabled: z.boolean().optional(),
|
|
108
|
+
clientId: z.string().optional(),
|
|
109
|
+
clientSecret: z.string().optional(),
|
|
110
|
+
dictionaryPriorityStrategy: z.enum(["local_first", "distant_first"]).optional(),
|
|
111
|
+
liveSync: z.boolean().optional(),
|
|
112
|
+
liveSyncPort: z.number().int().positive().max(65535).optional(),
|
|
113
|
+
liveSyncURL: z.union([z.url(), z.literal("")]).optional()
|
|
114
|
+
});
|
|
115
|
+
const logSchema = z.object({
|
|
116
|
+
mode: z.enum([
|
|
117
|
+
"default",
|
|
118
|
+
"verbose",
|
|
119
|
+
"disabled"
|
|
120
|
+
]).optional(),
|
|
121
|
+
prefix: z.string().optional(),
|
|
122
|
+
error: z.function().optional(),
|
|
123
|
+
log: z.function().optional(),
|
|
124
|
+
info: z.function().optional(),
|
|
125
|
+
warn: z.function().optional()
|
|
126
|
+
});
|
|
127
|
+
const aiSchema = z.object({
|
|
128
|
+
provider: z.enum(AiProviders).optional(),
|
|
129
|
+
apiKey: z.string().optional(),
|
|
130
|
+
model: z.string().optional(),
|
|
131
|
+
temperature: z.number().min(0).max(2).optional(),
|
|
132
|
+
applicationContext: z.string().optional(),
|
|
133
|
+
baseURL: z.url().optional(),
|
|
134
|
+
dataSerialization: z.enum(["json", "toon"]).optional()
|
|
135
|
+
});
|
|
136
|
+
const buildSchema = z.object({
|
|
137
|
+
mode: z.enum(["auto", "manual"]).optional(),
|
|
138
|
+
optimize: z.boolean().optional(),
|
|
139
|
+
importMode: z.enum([
|
|
140
|
+
"static",
|
|
141
|
+
"dynamic",
|
|
142
|
+
"fetch"
|
|
143
|
+
]).optional(),
|
|
144
|
+
traversePattern: z.array(z.string()).optional(),
|
|
145
|
+
outputFormat: z.array(z.enum(["cjs", "esm"])).optional(),
|
|
146
|
+
cache: z.boolean().optional(),
|
|
147
|
+
require: z.unknown().optional(),
|
|
148
|
+
checkTypes: z.boolean().optional()
|
|
149
|
+
});
|
|
150
|
+
const compilerSchema = z.object({
|
|
151
|
+
enabled: z.union([z.boolean(), z.literal("build-only")]).optional(),
|
|
152
|
+
dictionaryKeyPrefix: z.string().optional(),
|
|
153
|
+
transformPattern: z.union([z.string(), z.array(z.string())]).optional(),
|
|
154
|
+
excludePattern: z.union([z.string(), z.array(z.string())]).optional(),
|
|
155
|
+
output: z.unknown().optional(),
|
|
156
|
+
noMetadata: z.boolean().optional(),
|
|
157
|
+
saveComponents: z.boolean().optional()
|
|
158
|
+
});
|
|
159
|
+
const dictionarySchema = z.object({
|
|
160
|
+
fill: z.unknown().optional(),
|
|
161
|
+
contentAutoTransformation: z.union([z.boolean(), z.object({
|
|
162
|
+
markdown: z.boolean().optional(),
|
|
163
|
+
html: z.boolean().optional(),
|
|
164
|
+
insertion: z.boolean().optional()
|
|
165
|
+
})]).optional(),
|
|
166
|
+
location: z.string().optional(),
|
|
167
|
+
locale: z.string().optional(),
|
|
168
|
+
title: z.string().optional()
|
|
169
|
+
});
|
|
170
|
+
const intlayerConfigSchema = z.object({
|
|
171
|
+
internationalization: internationalizationSchema.optional(),
|
|
172
|
+
routing: routingSchema.optional(),
|
|
173
|
+
content: contentSchema.optional(),
|
|
174
|
+
system: systemSchema.optional(),
|
|
175
|
+
editor: editorSchema.optional(),
|
|
176
|
+
log: logSchema.optional(),
|
|
177
|
+
ai: aiSchema.optional(),
|
|
178
|
+
build: buildSchema.optional(),
|
|
179
|
+
compiler: compilerSchema.optional(),
|
|
180
|
+
dictionary: dictionarySchema.optional(),
|
|
181
|
+
plugins: z.array(z.unknown()).optional(),
|
|
182
|
+
schemas: z.record(z.string(), z.unknown()).optional(),
|
|
183
|
+
metadata: z.object({
|
|
184
|
+
name: z.string().optional(),
|
|
185
|
+
version: z.string().optional(),
|
|
186
|
+
doc: z.string().optional()
|
|
187
|
+
}).optional()
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
//#endregion
|
|
191
|
+
export { aiSchema, buildSchema, compilerSchema, contentSchema, cookiesAttributesSchema, dictionarySchema, editorSchema, internationalizationSchema, intlayerConfigSchema, logSchema, rewriteObjectSchema, rewriteRuleSchema, rewriteRulesSchema, routingSchema, storageAttributesSchema, storageSchema, systemSchema };
|
|
2
192
|
//# sourceMappingURL=configurationSchema.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurationSchema.mjs","names":[],"sources":["../../../src/configFile/configurationSchema.ts"],"sourcesContent":["import { AiProviders } from '@intlayer/types/config';\nimport { z } from 'zod';\n\nexport const internationalizationSchema = z.object({\n locales: z.array(z.string()).min(1),\n requiredLocales: z.array(z.string()).optional(),\n strictMode: z.enum(['strict', 'inclusive', 'loose']).optional(),\n defaultLocale: z.string().optional(),\n});\n\nexport const cookiesAttributesSchema = z.object({\n type: z.literal('cookie'),\n name: z.string().optional(),\n domain: z.string().optional(),\n path: z.string().optional(),\n secure: z.boolean().optional(),\n httpOnly: z.boolean().optional(),\n sameSite: z.enum(['strict', 'lax', 'none']).optional(),\n expires: z.union([z.date(), z.number()]).optional(),\n});\n\nexport const storageAttributesSchema = z.object({\n type: z.enum(['localStorage', 'sessionStorage', 'header']),\n name: z.string().optional(),\n});\n\nexport const storageSchema = z.union([\n z.literal(false),\n z.enum(['cookie', 'localStorage', 'sessionStorage', 'header']),\n cookiesAttributesSchema,\n storageAttributesSchema,\n z.array(\n z.union([\n z.enum(['cookie', 'localStorage', 'sessionStorage', 'header']),\n cookiesAttributesSchema,\n storageAttributesSchema,\n ])\n ),\n]);\n\nexport const rewriteRuleSchema = z.object({\n canonical: z.string(),\n localized: z.record(z.string(), z.string()),\n});\n\nexport const rewriteRulesSchema = z.object({\n rules: z.array(rewriteRuleSchema),\n});\n\nexport const rewriteObjectSchema = z.object({\n url: rewriteRulesSchema,\n nextjs: rewriteRulesSchema.optional(),\n vite: rewriteRulesSchema.optional(),\n});\n\nexport const routingSchema = z.object({\n rewrite: z\n .union([\n z.record(z.string(), z.record(z.string(), z.string())),\n rewriteObjectSchema,\n ])\n .optional(),\n mode: z\n .enum(['prefix-no-default', 'prefix-all', 'no-prefix', 'search-params'])\n .optional(),\n storage: storageSchema.optional(),\n basePath: z.string().optional(),\n});\n\nexport const systemSchema = z.object({\n baseDir: z.string().optional(),\n moduleAugmentationDir: z.string().optional(),\n unmergedDictionariesDir: z.string().optional(),\n remoteDictionariesDir: z.string().optional(),\n dictionariesDir: z.string().optional(),\n dynamicDictionariesDir: z.string().optional(),\n fetchDictionariesDir: z.string().optional(),\n typesDir: z.string().optional(),\n mainDir: z.string().optional(),\n configDir: z.string().optional(),\n cacheDir: z.string().optional(),\n tempDir: z.string().optional(),\n});\n\nexport const contentSchema = z.object({\n fileExtensions: z.array(z.string()).optional(),\n contentDir: z.array(z.string()).optional(),\n codeDir: z.array(z.string()).optional(),\n excludedPath: z.array(z.string()).optional(),\n watch: z.boolean().optional(),\n formatCommand: z.string().optional(),\n});\n\nexport const editorSchema = z.object({\n applicationURL: z.union([z.url(), z.literal('')]).optional(),\n editorURL: z.union([z.url(), z.literal('')]).optional(),\n cmsURL: z.union([z.url(), z.literal('')]).optional(),\n backendURL: z.union([z.url(), z.literal('')]).optional(),\n port: z.number().int().positive().max(65535).optional(),\n enabled: z.boolean().optional(),\n clientId: z.string().optional(),\n clientSecret: z.string().optional(),\n dictionaryPriorityStrategy: z\n .enum(['local_first', 'distant_first'])\n .optional(),\n liveSync: z.boolean().optional(),\n liveSyncPort: z.number().int().positive().max(65535).optional(),\n liveSyncURL: z.union([z.url(), z.literal('')]).optional(),\n});\n\nexport const logSchema = z.object({\n mode: z.enum(['default', 'verbose', 'disabled']).optional(),\n prefix: z.string().optional(),\n error: z.function().optional(),\n log: z.function().optional(),\n info: z.function().optional(),\n warn: z.function().optional(),\n});\n\nexport const aiSchema = z.object({\n provider: z.enum(AiProviders).optional(),\n apiKey: z.string().optional(),\n model: z.string().optional(),\n temperature: z.number().min(0).max(2).optional(),\n applicationContext: z.string().optional(),\n baseURL: z.url().optional(),\n dataSerialization: z.enum(['json', 'toon']).optional(),\n});\n\nexport const buildSchema = z.object({\n mode: z.enum(['auto', 'manual']).optional(),\n optimize: z.boolean().optional(),\n importMode: z.enum(['static', 'dynamic', 'fetch']).optional(),\n traversePattern: z.array(z.string()).optional(),\n outputFormat: z.array(z.enum(['cjs', 'esm'])).optional(),\n cache: z.boolean().optional(),\n require: z.unknown().optional(),\n checkTypes: z.boolean().optional(),\n});\n\nexport const compilerSchema = z.object({\n enabled: z.union([z.boolean(), z.literal('build-only')]).optional(),\n dictionaryKeyPrefix: z.string().optional(),\n transformPattern: z.union([z.string(), z.array(z.string())]).optional(),\n excludePattern: z.union([z.string(), z.array(z.string())]).optional(),\n output: z.unknown().optional(),\n noMetadata: z.boolean().optional(),\n saveComponents: z.boolean().optional(),\n});\n\nexport const dictionarySchema = z.object({\n fill: z.unknown().optional(),\n contentAutoTransformation: z\n .union([\n z.boolean(),\n z.object({\n markdown: z.boolean().optional(),\n html: z.boolean().optional(),\n insertion: z.boolean().optional(),\n }),\n ])\n .optional(),\n location: z.string().optional(),\n locale: z.string().optional(),\n title: z.string().optional(),\n});\n\nexport const intlayerConfigSchema = z.object({\n internationalization: internationalizationSchema.optional(),\n routing: routingSchema.optional(),\n content: contentSchema.optional(),\n system: systemSchema.optional(),\n editor: editorSchema.optional(),\n log: logSchema.optional(),\n ai: aiSchema.optional(),\n build: buildSchema.optional(),\n compiler: compilerSchema.optional(),\n dictionary: dictionarySchema.optional(),\n plugins: z.array(z.unknown()).optional(),\n schemas: z.record(z.string(), z.unknown()).optional(),\n metadata: z\n .object({\n name: z.string().optional(),\n version: z.string().optional(),\n doc: z.string().optional(),\n })\n .optional(),\n});\n"],"mappings":"6EAGA,MAAa,EAA6B,EAAE,OAAO,CACjD,QAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,CACnC,gBAAiB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU,CAC/C,WAAY,EAAE,KAAK,CAAC,SAAU,YAAa,QAAQ,CAAC,CAAC,UAAU,CAC/D,cAAe,EAAE,QAAQ,CAAC,UAAU,CACrC,CAAC,CAEW,EAA0B,EAAE,OAAO,CAC9C,KAAM,EAAE,QAAQ,SAAS,CACzB,KAAM,EAAE,QAAQ,CAAC,UAAU,CAC3B,OAAQ,EAAE,QAAQ,CAAC,UAAU,CAC7B,KAAM,EAAE,QAAQ,CAAC,UAAU,CAC3B,OAAQ,EAAE,SAAS,CAAC,UAAU,CAC9B,SAAU,EAAE,SAAS,CAAC,UAAU,CAChC,SAAU,EAAE,KAAK,CAAC,SAAU,MAAO,OAAO,CAAC,CAAC,UAAU,CACtD,QAAS,EAAE,MAAM,CAAC,EAAE,MAAM,CAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CACpD,CAAC,CAEW,EAA0B,EAAE,OAAO,CAC9C,KAAM,EAAE,KAAK,CAAC,eAAgB,iBAAkB,SAAS,CAAC,CAC1D,KAAM,EAAE,QAAQ,CAAC,UAAU,CAC5B,CAAC,CAEW,EAAgB,EAAE,MAAM,CACnC,EAAE,QAAQ,GAAM,CAChB,EAAE,KAAK,CAAC,SAAU,eAAgB,iBAAkB,SAAS,CAAC,CAC9D,EACA,EACA,EAAE,MACA,EAAE,MAAM,CACN,EAAE,KAAK,CAAC,SAAU,eAAgB,iBAAkB,SAAS,CAAC,CAC9D,EACA,EACD,CAAC,CACH,CACF,CAAC,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":3,"file":"configurationSchema.mjs","names":[],"sources":["../../../src/configFile/configurationSchema.ts"],"sourcesContent":["import { AiProviders } from '@intlayer/types/config';\nimport z from 'zod';\n\nexport const internationalizationSchema = z.object({\n locales: z.array(z.string()).min(1),\n requiredLocales: z.array(z.string()).optional(),\n strictMode: z.enum(['strict', 'inclusive', 'loose']).optional(),\n defaultLocale: z.string().optional(),\n});\n\nexport const cookiesAttributesSchema = z.object({\n type: z.literal('cookie'),\n name: z.string().optional(),\n domain: z.string().optional(),\n path: z.string().optional(),\n secure: z.boolean().optional(),\n httpOnly: z.boolean().optional(),\n sameSite: z.enum(['strict', 'lax', 'none']).optional(),\n expires: z.union([z.date(), z.number()]).optional(),\n});\n\nexport const storageAttributesSchema = z.object({\n type: z.enum(['localStorage', 'sessionStorage', 'header']),\n name: z.string().optional(),\n});\n\nexport const storageSchema = z.union([\n z.literal(false),\n z.enum(['cookie', 'localStorage', 'sessionStorage', 'header']),\n cookiesAttributesSchema,\n storageAttributesSchema,\n z.array(\n z.union([\n z.enum(['cookie', 'localStorage', 'sessionStorage', 'header']),\n cookiesAttributesSchema,\n storageAttributesSchema,\n ])\n ),\n]);\n\nexport const rewriteRuleSchema = z.object({\n canonical: z.string(),\n localized: z.record(z.string(), z.string()),\n});\n\nexport const rewriteRulesSchema = z.object({\n rules: z.array(rewriteRuleSchema),\n});\n\nexport const rewriteObjectSchema = z.object({\n url: rewriteRulesSchema,\n nextjs: rewriteRulesSchema.optional(),\n vite: rewriteRulesSchema.optional(),\n});\n\nexport const routingSchema = z.object({\n rewrite: z\n .union([\n z.record(z.string(), z.record(z.string(), z.string())),\n rewriteObjectSchema,\n ])\n .optional(),\n mode: z\n .enum(['prefix-no-default', 'prefix-all', 'no-prefix', 'search-params'])\n .optional(),\n storage: storageSchema.optional(),\n basePath: z.string().optional(),\n});\n\nexport const systemSchema = z.object({\n baseDir: z.string().optional(),\n moduleAugmentationDir: z.string().optional(),\n unmergedDictionariesDir: z.string().optional(),\n remoteDictionariesDir: z.string().optional(),\n dictionariesDir: z.string().optional(),\n dynamicDictionariesDir: z.string().optional(),\n fetchDictionariesDir: z.string().optional(),\n typesDir: z.string().optional(),\n mainDir: z.string().optional(),\n configDir: z.string().optional(),\n cacheDir: z.string().optional(),\n tempDir: z.string().optional(),\n});\n\nexport const contentSchema = z.object({\n fileExtensions: z.array(z.string()).optional(),\n contentDir: z.array(z.string()).optional(),\n codeDir: z.array(z.string()).optional(),\n excludedPath: z.array(z.string()).optional(),\n watch: z.boolean().optional(),\n formatCommand: z.string().optional(),\n});\n\nexport const editorSchema = z.object({\n applicationURL: z.union([z.url(), z.literal('')]).optional(),\n editorURL: z.union([z.url(), z.literal('')]).optional(),\n cmsURL: z.union([z.url(), z.literal('')]).optional(),\n backendURL: z.union([z.url(), z.literal('')]).optional(),\n port: z.number().int().positive().max(65535).optional(),\n enabled: z.boolean().optional(),\n clientId: z.string().optional(),\n clientSecret: z.string().optional(),\n dictionaryPriorityStrategy: z\n .enum(['local_first', 'distant_first'])\n .optional(),\n liveSync: z.boolean().optional(),\n liveSyncPort: z.number().int().positive().max(65535).optional(),\n liveSyncURL: z.union([z.url(), z.literal('')]).optional(),\n});\n\nexport const logSchema = z.object({\n mode: z.enum(['default', 'verbose', 'disabled']).optional(),\n prefix: z.string().optional(),\n error: z.function().optional(),\n log: z.function().optional(),\n info: z.function().optional(),\n warn: z.function().optional(),\n});\n\nexport const aiSchema = z.object({\n provider: z.enum(AiProviders).optional(),\n apiKey: z.string().optional(),\n model: z.string().optional(),\n temperature: z.number().min(0).max(2).optional(),\n applicationContext: z.string().optional(),\n baseURL: z.url().optional(),\n dataSerialization: z.enum(['json', 'toon']).optional(),\n});\n\nexport const buildSchema = z.object({\n mode: z.enum(['auto', 'manual']).optional(),\n optimize: z.boolean().optional(),\n importMode: z.enum(['static', 'dynamic', 'fetch']).optional(),\n traversePattern: z.array(z.string()).optional(),\n outputFormat: z.array(z.enum(['cjs', 'esm'])).optional(),\n cache: z.boolean().optional(),\n require: z.unknown().optional(),\n checkTypes: z.boolean().optional(),\n});\n\nexport const compilerSchema = z.object({\n enabled: z.union([z.boolean(), z.literal('build-only')]).optional(),\n dictionaryKeyPrefix: z.string().optional(),\n transformPattern: z.union([z.string(), z.array(z.string())]).optional(),\n excludePattern: z.union([z.string(), z.array(z.string())]).optional(),\n output: z.unknown().optional(),\n noMetadata: z.boolean().optional(),\n saveComponents: z.boolean().optional(),\n});\n\nexport const dictionarySchema = z.object({\n fill: z.unknown().optional(),\n contentAutoTransformation: z\n .union([\n z.boolean(),\n z.object({\n markdown: z.boolean().optional(),\n html: z.boolean().optional(),\n insertion: z.boolean().optional(),\n }),\n ])\n .optional(),\n location: z.string().optional(),\n locale: z.string().optional(),\n title: z.string().optional(),\n});\n\nexport const intlayerConfigSchema = z.object({\n internationalization: internationalizationSchema.optional(),\n routing: routingSchema.optional(),\n content: contentSchema.optional(),\n system: systemSchema.optional(),\n editor: editorSchema.optional(),\n log: logSchema.optional(),\n ai: aiSchema.optional(),\n build: buildSchema.optional(),\n compiler: compilerSchema.optional(),\n dictionary: dictionarySchema.optional(),\n plugins: z.array(z.unknown()).optional(),\n schemas: z.record(z.string(), z.unknown()).optional(),\n metadata: z\n .object({\n name: z.string().optional(),\n version: z.string().optional(),\n doc: z.string().optional(),\n })\n .optional(),\n});\n"],"mappings":";;;;AAGA,MAAa,6BAA6B,EAAE,OAAO;CACjD,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE;CACnC,iBAAiB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CAC/C,YAAY,EAAE,KAAK;EAAC;EAAU;EAAa;EAAQ,CAAC,CAAC,UAAU;CAC/D,eAAe,EAAE,QAAQ,CAAC,UAAU;CACrC,CAAC;AAEF,MAAa,0BAA0B,EAAE,OAAO;CAC9C,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,QAAQ,EAAE,QAAQ,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AAC,UAAU;EAClC,CAAC,CACH,CAAC,CACD,UAAU;CACb,UAAU,EAAE,QAAQ,CAAC,UAAU;CAC/B,QAAQ,EAAE,QAAQ,CAAC,UAAU;CAC7B,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC7B,CAAC;AAEF,MAAa,uBAAuB,EAAE,OAAO;CAC3C,sBAAsB,2BAA2B,UAAU;CAC3D,SAAS,cAAc,UAAU;CACjC,SAAS,cAAc,UAAU;CACjC,QAAQ,aAAa,UAAU;CAC/B,QAAQ,aAAa,UAAU;CAC/B,KAAK,UAAU,UAAU;CACzB,IAAI,SAAS,UAAU;CACvB,OAAO,YAAY,UAAU;CAC7B,UAAU,eAAe,UAAU;CACnC,YAAY,iBAAiB,UAAU;CACvC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,UAAU;CACxC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC,UAAU;CACrD,UAAU,EACP,OAAO;EACN,MAAM,EAAE,QAAQ,CAAC,UAAU;EAC3B,SAAS,EAAE,QAAQ,CAAC,UAAU;EAC9B,KAAK,EAAE,QAAQ,CAAC,UAAU;EAC3B,CAAC,CACD,UAAU;CACd,CAAC"}
|
|
@@ -1,2 +1,67 @@
|
|
|
1
|
-
import{cacheMemory
|
|
1
|
+
import { cacheMemory } from "../utils/cacheMemory.mjs";
|
|
2
|
+
import { getPackageJsonPath } from "../utils/getPackageJsonPath.mjs";
|
|
3
|
+
import { buildConfigurationFields } from "./buildConfigurationFields.mjs";
|
|
4
|
+
import { loadConfigurationFile } from "./loadConfigurationFile.mjs";
|
|
5
|
+
import { searchConfigurationFile } from "./searchConfigurationFile.mjs";
|
|
6
|
+
import { defu } from "defu";
|
|
7
|
+
|
|
8
|
+
//#region src/configFile/getConfiguration.ts
|
|
9
|
+
/**
|
|
10
|
+
* Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)
|
|
11
|
+
*/
|
|
12
|
+
const getConfigurationAndFilePath = (options) => {
|
|
13
|
+
let baseDir;
|
|
14
|
+
try {
|
|
15
|
+
baseDir = options?.baseDir ?? getPackageJsonPath().baseDir;
|
|
16
|
+
} catch (_err) {
|
|
17
|
+
return {
|
|
18
|
+
configuration: buildConfigurationFields({}, options?.baseDir, options?.logFunctions),
|
|
19
|
+
customConfiguration: void 0,
|
|
20
|
+
numCustomConfiguration: 0,
|
|
21
|
+
configurationFilePath: void 0
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const cachedConfiguration = cacheMemory.get(options);
|
|
25
|
+
if (cachedConfiguration) return cachedConfiguration;
|
|
26
|
+
const { configurationFilePath, numCustomConfiguration } = searchConfigurationFile(baseDir);
|
|
27
|
+
let storedConfiguration;
|
|
28
|
+
let customConfiguration;
|
|
29
|
+
if (configurationFilePath) {
|
|
30
|
+
customConfiguration = loadConfigurationFile(configurationFilePath, {
|
|
31
|
+
projectRequire: options?.require,
|
|
32
|
+
envVarOptions: {
|
|
33
|
+
env: options?.env,
|
|
34
|
+
envFile: options?.envFile
|
|
35
|
+
},
|
|
36
|
+
additionalEnvVars: options?.additionalEnvVars,
|
|
37
|
+
aliases: options?.aliases,
|
|
38
|
+
buildOptions: options?.buildOptions
|
|
39
|
+
});
|
|
40
|
+
storedConfiguration = buildConfigurationFields(customConfiguration, options?.baseDir, options?.logFunctions);
|
|
41
|
+
} else storedConfiguration = buildConfigurationFields({}, options?.baseDir, options?.logFunctions);
|
|
42
|
+
const configWithProjectRequire = defu(options?.require ? { build: {
|
|
43
|
+
require: options?.require,
|
|
44
|
+
cache: options?.cache
|
|
45
|
+
} } : {}, storedConfiguration);
|
|
46
|
+
const configuration = defu(options?.override ?? {}, configWithProjectRequire);
|
|
47
|
+
cacheMemory.set(options, {
|
|
48
|
+
configuration,
|
|
49
|
+
customConfiguration,
|
|
50
|
+
numCustomConfiguration,
|
|
51
|
+
configurationFilePath
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
configuration,
|
|
55
|
+
customConfiguration,
|
|
56
|
+
numCustomConfiguration,
|
|
57
|
+
configurationFilePath
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)
|
|
62
|
+
*/
|
|
63
|
+
const getConfiguration = (options) => getConfigurationAndFilePath(options).configuration;
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { getConfiguration, getConfigurationAndFilePath };
|
|
2
67
|
//# sourceMappingURL=getConfiguration.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConfiguration.mjs","names":[],"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import type {\n CustomIntlayerConfig,\n IntlayerConfig,\n LogFunctions,\n} from '@intlayer/types/config';\nimport { defu } from 'defu';\nimport type { LoadExternalFileOptions } from '../loadExternalFile/loadExternalFile';\nimport type { SandBoxContextOptions } from '../loadExternalFile/parseFileContent';\nimport { cacheMemory } from '../utils/cacheMemory';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n override?: CustomIntlayerConfig;\n // Dotenv options\n env?: string;\n envFile?: string;\n // Log functions\n logFunctions?: LogFunctions;\n // Require function\n require?: NodeJS.Require;\n // cache\n cache?: boolean;\n // Build options for TypeScript transpilation (e.g. custom esbuild instance)\n buildOptions?: LoadExternalFileOptions['buildOptions'];\n} & Omit<SandBoxContextOptions, 'projectRequire'>;\n\nexport type GetConfigurationAndFilePathResult = {\n configuration: IntlayerConfig;\n customConfiguration: CustomIntlayerConfig | undefined;\n numCustomConfiguration: number;\n configurationFilePath: string | undefined;\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfigurationAndFilePath = (\n options?: GetConfigurationOptions\n): GetConfigurationAndFilePathResult => {\n let baseDir: string | undefined;\n\n try {\n // Can fail in some environments (e.g. MCP server, VScode extension)\n baseDir = options?.baseDir ?? getPackageJsonPath().baseDir;\n } catch (_err) {\n // Return default config if the package.json is not found\n return {\n configuration: buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n ),\n customConfiguration: undefined,\n numCustomConfiguration: 0,\n configurationFilePath: undefined,\n };\n }\n\n const cachedConfiguration =\n cacheMemory.get<GetConfigurationAndFilePathResult>(options);\n\n if (cachedConfiguration) return cachedConfiguration;\n\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n let storedConfiguration: IntlayerConfig;\n let customConfiguration: CustomIntlayerConfig | undefined;\n\n if (configurationFilePath) {\n // Load the custom configuration\n customConfiguration = loadConfigurationFile(configurationFilePath, {\n projectRequire: options?.require,\n // Dotenv options\n envVarOptions: {\n env: options?.env,\n envFile: options?.envFile,\n },\n // Sandbox context additional variables\n additionalEnvVars: options?.additionalEnvVars,\n aliases: options?.aliases,\n // Build options for TypeScript transpilation (e.g. custom esbuild instance)\n buildOptions: options?.buildOptions,\n });\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n options?.baseDir,\n options?.logFunctions\n );\n } else {\n // No configuration file found, use default configuration\n storedConfiguration = buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n );\n }\n\n // Log warning if multiple configuration files are found\n const projectRequireConfig: CustomIntlayerConfig = options?.require\n ? {\n build: {\n require: options?.require,\n cache: options?.cache,\n },\n }\n : {};\n\n const configWithProjectRequire = defu(\n projectRequireConfig,\n storedConfiguration\n ) as IntlayerConfig;\n\n const configuration = defu(\n options?.override ?? {},\n configWithProjectRequire\n ) as IntlayerConfig;\n\n cacheMemory.set(options, {\n configuration,\n customConfiguration,\n numCustomConfiguration,\n configurationFilePath,\n });\n\n return {\n configuration,\n customConfiguration,\n numCustomConfiguration,\n configurationFilePath,\n };\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => getConfigurationAndFilePath(options).configuration;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getConfiguration.mjs","names":[],"sources":["../../../src/configFile/getConfiguration.ts"],"sourcesContent":["import type {\n CustomIntlayerConfig,\n IntlayerConfig,\n LogFunctions,\n} from '@intlayer/types/config';\nimport { defu } from 'defu';\nimport type { LoadExternalFileOptions } from '../loadExternalFile/loadExternalFile';\nimport type { SandBoxContextOptions } from '../loadExternalFile/parseFileContent';\nimport { cacheMemory } from '../utils/cacheMemory';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\nimport { buildConfigurationFields } from './buildConfigurationFields';\nimport { loadConfigurationFile } from './loadConfigurationFile';\nimport { searchConfigurationFile } from './searchConfigurationFile';\n\nexport type GetConfigurationOptions = {\n baseDir?: string;\n override?: CustomIntlayerConfig;\n // Dotenv options\n env?: string;\n envFile?: string;\n // Log functions\n logFunctions?: LogFunctions;\n // Require function\n require?: NodeJS.Require;\n // cache\n cache?: boolean;\n // Build options for TypeScript transpilation (e.g. custom esbuild instance)\n buildOptions?: LoadExternalFileOptions['buildOptions'];\n} & Omit<SandBoxContextOptions, 'projectRequire'>;\n\nexport type GetConfigurationAndFilePathResult = {\n configuration: IntlayerConfig;\n customConfiguration: CustomIntlayerConfig | undefined;\n numCustomConfiguration: number;\n configurationFilePath: string | undefined;\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfigurationAndFilePath = (\n options?: GetConfigurationOptions\n): GetConfigurationAndFilePathResult => {\n let baseDir: string | undefined;\n\n try {\n // Can fail in some environments (e.g. MCP server, VScode extension)\n baseDir = options?.baseDir ?? getPackageJsonPath().baseDir;\n } catch (_err) {\n // Return default config if the package.json is not found\n return {\n configuration: buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n ),\n customConfiguration: undefined,\n numCustomConfiguration: 0,\n configurationFilePath: undefined,\n };\n }\n\n const cachedConfiguration =\n cacheMemory.get<GetConfigurationAndFilePathResult>(options);\n\n if (cachedConfiguration) return cachedConfiguration;\n\n // Search for configuration files\n const { configurationFilePath, numCustomConfiguration } =\n searchConfigurationFile(baseDir);\n\n let storedConfiguration: IntlayerConfig;\n let customConfiguration: CustomIntlayerConfig | undefined;\n\n if (configurationFilePath) {\n // Load the custom configuration\n customConfiguration = loadConfigurationFile(configurationFilePath, {\n projectRequire: options?.require,\n // Dotenv options\n envVarOptions: {\n env: options?.env,\n envFile: options?.envFile,\n },\n // Sandbox context additional variables\n additionalEnvVars: options?.additionalEnvVars,\n aliases: options?.aliases,\n // Build options for TypeScript transpilation (e.g. custom esbuild instance)\n buildOptions: options?.buildOptions,\n });\n\n // Save the configuration to avoid reading the file again\n storedConfiguration = buildConfigurationFields(\n customConfiguration,\n options?.baseDir,\n options?.logFunctions\n );\n } else {\n // No configuration file found, use default configuration\n storedConfiguration = buildConfigurationFields(\n {},\n options?.baseDir,\n options?.logFunctions\n );\n }\n\n // Log warning if multiple configuration files are found\n const projectRequireConfig: CustomIntlayerConfig = options?.require\n ? {\n build: {\n require: options?.require,\n cache: options?.cache,\n },\n }\n : {};\n\n const configWithProjectRequire = defu(\n projectRequireConfig,\n storedConfiguration\n ) as IntlayerConfig;\n\n const configuration = defu(\n options?.override ?? {},\n configWithProjectRequire\n ) as IntlayerConfig;\n\n cacheMemory.set(options, {\n configuration,\n customConfiguration,\n numCustomConfiguration,\n configurationFilePath,\n });\n\n return {\n configuration,\n customConfiguration,\n numCustomConfiguration,\n configurationFilePath,\n };\n};\n\n/**\n * Get the configuration for the intlayer by reading the configuration file (e.g. intlayer.config.js)\n */\nexport const getConfiguration = (\n options?: GetConfigurationOptions\n): IntlayerConfig => getConfigurationAndFilePath(options).configuration;\n"],"mappings":";;;;;;;;;;;AAwCA,MAAa,+BACX,YACsC;CACtC,IAAI;AAEJ,KAAI;AAEF,YAAU,SAAS,WAAW,oBAAoB,CAAC;UAC5C,MAAM;AAEb,SAAO;GACL,eAAe,yBACb,EAAE,EACF,SAAS,SACT,SAAS,aACV;GACD,qBAAqB;GACrB,wBAAwB;GACxB,uBAAuB;GACxB;;CAGH,MAAM,sBACJ,YAAY,IAAuC,QAAQ;AAE7D,KAAI,oBAAqB,QAAO;CAGhC,MAAM,EAAE,uBAAuB,2BAC7B,wBAAwB,QAAQ;CAElC,IAAI;CACJ,IAAI;AAEJ,KAAI,uBAAuB;AAEzB,wBAAsB,sBAAsB,uBAAuB;GACjE,gBAAgB,SAAS;GAEzB,eAAe;IACb,KAAK,SAAS;IACd,SAAS,SAAS;IACnB;GAED,mBAAmB,SAAS;GAC5B,SAAS,SAAS;GAElB,cAAc,SAAS;GACxB,CAAC;AAGF,wBAAsB,yBACpB,qBACA,SAAS,SACT,SAAS,aACV;OAGD,uBAAsB,yBACpB,EAAE,EACF,SAAS,SACT,SAAS,aACV;CAaH,MAAM,2BAA2B,KATkB,SAAS,UACxD,EACE,OAAO;EACL,SAAS,SAAS;EAClB,OAAO,SAAS;EACjB,EACF,GACD,EAAE,EAIJ,oBACD;CAED,MAAM,gBAAgB,KACpB,SAAS,YAAY,EAAE,EACvB,yBACD;AAED,aAAY,IAAI,SAAS;EACvB;EACA;EACA;EACA;EACD,CAAC;AAEF,QAAO;EACL;EACA;EACA;EACA;EACD;;;;;AAMH,MAAa,oBACX,YACmB,4BAA4B,QAAQ,CAAC"}
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { aiSchema, buildSchema, compilerSchema, contentSchema, cookiesAttributesSchema, dictionarySchema, editorSchema, internationalizationSchema, intlayerConfigSchema, logSchema, rewriteObjectSchema, rewriteRuleSchema, rewriteRulesSchema, routingSchema, storageAttributesSchema, storageSchema, systemSchema } from "./configurationSchema.mjs";
|
|
2
|
+
import { buildConfigurationFields } from "./buildConfigurationFields.mjs";
|
|
3
|
+
import { configurationFilesCandidates, searchConfigurationFile } from "./searchConfigurationFile.mjs";
|
|
4
|
+
import { getConfiguration, getConfigurationAndFilePath } from "./getConfiguration.mjs";
|
|
5
|
+
|
|
6
|
+
export { aiSchema, buildConfigurationFields, buildSchema, compilerSchema, configurationFilesCandidates, contentSchema, cookiesAttributesSchema, dictionarySchema, editorSchema, getConfiguration, getConfigurationAndFilePath, internationalizationSchema, intlayerConfigSchema, logSchema, rewriteObjectSchema, rewriteRuleSchema, rewriteRulesSchema, routingSchema, searchConfigurationFile, storageAttributesSchema, storageSchema, systemSchema };
|
|
@@ -1,2 +1,30 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { configESMxCJSRequire } from "../utils/ESMxCJSHelpers.mjs";
|
|
2
|
+
import { loadExternalFileSync } from "../loadExternalFile/loadExternalFile.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/configFile/loadConfigurationFile.ts
|
|
5
|
+
const getAliases = (options) => {
|
|
6
|
+
try {
|
|
7
|
+
return {
|
|
8
|
+
...options?.aliases,
|
|
9
|
+
intlayer: configESMxCJSRequire.resolve("@intlayer/types")
|
|
10
|
+
};
|
|
11
|
+
} catch {
|
|
12
|
+
return options?.aliases;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Load the configuration file from the given path
|
|
17
|
+
* Example of configuration file: intlayer.config.js
|
|
18
|
+
*
|
|
19
|
+
* Accepts JSON, JS, MJS and TS files as configuration
|
|
20
|
+
*/
|
|
21
|
+
const loadConfigurationFile = (configFilePath, options) => {
|
|
22
|
+
return loadExternalFileSync(configFilePath, {
|
|
23
|
+
...options,
|
|
24
|
+
aliases: getAliases(options)
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { loadConfigurationFile };
|
|
2
30
|
//# sourceMappingURL=loadConfigurationFile.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadConfigurationFile.mjs","names":[],"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["import type { CustomIntlayerConfig } from '@intlayer/types/config';\nimport {\n type LoadExternalFileOptions,\n loadExternalFileSync,\n} from '../loadExternalFile/loadExternalFile';\nimport { configESMxCJSRequire } from '../utils/ESMxCJSHelpers';\n\nconst getAliases = (\n options?: Omit<LoadExternalFileOptions, 'configuration'>\n) => {\n // Can fail if CJS hot removed from the module (e.g. in Tanstack Start + Nitro)\n try {\n return {\n ...options?.aliases,\n // Replace intlayer with @intlayer/types to avoid circular dependency intlayer -> @intlayer/config -> intlayer\n intlayer: configESMxCJSRequire.resolve('@intlayer/types'),\n };\n } catch {\n return options?.aliases;\n }\n};\n\n/**\n * Load the configuration file from the given path\n * Example of configuration file: intlayer.config.js\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadConfigurationFile = (\n configFilePath: string,\n options?: Omit<LoadExternalFileOptions, 'configuration'>\n): CustomIntlayerConfig | undefined => {\n const fileContent = loadExternalFileSync(configFilePath, {\n ...options,\n aliases: getAliases(options),\n });\n\n return fileContent;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadConfigurationFile.mjs","names":[],"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["import type { CustomIntlayerConfig } from '@intlayer/types/config';\nimport {\n type LoadExternalFileOptions,\n loadExternalFileSync,\n} from '../loadExternalFile/loadExternalFile';\nimport { configESMxCJSRequire } from '../utils/ESMxCJSHelpers';\n\nconst getAliases = (\n options?: Omit<LoadExternalFileOptions, 'configuration'>\n) => {\n // Can fail if CJS hot removed from the module (e.g. in Tanstack Start + Nitro)\n try {\n return {\n ...options?.aliases,\n // Replace intlayer with @intlayer/types to avoid circular dependency intlayer -> @intlayer/config -> intlayer\n intlayer: configESMxCJSRequire.resolve('@intlayer/types'),\n };\n } catch {\n return options?.aliases;\n }\n};\n\n/**\n * Load the configuration file from the given path\n * Example of configuration file: intlayer.config.js\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadConfigurationFile = (\n configFilePath: string,\n options?: Omit<LoadExternalFileOptions, 'configuration'>\n): CustomIntlayerConfig | undefined => {\n const fileContent = loadExternalFileSync(configFilePath, {\n ...options,\n aliases: getAliases(options),\n });\n\n return fileContent;\n};\n"],"mappings":";;;;AAOA,MAAM,cACJ,YACG;AAEH,KAAI;AACF,SAAO;GACL,GAAG,SAAS;GAEZ,UAAU,qBAAqB,QAAQ,kBAAkB;GAC1D;SACK;AACN,SAAO,SAAS;;;;;;;;;AAUpB,MAAa,yBACX,gBACA,YACqC;AAMrC,QALoB,qBAAqB,gBAAgB;EACvD,GAAG;EACH,SAAS,WAAW,QAAQ;EAC7B,CAAC"}
|
|
@@ -1,2 +1,51 @@
|
|
|
1
|
-
import{getPackageJsonPath
|
|
1
|
+
import { getPackageJsonPath } from "../utils/getPackageJsonPath.mjs";
|
|
2
|
+
import { logger } from "../logger.mjs";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
|
+
|
|
6
|
+
//#region src/configFile/searchConfigurationFile.ts
|
|
7
|
+
const configurationFilesCandidates = [
|
|
8
|
+
"intlayer.config.ts",
|
|
9
|
+
"intlayer.config.js",
|
|
10
|
+
"intlayer.config.json",
|
|
11
|
+
"intlayer.config.json5",
|
|
12
|
+
"intlayer.config.jsonc",
|
|
13
|
+
"intlayer.config.cjs",
|
|
14
|
+
"intlayer.config.mjs",
|
|
15
|
+
".intlayerrc"
|
|
16
|
+
];
|
|
17
|
+
const rootPathCache = /* @__PURE__ */ new Map();
|
|
18
|
+
/**
|
|
19
|
+
* Search for the configuration file in the given path
|
|
20
|
+
*
|
|
21
|
+
* List of detected configuration files:
|
|
22
|
+
* - intlayer.config.ts
|
|
23
|
+
* - intlayer.config.js
|
|
24
|
+
* - intlayer.config.json
|
|
25
|
+
* - intlayer.config.cjs
|
|
26
|
+
* - intlayer.config.mjs
|
|
27
|
+
* - .intlayerrc
|
|
28
|
+
*/
|
|
29
|
+
const searchConfigurationFile = (startDir) => {
|
|
30
|
+
let configurationFilePath;
|
|
31
|
+
let numCustomConfiguration = 0;
|
|
32
|
+
if (rootPathCache.has(startDir)) return rootPathCache.get(startDir);
|
|
33
|
+
const { baseDir } = getPackageJsonPath(startDir);
|
|
34
|
+
for (const fileName of configurationFilesCandidates) try {
|
|
35
|
+
const filePath = resolve(baseDir, fileName);
|
|
36
|
+
if (!existsSync(filePath)) {} else {
|
|
37
|
+
numCustomConfiguration += 1;
|
|
38
|
+
if (!configurationFilePath) configurationFilePath = filePath;
|
|
39
|
+
}
|
|
40
|
+
} catch (error) {
|
|
41
|
+
logger(`${fileName}: ${error}`, { level: "error" });
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
configurationFilePath,
|
|
45
|
+
numCustomConfiguration
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { configurationFilesCandidates, searchConfigurationFile };
|
|
2
51
|
//# sourceMappingURL=searchConfigurationFile.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchConfigurationFile.mjs","names":[],"sources":["../../../src/configFile/searchConfigurationFile.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { logger } from '../logger';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\n\nexport const configurationFilesCandidates = [\n 'intlayer.config.ts',\n 'intlayer.config.js',\n 'intlayer.config.json',\n 'intlayer.config.json5',\n 'intlayer.config.jsonc',\n 'intlayer.config.cjs',\n 'intlayer.config.mjs',\n '.intlayerrc',\n] as const;\n\ntype SearchConfigurationFileResult = {\n configurationFilePath?: string;\n numCustomConfiguration: number;\n};\n\n// CACHE: Store results to avoid re-walking the file system for the same path\nconst rootPathCache = new Map<string, SearchConfigurationFileResult>();\n\n/**\n * Search for the configuration file in the given path\n *\n * List of detected configuration files:\n * - intlayer.config.ts\n * - intlayer.config.js\n * - intlayer.config.json\n * - intlayer.config.cjs\n * - intlayer.config.mjs\n * - .intlayerrc\n */\nexport const searchConfigurationFile = (\n startDir: string\n): SearchConfigurationFileResult => {\n let configurationFilePath: string | undefined;\n let numCustomConfiguration = 0;\n\n // OPTIMIZATION: Return cached result immediately\n if (rootPathCache.has(startDir)) {\n return rootPathCache.get(startDir) as SearchConfigurationFileResult;\n }\n\n const { baseDir } = getPackageJsonPath(startDir);\n\n for (const fileName of configurationFilesCandidates) {\n try {\n const filePath = resolve(baseDir, fileName);\n\n // Check if the file exists\n if (!existsSync(filePath)) {\n } else {\n numCustomConfiguration += 1;\n\n if (!configurationFilePath) {\n configurationFilePath = filePath;\n }\n }\n } catch (error) {\n // Return \"Cannot use import statement outside a module\"\n logger(`${fileName}: ${error as string}`, { level: 'error' });\n }\n }\n\n return { configurationFilePath, numCustomConfiguration };\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"searchConfigurationFile.mjs","names":[],"sources":["../../../src/configFile/searchConfigurationFile.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { logger } from '../logger';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\n\nexport const configurationFilesCandidates = [\n 'intlayer.config.ts',\n 'intlayer.config.js',\n 'intlayer.config.json',\n 'intlayer.config.json5',\n 'intlayer.config.jsonc',\n 'intlayer.config.cjs',\n 'intlayer.config.mjs',\n '.intlayerrc',\n] as const;\n\ntype SearchConfigurationFileResult = {\n configurationFilePath?: string;\n numCustomConfiguration: number;\n};\n\n// CACHE: Store results to avoid re-walking the file system for the same path\nconst rootPathCache = new Map<string, SearchConfigurationFileResult>();\n\n/**\n * Search for the configuration file in the given path\n *\n * List of detected configuration files:\n * - intlayer.config.ts\n * - intlayer.config.js\n * - intlayer.config.json\n * - intlayer.config.cjs\n * - intlayer.config.mjs\n * - .intlayerrc\n */\nexport const searchConfigurationFile = (\n startDir: string\n): SearchConfigurationFileResult => {\n let configurationFilePath: string | undefined;\n let numCustomConfiguration = 0;\n\n // OPTIMIZATION: Return cached result immediately\n if (rootPathCache.has(startDir)) {\n return rootPathCache.get(startDir) as SearchConfigurationFileResult;\n }\n\n const { baseDir } = getPackageJsonPath(startDir);\n\n for (const fileName of configurationFilesCandidates) {\n try {\n const filePath = resolve(baseDir, fileName);\n\n // Check if the file exists\n if (!existsSync(filePath)) {\n } else {\n numCustomConfiguration += 1;\n\n if (!configurationFilePath) {\n configurationFilePath = filePath;\n }\n }\n } catch (error) {\n // Return \"Cannot use import statement outside a module\"\n logger(`${fileName}: ${error as string}`, { level: 'error' });\n }\n }\n\n return { configurationFilePath, numCustomConfiguration };\n};\n"],"mappings":";;;;;;AAKA,MAAa,+BAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAQD,MAAM,gCAAgB,IAAI,KAA4C;;;;;;;;;;;;AAatE,MAAa,2BACX,aACkC;CAClC,IAAI;CACJ,IAAI,yBAAyB;AAG7B,KAAI,cAAc,IAAI,SAAS,CAC7B,QAAO,cAAc,IAAI,SAAS;CAGpC,MAAM,EAAE,YAAY,mBAAmB,SAAS;AAEhD,MAAK,MAAM,YAAY,6BACrB,KAAI;EACF,MAAM,WAAW,QAAQ,SAAS,SAAS;AAG3C,MAAI,CAAC,WAAW,SAAS,EAAE,QACpB;AACL,6BAA0B;AAE1B,OAAI,CAAC,sBACH,yBAAwB;;UAGrB,OAAO;AAEd,SAAO,GAAG,SAAS,IAAI,SAAmB,EAAE,OAAO,SAAS,CAAC;;AAIjE,QAAO;EAAE;EAAuB;EAAwB"}
|
|
@@ -1,2 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/defaultValues/build.ts
|
|
2
|
+
const BUILD_MODE = "auto";
|
|
3
|
+
const OPTIMIZE = void 0;
|
|
4
|
+
const TRAVERSE_PATTERN = [
|
|
5
|
+
"**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}",
|
|
6
|
+
"!**/node_modules/**",
|
|
7
|
+
"!**/dist/**",
|
|
8
|
+
"!**/build/**",
|
|
9
|
+
"!**/.intlayer/**",
|
|
10
|
+
"!**/.next/**",
|
|
11
|
+
"!**/.nuxt/**",
|
|
12
|
+
"!**/.expo/**",
|
|
13
|
+
"!**/.vercel/**",
|
|
14
|
+
"!**/.turbo/**",
|
|
15
|
+
"!**/.tanstack/**",
|
|
16
|
+
"!**/*.config.*",
|
|
17
|
+
"!**/*.test.*",
|
|
18
|
+
"!**/*.spec.*",
|
|
19
|
+
"!**/*.stories.*",
|
|
20
|
+
"!**/*.d.ts",
|
|
21
|
+
"!**/*.d.ts.map"
|
|
22
|
+
];
|
|
23
|
+
const OUTPUT_FORMAT = ["esm", "cjs"];
|
|
24
|
+
const CACHE = true;
|
|
25
|
+
const TYPE_CHECKING = false;
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { BUILD_MODE, CACHE, OPTIMIZE, OUTPUT_FORMAT, TRAVERSE_PATTERN, TYPE_CHECKING };
|
|
2
29
|
//# sourceMappingURL=build.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.mjs","names":[],"sources":["../../../src/defaultValues/build.ts"],"sourcesContent":["export const BUILD_MODE = 'auto';\n\nexport const OPTIMIZE = undefined;\n\nexport const TRAVERSE_PATTERN = [\n '**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}',\n\n '!**/node_modules/**',\n '!**/dist/**',\n '!**/build/**',\n '!**/.intlayer/**',\n '!**/.next/**',\n '!**/.nuxt/**',\n '!**/.expo/**',\n '!**/.vercel/**',\n '!**/.turbo/**',\n '!**/.tanstack/**',\n\n '!**/*.config.*',\n '!**/*.test.*',\n '!**/*.spec.*',\n '!**/*.stories.*',\n '!**/*.d.ts',\n '!**/*.d.ts.map',\n];\n\nexport const OUTPUT_FORMAT: ('cjs' | 'esm')[] = ['esm', 'cjs'];\n\nexport const CACHE = true;\n\nexport const TYPE_CHECKING = false;\n"],"mappings":"AAAA,MAAa,
|
|
1
|
+
{"version":3,"file":"build.mjs","names":[],"sources":["../../../src/defaultValues/build.ts"],"sourcesContent":["export const BUILD_MODE = 'auto';\n\nexport const OPTIMIZE = undefined;\n\nexport const TRAVERSE_PATTERN = [\n '**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}',\n\n '!**/node_modules/**',\n '!**/dist/**',\n '!**/build/**',\n '!**/.intlayer/**',\n '!**/.next/**',\n '!**/.nuxt/**',\n '!**/.expo/**',\n '!**/.vercel/**',\n '!**/.turbo/**',\n '!**/.tanstack/**',\n\n '!**/*.config.*',\n '!**/*.test.*',\n '!**/*.spec.*',\n '!**/*.stories.*',\n '!**/*.d.ts',\n '!**/*.d.ts.map',\n];\n\nexport const OUTPUT_FORMAT: ('cjs' | 'esm')[] = ['esm', 'cjs'];\n\nexport const CACHE = true;\n\nexport const TYPE_CHECKING = false;\n"],"mappings":";AAAA,MAAa,aAAa;AAE1B,MAAa,WAAW;AAExB,MAAa,mBAAmB;CAC9B;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,gBAAmC,CAAC,OAAO,MAAM;AAE9D,MAAa,QAAQ;AAErB,MAAa,gBAAgB"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/defaultValues/compiler.ts
|
|
2
|
+
const COMPILER_ENABLED = true;
|
|
3
|
+
const COMPILER_DICTIONARY_KEY_PREFIX = "";
|
|
4
|
+
const COMPILER_NO_METADATA = false;
|
|
5
|
+
const COMPILER_SAVE_COMPONENTS = false;
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { COMPILER_DICTIONARY_KEY_PREFIX, COMPILER_ENABLED, COMPILER_NO_METADATA, COMPILER_SAVE_COMPONENTS };
|
|
2
9
|
//# sourceMappingURL=compiler.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.mjs","names":[],"sources":["../../../src/defaultValues/compiler.ts"],"sourcesContent":["export const COMPILER_ENABLED = true;\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,
|
|
1
|
+
{"version":3,"file":"compiler.mjs","names":[],"sources":["../../../src/defaultValues/compiler.ts"],"sourcesContent":["export const COMPILER_ENABLED = true;\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"}
|
|
@@ -1,2 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/defaultValues/content.ts
|
|
2
|
+
const FILE_EXTENSIONS = [
|
|
3
|
+
".content.ts",
|
|
4
|
+
".content.js",
|
|
5
|
+
".content.cjs",
|
|
6
|
+
".content.mjs",
|
|
7
|
+
".content.json",
|
|
8
|
+
".content.json5",
|
|
9
|
+
".content.jsonc",
|
|
10
|
+
".content.tsx",
|
|
11
|
+
".content.jsx"
|
|
12
|
+
];
|
|
13
|
+
const EXCLUDED_PATHS = [
|
|
14
|
+
"**/node_modules/**",
|
|
15
|
+
"**/dist/**",
|
|
16
|
+
"**/build/**",
|
|
17
|
+
"**/.intlayer/**",
|
|
18
|
+
"**/.next/**",
|
|
19
|
+
"**/.nuxt/**",
|
|
20
|
+
"**/.expo/**",
|
|
21
|
+
"**/.vercel/**",
|
|
22
|
+
"**/.turbo/**",
|
|
23
|
+
"**/.tanstack/**"
|
|
24
|
+
];
|
|
25
|
+
const CONTENT_DIR = ["."];
|
|
26
|
+
const CODE_DIR = ["."];
|
|
27
|
+
const I18NEXT_DICTIONARIES_DIR = "i18next_resources";
|
|
28
|
+
const REACT_INTL_MESSAGES_DIR = "intl_messages";
|
|
29
|
+
const WATCH = true;
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { CODE_DIR, CONTENT_DIR, EXCLUDED_PATHS, FILE_EXTENSIONS, I18NEXT_DICTIONARIES_DIR, REACT_INTL_MESSAGES_DIR, WATCH };
|
|
2
33
|
//# sourceMappingURL=content.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.mjs","names":[],"sources":["../../../src/defaultValues/content.ts"],"sourcesContent":["export const FILE_EXTENSIONS = [\n '.content.ts',\n '.content.js',\n '.content.cjs',\n '.content.mjs',\n '.content.json',\n '.content.json5',\n '.content.jsonc',\n '.content.tsx',\n '.content.jsx',\n];\n\nexport const EXCLUDED_PATHS = [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n '**/.intlayer/**',\n '**/.next/**',\n '**/.nuxt/**',\n '**/.expo/**',\n '**/.vercel/**',\n '**/.turbo/**',\n '**/.tanstack/**',\n];\n\nexport const CONTENT_DIR = ['.'];\n\nexport const CODE_DIR = ['.'];\n\nexport const I18NEXT_DICTIONARIES_DIR = 'i18next_resources';\n\nexport const REACT_INTL_MESSAGES_DIR = 'intl_messages';\n\nexport const WATCH = true;\n"],"mappings":"AAAA,MAAa,
|
|
1
|
+
{"version":3,"file":"content.mjs","names":[],"sources":["../../../src/defaultValues/content.ts"],"sourcesContent":["export const FILE_EXTENSIONS = [\n '.content.ts',\n '.content.js',\n '.content.cjs',\n '.content.mjs',\n '.content.json',\n '.content.json5',\n '.content.jsonc',\n '.content.tsx',\n '.content.jsx',\n];\n\nexport const EXCLUDED_PATHS = [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n '**/.intlayer/**',\n '**/.next/**',\n '**/.nuxt/**',\n '**/.expo/**',\n '**/.vercel/**',\n '**/.turbo/**',\n '**/.tanstack/**',\n];\n\nexport const CONTENT_DIR = ['.'];\n\nexport const CODE_DIR = ['.'];\n\nexport const I18NEXT_DICTIONARIES_DIR = 'i18next_resources';\n\nexport const REACT_INTL_MESSAGES_DIR = 'intl_messages';\n\nexport const WATCH = true;\n"],"mappings":";AAAA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,cAAc,CAAC,IAAI;AAEhC,MAAa,WAAW,CAAC,IAAI;AAE7B,MAAa,2BAA2B;AAExC,MAAa,0BAA0B;AAEvC,MAAa,QAAQ"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/defaultValues/dictionary.ts
|
|
2
|
+
const FILL = true;
|
|
3
|
+
const LOCATION = "local";
|
|
4
|
+
const CONTENT_AUTO_TRANSFORMATION = false;
|
|
5
|
+
const IMPORT_MODE = "static";
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { CONTENT_AUTO_TRANSFORMATION, FILL, IMPORT_MODE, LOCATION };
|
|
2
9
|
//# sourceMappingURL=dictionary.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.mjs","names":[],"sources":["../../../src/defaultValues/dictionary.ts"],"sourcesContent":["import type { DictionaryLocation } from '@intlayer/types/dictionary';\n\nexport const FILL = true;\nexport const LOCATION: DictionaryLocation = 'local';\nexport const CONTENT_AUTO_TRANSFORMATION = false;\nexport const IMPORT_MODE = 'static';\n"],"mappings":"AAEA,MAAa,
|
|
1
|
+
{"version":3,"file":"dictionary.mjs","names":[],"sources":["../../../src/defaultValues/dictionary.ts"],"sourcesContent":["import type { DictionaryLocation } from '@intlayer/types/dictionary';\n\nexport const FILL = true;\nexport const LOCATION: DictionaryLocation = 'local';\nexport const CONTENT_AUTO_TRANSFORMATION = false;\nexport const IMPORT_MODE = 'static';\n"],"mappings":";AAEA,MAAa,OAAO;AACpB,MAAa,WAA+B;AAC5C,MAAa,8BAA8B;AAC3C,MAAa,cAAc"}
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/defaultValues/editor.ts
|
|
2
|
+
const APPLICATION_URL = void 0;
|
|
3
|
+
const EDITOR_URL = "http://localhost:8000";
|
|
4
|
+
const CMS_URL = "https://app.intlayer.org";
|
|
5
|
+
const BACKEND_URL = "https://back.intlayer.org";
|
|
6
|
+
const PORT = 8e3;
|
|
7
|
+
const IS_ENABLED = false;
|
|
8
|
+
const LIVE_SYNC = true;
|
|
9
|
+
const DICTIONARY_PRIORITY_STRATEGY = "local_first";
|
|
10
|
+
const LIVE_SYNC_PORT = 4e3;
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { APPLICATION_URL, BACKEND_URL, CMS_URL, DICTIONARY_PRIORITY_STRATEGY, EDITOR_URL, IS_ENABLED, LIVE_SYNC, LIVE_SYNC_PORT, PORT };
|
|
2
14
|
//# sourceMappingURL=editor.mjs.map
|