@intlayer/chokidar 8.3.1 → 8.3.2

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.
@@ -1,11 +1,108 @@
1
+ /**
2
+ * Intlayer configuration file documentation
3
+ * @see https://intlayer.org/doc/concept/configuration
4
+ */
5
+
1
6
  const { Locales } = require('intlayer');
2
7
 
3
8
  /** @type {import('intlayer').IntlayerConfig} */
4
9
  const config = {
5
10
  internationalization: {
6
11
  locales: [Locales.ENGLISH],
12
+ /**
13
+ * Default locale used as a fallback if the requested locale is not found.
14
+ */
7
15
  defaultLocale: Locales.ENGLISH,
8
16
  },
17
+ routing: {
18
+ /**
19
+ * Locale routing strategy.
20
+ * - "prefix-no-default": Prefix all except the default locale (e.g., /dashboard, /fr/dashboard).
21
+ * - "prefix-all": Prefix all locales (e.g., /en/dashboard, /fr/dashboard).
22
+ * - "no-prefix": No locale in the URL.
23
+ * - "search-params": Use ?locale=...
24
+ * Default: "prefix-no-default"
25
+ */
26
+ mode: 'prefix-no-default',
27
+ },
28
+ content: {
29
+ /**
30
+ * File extensions to scan for dictionaries.
31
+ * Default: ['.content.ts', '.content.js', '.content.json', etc.]
32
+ */
33
+ fileExtensions: ['.content.ts'],
34
+ /**
35
+ * Directories where .content files are located.
36
+ */
37
+ contentDir: ['.'],
38
+ /**
39
+ * Directories where source code is located.
40
+ * Used for build optimization and code transformation.
41
+ */
42
+ codeDir: ['.'],
43
+ },
44
+ editor: {
45
+ /**
46
+ * Whether the visual editor is enabled.
47
+ */
48
+ enabled: false,
49
+
50
+ /**
51
+ * URL of your application for origin validation.
52
+ */
53
+ applicationURL: 'http://localhost:3000',
54
+ },
55
+ dictionary: {
56
+ /**
57
+ * Controls how dictionaries are imported.
58
+ * - "static": Statically imported at build time.
59
+ * - "dynamic": Dynamically imported using Suspense.
60
+ * - "fetch": Fetched dynamically via the live sync API.
61
+ */
62
+ importMode: 'static',
63
+ },
64
+ ai: {
65
+ /**
66
+ * AI provider to use.
67
+ * Options: 'openai', 'anthropic', 'mistral', 'deepseek', 'gemini', 'ollama', 'openrouter', 'alibaba', 'fireworks', 'groq', 'huggingface', 'bedrock', 'googlevertex', 'togetherai'
68
+ */
69
+ provider: 'openai',
70
+ model: 'gpt-5-mini',
71
+ apiKey: process.env.OPENAI_API_KEY,
72
+ applicationContext: [''].join('\n'),
73
+ },
74
+ compiler: {
75
+ /**
76
+ * Defines the output files path. Replaces `outputDir`.
77
+ *
78
+ * - `./` paths are resolved relative to the component directory.
79
+ * - `/` paths are resolved relative to the project root (`baseDir`).
80
+ *
81
+ * - Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.
82
+ *
83
+ * Example:
84
+ * ```ts
85
+ * {
86
+ * // Create Multilingual .content.ts files close to the component
87
+ * output: ({ fileName, extension }) => `./${fileName}${extension}`,
88
+ * }
89
+ * ```
90
+ *
91
+ * ```ts
92
+ * {
93
+ * // Create centralize per-locale JSON at the root of the project
94
+ * output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
95
+ * }
96
+ * ```
97
+ */
98
+ output: ({ fileName }) => `./${fileName}.content.ts`,
99
+
100
+ /**
101
+ * Indicates if the components should be saved after being transformed.
102
+ * That way, the compiler can be run only once to transform the app, and then it can be removed.
103
+ */
104
+ saveComponents: false,
105
+ },
9
106
  };
10
107
 
11
108
  module.exports = config;
@@ -2,6 +2,31 @@
2
2
  "internationalization": {
3
3
  "locales": ["en"],
4
4
  "defaultLocale": "en"
5
- }
5
+ },
6
+ "routing": {
7
+ "mode": "prefix-no-default"
8
+ },
9
+ "content": {
10
+ "fileExtensions": [".content.ts"],
11
+ "contentDir": ["./src"],
12
+ "codeDir": ["./src"],
13
+ },
14
+ "editor": {
15
+ "enabled": false,
16
+ "applicationURL": 'http://localhost:3000',
17
+ },
18
+ "dictionary": {
19
+ "importMode": "static",
20
+ },
21
+ "ai": {
22
+ "provider": 'openai',
23
+ "model": 'gpt-5-mini',
24
+ "apiKey": process.env.OPENAI_API_KEY,
25
+ "applicationContext": ',
26
+ },
27
+ "compiler": {
28
+ "output": './{{fileName}}.content.ts',
29
+ "saveComponents": false,
30
+ },
6
31
  }
7
32
 
@@ -1,11 +1,108 @@
1
+ /**
2
+ * Intlayer configuration file documentation
3
+ * @see https://intlayer.org/doc/concept/configuration
4
+ */
5
+
1
6
  import { Locales } from 'intlayer';
2
7
 
3
8
  /** @type {import('intlayer').IntlayerConfig} */
4
9
  const config = {
5
10
  internationalization: {
6
11
  locales: [Locales.ENGLISH],
12
+ /**
13
+ * Default locale used as a fallback if the requested locale is not found.
14
+ */
7
15
  defaultLocale: Locales.ENGLISH,
8
16
  },
17
+ routing: {
18
+ /**
19
+ * Locale routing strategy.
20
+ * - "prefix-no-default": Prefix all except the default locale (e.g., /dashboard, /fr/dashboard).
21
+ * - "prefix-all": Prefix all locales (e.g., /en/dashboard, /fr/dashboard).
22
+ * - "no-prefix": No locale in the URL.
23
+ * - "search-params": Use ?locale=...
24
+ * Default: "prefix-no-default"
25
+ */
26
+ mode: 'prefix-no-default',
27
+ },
28
+ content: {
29
+ /**
30
+ * File extensions to scan for dictionaries.
31
+ * Default: ['.content.ts', '.content.js', '.content.json', etc.]
32
+ */
33
+ fileExtensions: ['.content.ts'],
34
+ /**
35
+ * Directories where .content files are located.
36
+ */
37
+ contentDir: ['.'],
38
+ /**
39
+ * Directories where source code is located.
40
+ * Used for build optimization and code transformation.
41
+ */
42
+ codeDir: ['.'],
43
+ },
44
+ editor: {
45
+ /**
46
+ * Whether the visual editor is enabled.
47
+ */
48
+ enabled: false,
49
+
50
+ /**
51
+ * URL of your application for origin validation.
52
+ */
53
+ applicationURL: 'http://localhost:3000',
54
+ },
55
+ dictionary: {
56
+ /**
57
+ * Controls how dictionaries are imported.
58
+ * - "static": Statically imported at build time.
59
+ * - "dynamic": Dynamically imported using Suspense.
60
+ * - "fetch": Fetched dynamically via the live sync API.
61
+ */
62
+ importMode: 'static',
63
+ },
64
+ ai: {
65
+ /**
66
+ * AI provider to use.
67
+ * Options: 'openai', 'anthropic', 'mistral', 'deepseek', 'gemini', 'ollama', 'openrouter', 'alibaba', 'fireworks', 'groq', 'huggingface', 'bedrock', 'googlevertex', 'togetherai'
68
+ */
69
+ provider: 'openai',
70
+ model: 'gpt-5-mini',
71
+ apiKey: process.env.OPENAI_API_KEY,
72
+ applicationContext: [''].join('\n'),
73
+ },
74
+ compiler: {
75
+ /**
76
+ * Defines the output files path. Replaces `outputDir`.
77
+ *
78
+ * - `./` paths are resolved relative to the component directory.
79
+ * - `/` paths are resolved relative to the project root (`baseDir`).
80
+ *
81
+ * - Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.
82
+ *
83
+ * Example:
84
+ * ```ts
85
+ * {
86
+ * // Create Multilingual .content.ts files close to the component
87
+ * output: ({ fileName, extension }) => `./${fileName}${extension}`,
88
+ * }
89
+ * ```
90
+ *
91
+ * ```ts
92
+ * {
93
+ * // Create centralize per-locale JSON at the root of the project
94
+ * output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
95
+ * }
96
+ * ```
97
+ */
98
+ output: ({ fileName }) => `./${fileName}.content.ts`,
99
+
100
+ /**
101
+ * Indicates if the components should be saved after being transformed.
102
+ * That way, the compiler can be run only once to transform the app, and then it can be removed.
103
+ */
104
+ saveComponents: false,
105
+ },
9
106
  };
10
107
 
11
108
  export default config;
@@ -1,10 +1,107 @@
1
+ /**
2
+ * Intlayer configuration file documentation
3
+ * @see https://intlayer.org/doc/concept/configuration
4
+ */
5
+
1
6
  import { type IntlayerConfig, Locales } from 'intlayer';
2
7
 
3
8
  const config: IntlayerConfig = {
4
9
  internationalization: {
5
10
  locales: [Locales.ENGLISH],
11
+ /**
12
+ * Default locale used as a fallback if the requested locale is not found.
13
+ */
6
14
  defaultLocale: Locales.ENGLISH,
7
15
  },
16
+ routing: {
17
+ /**
18
+ * Locale routing strategy.
19
+ * - "prefix-no-default": Prefix all except the default locale (e.g., /dashboard, /fr/dashboard).
20
+ * - "prefix-all": Prefix all locales (e.g., /en/dashboard, /fr/dashboard).
21
+ * - "no-prefix": No locale in the URL.
22
+ * - "search-params": Use ?locale=...
23
+ * Default: "prefix-no-default"
24
+ */
25
+ mode: 'prefix-no-default',
26
+ },
27
+ content: {
28
+ /**
29
+ * File extensions to scan for dictionaries.
30
+ * Default: ['.content.ts', '.content.js', '.content.json', etc.]
31
+ */
32
+ fileExtensions: ['.content.ts'],
33
+ /**
34
+ * Directories where .content files are located.
35
+ */
36
+ contentDir: ['.'],
37
+ /**
38
+ * Directories where source code is located.
39
+ * Used for build optimization and code transformation.
40
+ */
41
+ codeDir: ['.'],
42
+ },
43
+ editor: {
44
+ /**
45
+ * Whether the visual editor is enabled.
46
+ */
47
+ enabled: false,
48
+
49
+ /**
50
+ * URL of your application for origin validation.
51
+ */
52
+ applicationURL: 'http://localhost:3000',
53
+ },
54
+ build: {
55
+ /**
56
+ * Controls how dictionaries are imported.
57
+ * - "static": Statically imported at build time.
58
+ * - "dynamic": Dynamically imported using Suspense.
59
+ * - "fetch": Fetched dynamically via the live sync API.
60
+ */
61
+ importMode: 'static',
62
+ },
63
+ ai: {
64
+ /**
65
+ * AI provider to use.
66
+ * Options: 'openai', 'anthropic', 'mistral', 'deepseek', 'gemini', 'ollama', 'openrouter', 'alibaba', 'fireworks', 'groq', 'huggingface', 'bedrock', 'googlevertex', 'togetherai'
67
+ */
68
+ provider: 'openai',
69
+ model: 'gpt-5-mini',
70
+ apiKey: process.env.OPENAI_API_KEY,
71
+ applicationContext: [''].join('\n'),
72
+ },
73
+ compiler: {
74
+ /**
75
+ * Defines the output files path. Replaces `outputDir`.
76
+ *
77
+ * - `./` paths are resolved relative to the component directory.
78
+ * - `/` paths are resolved relative to the project root (`baseDir`).
79
+ *
80
+ * - Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.
81
+ *
82
+ * Example:
83
+ * ```ts
84
+ * {
85
+ * // Create Multilingual .content.ts files close to the component
86
+ * output: ({ fileName, extension }) => `./${fileName}${extension}`,
87
+ * }
88
+ * ```
89
+ *
90
+ * ```ts
91
+ * {
92
+ * // Create centralize per-locale JSON at the root of the project
93
+ * output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
94
+ * }
95
+ * ```
96
+ */
97
+ output: ({ fileName }) => `./${fileName}.content.ts`,
98
+
99
+ /**
100
+ * Indicates if the components should be saved after being transformed.
101
+ * That way, the compiler can be run only once to transform the app, and then it can be removed.
102
+ */
103
+ saveComponents: false,
104
+ },
8
105
  };
9
106
 
10
107
  export default config;
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../initConfig/index.cjs`),t=require(`./utils/configManipulation.cjs`),n=require(`./utils/fileSystem.cjs`),r=require(`./utils/jsonParser.cjs`),i=require(`./utils/tsConfig.cjs`);let a=require(`node:path`),o=require(`@intlayer/config/logger`),s=require(`@intlayer/config/node`),c=require(`@intlayer/config/utils`);const l={NextJS:`https://intlayer.org/doc/environment/nextjs.md`,NextJS_15:`https://intlayer.org/doc/environment/nextjs/15.md`,NextJS_14:`https://intlayer.org/doc/environment/nextjs/14.md`,CRA:`https://intlayer.org/doc/environment/create-react-app.md`,Astro:`https://intlayer.org/doc/environment/astro.md`,ViteAndReact:`https://intlayer.org/doc/environment/vite-and-react.md`,ViteAndReact_ReactRouterV7:`https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md`,ViteAndReact_ReactRouterV7_FSRoutes:`https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md`,ViteAndVue:`https://intlayer.org/doc/environment/vite-and-vue.md`,ViteAndSolid:`https://intlayer.org/doc/environment/vite-and-solid.md`,ViteAndSvelte:`https://intlayer.org/doc/environment/vite-and-svelte.md`,ViteAndPreact:`https://intlayer.org/doc/environment/vite-and-preact.md`,TanStackRouter:`https://intlayer.org/doc/environment/tanstack.md`,NuxtAndVue:`https://intlayer.org/doc/environment/nuxt-and-vue.md`,Angular:`https://intlayer.org/doc/environment/angular.md`,SvelteKit:`https://intlayer.org/doc/environment/sveltekit.md`,ReactNativeAndExpo:`https://intlayer.org/doc/environment/react-native-and-expo.md`,Lynx:`https://intlayer.org/doc/environment/lynx-and-react.md`,Express:`https://intlayer.org/doc/environment/express.md`,NestJS:`https://intlayer.org/doc/environment/nestjs.md`,Fastify:`https://intlayer.org/doc/environment/fastify.md`,Default:`https://intlayer.org/doc/get-started`,NextIntl:`https://intlayer.org/blog/intlayer-with-next-intl.md`,ReactI18Next:`https://intlayer.org/blog/intlayer-with-react-i18next.md`,ReactIntl:`https://intlayer.org/blog/intlayer-with-react-intl.md`,NextI18Next:`https://intlayer.org/blog/intlayer-with-next-i18next.md`,VueI18n:`https://intlayer.org/blog/intlayer-with-vue-i18n.md`},u=e=>{let t={...e.dependencies,...e.devDependencies},n=(e,t)=>!e||typeof e!=`string`?!1:RegExp(`^[\\^~]?${t}(?:\\.|$)`).test(e);if(t[`@lynx-js/react`]||t[`@lynx-js/core`])return l.Lynx;if(t[`react-native`]||t.expo)return l.ReactNativeAndExpo;if(t.next){let e=t.next;return n(e,14)?l.NextJS_14:n(e,15)?l.NextJS_15:l.NextJS}if(t.nuxt)return l.NuxtAndVue;if(t.astro)return l.Astro;if(t[`@sveltejs/kit`])return l.SvelteKit;if(t[`@tanstack/react-router`])return l.TanStackRouter;let r=t[`react-router`];if(r&&typeof r==`string`){if(t[`@react-router/fs-routes`])return l.ViteAndReact_ReactRouterV7_FSRoutes;if(n(r,7))return l.ViteAndReact_ReactRouterV7}return t.vite?t.vue?l.ViteAndVue:t[`solid-js`]?l.ViteAndSolid:t.svelte?l.ViteAndSvelte:t.preact?l.ViteAndPreact:l.ViteAndReact:t[`react-scripts`]?l.CRA:t[`@angular/core`]?l.Angular:t[`@nestjs/core`]?l.NestJS:t.express?l.Express:t.fastify?l.Fastify:t[`next-intl`]?l.NextIntl:t[`react-i18next`]||t.i18next?l.ReactI18Next:t[`react-intl`]?l.ReactIntl:t[`next-i18next`]?l.NextI18Next:t[`vue-i18n`]?l.VueI18n:l.Default},d=async l=>{(0,o.logger)((0,o.colorize)(`Checking Intlayer configuration...`,o.ANSIColors.CYAN));let d=`package.json`;await n.exists(l,d)||((0,o.logger)(`${o.x} No ${(0,o.colorizePath)(`package.json`)} found. Please run this script from the project root.`,{level:`error`}),process.exit(1));let f=await n.readFileFromRoot(l,d),p;try{p=JSON.parse(f)}catch{(0,o.logger)(`${o.x} Could not parse ${(0,o.colorizePath)(`package.json`)}.`,{level:`error`}),process.exit(1)}let m=u(p),h=`.gitignore`;if(await n.exists(l,h)){let e=await n.readFileFromRoot(l,h);e.includes(`intlayer`)?(0,o.logger)(`${o.v} ${(0,o.colorizePath)(h)} already includes .intlayer`):(await n.writeFileToRoot(l,h,`${e}\n# Intlayer\n.intlayer\n`),(0,o.logger)(`${o.v} Added ${(0,o.colorizePath)(`.intlayer`)} to ${(0,o.colorizePath)(h)}`))}let g=`.vscode`,_=(0,a.join)(g,`extensions.json`),v=`intlayer.intlayer-vs-code-extension`;try{let e={recommendations:[]};await n.exists(l,_)?e=r.parseJSONWithComments(await n.readFileFromRoot(l,_)):await n.ensureDirectory(l,g),e.recommendations||=[],e.recommendations.includes(v)?(0,o.logger)(`${o.v} ${(0,o.colorizePath)(_)} already includes ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)}`):(e.recommendations.push(v),await n.writeFileToRoot(l,_,JSON.stringify(e,null,2)),(0,o.logger)(`${o.v} Added ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)} to ${(0,o.colorizePath)(_)}`))}catch{(0,o.logger)(`${o.x} Could not update ${(0,o.colorizePath)(_)}. You may need to add ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)} manually.`,{level:`warn`})}let y=await i.findTsConfigFiles(l),b=!1;for(let e of y)if(await n.exists(l,e)){b=!0;try{let t=r.parseJSONWithComments(await n.readFileFromRoot(l,e)),i=`.intlayer/**/*.ts`,a=!1;t.include&&(Array.isArray(t.include)&&!t.include.some(e=>e.includes(`.intlayer`))?(t.include.push(i),a=!0):t.include.includes(i)&&(0,o.logger)(`${o.v} ${(0,o.colorizePath)(e)} already includes intlayer types`)),a&&(await n.writeFileToRoot(l,e,JSON.stringify(t,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include intlayer types`))}catch{(0,o.logger)(`${o.x} Could not parse or update ${(0,o.colorizePath)(e)}. You may need to add ${(0,o.colorizePath)(`.intlayer/types/**/*.ts`)} manually.`,{level:`warn`})}}await e.initConfig(b?`intlayer.config.ts`:`intlayer.config.mjs`,l);let x=!1;for(let e of[`vite.config.ts`,`vite.config.js`,`vite.config.mjs`])if(await n.exists(l,e)){x=!0;let r=await n.readFileFromRoot(l,e);r.includes(`vite-intlayer`)||(await n.writeFileToRoot(l,e,t.updateViteConfig(r,e.split(`.`).pop())),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include Intlayer plugin`));break}for(let e of[`next.config.js`,`next.config.mjs`,`next.config.ts`])if(await n.exists(l,e)){x=!0;let r=await n.readFileFromRoot(l,e);r.includes(`next-intlayer`)||(await n.writeFileToRoot(l,e,t.updateNextConfig(r,e.split(`.`).pop())),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include Intlayer plugin`));break}for(let e of[`webpack.config.js`,`webpack.config.ts`,`webpack.config.mjs`,`webpack.config.cjs`])if(await n.exists(l,e)){x=!0,(0,o.logger)(`${o.v} Found ${(0,o.colorizePath)(e)}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`);break}if(!x){let e=(0,c.getAlias)({configuration:(0,s.getConfiguration)({baseDir:l})});if(b&&y.length>0){let t=y.find(e=>e===`tsconfig.json`)||y[0],i=r.parseJSONWithComments(await n.readFileFromRoot(l,t));i.compilerOptions??={},i.compilerOptions.paths??={};let a=!1;Object.entries(e).forEach(([e,t])=>{i.compilerOptions.paths[e]||(i.compilerOptions.paths[e]=[t],a=!0)}),a&&(await n.writeFileToRoot(l,t,JSON.stringify(i,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(t)} to include Intlayer aliases`))}else{let t=`jsconfig.json`;if(await n.exists(l,t)){let i=r.parseJSONWithComments(await n.readFileFromRoot(l,t));i.compilerOptions??={},i.compilerOptions.paths??={};let a=!1;Object.entries(e).forEach(([e,t])=>{i.compilerOptions.paths[e]||(i.compilerOptions.paths[e]=[t],a=!0)}),a&&(await n.writeFileToRoot(l,t,JSON.stringify(i,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(t)} to include Intlayer aliases`))}else{p.imports??={};let t=!1;Object.entries(e).forEach(([e,n])=>{let r=e.replace(`@`,`#`),i=n.startsWith(`.`)?n:`./${n}`;p.imports[r]||(p.imports[r]=i,t=!0)}),t&&(await n.writeFileToRoot(l,d,JSON.stringify(p,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(d)} to include Intlayer imports`))}}}(0,o.logger)(`${o.v} ${(0,o.colorize)(`Intlayer init setup complete.`,o.ANSIColors.GREEN)}`),(0,o.logger)([(0,o.colorize)(`Next →`,o.ANSIColors.MAGENTA),(0,o.colorize)(`Follow the instructions in the documentation to complete the setup:`,o.ANSIColors.GREY_LIGHT),(0,o.colorizePath)(m)])};exports.initIntlayer=d;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../initConfig/index.cjs`),t=require(`./utils/configManipulation.cjs`),n=require(`./utils/fileSystem.cjs`),r=require(`./utils/jsonParser.cjs`),i=require(`./utils/tsConfig.cjs`);let a=require(`node:path`),o=require(`@intlayer/config/logger`),s=require(`@intlayer/config/node`),c=require(`@intlayer/config/utils`);const l={NextJS:`https://intlayer.org/doc/environment/nextjs.md`,NextJS_15:`https://intlayer.org/doc/environment/nextjs/15.md`,NextJS_14:`https://intlayer.org/doc/environment/nextjs/14.md`,CRA:`https://intlayer.org/doc/environment/create-react-app.md`,Astro:`https://intlayer.org/doc/environment/astro.md`,ViteAndReact:`https://intlayer.org/doc/environment/vite-and-react.md`,ViteAndReact_ReactRouterV7:`https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md`,ViteAndReact_ReactRouterV7_FSRoutes:`https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md`,ViteAndVue:`https://intlayer.org/doc/environment/vite-and-vue.md`,ViteAndSolid:`https://intlayer.org/doc/environment/vite-and-solid.md`,ViteAndSvelte:`https://intlayer.org/doc/environment/vite-and-svelte.md`,ViteAndPreact:`https://intlayer.org/doc/environment/vite-and-preact.md`,TanStackRouter:`https://intlayer.org/doc/environment/tanstack.md`,NuxtAndVue:`https://intlayer.org/doc/environment/nuxt-and-vue.md`,Angular:`https://intlayer.org/doc/environment/angular.md`,SvelteKit:`https://intlayer.org/doc/environment/sveltekit.md`,ReactNativeAndExpo:`https://intlayer.org/doc/environment/react-native-and-expo.md`,Lynx:`https://intlayer.org/doc/environment/lynx-and-react.md`,Express:`https://intlayer.org/doc/environment/express.md`,NestJS:`https://intlayer.org/doc/environment/nestjs.md`,Fastify:`https://intlayer.org/doc/environment/fastify.md`,Default:`https://intlayer.org/doc/get-started`,NextIntl:`https://intlayer.org/blog/intlayer-with-next-intl.md`,ReactI18Next:`https://intlayer.org/blog/intlayer-with-react-i18next.md`,ReactIntl:`https://intlayer.org/blog/intlayer-with-react-intl.md`,NextI18Next:`https://intlayer.org/blog/intlayer-with-next-i18next.md`,VueI18n:`https://intlayer.org/blog/intlayer-with-vue-i18n.md`},u=e=>{let t={...e.dependencies,...e.devDependencies},n=(e,t)=>!e||typeof e!=`string`?!1:RegExp(`^[\\^~]?${t}(?:\\.|$)`).test(e);if(t[`@lynx-js/react`]||t[`@lynx-js/core`])return l.Lynx;if(t[`react-native`]||t.expo)return l.ReactNativeAndExpo;if(t.next){let e=t.next;return n(e,14)?l.NextJS_14:n(e,15)?l.NextJS_15:l.NextJS}if(t.nuxt)return l.NuxtAndVue;if(t.astro)return l.Astro;if(t[`@sveltejs/kit`])return l.SvelteKit;if(t[`@tanstack/react-router`])return l.TanStackRouter;let r=t[`react-router`];if(r&&typeof r==`string`){if(t[`@react-router/fs-routes`])return l.ViteAndReact_ReactRouterV7_FSRoutes;if(n(r,7))return l.ViteAndReact_ReactRouterV7}return t.vite?t.vue?l.ViteAndVue:t[`solid-js`]?l.ViteAndSolid:t.svelte?l.ViteAndSvelte:t.preact?l.ViteAndPreact:l.ViteAndReact:t[`react-scripts`]?l.CRA:t[`@angular/core`]?l.Angular:t[`@nestjs/core`]?l.NestJS:t.express?l.Express:t.fastify?l.Fastify:t[`next-intl`]?l.NextIntl:t[`react-i18next`]||t.i18next?l.ReactI18Next:t[`react-intl`]?l.ReactIntl:t[`next-i18next`]?l.NextI18Next:t[`vue-i18n`]?l.VueI18n:l.Default},d=async l=>{(0,o.logger)((0,o.colorize)(`Checking Intlayer configuration...`,o.ANSIColors.CYAN));let d=`package.json`;await n.exists(l,d)||((0,o.logger)(`${o.x} No ${(0,o.colorizePath)(`package.json`)} found. Please run this script from the project root.`,{level:`error`}),process.exit(1));let f=await n.readFileFromRoot(l,d),p;try{p=JSON.parse(f)}catch{(0,o.logger)(`${o.x} Could not parse ${(0,o.colorizePath)(`package.json`)}.`,{level:`error`}),process.exit(1)}let m=u(p),h=`.gitignore`;if(await n.exists(l,h)){let e=await n.readFileFromRoot(l,h);e.includes(`intlayer`)?(0,o.logger)(`${o.v} ${(0,o.colorizePath)(h)} already includes .intlayer`):(await n.writeFileToRoot(l,h,`${e}\n# Intlayer\n.intlayer\n`),(0,o.logger)(`${o.v} Added ${(0,o.colorizePath)(`.intlayer`)} to ${(0,o.colorizePath)(h)}`))}let g=`.vscode`,_=(0,a.join)(g,`extensions.json`),v=`intlayer.intlayer-vs-code-extension`;try{let e={recommendations:[]};await n.exists(l,_)?e=r.parseJSONWithComments(await n.readFileFromRoot(l,_)):await n.ensureDirectory(l,g),e.recommendations||=[],e.recommendations.includes(v)?(0,o.logger)(`${o.v} ${(0,o.colorizePath)(_)} already includes ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)}`):(e.recommendations.push(v),await n.writeFileToRoot(l,_,JSON.stringify(e,null,2)),(0,o.logger)(`${o.v} Added ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)} to ${(0,o.colorizePath)(_)}`))}catch{(0,o.logger)(`${o.x} Could not update ${(0,o.colorizePath)(_)}. You may need to add ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)} manually.`,{level:`warn`})}let y=await i.findTsConfigFiles(l),b=!1;for(let e of y)if(await n.exists(l,e)){b=!0;try{let t=r.parseJSONWithComments(await n.readFileFromRoot(l,e)),i=`.intlayer/**/*.ts`,a=!1;t.include&&(Array.isArray(t.include)&&!t.include.some(e=>e.includes(`.intlayer`))?(t.include.push(i),a=!0):t.include.includes(i)&&(0,o.logger)(`${o.v} ${(0,o.colorizePath)(e)} already includes intlayer types`)),a&&(await n.writeFileToRoot(l,e,JSON.stringify(t,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include intlayer types`))}catch{(0,o.logger)(`${o.x} Could not parse or update ${(0,o.colorizePath)(e)}. You may need to add ${(0,o.colorizePath)(`.intlayer/types/**/*.ts`)} manually.`,{level:`warn`})}}await e.initConfig(b?`intlayer.config.ts`:`intlayer.config.mjs`,l);let x=!1;for(let e of[`vite.config.ts`,`vite.config.js`,`vite.config.mjs`])if(await n.exists(l,e)){x=!0;let r=await n.readFileFromRoot(l,e);r.includes(`vite-intlayer`)||(await n.writeFileToRoot(l,e,t.updateViteConfig(r,e.split(`.`).pop())),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include Intlayer plugin`));break}let S=[`next.config.js`,`next.config.mjs`,`next.config.ts`],C=!1;for(let e of S)if(await n.exists(l,e)){C=!0,x=!0;let r=await n.readFileFromRoot(l,e);r.includes(`next-intlayer`)||(await n.writeFileToRoot(l,e,t.updateNextConfig(r,e.split(`.`).pop())),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include Intlayer plugin`));break}if(C){let e=p.dependencies?.next||p.devDependencies?.next;if(e&&((e,t)=>{if(!e||typeof e!=`string`)return!1;let n=e.match(/^[^\d]*(\d+)/);return n?parseInt(n[1],10)>=t:!1})(e,16)){let e=p.scripts?.dev,t=`intlayer watch --with 'bun run --bun next dev'`;e&&e!==t&&e.includes(`next dev`)&&(p.scripts.dev=t,await n.writeFileToRoot(l,d,JSON.stringify(p,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(`package.json`)} dev script for Next.js >= 16`))}}for(let e of[`webpack.config.js`,`webpack.config.ts`,`webpack.config.mjs`,`webpack.config.cjs`])if(await n.exists(l,e)){x=!0,(0,o.logger)(`${o.v} Found ${(0,o.colorizePath)(e)}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`);break}if(!x){let e=(0,c.getAlias)({configuration:(0,s.getConfiguration)({baseDir:l})});if(b&&y.length>0){let t=y.find(e=>e===`tsconfig.json`)||y[0],i=r.parseJSONWithComments(await n.readFileFromRoot(l,t));i.compilerOptions??={},i.compilerOptions.paths??={};let a=!1;Object.entries(e).forEach(([e,t])=>{i.compilerOptions.paths[e]||(i.compilerOptions.paths[e]=[t],a=!0)}),a&&(await n.writeFileToRoot(l,t,JSON.stringify(i,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(t)} to include Intlayer aliases`))}else{let t=`jsconfig.json`;if(await n.exists(l,t)){let i=r.parseJSONWithComments(await n.readFileFromRoot(l,t));i.compilerOptions??={},i.compilerOptions.paths??={};let a=!1;Object.entries(e).forEach(([e,t])=>{i.compilerOptions.paths[e]||(i.compilerOptions.paths[e]=[t],a=!0)}),a&&(await n.writeFileToRoot(l,t,JSON.stringify(i,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(t)} to include Intlayer aliases`))}else{p.imports??={};let t=!1;Object.entries(e).forEach(([e,n])=>{let r=e.replace(`@`,`#`),i=n.startsWith(`.`)?n:`./${n}`;p.imports[r]||(p.imports[r]=i,t=!0)}),t&&(await n.writeFileToRoot(l,d,JSON.stringify(p,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(d)} to include Intlayer imports`))}}}(0,o.logger)(`${o.v} ${(0,o.colorize)(`Intlayer init setup complete.`,o.ANSIColors.GREEN)}`),(0,o.logger)([(0,o.colorize)(`Next →`,o.ANSIColors.MAGENTA),(0,o.colorize)(`Follow the instructions in the documentation to complete the setup:`,o.ANSIColors.GREY_LIGHT),(0,o.colorizePath)(m)])};exports.initIntlayer=d;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["ANSIColors","exists","x","readFileFromRoot","writeFileToRoot","v","parseJSONWithComments","ensureDirectory","findTsConfigFiles","initConfig","updateViteConfig","updateNextConfig"],"sources":["../../../src/init/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport {\n ANSIColors,\n colorize,\n colorizePath,\n logger,\n v,\n x,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\n\nimport { getAlias } from '@intlayer/config/utils';\nimport { initConfig } from '../initConfig';\nimport {\n ensureDirectory,\n exists,\n findTsConfigFiles,\n parseJSONWithComments,\n readFileFromRoot,\n updateNextConfig,\n updateViteConfig,\n writeFileToRoot,\n} from './utils';\n\n/**\n * Documentation URL Constants\n */\nconst DocumentationRouter = {\n NextJS: 'https://intlayer.org/doc/environment/nextjs.md',\n NextJS_15: 'https://intlayer.org/doc/environment/nextjs/15.md',\n NextJS_14: 'https://intlayer.org/doc/environment/nextjs/14.md',\n CRA: 'https://intlayer.org/doc/environment/create-react-app.md',\n Astro: 'https://intlayer.org/doc/environment/astro.md',\n ViteAndReact: 'https://intlayer.org/doc/environment/vite-and-react.md',\n ViteAndReact_ReactRouterV7:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md',\n ViteAndReact_ReactRouterV7_FSRoutes:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md',\n ViteAndVue: 'https://intlayer.org/doc/environment/vite-and-vue.md',\n ViteAndSolid: 'https://intlayer.org/doc/environment/vite-and-solid.md',\n ViteAndSvelte: 'https://intlayer.org/doc/environment/vite-and-svelte.md',\n ViteAndPreact: 'https://intlayer.org/doc/environment/vite-and-preact.md',\n TanStackRouter: 'https://intlayer.org/doc/environment/tanstack.md',\n NuxtAndVue: 'https://intlayer.org/doc/environment/nuxt-and-vue.md',\n Angular: 'https://intlayer.org/doc/environment/angular.md',\n SvelteKit: 'https://intlayer.org/doc/environment/sveltekit.md',\n ReactNativeAndExpo:\n 'https://intlayer.org/doc/environment/react-native-and-expo.md',\n Lynx: 'https://intlayer.org/doc/environment/lynx-and-react.md',\n Express: 'https://intlayer.org/doc/environment/express.md',\n NestJS: 'https://intlayer.org/doc/environment/nestjs.md',\n Fastify: 'https://intlayer.org/doc/environment/fastify.md',\n Default: 'https://intlayer.org/doc/get-started',\n\n // Check for competitors libs\n NextIntl: 'https://intlayer.org/blog/intlayer-with-next-intl.md',\n ReactI18Next: 'https://intlayer.org/blog/intlayer-with-react-i18next.md',\n ReactIntl: 'https://intlayer.org/blog/intlayer-with-react-intl.md',\n NextI18Next: 'https://intlayer.org/blog/intlayer-with-next-i18next.md',\n VueI18n: 'https://intlayer.org/blog/intlayer-with-vue-i18n.md',\n};\n\n/**\n * Helper: Detects the environment and returns the doc URL\n */\nconst getDocumentationUrl = (packageJson: any): string => {\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n /**\n * Helper to check if a version string matches a specific major version\n * Matches: \"15\", \"^15.0.0\", \"~15.2\", \"15.0.0-beta\"\n */\n const isVersion = (versionString: string, major: number): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const regex = new RegExp(`^[\\\\^~]?${major}(?:\\\\.|$)`);\n return regex.test(versionString);\n };\n\n // Mobile / Cross-platform\n if (deps['@lynx-js/react'] || deps['@lynx-js/core']) {\n return DocumentationRouter.Lynx;\n }\n if (deps['react-native'] || deps.expo) {\n return DocumentationRouter.ReactNativeAndExpo;\n }\n\n // Meta-frameworks (Next, Nuxt, Astro, SvelteKit)\n if (deps.next) {\n const version = deps.next;\n\n if (isVersion(version, 14)) {\n return DocumentationRouter.NextJS_14;\n }\n\n if (isVersion(version, 15)) {\n return DocumentationRouter.NextJS_15;\n }\n\n return DocumentationRouter.NextJS;\n }\n\n if (deps.nuxt) return DocumentationRouter.NuxtAndVue;\n if (deps.astro) return DocumentationRouter.Astro;\n if (deps['@sveltejs/kit']) return DocumentationRouter.SvelteKit;\n\n // Routers (TanStack & React Router v7)\n if (deps['@tanstack/react-router']) {\n return DocumentationRouter.TanStackRouter;\n }\n\n // Check for React Router v7\n const reactRouterVersion = deps['react-router'];\n if (reactRouterVersion && typeof reactRouterVersion === 'string') {\n // Distinguish between standard v7 and v7 with FS routes\n if (deps['@react-router/fs-routes']) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7_FSRoutes;\n }\n\n // Use Regex to ensure it is v7\n if (isVersion(reactRouterVersion, 7)) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7;\n }\n }\n\n // Vite Ecosystem (General)\n if (deps.vite) {\n if (deps.vue) return DocumentationRouter.ViteAndVue;\n if (deps['solid-js']) return DocumentationRouter.ViteAndSolid;\n if (deps.svelte) return DocumentationRouter.ViteAndSvelte;\n if (deps.preact) return DocumentationRouter.ViteAndPreact;\n\n // Default to React if Vite is present but specific other frameworks aren't found\n return DocumentationRouter.ViteAndReact;\n }\n\n // Other Web Frameworks\n if (deps['react-scripts']) return DocumentationRouter.CRA;\n if (deps['@angular/core']) return DocumentationRouter.Angular;\n\n // Backend\n if (deps['@nestjs/core']) return DocumentationRouter.NestJS;\n if (deps.express) return DocumentationRouter.Express;\n if (deps.fastify) return DocumentationRouter.Fastify;\n\n // Competitor Libs (Migration Guides)\n // We check these last as specific environment setup is usually higher priority,\n // but if no specific framework logic matched (or as a fallback), we guide to migration.\n if (deps['next-intl']) return DocumentationRouter.NextIntl;\n if (deps['react-i18next'] || deps.i18next)\n return DocumentationRouter.ReactI18Next;\n if (deps['react-intl']) return DocumentationRouter.ReactIntl;\n if (deps['next-i18next']) return DocumentationRouter.NextI18Next;\n if (deps['vue-i18n']) return DocumentationRouter.VueI18n;\n\n return DocumentationRouter.Default;\n};\n\n/**\n * MAIN LOGIC\n */\nexport const initIntlayer = async (rootDir: string) => {\n logger(colorize('Checking Intlayer configuration...', ANSIColors.CYAN));\n\n // READ PACKAGE.JSON\n const packageJsonPath = 'package.json';\n if (!(await exists(rootDir, packageJsonPath))) {\n logger(\n `${x} No ${colorizePath('package.json')} found. Please run this script from the project root.`,\n { level: 'error' }\n );\n process.exit(1);\n }\n\n const packageJsonContent = await readFileFromRoot(rootDir, packageJsonPath);\n let packageJson: Record<string, any>;\n try {\n packageJson = JSON.parse(packageJsonContent);\n } catch {\n logger(`${x} Could not parse ${colorizePath('package.json')}.`, {\n level: 'error',\n });\n process.exit(1);\n }\n\n // Determine the correct documentation URL based on dependencies\n const guideUrl = getDocumentationUrl(packageJson);\n\n // 2. CHECK .GITIGNORE\n const gitignorePath = '.gitignore';\n if (await exists(rootDir, gitignorePath)) {\n const gitignoreContent = await readFileFromRoot(rootDir, gitignorePath);\n\n if (!gitignoreContent.includes('intlayer')) {\n const newContent = `${gitignoreContent}\\n# Intlayer\\n.intlayer\\n`;\n await writeFileToRoot(rootDir, gitignorePath, newContent);\n logger(\n `${v} Added ${colorizePath('.intlayer')} to ${colorizePath(gitignorePath)}`\n );\n } else {\n logger(`${v} ${colorizePath(gitignorePath)} already includes .intlayer`);\n }\n }\n\n // 3. CHECK VS CODE EXTENSION RECOMMENDATIONS\n const vscodeDir = '.vscode';\n const extensionsJsonPath = join(vscodeDir, 'extensions.json');\n const extensionId = 'intlayer.intlayer-vs-code-extension';\n\n try {\n let extensionsConfig: { recommendations: string[] } = {\n recommendations: [],\n };\n\n if (await exists(rootDir, extensionsJsonPath)) {\n const content = await readFileFromRoot(rootDir, extensionsJsonPath);\n extensionsConfig = parseJSONWithComments(content);\n } else {\n await ensureDirectory(rootDir, vscodeDir);\n }\n\n if (!extensionsConfig.recommendations) {\n extensionsConfig.recommendations = [];\n }\n\n if (!extensionsConfig.recommendations.includes(extensionId)) {\n extensionsConfig.recommendations.push(extensionId);\n await writeFileToRoot(\n rootDir,\n extensionsJsonPath,\n JSON.stringify(extensionsConfig, null, 2)\n );\n logger(\n `${v} Added ${colorize(extensionId, ANSIColors.MAGENTA)} to ${colorizePath(extensionsJsonPath)}`\n );\n } else {\n logger(\n `${v} ${colorizePath(extensionsJsonPath)} already includes ${colorize(extensionId, ANSIColors.MAGENTA)}`\n );\n }\n } catch {\n logger(\n `${x} Could not update ${colorizePath(extensionsJsonPath)}. You may need to add ${colorize(extensionId, ANSIColors.MAGENTA)} manually.`,\n { level: 'warn' }\n );\n }\n\n // CHECK TSCONFIGS\n const tsConfigFiles = await findTsConfigFiles(rootDir);\n let hasTsConfig = false;\n\n for (const fileName of tsConfigFiles) {\n if (await exists(rootDir, fileName)) {\n hasTsConfig = true;\n try {\n const fileContent = await readFileFromRoot(rootDir, fileName);\n const config = parseJSONWithComments(fileContent);\n const typeDefinition = '.intlayer/**/*.ts';\n\n let updated = false;\n\n if (!config.include) {\n // Skip if no include array (solution-style)\n } else if (\n Array.isArray(config.include) &&\n !(config.include as string[]).some((pattern: string) =>\n pattern.includes('.intlayer')\n )\n ) {\n config.include.push(typeDefinition);\n updated = true;\n } else if (config.include.includes(typeDefinition)) {\n logger(\n `${v} ${colorizePath(fileName)} already includes intlayer types`\n );\n }\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n fileName,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(fileName)} to include intlayer types`\n );\n }\n } catch {\n logger(\n `${x} Could not parse or update ${colorizePath(fileName)}. You may need to add ${colorizePath('.intlayer/types/**/*.ts')} manually.`,\n { level: 'warn' }\n );\n }\n }\n }\n\n // INITIALIZE CONFIG FILE\n const format = hasTsConfig ? 'intlayer.config.ts' : 'intlayer.config.mjs';\n await initConfig(format, rootDir);\n\n let hasAliasConfiguration = false;\n\n // CHECK VITE CONFIG\n const viteConfigs = ['vite.config.ts', 'vite.config.js', 'vite.config.mjs'];\n for (const file of viteConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('vite-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateViteConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // CHECK NEXT CONFIG\n const nextConfigs = ['next.config.js', 'next.config.mjs', 'next.config.ts'];\n for (const file of nextConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('next-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateNextConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // CHECK WEBPACK CONFIG\n const webpackConfigs = [\n 'webpack.config.js',\n 'webpack.config.ts',\n 'webpack.config.mjs',\n 'webpack.config.cjs',\n ];\n for (const file of webpackConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n logger(\n `${v} Found ${colorizePath(\n file\n )}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`\n );\n break;\n }\n }\n\n if (!hasAliasConfiguration) {\n const configuration = getConfiguration({ baseDir: rootDir });\n const aliases = getAlias({ configuration });\n\n if (hasTsConfig && tsConfigFiles.length > 0) {\n const tsConfigPath =\n tsConfigFiles.find((f) => f === 'tsconfig.json') || tsConfigFiles[0];\n const tsConfigContent = await readFileFromRoot(rootDir, tsConfigPath);\n const config = parseJSONWithComments(tsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n tsConfigPath,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n tsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n const jsConfigPath = 'jsconfig.json';\n if (await exists(rootDir, jsConfigPath)) {\n const jsConfigContent = await readFileFromRoot(rootDir, jsConfigPath);\n const config = parseJSONWithComments(jsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n jsConfigPath,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n jsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n packageJson.imports ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n const importAlias = alias.replace('@', '#');\n const importPath = path.startsWith('.') ? path : `./${path}`;\n\n if (!packageJson.imports[importAlias]) {\n packageJson.imports[importAlias] = importPath;\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n packageJsonPath\n )} to include Intlayer imports`\n );\n }\n }\n }\n }\n\n // FINAL SUCCESS MESSAGE\n logger(`${v} ${colorize('Intlayer init setup complete.', ANSIColors.GREEN)}`);\n logger([\n colorize('Next →', ANSIColors.MAGENTA),\n colorize(\n `Follow the instructions in the documentation to complete the setup:`,\n ANSIColors.GREY_LIGHT\n ),\n colorizePath(guideUrl),\n ]);\n};\n"],"mappings":"w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ectory","findTsConfigFiles","initConfig","updateViteConfig","updateNextConfig"],"sources":["../../../src/init/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport {\n ANSIColors,\n colorize,\n colorizePath,\n logger,\n v,\n x,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\n\nimport { getAlias } from '@intlayer/config/utils';\nimport { initConfig } from '../initConfig';\nimport {\n ensureDirectory,\n exists,\n findTsConfigFiles,\n parseJSONWithComments,\n readFileFromRoot,\n updateNextConfig,\n updateViteConfig,\n writeFileToRoot,\n} from './utils';\n\n/**\n * Documentation URL Constants\n */\nconst DocumentationRouter = {\n NextJS: 'https://intlayer.org/doc/environment/nextjs.md',\n NextJS_15: 'https://intlayer.org/doc/environment/nextjs/15.md',\n NextJS_14: 'https://intlayer.org/doc/environment/nextjs/14.md',\n CRA: 'https://intlayer.org/doc/environment/create-react-app.md',\n Astro: 'https://intlayer.org/doc/environment/astro.md',\n ViteAndReact: 'https://intlayer.org/doc/environment/vite-and-react.md',\n ViteAndReact_ReactRouterV7:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md',\n ViteAndReact_ReactRouterV7_FSRoutes:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md',\n ViteAndVue: 'https://intlayer.org/doc/environment/vite-and-vue.md',\n ViteAndSolid: 'https://intlayer.org/doc/environment/vite-and-solid.md',\n ViteAndSvelte: 'https://intlayer.org/doc/environment/vite-and-svelte.md',\n ViteAndPreact: 'https://intlayer.org/doc/environment/vite-and-preact.md',\n TanStackRouter: 'https://intlayer.org/doc/environment/tanstack.md',\n NuxtAndVue: 'https://intlayer.org/doc/environment/nuxt-and-vue.md',\n Angular: 'https://intlayer.org/doc/environment/angular.md',\n SvelteKit: 'https://intlayer.org/doc/environment/sveltekit.md',\n ReactNativeAndExpo:\n 'https://intlayer.org/doc/environment/react-native-and-expo.md',\n Lynx: 'https://intlayer.org/doc/environment/lynx-and-react.md',\n Express: 'https://intlayer.org/doc/environment/express.md',\n NestJS: 'https://intlayer.org/doc/environment/nestjs.md',\n Fastify: 'https://intlayer.org/doc/environment/fastify.md',\n Default: 'https://intlayer.org/doc/get-started',\n\n // Check for competitors libs\n NextIntl: 'https://intlayer.org/blog/intlayer-with-next-intl.md',\n ReactI18Next: 'https://intlayer.org/blog/intlayer-with-react-i18next.md',\n ReactIntl: 'https://intlayer.org/blog/intlayer-with-react-intl.md',\n NextI18Next: 'https://intlayer.org/blog/intlayer-with-next-i18next.md',\n VueI18n: 'https://intlayer.org/blog/intlayer-with-vue-i18n.md',\n};\n\n/**\n * Helper: Detects the environment and returns the doc URL\n */\nconst getDocumentationUrl = (packageJson: any): string => {\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n /**\n * Helper to check if a version string matches a specific major version\n * Matches: \"15\", \"^15.0.0\", \"~15.2\", \"15.0.0-beta\"\n */\n const isVersion = (versionString: string, major: number): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const regex = new RegExp(`^[\\\\^~]?${major}(?:\\\\.|$)`);\n return regex.test(versionString);\n };\n\n // Mobile / Cross-platform\n if (deps['@lynx-js/react'] || deps['@lynx-js/core']) {\n return DocumentationRouter.Lynx;\n }\n if (deps['react-native'] || deps.expo) {\n return DocumentationRouter.ReactNativeAndExpo;\n }\n\n // Meta-frameworks (Next, Nuxt, Astro, SvelteKit)\n if (deps.next) {\n const version = deps.next;\n\n if (isVersion(version, 14)) {\n return DocumentationRouter.NextJS_14;\n }\n\n if (isVersion(version, 15)) {\n return DocumentationRouter.NextJS_15;\n }\n\n return DocumentationRouter.NextJS;\n }\n\n if (deps.nuxt) return DocumentationRouter.NuxtAndVue;\n if (deps.astro) return DocumentationRouter.Astro;\n if (deps['@sveltejs/kit']) return DocumentationRouter.SvelteKit;\n\n // Routers (TanStack & React Router v7)\n if (deps['@tanstack/react-router']) {\n return DocumentationRouter.TanStackRouter;\n }\n\n // Check for React Router v7\n const reactRouterVersion = deps['react-router'];\n if (reactRouterVersion && typeof reactRouterVersion === 'string') {\n // Distinguish between standard v7 and v7 with FS routes\n if (deps['@react-router/fs-routes']) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7_FSRoutes;\n }\n\n // Use Regex to ensure it is v7\n if (isVersion(reactRouterVersion, 7)) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7;\n }\n }\n\n // Vite Ecosystem (General)\n if (deps.vite) {\n if (deps.vue) return DocumentationRouter.ViteAndVue;\n if (deps['solid-js']) return DocumentationRouter.ViteAndSolid;\n if (deps.svelte) return DocumentationRouter.ViteAndSvelte;\n if (deps.preact) return DocumentationRouter.ViteAndPreact;\n\n // Default to React if Vite is present but specific other frameworks aren't found\n return DocumentationRouter.ViteAndReact;\n }\n\n // Other Web Frameworks\n if (deps['react-scripts']) return DocumentationRouter.CRA;\n if (deps['@angular/core']) return DocumentationRouter.Angular;\n\n // Backend\n if (deps['@nestjs/core']) return DocumentationRouter.NestJS;\n if (deps.express) return DocumentationRouter.Express;\n if (deps.fastify) return DocumentationRouter.Fastify;\n\n // Competitor Libs (Migration Guides)\n // We check these last as specific environment setup is usually higher priority,\n // but if no specific framework logic matched (or as a fallback), we guide to migration.\n if (deps['next-intl']) return DocumentationRouter.NextIntl;\n if (deps['react-i18next'] || deps.i18next)\n return DocumentationRouter.ReactI18Next;\n if (deps['react-intl']) return DocumentationRouter.ReactIntl;\n if (deps['next-i18next']) return DocumentationRouter.NextI18Next;\n if (deps['vue-i18n']) return DocumentationRouter.VueI18n;\n\n return DocumentationRouter.Default;\n};\n\n/**\n * MAIN LOGIC\n */\nexport const initIntlayer = async (rootDir: string) => {\n logger(colorize('Checking Intlayer configuration...', ANSIColors.CYAN));\n\n // READ PACKAGE.JSON\n const packageJsonPath = 'package.json';\n if (!(await exists(rootDir, packageJsonPath))) {\n logger(\n `${x} No ${colorizePath('package.json')} found. Please run this script from the project root.`,\n { level: 'error' }\n );\n process.exit(1);\n }\n\n const packageJsonContent = await readFileFromRoot(rootDir, packageJsonPath);\n let packageJson: Record<string, any>;\n try {\n packageJson = JSON.parse(packageJsonContent);\n } catch {\n logger(`${x} Could not parse ${colorizePath('package.json')}.`, {\n level: 'error',\n });\n process.exit(1);\n }\n\n // Determine the correct documentation URL based on dependencies\n const guideUrl = getDocumentationUrl(packageJson);\n\n // 2. CHECK .GITIGNORE\n const gitignorePath = '.gitignore';\n if (await exists(rootDir, gitignorePath)) {\n const gitignoreContent = await readFileFromRoot(rootDir, gitignorePath);\n\n if (!gitignoreContent.includes('intlayer')) {\n const newContent = `${gitignoreContent}\\n# Intlayer\\n.intlayer\\n`;\n await writeFileToRoot(rootDir, gitignorePath, newContent);\n logger(\n `${v} Added ${colorizePath('.intlayer')} to ${colorizePath(gitignorePath)}`\n );\n } else {\n logger(`${v} ${colorizePath(gitignorePath)} already includes .intlayer`);\n }\n }\n\n // 3. CHECK VS CODE EXTENSION RECOMMENDATIONS\n const vscodeDir = '.vscode';\n const extensionsJsonPath = join(vscodeDir, 'extensions.json');\n const extensionId = 'intlayer.intlayer-vs-code-extension';\n\n try {\n let extensionsConfig: { recommendations: string[] } = {\n recommendations: [],\n };\n\n if (await exists(rootDir, extensionsJsonPath)) {\n const content = await readFileFromRoot(rootDir, extensionsJsonPath);\n extensionsConfig = parseJSONWithComments(content);\n } else {\n await ensureDirectory(rootDir, vscodeDir);\n }\n\n if (!extensionsConfig.recommendations) {\n extensionsConfig.recommendations = [];\n }\n\n if (!extensionsConfig.recommendations.includes(extensionId)) {\n extensionsConfig.recommendations.push(extensionId);\n await writeFileToRoot(\n rootDir,\n extensionsJsonPath,\n JSON.stringify(extensionsConfig, null, 2)\n );\n logger(\n `${v} Added ${colorize(extensionId, ANSIColors.MAGENTA)} to ${colorizePath(extensionsJsonPath)}`\n );\n } else {\n logger(\n `${v} ${colorizePath(extensionsJsonPath)} already includes ${colorize(extensionId, ANSIColors.MAGENTA)}`\n );\n }\n } catch {\n logger(\n `${x} Could not update ${colorizePath(extensionsJsonPath)}. You may need to add ${colorize(extensionId, ANSIColors.MAGENTA)} manually.`,\n { level: 'warn' }\n );\n }\n\n // CHECK TSCONFIGS\n const tsConfigFiles = await findTsConfigFiles(rootDir);\n let hasTsConfig = false;\n\n for (const fileName of tsConfigFiles) {\n if (await exists(rootDir, fileName)) {\n hasTsConfig = true;\n try {\n const fileContent = await readFileFromRoot(rootDir, fileName);\n const config = parseJSONWithComments(fileContent);\n const typeDefinition = '.intlayer/**/*.ts';\n\n let updated = false;\n\n if (!config.include) {\n // Skip if no include array (solution-style)\n } else if (\n Array.isArray(config.include) &&\n !(config.include as string[]).some((pattern: string) =>\n pattern.includes('.intlayer')\n )\n ) {\n config.include.push(typeDefinition);\n updated = true;\n } else if (config.include.includes(typeDefinition)) {\n logger(\n `${v} ${colorizePath(fileName)} already includes intlayer types`\n );\n }\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n fileName,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(fileName)} to include intlayer types`\n );\n }\n } catch {\n logger(\n `${x} Could not parse or update ${colorizePath(fileName)}. You may need to add ${colorizePath('.intlayer/types/**/*.ts')} manually.`,\n { level: 'warn' }\n );\n }\n }\n }\n\n // INITIALIZE CONFIG FILE\n const format = hasTsConfig ? 'intlayer.config.ts' : 'intlayer.config.mjs';\n await initConfig(format, rootDir);\n\n let hasAliasConfiguration = false;\n\n // CHECK VITE CONFIG\n const viteConfigs = ['vite.config.ts', 'vite.config.js', 'vite.config.mjs'];\n for (const file of viteConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('vite-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateViteConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // CHECK NEXT CONFIG\n const nextConfigs = ['next.config.js', 'next.config.mjs', 'next.config.ts'];\n let isNextJsProject = false;\n for (const file of nextConfigs) {\n if (await exists(rootDir, file)) {\n isNextJsProject = true;\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('next-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateNextConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // UPDATE PACKAGE.JSON DEV SCRIPT FOR NEXT.JS >= 16\n if (isNextJsProject) {\n const nextVersion =\n packageJson.dependencies?.next || packageJson.devDependencies?.next;\n\n const isVersionGreaterOrEqual = (\n versionString: string,\n major: number\n ): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const match = versionString.match(/^[^\\d]*(\\d+)/);\n if (!match) return false;\n const majorVersion = parseInt(match[1], 10);\n return majorVersion >= major;\n };\n\n if (nextVersion && isVersionGreaterOrEqual(nextVersion, 16)) {\n const devScript = packageJson.scripts?.dev;\n const expectedScript = \"intlayer watch --with 'bun run --bun next dev'\";\n\n if (\n devScript &&\n devScript !== expectedScript &&\n devScript.includes('next dev')\n ) {\n packageJson.scripts.dev = expectedScript;\n\n await writeFileToRoot(\n rootDir,\n packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n\n logger(\n `${v} Updated ${colorizePath('package.json')} dev script for Next.js >= 16`\n );\n }\n }\n }\n\n // CHECK WEBPACK CONFIG\n const webpackConfigs = [\n 'webpack.config.js',\n 'webpack.config.ts',\n 'webpack.config.mjs',\n 'webpack.config.cjs',\n ];\n for (const file of webpackConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n logger(\n `${v} Found ${colorizePath(\n file\n )}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`\n );\n break;\n }\n }\n\n if (!hasAliasConfiguration) {\n const configuration = getConfiguration({ baseDir: rootDir });\n const aliases = getAlias({ configuration });\n\n if (hasTsConfig && tsConfigFiles.length > 0) {\n const tsConfigPath =\n tsConfigFiles.find((f) => f === 'tsconfig.json') || tsConfigFiles[0];\n const tsConfigContent = await readFileFromRoot(rootDir, tsConfigPath);\n const config = parseJSONWithComments(tsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n tsConfigPath,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n tsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n const jsConfigPath = 'jsconfig.json';\n if (await exists(rootDir, jsConfigPath)) {\n const jsConfigContent = await readFileFromRoot(rootDir, jsConfigPath);\n const config = parseJSONWithComments(jsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n jsConfigPath,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n jsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n packageJson.imports ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n const importAlias = alias.replace('@', '#');\n const importPath = path.startsWith('.') ? path : `./${path}`;\n\n if (!packageJson.imports[importAlias]) {\n packageJson.imports[importAlias] = importPath;\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n packageJsonPath\n )} to include Intlayer imports`\n );\n }\n }\n }\n }\n\n // FINAL SUCCESS MESSAGE\n logger(`${v} ${colorize('Intlayer init setup complete.', ANSIColors.GREEN)}`);\n logger([\n colorize('Next →', ANSIColors.MAGENTA),\n colorize(\n `Follow the instructions in the documentation to complete the setup:`,\n ANSIColors.GREY_LIGHT\n ),\n colorizePath(guideUrl),\n ]);\n};\n"],"mappings":"wbA2BA,MAAM,EAAsB,CAC1B,OAAQ,iDACR,UAAW,oDACX,UAAW,oDACX,IAAK,2DACL,MAAO,gDACP,aAAc,yDACd,2BACE,yEACF,oCACE,mFACF,WAAY,uDACZ,aAAc,yDACd,cAAe,0DACf,cAAe,0DACf,eAAgB,mDAChB,WAAY,uDACZ,QAAS,kDACT,UAAW,oDACX,mBACE,gEACF,KAAM,yDACN,QAAS,kDACT,OAAQ,iDACR,QAAS,kDACT,QAAS,uCAGT,SAAU,uDACV,aAAc,2DACd,UAAW,wDACX,YAAa,0DACb,QAAS,sDACV,CAKK,EAAuB,GAA6B,CACxD,IAAM,EAAO,CACX,GAAG,EAAY,aACf,GAAG,EAAY,gBAChB,CAMK,GAAa,EAAuB,IACpC,CAAC,GAAiB,OAAO,GAAkB,SAAiB,GAC9C,OAAO,WAAW,EAAM,WAAW,CACxC,KAAK,EAAc,CAIlC,GAAI,EAAK,mBAAqB,EAAK,iBACjC,OAAO,EAAoB,KAE7B,GAAI,EAAK,iBAAmB,EAAK,KAC/B,OAAO,EAAoB,mBAI7B,GAAI,EAAK,KAAM,CACb,IAAM,EAAU,EAAK,KAUrB,OARI,EAAU,EAAS,GAAG,CACjB,EAAoB,UAGzB,EAAU,EAAS,GAAG,CACjB,EAAoB,UAGtB,EAAoB,OAG7B,GAAI,EAAK,KAAM,OAAO,EAAoB,WAC1C,GAAI,EAAK,MAAO,OAAO,EAAoB,MAC3C,GAAI,EAAK,iBAAkB,OAAO,EAAoB,UAGtD,GAAI,EAAK,0BACP,OAAO,EAAoB,eAI7B,IAAM,EAAqB,EAAK,gBAChC,GAAI,GAAsB,OAAO,GAAuB,SAAU,CAEhE,GAAI,EAAK,2BACP,OAAO,EAAoB,oCAI7B,GAAI,EAAU,EA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8BACH,MAEE,CACL,EAAY,UAAY,EAAE,CAE1B,IAAI,EAAU,GAEd,OAAO,QAAQ,EAAQ,CAAC,SAAS,CAAC,EAAO,KAAU,CACjD,IAAM,EAAc,EAAM,QAAQ,IAAK,IAAI,CACrC,EAAa,EAAK,WAAW,IAAI,CAAG,EAAO,KAAK,IAEjD,EAAY,QAAQ,KACvB,EAAY,QAAQ,GAAe,EACnC,EAAU,KAEZ,CAEE,IACF,MAAMD,EAAAA,gBACJ,EACA,EACA,KAAK,UAAU,EAAa,KAAM,EAAE,CACrC,EACD,EAAA,EAAA,QACE,GAAGC,EAAAA,EAAE,YAAA,EAAA,EAAA,cACH,EACD,CAAC,8BACH,KAOT,EAAA,EAAA,QAAO,GAAGA,EAAAA,EAAE,IAAA,EAAA,EAAA,UAAY,gCAAiCL,EAAAA,WAAW,MAAM,GAAG,EAC7E,EAAA,EAAA,QAAO,gBACI,SAAUA,EAAAA,WAAW,QAAQ,gBAEpC,sEACAA,EAAAA,WAAW,WACZ,oBACY,EAAS,CACvB,CAAC"}
@@ -1,2 +1,2 @@
1
- import{initConfig as e}from"../initConfig/index.mjs";import{updateNextConfig as t,updateViteConfig as n}from"./utils/configManipulation.mjs";import{ensureDirectory as r,exists as i,readFileFromRoot as a,writeFileToRoot as o}from"./utils/fileSystem.mjs";import{parseJSONWithComments as s}from"./utils/jsonParser.mjs";import{findTsConfigFiles as c}from"./utils/tsConfig.mjs";import{join as l}from"node:path";import{ANSIColors as u,colorize as d,colorizePath as f,logger as p,v as m,x as h}from"@intlayer/config/logger";import{getConfiguration as g}from"@intlayer/config/node";import{getAlias as _}from"@intlayer/config/utils";const v={NextJS:`https://intlayer.org/doc/environment/nextjs.md`,NextJS_15:`https://intlayer.org/doc/environment/nextjs/15.md`,NextJS_14:`https://intlayer.org/doc/environment/nextjs/14.md`,CRA:`https://intlayer.org/doc/environment/create-react-app.md`,Astro:`https://intlayer.org/doc/environment/astro.md`,ViteAndReact:`https://intlayer.org/doc/environment/vite-and-react.md`,ViteAndReact_ReactRouterV7:`https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md`,ViteAndReact_ReactRouterV7_FSRoutes:`https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md`,ViteAndVue:`https://intlayer.org/doc/environment/vite-and-vue.md`,ViteAndSolid:`https://intlayer.org/doc/environment/vite-and-solid.md`,ViteAndSvelte:`https://intlayer.org/doc/environment/vite-and-svelte.md`,ViteAndPreact:`https://intlayer.org/doc/environment/vite-and-preact.md`,TanStackRouter:`https://intlayer.org/doc/environment/tanstack.md`,NuxtAndVue:`https://intlayer.org/doc/environment/nuxt-and-vue.md`,Angular:`https://intlayer.org/doc/environment/angular.md`,SvelteKit:`https://intlayer.org/doc/environment/sveltekit.md`,ReactNativeAndExpo:`https://intlayer.org/doc/environment/react-native-and-expo.md`,Lynx:`https://intlayer.org/doc/environment/lynx-and-react.md`,Express:`https://intlayer.org/doc/environment/express.md`,NestJS:`https://intlayer.org/doc/environment/nestjs.md`,Fastify:`https://intlayer.org/doc/environment/fastify.md`,Default:`https://intlayer.org/doc/get-started`,NextIntl:`https://intlayer.org/blog/intlayer-with-next-intl.md`,ReactI18Next:`https://intlayer.org/blog/intlayer-with-react-i18next.md`,ReactIntl:`https://intlayer.org/blog/intlayer-with-react-intl.md`,NextI18Next:`https://intlayer.org/blog/intlayer-with-next-i18next.md`,VueI18n:`https://intlayer.org/blog/intlayer-with-vue-i18n.md`},y=e=>{let t={...e.dependencies,...e.devDependencies},n=(e,t)=>!e||typeof e!=`string`?!1:RegExp(`^[\\^~]?${t}(?:\\.|$)`).test(e);if(t[`@lynx-js/react`]||t[`@lynx-js/core`])return v.Lynx;if(t[`react-native`]||t.expo)return v.ReactNativeAndExpo;if(t.next){let e=t.next;return n(e,14)?v.NextJS_14:n(e,15)?v.NextJS_15:v.NextJS}if(t.nuxt)return v.NuxtAndVue;if(t.astro)return v.Astro;if(t[`@sveltejs/kit`])return v.SvelteKit;if(t[`@tanstack/react-router`])return v.TanStackRouter;let r=t[`react-router`];if(r&&typeof r==`string`){if(t[`@react-router/fs-routes`])return v.ViteAndReact_ReactRouterV7_FSRoutes;if(n(r,7))return v.ViteAndReact_ReactRouterV7}return t.vite?t.vue?v.ViteAndVue:t[`solid-js`]?v.ViteAndSolid:t.svelte?v.ViteAndSvelte:t.preact?v.ViteAndPreact:v.ViteAndReact:t[`react-scripts`]?v.CRA:t[`@angular/core`]?v.Angular:t[`@nestjs/core`]?v.NestJS:t.express?v.Express:t.fastify?v.Fastify:t[`next-intl`]?v.NextIntl:t[`react-i18next`]||t.i18next?v.ReactI18Next:t[`react-intl`]?v.ReactIntl:t[`next-i18next`]?v.NextI18Next:t[`vue-i18n`]?v.VueI18n:v.Default},b=async v=>{p(d(`Checking Intlayer configuration...`,u.CYAN));let b=`package.json`;await i(v,b)||(p(`${h} No ${f(`package.json`)} found. Please run this script from the project root.`,{level:`error`}),process.exit(1));let x=await a(v,b),S;try{S=JSON.parse(x)}catch{p(`${h} Could not parse ${f(`package.json`)}.`,{level:`error`}),process.exit(1)}let C=y(S),w=`.gitignore`;if(await i(v,w)){let e=await a(v,w);e.includes(`intlayer`)?p(`${m} ${f(w)} already includes .intlayer`):(await o(v,w,`${e}\n# Intlayer\n.intlayer\n`),p(`${m} Added ${f(`.intlayer`)} to ${f(w)}`))}let T=`.vscode`,E=l(T,`extensions.json`),D=`intlayer.intlayer-vs-code-extension`;try{let e={recommendations:[]};await i(v,E)?e=s(await a(v,E)):await r(v,T),e.recommendations||=[],e.recommendations.includes(D)?p(`${m} ${f(E)} already includes ${d(D,u.MAGENTA)}`):(e.recommendations.push(D),await o(v,E,JSON.stringify(e,null,2)),p(`${m} Added ${d(D,u.MAGENTA)} to ${f(E)}`))}catch{p(`${h} Could not update ${f(E)}. You may need to add ${d(D,u.MAGENTA)} manually.`,{level:`warn`})}let O=await c(v),k=!1;for(let e of O)if(await i(v,e)){k=!0;try{let t=s(await a(v,e)),n=`.intlayer/**/*.ts`,r=!1;t.include&&(Array.isArray(t.include)&&!t.include.some(e=>e.includes(`.intlayer`))?(t.include.push(n),r=!0):t.include.includes(n)&&p(`${m} ${f(e)} already includes intlayer types`)),r&&(await o(v,e,JSON.stringify(t,null,2)),p(`${m} Updated ${f(e)} to include intlayer types`))}catch{p(`${h} Could not parse or update ${f(e)}. You may need to add ${f(`.intlayer/types/**/*.ts`)} manually.`,{level:`warn`})}}await e(k?`intlayer.config.ts`:`intlayer.config.mjs`,v);let A=!1;for(let e of[`vite.config.ts`,`vite.config.js`,`vite.config.mjs`])if(await i(v,e)){A=!0;let t=await a(v,e);t.includes(`vite-intlayer`)||(await o(v,e,n(t,e.split(`.`).pop())),p(`${m} Updated ${f(e)} to include Intlayer plugin`));break}for(let e of[`next.config.js`,`next.config.mjs`,`next.config.ts`])if(await i(v,e)){A=!0;let n=await a(v,e);n.includes(`next-intlayer`)||(await o(v,e,t(n,e.split(`.`).pop())),p(`${m} Updated ${f(e)} to include Intlayer plugin`));break}for(let e of[`webpack.config.js`,`webpack.config.ts`,`webpack.config.mjs`,`webpack.config.cjs`])if(await i(v,e)){A=!0,p(`${m} Found ${f(e)}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`);break}if(!A){let e=_({configuration:g({baseDir:v})});if(k&&O.length>0){let t=O.find(e=>e===`tsconfig.json`)||O[0],n=s(await a(v,t));n.compilerOptions??={},n.compilerOptions.paths??={};let r=!1;Object.entries(e).forEach(([e,t])=>{n.compilerOptions.paths[e]||(n.compilerOptions.paths[e]=[t],r=!0)}),r&&(await o(v,t,JSON.stringify(n,null,2)),p(`${m} Updated ${f(t)} to include Intlayer aliases`))}else{let t=`jsconfig.json`;if(await i(v,t)){let n=s(await a(v,t));n.compilerOptions??={},n.compilerOptions.paths??={};let r=!1;Object.entries(e).forEach(([e,t])=>{n.compilerOptions.paths[e]||(n.compilerOptions.paths[e]=[t],r=!0)}),r&&(await o(v,t,JSON.stringify(n,null,2)),p(`${m} Updated ${f(t)} to include Intlayer aliases`))}else{S.imports??={};let t=!1;Object.entries(e).forEach(([e,n])=>{let r=e.replace(`@`,`#`),i=n.startsWith(`.`)?n:`./${n}`;S.imports[r]||(S.imports[r]=i,t=!0)}),t&&(await o(v,b,JSON.stringify(S,null,2)),p(`${m} Updated ${f(b)} to include Intlayer imports`))}}}p(`${m} ${d(`Intlayer init setup complete.`,u.GREEN)}`),p([d(`Next →`,u.MAGENTA),d(`Follow the instructions in the documentation to complete the setup:`,u.GREY_LIGHT),f(C)])};export{b as initIntlayer};
1
+ import{initConfig as e}from"../initConfig/index.mjs";import{updateNextConfig as t,updateViteConfig as n}from"./utils/configManipulation.mjs";import{ensureDirectory as r,exists as i,readFileFromRoot as a,writeFileToRoot as o}from"./utils/fileSystem.mjs";import{parseJSONWithComments as s}from"./utils/jsonParser.mjs";import{findTsConfigFiles as c}from"./utils/tsConfig.mjs";import{join as l}from"node:path";import{ANSIColors as u,colorize as d,colorizePath as f,logger as p,v as m,x as h}from"@intlayer/config/logger";import{getConfiguration as g}from"@intlayer/config/node";import{getAlias as _}from"@intlayer/config/utils";const v={NextJS:`https://intlayer.org/doc/environment/nextjs.md`,NextJS_15:`https://intlayer.org/doc/environment/nextjs/15.md`,NextJS_14:`https://intlayer.org/doc/environment/nextjs/14.md`,CRA:`https://intlayer.org/doc/environment/create-react-app.md`,Astro:`https://intlayer.org/doc/environment/astro.md`,ViteAndReact:`https://intlayer.org/doc/environment/vite-and-react.md`,ViteAndReact_ReactRouterV7:`https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md`,ViteAndReact_ReactRouterV7_FSRoutes:`https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md`,ViteAndVue:`https://intlayer.org/doc/environment/vite-and-vue.md`,ViteAndSolid:`https://intlayer.org/doc/environment/vite-and-solid.md`,ViteAndSvelte:`https://intlayer.org/doc/environment/vite-and-svelte.md`,ViteAndPreact:`https://intlayer.org/doc/environment/vite-and-preact.md`,TanStackRouter:`https://intlayer.org/doc/environment/tanstack.md`,NuxtAndVue:`https://intlayer.org/doc/environment/nuxt-and-vue.md`,Angular:`https://intlayer.org/doc/environment/angular.md`,SvelteKit:`https://intlayer.org/doc/environment/sveltekit.md`,ReactNativeAndExpo:`https://intlayer.org/doc/environment/react-native-and-expo.md`,Lynx:`https://intlayer.org/doc/environment/lynx-and-react.md`,Express:`https://intlayer.org/doc/environment/express.md`,NestJS:`https://intlayer.org/doc/environment/nestjs.md`,Fastify:`https://intlayer.org/doc/environment/fastify.md`,Default:`https://intlayer.org/doc/get-started`,NextIntl:`https://intlayer.org/blog/intlayer-with-next-intl.md`,ReactI18Next:`https://intlayer.org/blog/intlayer-with-react-i18next.md`,ReactIntl:`https://intlayer.org/blog/intlayer-with-react-intl.md`,NextI18Next:`https://intlayer.org/blog/intlayer-with-next-i18next.md`,VueI18n:`https://intlayer.org/blog/intlayer-with-vue-i18n.md`},y=e=>{let t={...e.dependencies,...e.devDependencies},n=(e,t)=>!e||typeof e!=`string`?!1:RegExp(`^[\\^~]?${t}(?:\\.|$)`).test(e);if(t[`@lynx-js/react`]||t[`@lynx-js/core`])return v.Lynx;if(t[`react-native`]||t.expo)return v.ReactNativeAndExpo;if(t.next){let e=t.next;return n(e,14)?v.NextJS_14:n(e,15)?v.NextJS_15:v.NextJS}if(t.nuxt)return v.NuxtAndVue;if(t.astro)return v.Astro;if(t[`@sveltejs/kit`])return v.SvelteKit;if(t[`@tanstack/react-router`])return v.TanStackRouter;let r=t[`react-router`];if(r&&typeof r==`string`){if(t[`@react-router/fs-routes`])return v.ViteAndReact_ReactRouterV7_FSRoutes;if(n(r,7))return v.ViteAndReact_ReactRouterV7}return t.vite?t.vue?v.ViteAndVue:t[`solid-js`]?v.ViteAndSolid:t.svelte?v.ViteAndSvelte:t.preact?v.ViteAndPreact:v.ViteAndReact:t[`react-scripts`]?v.CRA:t[`@angular/core`]?v.Angular:t[`@nestjs/core`]?v.NestJS:t.express?v.Express:t.fastify?v.Fastify:t[`next-intl`]?v.NextIntl:t[`react-i18next`]||t.i18next?v.ReactI18Next:t[`react-intl`]?v.ReactIntl:t[`next-i18next`]?v.NextI18Next:t[`vue-i18n`]?v.VueI18n:v.Default},b=async v=>{p(d(`Checking Intlayer configuration...`,u.CYAN));let b=`package.json`;await i(v,b)||(p(`${h} No ${f(`package.json`)} found. Please run this script from the project root.`,{level:`error`}),process.exit(1));let x=await a(v,b),S;try{S=JSON.parse(x)}catch{p(`${h} Could not parse ${f(`package.json`)}.`,{level:`error`}),process.exit(1)}let C=y(S),w=`.gitignore`;if(await i(v,w)){let e=await a(v,w);e.includes(`intlayer`)?p(`${m} ${f(w)} already includes .intlayer`):(await o(v,w,`${e}\n# Intlayer\n.intlayer\n`),p(`${m} Added ${f(`.intlayer`)} to ${f(w)}`))}let T=`.vscode`,E=l(T,`extensions.json`),D=`intlayer.intlayer-vs-code-extension`;try{let e={recommendations:[]};await i(v,E)?e=s(await a(v,E)):await r(v,T),e.recommendations||=[],e.recommendations.includes(D)?p(`${m} ${f(E)} already includes ${d(D,u.MAGENTA)}`):(e.recommendations.push(D),await o(v,E,JSON.stringify(e,null,2)),p(`${m} Added ${d(D,u.MAGENTA)} to ${f(E)}`))}catch{p(`${h} Could not update ${f(E)}. You may need to add ${d(D,u.MAGENTA)} manually.`,{level:`warn`})}let O=await c(v),k=!1;for(let e of O)if(await i(v,e)){k=!0;try{let t=s(await a(v,e)),n=`.intlayer/**/*.ts`,r=!1;t.include&&(Array.isArray(t.include)&&!t.include.some(e=>e.includes(`.intlayer`))?(t.include.push(n),r=!0):t.include.includes(n)&&p(`${m} ${f(e)} already includes intlayer types`)),r&&(await o(v,e,JSON.stringify(t,null,2)),p(`${m} Updated ${f(e)} to include intlayer types`))}catch{p(`${h} Could not parse or update ${f(e)}. You may need to add ${f(`.intlayer/types/**/*.ts`)} manually.`,{level:`warn`})}}await e(k?`intlayer.config.ts`:`intlayer.config.mjs`,v);let A=!1;for(let e of[`vite.config.ts`,`vite.config.js`,`vite.config.mjs`])if(await i(v,e)){A=!0;let t=await a(v,e);t.includes(`vite-intlayer`)||(await o(v,e,n(t,e.split(`.`).pop())),p(`${m} Updated ${f(e)} to include Intlayer plugin`));break}let j=[`next.config.js`,`next.config.mjs`,`next.config.ts`],M=!1;for(let e of j)if(await i(v,e)){M=!0,A=!0;let n=await a(v,e);n.includes(`next-intlayer`)||(await o(v,e,t(n,e.split(`.`).pop())),p(`${m} Updated ${f(e)} to include Intlayer plugin`));break}if(M){let e=S.dependencies?.next||S.devDependencies?.next;if(e&&((e,t)=>{if(!e||typeof e!=`string`)return!1;let n=e.match(/^[^\d]*(\d+)/);return n?parseInt(n[1],10)>=t:!1})(e,16)){let e=S.scripts?.dev,t=`intlayer watch --with 'bun run --bun next dev'`;e&&e!==t&&e.includes(`next dev`)&&(S.scripts.dev=t,await o(v,b,JSON.stringify(S,null,2)),p(`${m} Updated ${f(`package.json`)} dev script for Next.js >= 16`))}}for(let e of[`webpack.config.js`,`webpack.config.ts`,`webpack.config.mjs`,`webpack.config.cjs`])if(await i(v,e)){A=!0,p(`${m} Found ${f(e)}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`);break}if(!A){let e=_({configuration:g({baseDir:v})});if(k&&O.length>0){let t=O.find(e=>e===`tsconfig.json`)||O[0],n=s(await a(v,t));n.compilerOptions??={},n.compilerOptions.paths??={};let r=!1;Object.entries(e).forEach(([e,t])=>{n.compilerOptions.paths[e]||(n.compilerOptions.paths[e]=[t],r=!0)}),r&&(await o(v,t,JSON.stringify(n,null,2)),p(`${m} Updated ${f(t)} to include Intlayer aliases`))}else{let t=`jsconfig.json`;if(await i(v,t)){let n=s(await a(v,t));n.compilerOptions??={},n.compilerOptions.paths??={};let r=!1;Object.entries(e).forEach(([e,t])=>{n.compilerOptions.paths[e]||(n.compilerOptions.paths[e]=[t],r=!0)}),r&&(await o(v,t,JSON.stringify(n,null,2)),p(`${m} Updated ${f(t)} to include Intlayer aliases`))}else{S.imports??={};let t=!1;Object.entries(e).forEach(([e,n])=>{let r=e.replace(`@`,`#`),i=n.startsWith(`.`)?n:`./${n}`;S.imports[r]||(S.imports[r]=i,t=!0)}),t&&(await o(v,b,JSON.stringify(S,null,2)),p(`${m} Updated ${f(b)} to include Intlayer imports`))}}}p(`${m} ${d(`Intlayer init setup complete.`,u.GREEN)}`),p([d(`Next →`,u.MAGENTA),d(`Follow the instructions in the documentation to complete the setup:`,u.GREY_LIGHT),f(C)])};export{b as initIntlayer};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/init/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport {\n ANSIColors,\n colorize,\n colorizePath,\n logger,\n v,\n x,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\n\nimport { getAlias } from '@intlayer/config/utils';\nimport { initConfig } from '../initConfig';\nimport {\n ensureDirectory,\n exists,\n findTsConfigFiles,\n parseJSONWithComments,\n readFileFromRoot,\n updateNextConfig,\n updateViteConfig,\n writeFileToRoot,\n} from './utils';\n\n/**\n * Documentation URL Constants\n */\nconst DocumentationRouter = {\n NextJS: 'https://intlayer.org/doc/environment/nextjs.md',\n NextJS_15: 'https://intlayer.org/doc/environment/nextjs/15.md',\n NextJS_14: 'https://intlayer.org/doc/environment/nextjs/14.md',\n CRA: 'https://intlayer.org/doc/environment/create-react-app.md',\n Astro: 'https://intlayer.org/doc/environment/astro.md',\n ViteAndReact: 'https://intlayer.org/doc/environment/vite-and-react.md',\n ViteAndReact_ReactRouterV7:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md',\n ViteAndReact_ReactRouterV7_FSRoutes:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md',\n ViteAndVue: 'https://intlayer.org/doc/environment/vite-and-vue.md',\n ViteAndSolid: 'https://intlayer.org/doc/environment/vite-and-solid.md',\n ViteAndSvelte: 'https://intlayer.org/doc/environment/vite-and-svelte.md',\n ViteAndPreact: 'https://intlayer.org/doc/environment/vite-and-preact.md',\n TanStackRouter: 'https://intlayer.org/doc/environment/tanstack.md',\n NuxtAndVue: 'https://intlayer.org/doc/environment/nuxt-and-vue.md',\n Angular: 'https://intlayer.org/doc/environment/angular.md',\n SvelteKit: 'https://intlayer.org/doc/environment/sveltekit.md',\n ReactNativeAndExpo:\n 'https://intlayer.org/doc/environment/react-native-and-expo.md',\n Lynx: 'https://intlayer.org/doc/environment/lynx-and-react.md',\n Express: 'https://intlayer.org/doc/environment/express.md',\n NestJS: 'https://intlayer.org/doc/environment/nestjs.md',\n Fastify: 'https://intlayer.org/doc/environment/fastify.md',\n Default: 'https://intlayer.org/doc/get-started',\n\n // Check for competitors libs\n NextIntl: 'https://intlayer.org/blog/intlayer-with-next-intl.md',\n ReactI18Next: 'https://intlayer.org/blog/intlayer-with-react-i18next.md',\n ReactIntl: 'https://intlayer.org/blog/intlayer-with-react-intl.md',\n NextI18Next: 'https://intlayer.org/blog/intlayer-with-next-i18next.md',\n VueI18n: 'https://intlayer.org/blog/intlayer-with-vue-i18n.md',\n};\n\n/**\n * Helper: Detects the environment and returns the doc URL\n */\nconst getDocumentationUrl = (packageJson: any): string => {\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n /**\n * Helper to check if a version string matches a specific major version\n * Matches: \"15\", \"^15.0.0\", \"~15.2\", \"15.0.0-beta\"\n */\n const isVersion = (versionString: string, major: number): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const regex = new RegExp(`^[\\\\^~]?${major}(?:\\\\.|$)`);\n return regex.test(versionString);\n };\n\n // Mobile / Cross-platform\n if (deps['@lynx-js/react'] || deps['@lynx-js/core']) {\n return DocumentationRouter.Lynx;\n }\n if (deps['react-native'] || deps.expo) {\n return DocumentationRouter.ReactNativeAndExpo;\n }\n\n // Meta-frameworks (Next, Nuxt, Astro, SvelteKit)\n if (deps.next) {\n const version = deps.next;\n\n if (isVersion(version, 14)) {\n return DocumentationRouter.NextJS_14;\n }\n\n if (isVersion(version, 15)) {\n return DocumentationRouter.NextJS_15;\n }\n\n return DocumentationRouter.NextJS;\n }\n\n if (deps.nuxt) return DocumentationRouter.NuxtAndVue;\n if (deps.astro) return DocumentationRouter.Astro;\n if (deps['@sveltejs/kit']) return DocumentationRouter.SvelteKit;\n\n // Routers (TanStack & React Router v7)\n if (deps['@tanstack/react-router']) {\n return DocumentationRouter.TanStackRouter;\n }\n\n // Check for React Router v7\n const reactRouterVersion = deps['react-router'];\n if (reactRouterVersion && typeof reactRouterVersion === 'string') {\n // Distinguish between standard v7 and v7 with FS routes\n if (deps['@react-router/fs-routes']) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7_FSRoutes;\n }\n\n // Use Regex to ensure it is v7\n if (isVersion(reactRouterVersion, 7)) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7;\n }\n }\n\n // Vite Ecosystem (General)\n if (deps.vite) {\n if (deps.vue) return DocumentationRouter.ViteAndVue;\n if (deps['solid-js']) return DocumentationRouter.ViteAndSolid;\n if (deps.svelte) return DocumentationRouter.ViteAndSvelte;\n if (deps.preact) return DocumentationRouter.ViteAndPreact;\n\n // Default to React if Vite is present but specific other frameworks aren't found\n return DocumentationRouter.ViteAndReact;\n }\n\n // Other Web Frameworks\n if (deps['react-scripts']) return DocumentationRouter.CRA;\n if (deps['@angular/core']) return DocumentationRouter.Angular;\n\n // Backend\n if (deps['@nestjs/core']) return DocumentationRouter.NestJS;\n if (deps.express) return DocumentationRouter.Express;\n if (deps.fastify) return DocumentationRouter.Fastify;\n\n // Competitor Libs (Migration Guides)\n // We check these last as specific environment setup is usually higher priority,\n // but if no specific framework logic matched (or as a fallback), we guide to migration.\n if (deps['next-intl']) return DocumentationRouter.NextIntl;\n if (deps['react-i18next'] || deps.i18next)\n return DocumentationRouter.ReactI18Next;\n if (deps['react-intl']) return DocumentationRouter.ReactIntl;\n if (deps['next-i18next']) return DocumentationRouter.NextI18Next;\n if (deps['vue-i18n']) return DocumentationRouter.VueI18n;\n\n return DocumentationRouter.Default;\n};\n\n/**\n * MAIN LOGIC\n */\nexport const initIntlayer = async (rootDir: string) => {\n logger(colorize('Checking Intlayer configuration...', ANSIColors.CYAN));\n\n // READ PACKAGE.JSON\n const packageJsonPath = 'package.json';\n if (!(await exists(rootDir, packageJsonPath))) {\n logger(\n `${x} No ${colorizePath('package.json')} found. Please run this script from the project root.`,\n { level: 'error' }\n );\n process.exit(1);\n }\n\n const packageJsonContent = await readFileFromRoot(rootDir, packageJsonPath);\n let packageJson: Record<string, any>;\n try {\n packageJson = JSON.parse(packageJsonContent);\n } catch {\n logger(`${x} Could not parse ${colorizePath('package.json')}.`, {\n level: 'error',\n });\n process.exit(1);\n }\n\n // Determine the correct documentation URL based on dependencies\n const guideUrl = getDocumentationUrl(packageJson);\n\n // 2. CHECK .GITIGNORE\n const gitignorePath = '.gitignore';\n if (await exists(rootDir, gitignorePath)) {\n const gitignoreContent = await readFileFromRoot(rootDir, gitignorePath);\n\n if (!gitignoreContent.includes('intlayer')) {\n const newContent = `${gitignoreContent}\\n# Intlayer\\n.intlayer\\n`;\n await writeFileToRoot(rootDir, gitignorePath, newContent);\n logger(\n `${v} Added ${colorizePath('.intlayer')} to ${colorizePath(gitignorePath)}`\n );\n } else {\n logger(`${v} ${colorizePath(gitignorePath)} already includes .intlayer`);\n }\n }\n\n // 3. CHECK VS CODE EXTENSION RECOMMENDATIONS\n const vscodeDir = '.vscode';\n const extensionsJsonPath = join(vscodeDir, 'extensions.json');\n const extensionId = 'intlayer.intlayer-vs-code-extension';\n\n try {\n let extensionsConfig: { recommendations: string[] } = {\n recommendations: [],\n };\n\n if (await exists(rootDir, extensionsJsonPath)) {\n const content = await readFileFromRoot(rootDir, extensionsJsonPath);\n extensionsConfig = parseJSONWithComments(content);\n } else {\n await ensureDirectory(rootDir, vscodeDir);\n }\n\n if (!extensionsConfig.recommendations) {\n extensionsConfig.recommendations = [];\n }\n\n if (!extensionsConfig.recommendations.includes(extensionId)) {\n extensionsConfig.recommendations.push(extensionId);\n await writeFileToRoot(\n rootDir,\n extensionsJsonPath,\n JSON.stringify(extensionsConfig, null, 2)\n );\n logger(\n `${v} Added ${colorize(extensionId, ANSIColors.MAGENTA)} to ${colorizePath(extensionsJsonPath)}`\n );\n } else {\n logger(\n `${v} ${colorizePath(extensionsJsonPath)} already includes ${colorize(extensionId, ANSIColors.MAGENTA)}`\n );\n }\n } catch {\n logger(\n `${x} Could not update ${colorizePath(extensionsJsonPath)}. You may need to add ${colorize(extensionId, ANSIColors.MAGENTA)} manually.`,\n { level: 'warn' }\n );\n }\n\n // CHECK TSCONFIGS\n const tsConfigFiles = await findTsConfigFiles(rootDir);\n let hasTsConfig = false;\n\n for (const fileName of tsConfigFiles) {\n if (await exists(rootDir, fileName)) {\n hasTsConfig = true;\n try {\n const fileContent = await readFileFromRoot(rootDir, fileName);\n const config = parseJSONWithComments(fileContent);\n const typeDefinition = '.intlayer/**/*.ts';\n\n let updated = false;\n\n if (!config.include) {\n // Skip if no include array (solution-style)\n } else if (\n Array.isArray(config.include) &&\n !(config.include as string[]).some((pattern: string) =>\n pattern.includes('.intlayer')\n )\n ) {\n config.include.push(typeDefinition);\n updated = true;\n } else if (config.include.includes(typeDefinition)) {\n logger(\n `${v} ${colorizePath(fileName)} already includes intlayer types`\n );\n }\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n fileName,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(fileName)} to include intlayer types`\n );\n }\n } catch {\n logger(\n `${x} Could not parse or update ${colorizePath(fileName)}. You may need to add ${colorizePath('.intlayer/types/**/*.ts')} manually.`,\n { level: 'warn' }\n );\n }\n }\n }\n\n // INITIALIZE CONFIG FILE\n const format = hasTsConfig ? 'intlayer.config.ts' : 'intlayer.config.mjs';\n await initConfig(format, rootDir);\n\n let hasAliasConfiguration = false;\n\n // CHECK VITE CONFIG\n const viteConfigs = ['vite.config.ts', 'vite.config.js', 'vite.config.mjs'];\n for (const file of viteConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('vite-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateViteConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // CHECK NEXT CONFIG\n const nextConfigs = ['next.config.js', 'next.config.mjs', 'next.config.ts'];\n for (const file of nextConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('next-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateNextConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // CHECK WEBPACK CONFIG\n const webpackConfigs = [\n 'webpack.config.js',\n 'webpack.config.ts',\n 'webpack.config.mjs',\n 'webpack.config.cjs',\n ];\n for (const file of webpackConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n logger(\n `${v} Found ${colorizePath(\n file\n )}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`\n );\n break;\n }\n }\n\n if (!hasAliasConfiguration) {\n const configuration = getConfiguration({ baseDir: rootDir });\n const aliases = getAlias({ configuration });\n\n if (hasTsConfig && tsConfigFiles.length > 0) {\n const tsConfigPath =\n tsConfigFiles.find((f) => f === 'tsconfig.json') || tsConfigFiles[0];\n const tsConfigContent = await readFileFromRoot(rootDir, tsConfigPath);\n const config = parseJSONWithComments(tsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n tsConfigPath,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n tsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n const jsConfigPath = 'jsconfig.json';\n if (await exists(rootDir, jsConfigPath)) {\n const jsConfigContent = await readFileFromRoot(rootDir, jsConfigPath);\n const config = parseJSONWithComments(jsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n jsConfigPath,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n jsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n packageJson.imports ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n const importAlias = alias.replace('@', '#');\n const importPath = path.startsWith('.') ? path : `./${path}`;\n\n if (!packageJson.imports[importAlias]) {\n packageJson.imports[importAlias] = importPath;\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n packageJsonPath\n )} to include Intlayer imports`\n );\n }\n }\n }\n }\n\n // FINAL SUCCESS MESSAGE\n logger(`${v} ${colorize('Intlayer init setup complete.', ANSIColors.GREEN)}`);\n logger([\n colorize('Next →', ANSIColors.MAGENTA),\n colorize(\n `Follow the instructions in the documentation to complete the setup:`,\n ANSIColors.GREY_LIGHT\n ),\n colorizePath(guideUrl),\n ]);\n};\n"],"mappings":"gnBA2BA,MAAM,EAAsB,CAC1B,OAAQ,iDACR,UAAW,oDACX,UAAW,oDACX,IAAK,2DACL,MAAO,gDACP,aAAc,yDACd,2BACE,yEACF,oCACE,mFACF,WAAY,uDACZ,aAAc,yDACd,cAAe,0DACf,cAAe,0DACf,eAAgB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,EAAU,KAEZ,CAEE,IACF,MAAM,EACJ,EACA,EACA,KAAK,UAAU,EAAQ,KAAM,EAAE,CAChC,CACD,EACE,GAAG,EAAE,WAAW,EACd,EACD,CAAC,8BACH,MAEE,CACL,IAAM,EAAe,gBACrB,GAAI,MAAM,EAAO,EAAS,EAAa,CAAE,CAEvC,IAAM,EAAS,EADS,MAAM,EAAiB,EAAS,EAAa,CAChB,CAErD,EAAO,kBAAoB,EAAE,CAC7B,EAAO,gBAAgB,QAAU,EAAE,CAEnC,IAAI,EAAU,GAEd,OAAO,QAAQ,EAAQ,CAAC,SAAS,CAAC,EAAO,KAAU,CAC5C,EAAO,gBAAgB,MAAM,KAChC,EAAO,gBAAgB,MAAM,GAAS,CAAC,EAAK,CAC5C,EAAU,KAEZ,CAEE,IACF,MAAM,EACJ,EACA,EACA,KAAK,UAAU,EAAQ,KAAM,EAAE,CAChC,CACD,EACE,GAAG,EAAE,WAAW,EACd,EACD,CAAC,8BACH,MAEE,CACL,EAAY,UAAY,EAAE,CAE1B,IAAI,EAAU,GAEd,OAAO,QAAQ,EAAQ,CAAC,SAAS,CAAC,EAAO,KAAU,CACjD,IAAM,EAAc,EAAM,QAAQ,IAAK,IAAI,CACrC,EAAa,EAAK,WAAW,IAAI,CAAG,EAAO,KAAK,IAEjD,EAAY,QAAQ,KACvB,EAAY,QAAQ,GAAe,EACnC,EAAU,KAEZ,CAEE,IACF,MAAM,EACJ,EACA,EACA,KAAK,UAAU,EAAa,KAAM,EAAE,CACrC,CACD,EACE,GAAG,EAAE,WAAW,EACd,EACD,CAAC,8BACH,IAOT,EAAO,GAAG,EAAE,GAAG,EAAS,gCAAiC,EAAW,MAAM,GAAG,CAC7E,EAAO,CACL,EAAS,SAAU,EAAW,QAAQ,CACtC,EACE,sEACA,EAAW,WACZ,CACD,EAAa,EAAS,CACvB,CAAC"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/init/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport {\n ANSIColors,\n colorize,\n colorizePath,\n logger,\n v,\n x,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\n\nimport { getAlias } from '@intlayer/config/utils';\nimport { initConfig } from '../initConfig';\nimport {\n ensureDirectory,\n exists,\n findTsConfigFiles,\n parseJSONWithComments,\n readFileFromRoot,\n updateNextConfig,\n updateViteConfig,\n writeFileToRoot,\n} from './utils';\n\n/**\n * Documentation URL Constants\n */\nconst DocumentationRouter = {\n NextJS: 'https://intlayer.org/doc/environment/nextjs.md',\n NextJS_15: 'https://intlayer.org/doc/environment/nextjs/15.md',\n NextJS_14: 'https://intlayer.org/doc/environment/nextjs/14.md',\n CRA: 'https://intlayer.org/doc/environment/create-react-app.md',\n Astro: 'https://intlayer.org/doc/environment/astro.md',\n ViteAndReact: 'https://intlayer.org/doc/environment/vite-and-react.md',\n ViteAndReact_ReactRouterV7:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md',\n ViteAndReact_ReactRouterV7_FSRoutes:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md',\n ViteAndVue: 'https://intlayer.org/doc/environment/vite-and-vue.md',\n ViteAndSolid: 'https://intlayer.org/doc/environment/vite-and-solid.md',\n ViteAndSvelte: 'https://intlayer.org/doc/environment/vite-and-svelte.md',\n ViteAndPreact: 'https://intlayer.org/doc/environment/vite-and-preact.md',\n TanStackRouter: 'https://intlayer.org/doc/environment/tanstack.md',\n NuxtAndVue: 'https://intlayer.org/doc/environment/nuxt-and-vue.md',\n Angular: 'https://intlayer.org/doc/environment/angular.md',\n SvelteKit: 'https://intlayer.org/doc/environment/sveltekit.md',\n ReactNativeAndExpo:\n 'https://intlayer.org/doc/environment/react-native-and-expo.md',\n Lynx: 'https://intlayer.org/doc/environment/lynx-and-react.md',\n Express: 'https://intlayer.org/doc/environment/express.md',\n NestJS: 'https://intlayer.org/doc/environment/nestjs.md',\n Fastify: 'https://intlayer.org/doc/environment/fastify.md',\n Default: 'https://intlayer.org/doc/get-started',\n\n // Check for competitors libs\n NextIntl: 'https://intlayer.org/blog/intlayer-with-next-intl.md',\n ReactI18Next: 'https://intlayer.org/blog/intlayer-with-react-i18next.md',\n ReactIntl: 'https://intlayer.org/blog/intlayer-with-react-intl.md',\n NextI18Next: 'https://intlayer.org/blog/intlayer-with-next-i18next.md',\n VueI18n: 'https://intlayer.org/blog/intlayer-with-vue-i18n.md',\n};\n\n/**\n * Helper: Detects the environment and returns the doc URL\n */\nconst getDocumentationUrl = (packageJson: any): string => {\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n /**\n * Helper to check if a version string matches a specific major version\n * Matches: \"15\", \"^15.0.0\", \"~15.2\", \"15.0.0-beta\"\n */\n const isVersion = (versionString: string, major: number): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const regex = new RegExp(`^[\\\\^~]?${major}(?:\\\\.|$)`);\n return regex.test(versionString);\n };\n\n // Mobile / Cross-platform\n if (deps['@lynx-js/react'] || deps['@lynx-js/core']) {\n return DocumentationRouter.Lynx;\n }\n if (deps['react-native'] || deps.expo) {\n return DocumentationRouter.ReactNativeAndExpo;\n }\n\n // Meta-frameworks (Next, Nuxt, Astro, SvelteKit)\n if (deps.next) {\n const version = deps.next;\n\n if (isVersion(version, 14)) {\n return DocumentationRouter.NextJS_14;\n }\n\n if (isVersion(version, 15)) {\n return DocumentationRouter.NextJS_15;\n }\n\n return DocumentationRouter.NextJS;\n }\n\n if (deps.nuxt) return DocumentationRouter.NuxtAndVue;\n if (deps.astro) return DocumentationRouter.Astro;\n if (deps['@sveltejs/kit']) return DocumentationRouter.SvelteKit;\n\n // Routers (TanStack & React Router v7)\n if (deps['@tanstack/react-router']) {\n return DocumentationRouter.TanStackRouter;\n }\n\n // Check for React Router v7\n const reactRouterVersion = deps['react-router'];\n if (reactRouterVersion && typeof reactRouterVersion === 'string') {\n // Distinguish between standard v7 and v7 with FS routes\n if (deps['@react-router/fs-routes']) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7_FSRoutes;\n }\n\n // Use Regex to ensure it is v7\n if (isVersion(reactRouterVersion, 7)) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7;\n }\n }\n\n // Vite Ecosystem (General)\n if (deps.vite) {\n if (deps.vue) return DocumentationRouter.ViteAndVue;\n if (deps['solid-js']) return DocumentationRouter.ViteAndSolid;\n if (deps.svelte) return DocumentationRouter.ViteAndSvelte;\n if (deps.preact) return DocumentationRouter.ViteAndPreact;\n\n // Default to React if Vite is present but specific other frameworks aren't found\n return DocumentationRouter.ViteAndReact;\n }\n\n // Other Web Frameworks\n if (deps['react-scripts']) return DocumentationRouter.CRA;\n if (deps['@angular/core']) return DocumentationRouter.Angular;\n\n // Backend\n if (deps['@nestjs/core']) return DocumentationRouter.NestJS;\n if (deps.express) return DocumentationRouter.Express;\n if (deps.fastify) return DocumentationRouter.Fastify;\n\n // Competitor Libs (Migration Guides)\n // We check these last as specific environment setup is usually higher priority,\n // but if no specific framework logic matched (or as a fallback), we guide to migration.\n if (deps['next-intl']) return DocumentationRouter.NextIntl;\n if (deps['react-i18next'] || deps.i18next)\n return DocumentationRouter.ReactI18Next;\n if (deps['react-intl']) return DocumentationRouter.ReactIntl;\n if (deps['next-i18next']) return DocumentationRouter.NextI18Next;\n if (deps['vue-i18n']) return DocumentationRouter.VueI18n;\n\n return DocumentationRouter.Default;\n};\n\n/**\n * MAIN LOGIC\n */\nexport const initIntlayer = async (rootDir: string) => {\n logger(colorize('Checking Intlayer configuration...', ANSIColors.CYAN));\n\n // READ PACKAGE.JSON\n const packageJsonPath = 'package.json';\n if (!(await exists(rootDir, packageJsonPath))) {\n logger(\n `${x} No ${colorizePath('package.json')} found. Please run this script from the project root.`,\n { level: 'error' }\n );\n process.exit(1);\n }\n\n const packageJsonContent = await readFileFromRoot(rootDir, packageJsonPath);\n let packageJson: Record<string, any>;\n try {\n packageJson = JSON.parse(packageJsonContent);\n } catch {\n logger(`${x} Could not parse ${colorizePath('package.json')}.`, {\n level: 'error',\n });\n process.exit(1);\n }\n\n // Determine the correct documentation URL based on dependencies\n const guideUrl = getDocumentationUrl(packageJson);\n\n // 2. CHECK .GITIGNORE\n const gitignorePath = '.gitignore';\n if (await exists(rootDir, gitignorePath)) {\n const gitignoreContent = await readFileFromRoot(rootDir, gitignorePath);\n\n if (!gitignoreContent.includes('intlayer')) {\n const newContent = `${gitignoreContent}\\n# Intlayer\\n.intlayer\\n`;\n await writeFileToRoot(rootDir, gitignorePath, newContent);\n logger(\n `${v} Added ${colorizePath('.intlayer')} to ${colorizePath(gitignorePath)}`\n );\n } else {\n logger(`${v} ${colorizePath(gitignorePath)} already includes .intlayer`);\n }\n }\n\n // 3. CHECK VS CODE EXTENSION RECOMMENDATIONS\n const vscodeDir = '.vscode';\n const extensionsJsonPath = join(vscodeDir, 'extensions.json');\n const extensionId = 'intlayer.intlayer-vs-code-extension';\n\n try {\n let extensionsConfig: { recommendations: string[] } = {\n recommendations: [],\n };\n\n if (await exists(rootDir, extensionsJsonPath)) {\n const content = await readFileFromRoot(rootDir, extensionsJsonPath);\n extensionsConfig = parseJSONWithComments(content);\n } else {\n await ensureDirectory(rootDir, vscodeDir);\n }\n\n if (!extensionsConfig.recommendations) {\n extensionsConfig.recommendations = [];\n }\n\n if (!extensionsConfig.recommendations.includes(extensionId)) {\n extensionsConfig.recommendations.push(extensionId);\n await writeFileToRoot(\n rootDir,\n extensionsJsonPath,\n JSON.stringify(extensionsConfig, null, 2)\n );\n logger(\n `${v} Added ${colorize(extensionId, ANSIColors.MAGENTA)} to ${colorizePath(extensionsJsonPath)}`\n );\n } else {\n logger(\n `${v} ${colorizePath(extensionsJsonPath)} already includes ${colorize(extensionId, ANSIColors.MAGENTA)}`\n );\n }\n } catch {\n logger(\n `${x} Could not update ${colorizePath(extensionsJsonPath)}. You may need to add ${colorize(extensionId, ANSIColors.MAGENTA)} manually.`,\n { level: 'warn' }\n );\n }\n\n // CHECK TSCONFIGS\n const tsConfigFiles = await findTsConfigFiles(rootDir);\n let hasTsConfig = false;\n\n for (const fileName of tsConfigFiles) {\n if (await exists(rootDir, fileName)) {\n hasTsConfig = true;\n try {\n const fileContent = await readFileFromRoot(rootDir, fileName);\n const config = parseJSONWithComments(fileContent);\n const typeDefinition = '.intlayer/**/*.ts';\n\n let updated = false;\n\n if (!config.include) {\n // Skip if no include array (solution-style)\n } else if (\n Array.isArray(config.include) &&\n !(config.include as string[]).some((pattern: string) =>\n pattern.includes('.intlayer')\n )\n ) {\n config.include.push(typeDefinition);\n updated = true;\n } else if (config.include.includes(typeDefinition)) {\n logger(\n `${v} ${colorizePath(fileName)} already includes intlayer types`\n );\n }\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n fileName,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(fileName)} to include intlayer types`\n );\n }\n } catch {\n logger(\n `${x} Could not parse or update ${colorizePath(fileName)}. You may need to add ${colorizePath('.intlayer/types/**/*.ts')} manually.`,\n { level: 'warn' }\n );\n }\n }\n }\n\n // INITIALIZE CONFIG FILE\n const format = hasTsConfig ? 'intlayer.config.ts' : 'intlayer.config.mjs';\n await initConfig(format, rootDir);\n\n let hasAliasConfiguration = false;\n\n // CHECK VITE CONFIG\n const viteConfigs = ['vite.config.ts', 'vite.config.js', 'vite.config.mjs'];\n for (const file of viteConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('vite-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateViteConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // CHECK NEXT CONFIG\n const nextConfigs = ['next.config.js', 'next.config.mjs', 'next.config.ts'];\n let isNextJsProject = false;\n for (const file of nextConfigs) {\n if (await exists(rootDir, file)) {\n isNextJsProject = true;\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('next-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateNextConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // UPDATE PACKAGE.JSON DEV SCRIPT FOR NEXT.JS >= 16\n if (isNextJsProject) {\n const nextVersion =\n packageJson.dependencies?.next || packageJson.devDependencies?.next;\n\n const isVersionGreaterOrEqual = (\n versionString: string,\n major: number\n ): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const match = versionString.match(/^[^\\d]*(\\d+)/);\n if (!match) return false;\n const majorVersion = parseInt(match[1], 10);\n return majorVersion >= major;\n };\n\n if (nextVersion && isVersionGreaterOrEqual(nextVersion, 16)) {\n const devScript = packageJson.scripts?.dev;\n const expectedScript = \"intlayer watch --with 'bun run --bun next dev'\";\n\n if (\n devScript &&\n devScript !== expectedScript &&\n devScript.includes('next dev')\n ) {\n packageJson.scripts.dev = expectedScript;\n\n await writeFileToRoot(\n rootDir,\n packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n\n logger(\n `${v} Updated ${colorizePath('package.json')} dev script for Next.js >= 16`\n );\n }\n }\n }\n\n // CHECK WEBPACK CONFIG\n const webpackConfigs = [\n 'webpack.config.js',\n 'webpack.config.ts',\n 'webpack.config.mjs',\n 'webpack.config.cjs',\n ];\n for (const file of webpackConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n logger(\n `${v} Found ${colorizePath(\n file\n )}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`\n );\n break;\n }\n }\n\n if (!hasAliasConfiguration) {\n const configuration = getConfiguration({ baseDir: rootDir });\n const aliases = getAlias({ configuration });\n\n if (hasTsConfig && tsConfigFiles.length > 0) {\n const tsConfigPath =\n tsConfigFiles.find((f) => f === 'tsconfig.json') || tsConfigFiles[0];\n const tsConfigContent = await readFileFromRoot(rootDir, tsConfigPath);\n const config = parseJSONWithComments(tsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n tsConfigPath,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n tsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n const jsConfigPath = 'jsconfig.json';\n if (await exists(rootDir, jsConfigPath)) {\n const jsConfigContent = await readFileFromRoot(rootDir, jsConfigPath);\n const config = parseJSONWithComments(jsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n jsConfigPath,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n jsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n packageJson.imports ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n const importAlias = alias.replace('@', '#');\n const importPath = path.startsWith('.') ? path : `./${path}`;\n\n if (!packageJson.imports[importAlias]) {\n packageJson.imports[importAlias] = importPath;\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n packageJsonPath\n )} to include Intlayer imports`\n );\n }\n }\n }\n }\n\n // FINAL SUCCESS MESSAGE\n logger(`${v} ${colorize('Intlayer init setup complete.', ANSIColors.GREEN)}`);\n logger([\n colorize('Next →', ANSIColors.MAGENTA),\n colorize(\n `Follow the instructions in the documentation to complete the setup:`,\n ANSIColors.GREY_LI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,EAAK,CAC5C,EAAU,KAEZ,CAEE,IACF,MAAM,EACJ,EACA,EACA,KAAK,UAAU,EAAQ,KAAM,EAAE,CAChC,CACD,EACE,GAAG,EAAE,WAAW,EACd,EACD,CAAC,8BACH,MAEE,CACL,EAAY,UAAY,EAAE,CAE1B,IAAI,EAAU,GAEd,OAAO,QAAQ,EAAQ,CAAC,SAAS,CAAC,EAAO,KAAU,CACjD,IAAM,EAAc,EAAM,QAAQ,IAAK,IAAI,CACrC,EAAa,EAAK,WAAW,IAAI,CAAG,EAAO,KAAK,IAEjD,EAAY,QAAQ,KACvB,EAAY,QAAQ,GAAe,EACnC,EAAU,KAEZ,CAEE,IACF,MAAM,EACJ,EACA,EACA,KAAK,UAAU,EAAa,KAAM,EAAE,CACrC,CACD,EACE,GAAG,EAAE,WAAW,EACd,EACD,CAAC,8BACH,IAOT,EAAO,GAAG,EAAE,GAAG,EAAS,gCAAiC,EAAW,MAAM,GAAG,CAC7E,EAAO,CACL,EAAS,SAAU,EAAW,QAAQ,CACtC,EACE,sEACA,EAAW,WACZ,CACD,EAAa,EAAS,CACvB,CAAC"}
@@ -1,7 +1,7 @@
1
- import { LocalesValues } from "./intlayer/dist/types/index.js";
2
1
  import * as _intlayer_types_dictionary0 from "@intlayer/types/dictionary";
3
2
  import { Dictionary } from "@intlayer/types/dictionary";
4
3
  import * as _intlayer_core_messageFormat0 from "@intlayer/core/messageFormat";
4
+ import * as _intlayer_types_module_augmentation0 from "@intlayer/types/module_augmentation";
5
5
 
6
6
  //#region src/formatDictionary.d.ts
7
7
  declare const formatDictionary: (dictionary: Dictionary) => Dictionary;
@@ -21,7 +21,7 @@ declare const formatDictionaryOutput: (dictionary: Dictionary) => Dictionary | {
21
21
  version?: string;
22
22
  filePath?: string;
23
23
  tags?: string[];
24
- locale?: LocalesValues;
24
+ locale?: _intlayer_types_module_augmentation0.LocalesValues;
25
25
  contentAutoTransformation?: _intlayer_types_dictionary0.ContentAutoTransformation;
26
26
  fill?: _intlayer_types_dictionary0.Fill;
27
27
  filled?: true;
@@ -45,7 +45,7 @@ declare const formatDictionariesOutput: (dictionaries: Dictionary[]) => (Diction
45
45
  version?: string;
46
46
  filePath?: string;
47
47
  tags?: string[];
48
- locale?: LocalesValues;
48
+ locale?: _intlayer_types_module_augmentation0.LocalesValues;
49
49
  contentAutoTransformation?: _intlayer_types_dictionary0.ContentAutoTransformation;
50
50
  fill?: _intlayer_types_dictionary0.Fill;
51
51
  filled?: true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/chokidar",
3
- "version": "8.3.1",
3
+ "version": "8.3.2",
4
4
  "private": false,
5
5
  "description": "Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.",
6
6
  "keywords": [
@@ -102,13 +102,13 @@
102
102
  },
103
103
  "dependencies": {
104
104
  "@babel/parser": "7.29.0",
105
- "@intlayer/api": "8.3.1",
106
- "@intlayer/config": "8.3.1",
107
- "@intlayer/core": "8.3.1",
108
- "@intlayer/dictionaries-entry": "8.3.1",
109
- "@intlayer/remote-dictionaries-entry": "8.3.1",
110
- "@intlayer/types": "8.3.1",
111
- "@intlayer/unmerged-dictionaries-entry": "8.3.1",
105
+ "@intlayer/api": "8.3.2",
106
+ "@intlayer/config": "8.3.2",
107
+ "@intlayer/core": "8.3.2",
108
+ "@intlayer/dictionaries-entry": "8.3.2",
109
+ "@intlayer/remote-dictionaries-entry": "8.3.2",
110
+ "@intlayer/types": "8.3.2",
111
+ "@intlayer/unmerged-dictionaries-entry": "8.3.2",
112
112
  "chokidar": "3.6.0",
113
113
  "defu": "6.1.4",
114
114
  "fast-glob": "3.3.3",
@@ -117,14 +117,14 @@
117
117
  "zod-to-ts": "2.0.0"
118
118
  },
119
119
  "devDependencies": {
120
- "@types/node": "25.4.0",
120
+ "@types/node": "25.5.0",
121
121
  "@utils/ts-config": "1.0.4",
122
122
  "@utils/ts-config-types": "1.0.4",
123
123
  "@utils/tsdown-config": "1.0.4",
124
124
  "rimraf": "6.1.3",
125
125
  "tsdown": "0.21.2",
126
126
  "typescript": "5.9.3",
127
- "vitest": "4.0.18",
127
+ "vitest": "4.1.0",
128
128
  "zod": "4.3.6"
129
129
  },
130
130
  "engines": {
@@ -1,3 +0,0 @@
1
- import { Dictionary } from "@intlayer/types/dictionary";
2
- import { LocalesValues as LocalesValues$1 } from "@intlayer/types/module_augmentation";
3
- export { type LocalesValues$1 as LocalesValues };