@intlayer/engine 9.5.9-canary.0 → 9.5.10
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/_utils_asset.cjs +1 -1
- package/dist/cjs/build.cjs +4 -4
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +2 -2
- package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +3 -3
- package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeNestedDictionary.cjs +3 -3
- package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +2 -2
- package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +2 -2
- package/dist/cjs/cleanOutputDir.cjs +1 -1
- package/dist/cjs/cleanRemovedContentDeclaration.cjs +1 -1
- package/dist/cjs/cli.cjs +10 -3
- package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +2 -2
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +2 -2
- package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +2 -2
- package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +2 -2
- package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +2 -2
- package/dist/cjs/createType/createModuleAugmentation.cjs +3 -3
- package/dist/cjs/createType/createType.cjs +1 -1
- package/dist/cjs/docReview/index.cjs +5 -5
- package/dist/cjs/docReview/pipeline.cjs +4 -4
- package/dist/cjs/docReview/reviewReport.cjs.map +1 -1
- package/dist/cjs/fetchDistantDictionaries.cjs +1 -1
- package/dist/cjs/handleContentDeclarationFileChange.cjs +2 -2
- package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +1 -1
- package/dist/cjs/init/cms.cjs +35 -0
- package/dist/cjs/init/cms.cjs.map +1 -1
- package/dist/cjs/init/documentationRouter.cjs +141 -0
- package/dist/cjs/init/documentationRouter.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/backend/index.cjs +138 -0
- package/dist/cjs/init/frameworkSetup/backend/index.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/backend/transforms.cjs +223 -0
- package/dist/cjs/init/frameworkSetup/backend/transforms.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/index.cjs +9 -3
- package/dist/cjs/init/frameworkSetup/index.cjs.map +1 -1
- package/dist/cjs/init/frameworkSetup/localeRouting.cjs +13 -0
- package/dist/cjs/init/frameworkSetup/localeRouting.cjs.map +1 -0
- package/dist/cjs/init/frameworkSetup/nextAppRouter/index.cjs +34 -7
- package/dist/cjs/init/frameworkSetup/nextAppRouter/index.cjs.map +1 -1
- package/dist/cjs/init/frameworkSetup/nextAppRouter/restructure.cjs +1 -1
- package/dist/cjs/init/frameworkSetup/nextAppRouter/templates.cjs +56 -0
- package/dist/cjs/init/frameworkSetup/nextAppRouter/templates.cjs.map +1 -1
- package/dist/cjs/init/frameworkSetup/nextAppRouter/transforms.cjs +2 -2
- package/dist/cjs/init/frameworkSetup/nextAppRouter/transforms.cjs.map +1 -1
- package/dist/cjs/init/frameworkSetup/tanstackStart/index.cjs +32 -3
- package/dist/cjs/init/frameworkSetup/tanstackStart/index.cjs.map +1 -1
- package/dist/cjs/init/frameworkSetup/tanstackStart/restructure.cjs +1 -1
- package/dist/cjs/init/frameworkSetup/tanstackStart/templates.cjs +58 -0
- package/dist/cjs/init/frameworkSetup/tanstackStart/templates.cjs.map +1 -1
- package/dist/cjs/init/frameworkSetup/tanstackStart/transforms.cjs +94 -14
- package/dist/cjs/init/frameworkSetup/tanstackStart/transforms.cjs.map +1 -1
- package/dist/cjs/init/index.cjs +46 -159
- package/dist/cjs/init/index.cjs.map +1 -1
- package/dist/cjs/init/utils/configManipulation.cjs +39 -0
- package/dist/cjs/init/utils/configManipulation.cjs.map +1 -1
- package/dist/cjs/init/utils/fileSystem.cjs +1 -1
- package/dist/cjs/init/utils/githubActions.cjs +1 -1
- package/dist/cjs/init/utils/index.cjs +10 -0
- package/dist/cjs/init/utils/intlayerDependencies.cjs +1 -1
- package/dist/cjs/init/utils/lintConfig.cjs +52 -0
- package/dist/cjs/init/utils/lintConfig.cjs.map +1 -0
- package/dist/cjs/init/utils/packageManager.cjs +63 -14
- package/dist/cjs/init/utils/packageManager.cjs.map +1 -1
- package/dist/cjs/init/utils/urlRoutingFramework.cjs +41 -0
- package/dist/cjs/init/utils/urlRoutingFramework.cjs.map +1 -0
- package/dist/cjs/initConfig/index.cjs +5 -2
- package/dist/cjs/initConfig/index.cjs.map +1 -1
- package/dist/cjs/installLSP.cjs +1 -1
- package/dist/cjs/installMCP/installMCP.cjs +1 -1
- package/dist/cjs/installSkills/index.cjs +1 -1
- package/dist/cjs/listDictionariesPath.cjs +1 -1
- package/dist/cjs/listGitFiles.cjs +1 -1
- package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +2 -2
- package/dist/cjs/loadDictionaries/index.cjs +1 -1
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +2 -2
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs +1 -1
- package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +1 -1
- package/dist/cjs/loadDictionaries/loadMarkdownContentDeclaration.cjs +1 -1
- package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs +104 -43
- package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs.map +1 -1
- package/dist/cjs/logConfigDetails.cjs +1 -1
- package/dist/cjs/prepareIntlayer.cjs +4 -4
- package/dist/cjs/scan/index.cjs +1 -1
- package/dist/cjs/scan/scanWebsite.cjs +1 -1
- package/dist/cjs/syncPluginKit/createFileAdapter.cjs +1 -1
- package/dist/cjs/syncPluginKit/index.cjs +1 -1
- package/dist/cjs/utils/buildComponentFilesList.cjs +1 -1
- package/dist/cjs/utils/contentWatcherLock.cjs +2 -2
- package/dist/cjs/utils/index.cjs +4 -4
- package/dist/cjs/utils/readDictionariesFromDisk.cjs +1 -1
- package/dist/cjs/utils/runOnce.cjs +1 -1
- package/dist/cjs/utils/runParallel/pidTree.cjs +1 -1
- package/dist/cjs/utils/withFileLock.cjs +1 -1
- package/dist/cjs/watcher.cjs +6 -6
- package/dist/cjs/writeConfiguration/index.cjs +1 -1
- package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +2 -2
- package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +1 -1
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +4 -4
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +3 -3
- package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs +1 -1
- package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs +1 -1
- package/dist/cjs/writeFileIfChanged.cjs +1 -1
- package/dist/esm/_virtual/_utils_asset.mjs +1 -1
- package/dist/esm/build.mjs +4 -4
- package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +2 -2
- package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs +3 -3
- package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +1 -1
- package/dist/esm/buildIntlayerDictionary/writeNestedDictionary.mjs +3 -3
- package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +2 -2
- package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +2 -2
- package/dist/esm/cleanOutputDir.mjs +1 -1
- package/dist/esm/cleanRemovedContentDeclaration.mjs +1 -1
- package/dist/esm/cli.mjs +8 -6
- package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs +2 -2
- package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs +2 -2
- package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs +2 -2
- package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs +2 -2
- package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs +2 -2
- package/dist/esm/createType/createModuleAugmentation.mjs +3 -3
- package/dist/esm/createType/createType.mjs +1 -1
- package/dist/esm/docReview/index.mjs +5 -5
- package/dist/esm/docReview/pipeline.mjs +4 -4
- package/dist/esm/docReview/reviewReport.mjs.map +1 -1
- package/dist/esm/fetchDistantDictionaries.mjs +1 -1
- package/dist/esm/handleContentDeclarationFileChange.mjs +2 -2
- package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +1 -1
- package/dist/esm/init/cms.mjs +35 -2
- package/dist/esm/init/cms.mjs.map +1 -1
- package/dist/esm/init/documentationRouter.mjs +139 -0
- package/dist/esm/init/documentationRouter.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/backend/index.mjs +130 -0
- package/dist/esm/init/frameworkSetup/backend/index.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/backend/transforms.mjs +216 -0
- package/dist/esm/init/frameworkSetup/backend/transforms.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/index.mjs +9 -3
- package/dist/esm/init/frameworkSetup/index.mjs.map +1 -1
- package/dist/esm/init/frameworkSetup/localeRouting.mjs +12 -0
- package/dist/esm/init/frameworkSetup/localeRouting.mjs.map +1 -0
- package/dist/esm/init/frameworkSetup/nextAppRouter/index.mjs +36 -9
- package/dist/esm/init/frameworkSetup/nextAppRouter/index.mjs.map +1 -1
- package/dist/esm/init/frameworkSetup/nextAppRouter/restructure.mjs +1 -1
- package/dist/esm/init/frameworkSetup/nextAppRouter/templates.mjs +54 -1
- package/dist/esm/init/frameworkSetup/nextAppRouter/templates.mjs.map +1 -1
- package/dist/esm/init/frameworkSetup/nextAppRouter/transforms.mjs +2 -2
- package/dist/esm/init/frameworkSetup/nextAppRouter/transforms.mjs.map +1 -1
- package/dist/esm/init/frameworkSetup/tanstackStart/index.mjs +35 -6
- package/dist/esm/init/frameworkSetup/tanstackStart/index.mjs.map +1 -1
- package/dist/esm/init/frameworkSetup/tanstackStart/restructure.mjs +1 -1
- package/dist/esm/init/frameworkSetup/tanstackStart/templates.mjs +56 -1
- package/dist/esm/init/frameworkSetup/tanstackStart/templates.mjs.map +1 -1
- package/dist/esm/init/frameworkSetup/tanstackStart/transforms.mjs +94 -15
- package/dist/esm/init/frameworkSetup/tanstackStart/transforms.mjs.map +1 -1
- package/dist/esm/init/index.mjs +42 -158
- package/dist/esm/init/index.mjs.map +1 -1
- package/dist/esm/init/utils/configManipulation.mjs +38 -1
- package/dist/esm/init/utils/configManipulation.mjs.map +1 -1
- package/dist/esm/init/utils/fileSystem.mjs +1 -1
- package/dist/esm/init/utils/githubActions.mjs +1 -1
- package/dist/esm/init/utils/index.mjs +5 -3
- package/dist/esm/init/utils/intlayerDependencies.mjs +1 -1
- package/dist/esm/init/utils/lintConfig.mjs +50 -0
- package/dist/esm/init/utils/lintConfig.mjs.map +1 -0
- package/dist/esm/init/utils/packageManager.mjs +61 -15
- package/dist/esm/init/utils/packageManager.mjs.map +1 -1
- package/dist/esm/init/utils/urlRoutingFramework.mjs +40 -0
- package/dist/esm/init/utils/urlRoutingFramework.mjs.map +1 -0
- package/dist/esm/initConfig/index.mjs +5 -2
- package/dist/esm/initConfig/index.mjs.map +1 -1
- package/dist/esm/installLSP.mjs +1 -1
- package/dist/esm/installMCP/installMCP.mjs +1 -1
- package/dist/esm/installSkills/index.mjs +1 -1
- package/dist/esm/listDictionariesPath.mjs +1 -1
- package/dist/esm/listGitFiles.mjs +1 -1
- package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +2 -2
- package/dist/esm/loadDictionaries/index.mjs +1 -1
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +2 -2
- package/dist/esm/loadDictionaries/loadDictionaries.mjs +1 -1
- package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs +1 -1
- package/dist/esm/loadDictionaries/loadMarkdownContentDeclaration.mjs +1 -1
- package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs +105 -44
- package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs.map +1 -1
- package/dist/esm/logConfigDetails.mjs +1 -1
- package/dist/esm/prepareIntlayer.mjs +4 -4
- package/dist/esm/scan/index.mjs +1 -1
- package/dist/esm/scan/scanWebsite.mjs +1 -1
- package/dist/esm/syncPluginKit/createFileAdapter.mjs +1 -1
- package/dist/esm/syncPluginKit/index.mjs +1 -1
- package/dist/esm/utils/buildComponentFilesList.mjs +1 -1
- package/dist/esm/utils/contentWatcherLock.mjs +2 -2
- package/dist/esm/utils/index.mjs +4 -4
- package/dist/esm/utils/readDictionariesFromDisk.mjs +1 -1
- package/dist/esm/utils/runOnce.mjs +1 -1
- package/dist/esm/utils/runParallel/pidTree.mjs +1 -1
- package/dist/esm/utils/withFileLock.mjs +1 -1
- package/dist/esm/watcher.mjs +6 -6
- package/dist/esm/writeConfiguration/index.mjs +1 -1
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +2 -2
- package/dist/esm/writeContentDeclaration/transformJSFile.mjs +1 -1
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +4 -4
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs +3 -3
- package/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs +1 -1
- package/dist/esm/writeContentDeclaration/writeYamlFile.mjs +1 -1
- package/dist/esm/writeFileIfChanged.mjs +1 -1
- package/dist/types/cli.d.ts +5 -3
- package/dist/types/docReview/reviewReport.d.ts.map +1 -1
- package/dist/types/formatDictionary.d.ts +2 -2
- package/dist/types/init/cms.d.ts +11 -0
- package/dist/types/init/cms.d.ts.map +1 -1
- package/dist/types/init/documentationRouter.d.ts +64 -0
- package/dist/types/init/documentationRouter.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/backend/index.d.ts +16 -0
- package/dist/types/init/frameworkSetup/backend/index.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/backend/transforms.d.ts +37 -0
- package/dist/types/init/frameworkSetup/backend/transforms.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/index.d.ts.map +1 -1
- package/dist/types/init/frameworkSetup/localeRouting.d.ts +11 -0
- package/dist/types/init/frameworkSetup/localeRouting.d.ts.map +1 -0
- package/dist/types/init/frameworkSetup/nextAppRouter/index.d.ts +5 -5
- package/dist/types/init/frameworkSetup/nextAppRouter/index.d.ts.map +1 -1
- package/dist/types/init/frameworkSetup/nextAppRouter/templates.d.ts +12 -0
- package/dist/types/init/frameworkSetup/nextAppRouter/templates.d.ts.map +1 -1
- package/dist/types/init/frameworkSetup/nextAppRouter/transforms.d.ts +10 -1
- package/dist/types/init/frameworkSetup/nextAppRouter/transforms.d.ts.map +1 -1
- package/dist/types/init/frameworkSetup/tanstackStart/index.d.ts +3 -2
- package/dist/types/init/frameworkSetup/tanstackStart/index.d.ts.map +1 -1
- package/dist/types/init/frameworkSetup/tanstackStart/templates.d.ts +10 -0
- package/dist/types/init/frameworkSetup/tanstackStart/templates.d.ts.map +1 -1
- package/dist/types/init/frameworkSetup/tanstackStart/transforms.d.ts +12 -0
- package/dist/types/init/frameworkSetup/tanstackStart/transforms.d.ts.map +1 -1
- package/dist/types/init/frameworkSetup/types.d.ts +6 -0
- package/dist/types/init/frameworkSetup/types.d.ts.map +1 -1
- package/dist/types/init/index.d.ts +15 -1
- package/dist/types/init/index.d.ts.map +1 -1
- package/dist/types/init/utils/configManipulation.d.ts +14 -0
- package/dist/types/init/utils/configManipulation.d.ts.map +1 -1
- package/dist/types/init/utils/index.d.ts +5 -3
- package/dist/types/init/utils/lintConfig.d.ts +28 -0
- package/dist/types/init/utils/lintConfig.d.ts.map +1 -0
- package/dist/types/init/utils/packageManager.d.ts +29 -6
- package/dist/types/init/utils/packageManager.d.ts.map +1 -1
- package/dist/types/init/utils/urlRoutingFramework.d.ts +9 -0
- package/dist/types/init/utils/urlRoutingFramework.d.ts.map +1 -0
- package/dist/types/initConfig/index.d.ts +3 -1
- package/dist/types/initConfig/index.d.ts.map +1 -1
- package/dist/types/loadDictionaries/logTypeScriptErrors.d.ts +4 -0
- package/dist/types/loadDictionaries/logTypeScriptErrors.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/esm/init/index.mjs
CHANGED
|
@@ -1,146 +1,27 @@
|
|
|
1
1
|
import { getMetroConfigTemplate, hasIntlayerVitePlugin, replaceViteConfigPluginImportSource, updateAstroConfig, updateIntlayerConfigWithSyncPlugin, updateMetroConfig, updateNextConfig, updateNextConfigForNextI18next, updateNextConfigForNextIntl, updateNextConfigForNextTranslate, updateNuxtConfig, updateNuxtConfigForNuxtjsI18n, updateViteConfig, updateViteConfigForCompatPlugin } from "./utils/configManipulation.mjs";
|
|
2
2
|
import { detectJsonLocalePattern, detectLinguiCatalogPattern, detectNextIntlMessagesPattern, ensureDirectory, exists, readFileFromRoot, writeFileToRoot } from "./utils/fileSystem.mjs";
|
|
3
|
-
import { setCompilerOutputInConfig, setRoutingModeInConfig } from "./cms.mjs";
|
|
3
|
+
import { setCompilerOutputInConfig, setEnableProxyInConfig, setRoutingModeInConfig, setRoutingStorageOnlyInConfig } from "./cms.mjs";
|
|
4
4
|
import { initConfig } from "../initConfig/index.mjs";
|
|
5
|
+
import { DocumentationRouter, getDocumentationUrl } from "./documentationRouter.mjs";
|
|
5
6
|
import { setupFramework } from "./frameworkSetup/index.mjs";
|
|
6
7
|
import { BACKEND_INTLAYER_PACKAGES, resolveDevScript } from "./utils/devScript.mjs";
|
|
7
|
-
import { detectMissingIntlayerPackages, detectPackageManager, hasLintTooling, installPackages, isIntlayerPackageName, moveCompatPackagesToDevDependencies } from "./utils/packageManager.mjs";
|
|
8
|
+
import { MINIMUM_ESLINT_MAJOR, detectCompatI18nLibraries, detectMissingIntlayerPackages, detectPackageManager, hasLegacyEslint, hasLintTooling, installPackages, isIntlayerPackageName, moveCompatPackagesToDevDependencies } from "./utils/packageManager.mjs";
|
|
8
9
|
import { getGithubWorkflows, resolveGithubWorkflowsContext } from "./utils/githubActions.mjs";
|
|
9
10
|
import { parseJSONWithComments } from "./utils/jsonParser.mjs";
|
|
11
|
+
import { LINT_PLUGIN_PACKAGE_NAME, addIntlayerRulesToOxlintConfig } from "./utils/lintConfig.mjs";
|
|
10
12
|
import { setupNextCompilerBabelConfig } from "./utils/nextCompilerBabel.mjs";
|
|
11
13
|
import { findTsConfigFiles } from "./utils/tsConfig.mjs";
|
|
14
|
+
import { hasUrlRoutingFramework } from "./utils/urlRoutingFramework.mjs";
|
|
12
15
|
import { upgradeIntlayerPackages } from "./upgradeIntlayerPackages.mjs";
|
|
13
16
|
import { join } from "node:path";
|
|
14
17
|
import * as ANSIColors from "@intlayer/config/colors";
|
|
15
18
|
import { colorize, colorizePath, logger, v, x } from "@intlayer/config/logger";
|
|
16
19
|
import { getConfiguration } from "@intlayer/config/node";
|
|
20
|
+
import { ROUTING_MODE } from "@intlayer/config/defaultValues";
|
|
17
21
|
import { getAlias } from "@intlayer/config/utils";
|
|
18
22
|
|
|
19
23
|
//#region src/init/index.ts
|
|
20
24
|
/**
|
|
21
|
-
* Documentation URL Constants
|
|
22
|
-
*/
|
|
23
|
-
const DocumentationRouter = {
|
|
24
|
-
NextJS: "https://intlayer.org/doc/environment/nextjs.md",
|
|
25
|
-
NextJS_15: "https://intlayer.org/doc/environment/nextjs/15.md",
|
|
26
|
-
NextJS_14: "https://intlayer.org/doc/environment/nextjs/14.md",
|
|
27
|
-
CRA: "https://intlayer.org/doc/environment/create-react-app.md",
|
|
28
|
-
Astro: "https://intlayer.org/doc/environment/astro.md",
|
|
29
|
-
ViteAndReact: "https://intlayer.org/doc/environment/vite-and-react.md",
|
|
30
|
-
ViteAndReact_ReactRouterV7: "https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md",
|
|
31
|
-
ViteAndVue: "https://intlayer.org/doc/environment/vite-and-vue.md",
|
|
32
|
-
ViteAndSolid: "https://intlayer.org/doc/environment/vite-and-solid.md",
|
|
33
|
-
ViteAndSvelte: "https://intlayer.org/doc/environment/vite-and-svelte.md",
|
|
34
|
-
ViteAndPreact: "https://intlayer.org/doc/environment/vite-and-preact.md",
|
|
35
|
-
ViteAndLit: "https://intlayer.org/doc/environment/vite-and-lit.md",
|
|
36
|
-
ViteAndVanilla: "https://intlayer.org/doc/environment/vite-and-vanilla.md",
|
|
37
|
-
Vanilla: "https://intlayer.org/doc/environment/vanilla.md",
|
|
38
|
-
TanStackRouter: "https://intlayer.org/doc/environment/tanstack-start.md",
|
|
39
|
-
TanStackRouterAndSolid: "https://intlayer.org/doc/environment/tanstack-start/solid.md",
|
|
40
|
-
SolidStart: "https://intlayer.org/doc/environment/solid-start.md",
|
|
41
|
-
Analog: "https://intlayer.org/doc/environment/analog.md",
|
|
42
|
-
Remix: "https://intlayer.org/doc/environment/remix-3.md",
|
|
43
|
-
NuxtAndVue: "https://intlayer.org/doc/environment/nuxt-and-vue.md",
|
|
44
|
-
Angular: "https://intlayer.org/doc/environment/angular.md",
|
|
45
|
-
SvelteKit: "https://intlayer.org/doc/environment/sveltekit.md",
|
|
46
|
-
ReactNativeAndExpo: "https://intlayer.org/doc/environment/react-native-and-expo.md",
|
|
47
|
-
Lynx: "https://intlayer.org/doc/environment/lynx-and-react.md",
|
|
48
|
-
Express: "https://intlayer.org/doc/environment/express.md",
|
|
49
|
-
NestJS: "https://intlayer.org/doc/environment/nest.md",
|
|
50
|
-
Fastify: "https://intlayer.org/doc/environment/fastify.md",
|
|
51
|
-
Hono: "https://intlayer.org/doc/environment/hono.md",
|
|
52
|
-
AdonisJS: "https://intlayer.org/doc/environment/adonisjs.md",
|
|
53
|
-
Elysia: "https://intlayer.org/doc/environment/elysia.md",
|
|
54
|
-
Default: "https://intlayer.org/doc/get-started",
|
|
55
|
-
LSP: "https://intlayer.org/doc/lsp.md",
|
|
56
|
-
ESLint: "https://intlayer.org/doc/eslint.md",
|
|
57
|
-
NextIntl: "https://intlayer.org/blog/intlayer-with-next-intl.md",
|
|
58
|
-
ReactI18Next: "https://intlayer.org/blog/intlayer-with-react-i18next.md",
|
|
59
|
-
ReactIntl: "https://intlayer.org/blog/intlayer-with-react-intl.md",
|
|
60
|
-
NextI18Next: "https://intlayer.org/blog/intlayer-with-next-i18next.md",
|
|
61
|
-
VueI18n: "https://intlayer.org/blog/intlayer-with-vue-i18n.md"
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* The Intlayer lint setup, as `intlayer init` writes it into `.oxlintrc.json`.
|
|
65
|
-
*
|
|
66
|
-
* Declared locally on purpose: `@intlayer/engine` is installed by every Intlayer
|
|
67
|
-
* user, so it must not depend on a lint plugin to write a handful of strings
|
|
68
|
-
* into a JSON file. oxlint resolves a plugin's *rules* but not its shipped
|
|
69
|
-
* *configs*, so the preset cannot be referenced by name there either.
|
|
70
|
-
*
|
|
71
|
-
* Mirrors the `recommended` preset of `eslint-plugin-intlayer`; keep in sync
|
|
72
|
-
* when a rule is enabled by default there.
|
|
73
|
-
*/
|
|
74
|
-
const LINT_PLUGIN_PACKAGE_NAME = "eslint-plugin-intlayer";
|
|
75
|
-
/** Intlayer's generated output — never source, never worth linting. */
|
|
76
|
-
const GENERATED_OUTPUT_GLOBS = ["**/.intlayer/**"];
|
|
77
|
-
/** Rules of the `recommended` preset, prefixed by the plugin namespace. */
|
|
78
|
-
const getRecommendedRules = () => ({
|
|
79
|
-
"intlayer/no-raw-text": "warn",
|
|
80
|
-
"intlayer/static-dictionary-key": "error",
|
|
81
|
-
"intlayer/no-dynamic-field-access": "error"
|
|
82
|
-
});
|
|
83
|
-
/**
|
|
84
|
-
* Helper: Detects the environment and returns the doc URL
|
|
85
|
-
*/
|
|
86
|
-
const getDocumentationUrl = (packageJson) => {
|
|
87
|
-
const deps = {
|
|
88
|
-
...packageJson.dependencies,
|
|
89
|
-
...packageJson.devDependencies
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Helper to check if a version string matches a specific major version
|
|
93
|
-
* Matches: "15", "^15.0.0", "~15.2", "15.0.0-beta"
|
|
94
|
-
*/
|
|
95
|
-
const isVersion = (versionString, major) => {
|
|
96
|
-
if (!versionString || typeof versionString !== "string") return false;
|
|
97
|
-
return new RegExp(`^[\\^~]?${major}(?:\\.|$)`).test(versionString);
|
|
98
|
-
};
|
|
99
|
-
if (deps["@lynx-js/react"] || deps["@lynx-js/core"]) return DocumentationRouter.Lynx;
|
|
100
|
-
if (deps["react-native"] || deps.expo) return DocumentationRouter.ReactNativeAndExpo;
|
|
101
|
-
if (deps.next) {
|
|
102
|
-
const version = deps.next;
|
|
103
|
-
if (isVersion(version, 14)) return DocumentationRouter.NextJS_14;
|
|
104
|
-
if (isVersion(version, 15)) return DocumentationRouter.NextJS_15;
|
|
105
|
-
return DocumentationRouter.NextJS;
|
|
106
|
-
}
|
|
107
|
-
if (deps.nuxt) return DocumentationRouter.NuxtAndVue;
|
|
108
|
-
if (deps.astro) return DocumentationRouter.Astro;
|
|
109
|
-
if (deps["@sveltejs/kit"]) return DocumentationRouter.SvelteKit;
|
|
110
|
-
if (deps["@analogjs/platform"]) return DocumentationRouter.Analog;
|
|
111
|
-
if (deps["@solidjs/start"]) return DocumentationRouter.SolidStart;
|
|
112
|
-
if (deps.remix || deps["remix-intlayer"]) return DocumentationRouter.Remix;
|
|
113
|
-
if (deps["@tanstack/react-router"]) return DocumentationRouter.TanStackRouter;
|
|
114
|
-
if (deps["@tanstack/solid-router"]) return DocumentationRouter.TanStackRouterAndSolid;
|
|
115
|
-
const reactRouterVersion = deps["react-router"];
|
|
116
|
-
if (typeof reactRouterVersion === "string" && (deps["@react-router/fs-routes"] || isVersion(reactRouterVersion, 7))) return DocumentationRouter.ViteAndReact_ReactRouterV7;
|
|
117
|
-
if (deps.vite) {
|
|
118
|
-
if (deps.vue) return DocumentationRouter.ViteAndVue;
|
|
119
|
-
if (deps["solid-js"]) return DocumentationRouter.ViteAndSolid;
|
|
120
|
-
if (deps.svelte) return DocumentationRouter.ViteAndSvelte;
|
|
121
|
-
if (deps.preact) return DocumentationRouter.ViteAndPreact;
|
|
122
|
-
if (deps.lit) return DocumentationRouter.ViteAndLit;
|
|
123
|
-
if (deps["vanilla-intlayer"]) return DocumentationRouter.ViteAndVanilla;
|
|
124
|
-
return DocumentationRouter.ViteAndReact;
|
|
125
|
-
}
|
|
126
|
-
if (deps["react-scripts"]) return DocumentationRouter.CRA;
|
|
127
|
-
if (deps["@angular/core"]) return DocumentationRouter.Angular;
|
|
128
|
-
if (deps.lit) return DocumentationRouter.ViteAndLit;
|
|
129
|
-
if (deps["vanilla-intlayer"]) return DocumentationRouter.Vanilla;
|
|
130
|
-
if (deps["@nestjs/core"]) return DocumentationRouter.NestJS;
|
|
131
|
-
if (deps["@adonisjs/core"]) return DocumentationRouter.AdonisJS;
|
|
132
|
-
if (deps.elysia) return DocumentationRouter.Elysia;
|
|
133
|
-
if (deps.hono) return DocumentationRouter.Hono;
|
|
134
|
-
if (deps.express) return DocumentationRouter.Express;
|
|
135
|
-
if (deps.fastify) return DocumentationRouter.Fastify;
|
|
136
|
-
if (deps["next-intl"]) return DocumentationRouter.NextIntl;
|
|
137
|
-
if (deps["react-i18next"] || deps.i18next) return DocumentationRouter.ReactI18Next;
|
|
138
|
-
if (deps["react-intl"]) return DocumentationRouter.ReactIntl;
|
|
139
|
-
if (deps["next-i18next"]) return DocumentationRouter.NextI18Next;
|
|
140
|
-
if (deps["vue-i18n"]) return DocumentationRouter.VueI18n;
|
|
141
|
-
return DocumentationRouter.Default;
|
|
142
|
-
};
|
|
143
|
-
/**
|
|
144
25
|
* Resolves the default dev-server URL of the detected framework, used as the
|
|
145
26
|
* `editor.applicationURL` of the generated configuration file. Frameworks that
|
|
146
27
|
* embed Vite (Astro, SvelteKit, …) are checked before the bare Vite fallback so
|
|
@@ -190,11 +71,14 @@ const initIntlayer = async (rootDir, options) => {
|
|
|
190
71
|
const linguiPresent = Boolean(allDeps["@lingui/core"] || allDeps["@lingui/react"] || allDeps["@intlayer/lingui"]);
|
|
191
72
|
const linguiCatalog = linguiPresent ? await detectLinguiCatalogPattern(rootDir) : null;
|
|
192
73
|
const linguiCatalogFormat = linguiCatalog?.format ?? (linguiPresent ? "po" : null);
|
|
193
|
-
const { packagesToInstall, devPackagesToInstall, compatSyncConfig, compatVitePluginConfig } = detectMissingIntlayerPackages(allDeps, {
|
|
74
|
+
const { packagesToInstall, devPackagesToInstall, compatSyncConfig, compatVitePluginConfig, pendingCompatAdapters } = detectMissingIntlayerPackages(allDeps, {
|
|
194
75
|
linguiCatalogFormat,
|
|
195
76
|
dependencies: packageJson.dependencies,
|
|
196
77
|
devDependencies: packageJson.devDependencies
|
|
197
78
|
});
|
|
79
|
+
/** Whether the compat adapter for a library is not released yet. */
|
|
80
|
+
const isCompatAdapterPending = (adapterPackage) => pendingCompatAdapters.includes(adapterPackage);
|
|
81
|
+
if (pendingCompatAdapters.length > 0) logger(`${x} No released Intlayer adapter yet for ${pendingCompatAdapters.map((adapterPackage) => colorize(adapterPackage, ANSIColors.MAGENTA)).join(", ")} — keeping your current i18n library and only syncing its catalogs with Intlayer.`, { level: "warn" });
|
|
198
82
|
const wantsJsonNamespaces = options?.contentStrategy === "json-namespaces" && !compatSyncConfig;
|
|
199
83
|
if (wantsJsonNamespaces && !allDeps["@intlayer/sync-json-plugin"] && !devPackagesToInstall.includes("@intlayer/sync-json-plugin")) devPackagesToInstall.push("@intlayer/sync-json-plugin");
|
|
200
84
|
if (!options?.noInstallPackages) {
|
|
@@ -220,7 +104,7 @@ const initIntlayer = async (rootDir, options) => {
|
|
|
220
104
|
await upgradeIntlayerPackages(rootDir);
|
|
221
105
|
}
|
|
222
106
|
const gitignorePath = ".gitignore";
|
|
223
|
-
if (!options?.noGitignore && await exists(rootDir, gitignorePath)) {
|
|
107
|
+
if (!options?.noGitignore && !options?.noFrameworkSetup && await exists(rootDir, gitignorePath)) {
|
|
224
108
|
const gitignoreContent = await readFileFromRoot(rootDir, gitignorePath);
|
|
225
109
|
if (!gitignoreContent.includes("intlayer")) {
|
|
226
110
|
const newContent = `${gitignoreContent}\n# Intlayer\n.intlayer\n`;
|
|
@@ -286,38 +170,24 @@ const initIntlayer = async (rootDir, options) => {
|
|
|
286
170
|
} catch {
|
|
287
171
|
logger(`${x} Could not update ${colorizePath(settingsJsonPath)}. You may need to add the LSP settings manually.`, { level: "warn" });
|
|
288
172
|
}
|
|
173
|
+
if (!options?.noEslint && hasLegacyEslint(allDeps)) logger(`${x} ${colorize(LINT_PLUGIN_PACKAGE_NAME, ANSIColors.MAGENTA)} needs ESLint ${9}+ (flat config) — skipped the Intlayer lint rules. Upgrade ESLint to enable them: ${colorizePath(DocumentationRouter.ESLint)}`, { level: "warn" });
|
|
289
174
|
if (!options?.noEslint && hasLintTooling(allDeps)) {
|
|
290
175
|
const oxlintConfigPath = ".oxlintrc.json";
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
oxlintConfig
|
|
295
|
-
oxlintConfig
|
|
296
|
-
oxlintConfig.ignorePatterns ??= [];
|
|
297
|
-
let oxlintUpdated = false;
|
|
298
|
-
for (const glob of GENERATED_OUTPUT_GLOBS) if (!oxlintConfig.ignorePatterns.includes(glob)) {
|
|
299
|
-
oxlintConfig.ignorePatterns.push(glob);
|
|
300
|
-
oxlintUpdated = true;
|
|
301
|
-
}
|
|
302
|
-
if (!oxlintConfig.jsPlugins.includes(LINT_PLUGIN_PACKAGE_NAME)) {
|
|
303
|
-
oxlintConfig.jsPlugins.push(LINT_PLUGIN_PACKAGE_NAME);
|
|
304
|
-
oxlintUpdated = true;
|
|
305
|
-
}
|
|
306
|
-
for (const [ruleName, severity] of Object.entries(getRecommendedRules())) if (!oxlintConfig.rules[ruleName]) {
|
|
307
|
-
oxlintConfig.rules[ruleName] = severity;
|
|
308
|
-
oxlintUpdated = true;
|
|
309
|
-
}
|
|
310
|
-
if (oxlintUpdated) {
|
|
176
|
+
const hasOxlintConfig = await exists(rootDir, oxlintConfigPath);
|
|
177
|
+
const shouldCreateOxlintConfig = !hasOxlintConfig && Boolean(allDeps.oxlint) && !allDeps.eslint;
|
|
178
|
+
if (hasOxlintConfig || shouldCreateOxlintConfig) try {
|
|
179
|
+
const oxlintConfig = hasOxlintConfig ? parseJSONWithComments(await readFileFromRoot(rootDir, oxlintConfigPath)) : {};
|
|
180
|
+
if (addIntlayerRulesToOxlintConfig(oxlintConfig)) {
|
|
311
181
|
await writeFileToRoot(rootDir, oxlintConfigPath, JSON.stringify(oxlintConfig, null, 2));
|
|
312
|
-
logger(`${v} Added the Intlayer lint rules to ${colorizePath(oxlintConfigPath)}`);
|
|
182
|
+
logger(`${v} ${hasOxlintConfig ? "Added the Intlayer lint rules to" : "Created"} ${colorizePath(oxlintConfigPath)}`);
|
|
313
183
|
} else logger(`${v} ${colorizePath(oxlintConfigPath)} already includes the Intlayer lint rules`);
|
|
314
184
|
} catch {
|
|
315
185
|
logger(`${x} Could not update ${colorizePath(oxlintConfigPath)}. You may need to add ${colorize(LINT_PLUGIN_PACKAGE_NAME, ANSIColors.MAGENTA)} manually.`, { level: "warn" });
|
|
316
186
|
}
|
|
317
187
|
else logger([
|
|
318
188
|
colorize("Intlayer lint rules →", ANSIColors.MAGENTA),
|
|
319
|
-
colorize(`Add ${LINT_PLUGIN_PACKAGE_NAME} to your ESLint flat config to catch hardcoded text and dynamic calls the compiler cannot optimize:`, ANSIColors.GREY_LIGHT),
|
|
320
|
-
colorize(` import intlayer from '${LINT_PLUGIN_PACKAGE_NAME}';\n export default [...intlayer.configs.recommended];`, ANSIColors.GREY_LIGHT),
|
|
189
|
+
colorize(`Add the ${LINT_PLUGIN_PACKAGE_NAME} preset to the array your ESLint flat config exports, to catch hardcoded text and dynamic calls the compiler cannot optimize:`, ANSIColors.GREY_LIGHT),
|
|
190
|
+
colorize(` import intlayer from '${LINT_PLUGIN_PACKAGE_NAME}';\n\n export default [\n // ...your existing config\n ...intlayer.configs.recommended,\n ];`, ANSIColors.GREY_LIGHT),
|
|
321
191
|
colorizePath(DocumentationRouter.ESLint)
|
|
322
192
|
]);
|
|
323
193
|
}
|
|
@@ -345,7 +215,7 @@ const initIntlayer = async (rootDir, options) => {
|
|
|
345
215
|
}
|
|
346
216
|
const format = hasTsConfig ? "intlayer.config.ts" : "intlayer.config.mjs";
|
|
347
217
|
const detectedPattern = await detectJsonLocalePattern(rootDir);
|
|
348
|
-
await initConfig(format, rootDir, {
|
|
218
|
+
const isConfigCreated = await initConfig(format, rootDir, {
|
|
349
219
|
locales: detectedPattern?.locales,
|
|
350
220
|
applicationURL: getDefaultApplicationURL(allDeps)
|
|
351
221
|
});
|
|
@@ -380,7 +250,14 @@ const initIntlayer = async (rootDir, options) => {
|
|
|
380
250
|
break;
|
|
381
251
|
}
|
|
382
252
|
}
|
|
383
|
-
|
|
253
|
+
const hasUrlRouting = hasUrlRoutingFramework(allDeps);
|
|
254
|
+
const hasCompatI18nLibrary = detectCompatI18nLibraries(allDeps).length > 0;
|
|
255
|
+
const shouldApplyDefaultRouting = isConfigCreated && options?.routingMode === void 0 && !hasCompatI18nLibrary;
|
|
256
|
+
if (shouldApplyDefaultRouting && !hasUrlRouting) await setRoutingStorageOnlyInConfig(rootDir);
|
|
257
|
+
const routingMode = options?.routingMode ?? (shouldApplyDefaultRouting && hasUrlRouting ? ROUTING_MODE : void 0);
|
|
258
|
+
const enableProxy = options?.enableProxy ?? (shouldApplyDefaultRouting && hasUrlRouting ? true : void 0);
|
|
259
|
+
if (routingMode) await setRoutingModeInConfig(rootDir, routingMode);
|
|
260
|
+
if (enableProxy !== void 0) await setEnableProxyInConfig(rootDir, enableProxy);
|
|
384
261
|
let hasAliasConfiguration = false;
|
|
385
262
|
for (const file of [
|
|
386
263
|
"vite.config.ts",
|
|
@@ -433,7 +310,8 @@ const initIntlayer = async (rootDir, options) => {
|
|
|
433
310
|
await writeFileToRoot(rootDir, file, updatedContent);
|
|
434
311
|
logger(`${v} Updated ${colorizePath(file)} to include Intlayer next-intl compat plugin`);
|
|
435
312
|
} else logger(`${v} ${colorizePath(file)} already includes @intlayer/next-intl/plugin`);
|
|
436
|
-
} else if (
|
|
313
|
+
} else if (isCompatAdapterPending("@intlayer/next-translate")) logger(`${v} Kept ${colorizePath(file)} untouched (next-translate stays in charge)`);
|
|
314
|
+
else if (allDeps["next-translate"] || allDeps["@intlayer/next-translate"]) {
|
|
437
315
|
if (!content.includes("@intlayer/next-translate")) {
|
|
438
316
|
const updatedContent = updateNextConfigForNextTranslate(content, extension);
|
|
439
317
|
await writeFileToRoot(rootDir, file, updatedContent);
|
|
@@ -473,7 +351,8 @@ const initIntlayer = async (rootDir, options) => {
|
|
|
473
351
|
for (const file of ["nuxt.config.js", "nuxt.config.ts"]) if (await exists(rootDir, file)) {
|
|
474
352
|
hasAliasConfiguration = true;
|
|
475
353
|
const content = await readFileFromRoot(rootDir, file);
|
|
476
|
-
if (
|
|
354
|
+
if (isCompatAdapterPending("@intlayer/nuxtjs-i18n")) logger(`${v} Kept ${colorizePath(file)} untouched (@nuxtjs/i18n stays in charge)`);
|
|
355
|
+
else if (allDeps["@nuxtjs/i18n"]) {
|
|
477
356
|
if (!content.includes("@intlayer/nuxtjs-i18n")) {
|
|
478
357
|
const updatedContent = updateNuxtConfigForNuxtjsI18n(content);
|
|
479
358
|
await writeFileToRoot(rootDir, file, updatedContent);
|
|
@@ -607,26 +486,31 @@ const initIntlayer = async (rootDir, options) => {
|
|
|
607
486
|
const hasCompatLibrary = Boolean(compatSyncConfig || compatVitePluginConfig);
|
|
608
487
|
if (hasCompatLibrary) logger(`${v} Compat i18n library detected — keeping the app structure untouched (no route restructure, no provider injection)`);
|
|
609
488
|
if (!hasCompatLibrary) try {
|
|
610
|
-
const
|
|
489
|
+
const { routing } = getConfiguration({ baseDir: rootDir });
|
|
611
490
|
await setupFramework({
|
|
612
491
|
rootDir,
|
|
613
492
|
allDeps,
|
|
614
493
|
packageManager,
|
|
615
494
|
useTypeScript: hasTsConfig,
|
|
616
|
-
routingMode
|
|
495
|
+
routingMode: routingMode ?? routing.mode,
|
|
496
|
+
enableProxy: enableProxy ?? routing.enableProxy !== false
|
|
617
497
|
});
|
|
618
498
|
} catch {
|
|
619
499
|
logger(`${x} Framework-specific scaffolding failed. Your existing files were left untouched; follow the documentation to finish the setup.`, { level: "warn" });
|
|
620
500
|
}
|
|
621
501
|
}
|
|
502
|
+
if (!options?.skipFinalMessage) logInitSuccessMessage(guideUrl);
|
|
503
|
+
return { guideUrl };
|
|
504
|
+
};
|
|
505
|
+
const logInitSuccessMessage = (guideUrl) => {
|
|
622
506
|
logger(`${v} ${colorize("Intlayer init setup complete.", ANSIColors.GREEN)}`);
|
|
623
507
|
logger([
|
|
624
508
|
colorize("Next →", ANSIColors.MAGENTA),
|
|
625
|
-
colorize(
|
|
509
|
+
colorize("Follow the instructions in the documentation to complete the setup:", ANSIColors.GREY_LIGHT),
|
|
626
510
|
colorizePath(guideUrl)
|
|
627
511
|
]);
|
|
628
512
|
};
|
|
629
513
|
|
|
630
514
|
//#endregion
|
|
631
|
-
export { getDefaultApplicationURL, initIntlayer };
|
|
515
|
+
export { DocumentationRouter, getDefaultApplicationURL, getDocumentationUrl, initIntlayer, logInitSuccessMessage };
|
|
632
516
|
//# sourceMappingURL=index.mjs.map
|