@intlayer/chokidar 8.1.6 → 8.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -28
- package/dist/assets/installSkills/skills/astro.md +2 -2
- package/dist/assets/installSkills/skills/cli.md +1 -1
- package/dist/assets/installSkills/skills/compiler.md +32 -0
- package/dist/assets/installSkills/skills/{next_js.md → next-js.md} +1 -2
- package/dist/cjs/build.cjs +1 -1
- package/dist/cjs/cli.cjs +1 -1
- package/dist/cjs/detectFormatCommand.cjs +2 -0
- package/dist/cjs/detectFormatCommand.cjs.map +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/init/index.cjs +1 -1
- package/dist/cjs/init/index.cjs.map +1 -1
- package/dist/cjs/init/utils/fileSystem.cjs +1 -1
- package/dist/cjs/init/utils/fileSystem.cjs.map +1 -1
- package/dist/cjs/init/utils/index.cjs +1 -1
- package/dist/cjs/installSkills/index.cjs +1 -1
- package/dist/cjs/installSkills/index.cjs.map +1 -1
- package/dist/cjs/transformFiles/transformFiles.cjs +1 -1
- package/dist/cjs/transformFiles/transformFiles.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/index.cjs +1 -1
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +1 -1
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
- package/dist/esm/build.mjs +1 -1
- package/dist/esm/cli.mjs +1 -1
- package/dist/esm/detectFormatCommand.mjs.map +1 -0
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/init/index.mjs +1 -1
- package/dist/esm/init/index.mjs.map +1 -1
- package/dist/esm/init/utils/fileSystem.mjs +1 -1
- package/dist/esm/init/utils/fileSystem.mjs.map +1 -1
- package/dist/esm/init/utils/index.mjs +1 -1
- package/dist/esm/installSkills/index.mjs +1 -1
- package/dist/esm/installSkills/index.mjs.map +1 -1
- package/dist/esm/transformFiles/transformFiles.mjs +1 -1
- package/dist/esm/transformFiles/transformFiles.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/index.mjs +1 -1
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs +1 -1
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
- package/dist/types/build.d.ts +1 -2
- package/dist/types/cli.d.ts +2 -1
- package/dist/types/{writeContentDeclaration/detectFormatCommand.d.ts → detectFormatCommand.d.ts} +1 -1
- package/dist/types/detectFormatCommand.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/init/index.d.ts.map +1 -1
- package/dist/types/init/utils/fileSystem.d.ts +5 -1
- package/dist/types/init/utils/fileSystem.d.ts.map +1 -1
- package/dist/types/init/utils/index.d.ts +2 -2
- package/dist/types/installSkills/index.d.ts +1 -0
- package/dist/types/installSkills/index.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/index.d.ts +1 -2
- package/package.json +11 -12
- package/dist/cjs/writeContentDeclaration/detectFormatCommand.cjs +0 -2
- package/dist/cjs/writeContentDeclaration/detectFormatCommand.cjs.map +0 -1
- package/dist/esm/writeContentDeclaration/detectFormatCommand.mjs.map +0 -1
- package/dist/types/writeContentDeclaration/detectFormatCommand.d.ts.map +0 -1
- /package/dist/assets/installSkills/skills/{remote_content.md → remote-content.md} +0 -0
- /package/dist/esm/{writeContentDeclaration/detectFormatCommand.mjs → detectFormatCommand.mjs} +0 -0
package/README.md
CHANGED
|
@@ -46,25 +46,26 @@ With **per-locale content files**, **TypeScript autocompletion**, **tree-shakabl
|
|
|
46
46
|
|
|
47
47
|
## Keys benefits of Intlayer:
|
|
48
48
|
|
|
49
|
-
| Feature | Description
|
|
50
|
-
| --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
51
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more.
|
|
52
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content)
|
|
53
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file)
|
|
54
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
55
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
56
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
57
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
58
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
59
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
60
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
61
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
62
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
63
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
64
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
65
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
66
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
67
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
49
|
+
| Feature | Description |
|
|
50
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
51
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more. |
|
|
52
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content) |
|
|
53
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file) |
|
|
54
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/compiler.jpg?raw=true" alt="Feature" width="700"> | **Compiler**<br><br>The Intlayer Compiler extract automatically the content from the components and generate the dictionary files.<br><br> - [Compiler](https://intlayer.org/doc/compiler) |
|
|
55
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true" alt="Feature" width="700"> | **Type-Safe Environment**<br><br>Leverage TypeScript to ensure your content definitions and code are error-free, while also benefiting from IDE autocompletion.<br><br> - [TypeScript configuration](https://intlayer.org/doc/environment/vite-and-react#configure-typescript) |
|
|
56
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/config_file.png?raw=true" alt="Feature" width="700"> | **Simplified Setup**<br><br>Get up and running quickly with minimal configuration. Adjust settings for internationalization, routing, AI, build, and content handling with ease. <br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
|
|
57
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/content_retrieval.png?raw=true" alt="Feature" width="700"> | **Simplified Content Retrieval**<br><br>No need to call your `t` function for each piece of content. Retrieve all your content directly using a single hook.<br><br> - [React integration](https://intlayer.org/doc/environment/create-react-app) |
|
|
58
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/server_component.png?raw=true" alt="Feature" width="700"> | **Consistent Server Component Implementation**<br><br>Perfectly suited for Next.js server components, use the same implementation for both client and server components, no need to pass your `t` function across each server component. <br><br> - [Server Components](https://intlayer.org/doc/environment/nextjs#step-7-utilize-content-in-your-code) |
|
|
59
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/file_tree.png?raw=true" alt="Feature" width="700"> | **Organized Codebase**<br><br>Keep your codebase more organized: 1 component = 1 dictionary in the same folder. Translations close to their respective components, enhance maintainability and clarity. <br><br> - [How Intlayer works](https://intlayer.org/doc/concept/how-works-intlayer) |
|
|
60
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/url_routing.png?raw=true" alt="Feature" width="700"> | **Enhanced Routing**<br><br>Full support of app routing, adapting seamlessly to complex application structures, for Next.js, React, Vite, Vue.js, etc.<br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
|
|
61
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/markdown.png?raw=true" alt="Feature" width="700"> | **Markdown Support**<br><br>Import and interpret, locale files and remote Markdown for multilingual content like privacy policies, documentation, etc. Interpret and make Markdown metadata accessible in your code.<br><br> - [Content files](https://intlayer.org/doc/concept/content/file) |
|
|
62
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/visual_editor.png?raw=true" alt="Feature" width="700"> | **Free Visual Editor & CMS**<br><br>A free visual editor and CMS are available for content writers, removing the need for a localization platform. Keep your content synchronized using Git, or externalize it totally or partially with the CMS.<br><br> - [Intlayer Editor](https://intlayer.org/doc/concept/editor) <br> - [Intlayer CMS](https://intlayer.org/doc/concept/cms) |
|
|
63
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.png?raw=true" alt="Feature" width="700"> | **Tree-shakable Content**<br><br>Tree-shakable content, reducing the size of the final bundle. Loads content per component, excluding any unused content from your bundle. Supports lazy loading to enhance app loading efficiency. <br><br> - [App build optimization](https://intlayer.org/doc/concept/how-works-intlayer#app-build-optimization) |
|
|
64
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/static_rendering.png?raw=true" alt="Feature" width="700"> | **Static Rendering**<br><br>Doesn't block Static Rendering. <br><br> - [Next.js integration](https://intlayer.org/doc/environment/nextjs) |
|
|
65
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/AI_translation.png?raw=true" alt="Feature" width="700"> | **AI-Powered Translation**<br><br>Transform your website into 231 languages with just one click using Intlayer's advanced AI-powered translation tools using your own AI provider / API key. <br><br> - [CI/CD integration](https://intlayer.org/doc/concept/ci-cd) <br> - [Intlayer CLI](https://intlayer.org/doc/concept/cli) <br> - [Auto fill](https://intlayer.org/doc/concept/auto-fill) |
|
|
66
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/mcp.png?raw=true" alt="Feature" width="700"> | **MCP Server Integration**<br><br>Provides an MCP (Model Context Protocol) server for IDE automation, enabling seamless content management and i18n workflows directly within your development environment. <br><br> - [MCP Server](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/mcp_server.md) |
|
|
67
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/vscode_extension.png?raw=true" alt="Feature" width="700"> | **VSCode Extension**<br><br>Intlayer provides a VSCode extension to help you manage your content and translations, building your dictionaries, translating your content, and more. <br><br> - [VSCode Extension](https://intlayer.org/doc/vs-code-extension) |
|
|
68
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/interoperability.png?raw=true" alt="Feature" width="700"> | **Interoperability**<br><br>Allow interoperability with react-i18next, next-i18next, next-intl, react-intl, vue-i18n. <br><br> - [Intlayer and react-intl](https://intlayer.org/blog/intlayer-with-react-intl) <br> - [Intlayer and next-intl](https://intlayer.org/blog/intlayer-with-next-intl) <br> - [Intlayer and next-i18next](https://intlayer.org/blog/intlayer-with-next-i18next) <br> - [Intlayer and vue-i18n](https://intlayer.org/blog/intlayer-with-vue-i18n) |
|
|
68
69
|
|
|
69
70
|
---
|
|
70
71
|
|
|
@@ -153,6 +154,8 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
153
154
|
<li><a href="https://intlayer.org/doc/concept/how-works-intlayer" rel=''>How Intlayer Works</a></li>
|
|
154
155
|
<li><a href="https://intlayer.org/doc/concept/configuration" rel=''>Configuration</a></li>
|
|
155
156
|
<li><a href="https://intlayer.org/doc/concept/cli" rel=''>Intlayer CLI</a></li>
|
|
157
|
+
<li><a href="https://intlayer.org/doc/compiler" rel=''>Compiler</a></li>
|
|
158
|
+
|
|
156
159
|
<li><a href="https://intlayer.org/doc/concept/editor" rel=''>Intlayer Editor</a></li>
|
|
157
160
|
<li><a href="https://intlayer.org/doc/concept/cms" rel=''>Intlayer CMS</a></li>
|
|
158
161
|
<li><a href="https://intlayer.org/doc/concept/content" rel=''>Dictionary</a>
|
|
@@ -179,17 +182,15 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
179
182
|
<li><a href="https://intlayer.org/doc/environment/nextjs/15" rel=''>Next.js 15</a></li>
|
|
180
183
|
<li><a href="https://intlayer.org/doc/environment/nextjs/14" rel=''>Next.js 14 (App Router)</a></li>
|
|
181
184
|
<li><a href="https://intlayer.org/doc/environment/nextjs/next-with-Page-Router" rel=''>Next.js Page Router</a></li>
|
|
185
|
+
<li><a href="https://intlayer.org/doc/environment/nextjs/compiler" rel=''>Next.js using Compiler</a></li>
|
|
182
186
|
</ul>
|
|
183
187
|
</li>
|
|
184
188
|
<li><a href="https://intlayer.org/doc/environment/create-react-app" rel=''>React CRA</a></li>
|
|
185
|
-
<li><a href="https://intlayer.org/doc/environment/vite-and-react" rel=''>Vite + React</a>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
</ul>
|
|
190
|
-
</li>
|
|
189
|
+
<li><a href="https://intlayer.org/doc/environment/vite-and-react" rel=''>Vite + React</a></li>
|
|
190
|
+
<li><a href="https://intlayer.org/doc/environment/vite-and-react" rel=''>Vite + React using Compiler</a></li>
|
|
191
|
+
<li><a href="https://intlayer.org/doc/environment/vite-and-react/compiler" rel=''>React-router-v7</a></li>
|
|
192
|
+
<li><a href="https://intlayer.org/doc/environment/vite-and-react/tanstack-start" rel=''>Tanstack start</a></li>
|
|
191
193
|
<li><a href="https://intlayer.org/doc/environment/react-native-and-expo" rel=''>React Native</a></li>
|
|
192
|
-
<li><a href="https://intlayer.org/doc/environment/lynx-and-react" rel=''>Lynx + React</a></li>
|
|
193
194
|
<li><a href="https://intlayer.org/doc/environment/vite-and-svelte" rel=''>Vite + Svelte</a></li>
|
|
194
195
|
<li><a href="https://intlayer.org/doc/environment/sveltekit" rel=''>SvelteKit</a></li>
|
|
195
196
|
<li><a href="https://intlayer.org/doc/environment/vite-and-preact" rel=''>Vite + Preact</a></li>
|
|
@@ -197,8 +198,16 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
197
198
|
<li><a href="https://intlayer.org/doc/environment/vite-and-nuxt" rel=''>Vite + Nuxt</a></li>
|
|
198
199
|
<li><a href="https://intlayer.org/doc/environment/vite-and-solid" rel=''>Vite + Solid</a></li>
|
|
199
200
|
<li><a href="https://intlayer.org/doc/environment/angular" rel=''>Angular</a></li>
|
|
200
|
-
<li
|
|
201
|
-
|
|
201
|
+
<li>
|
|
202
|
+
<a href="https://intlayer.org/doc/environment/express" rel=''>Backend</a>
|
|
203
|
+
<ul>
|
|
204
|
+
<li><a href="https://intlayer.org/doc/environment/express" rel=''>Express</a></li>
|
|
205
|
+
<li><a href="https://intlayer.org/doc/environment/nest" rel=''>NestJS</a></li>
|
|
206
|
+
<li><a href="https://intlayer.org/doc/environment/fastify" rel=''>Fastify</a></li>
|
|
207
|
+
<li><a href="https://intlayer.org/doc/environment/adonisjs" rel=''>AdonisJS</a></li>
|
|
208
|
+
<li><a href="https://intlayer.org/doc/environment/hono" rel=''>Hono</a></li>
|
|
209
|
+
</ul>
|
|
210
|
+
</li>
|
|
202
211
|
</ul>
|
|
203
212
|
</details>
|
|
204
213
|
|
|
@@ -28,12 +28,12 @@ const content = await getIntlayer("my-dictionary-key");
|
|
|
28
28
|
<h1>{content.title}</h1>
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
[Astro Documentation](https://intlayer.org/doc/
|
|
31
|
+
[Astro Documentation](https://intlayer.org/doc/environment/astro.md)
|
|
32
32
|
|
|
33
33
|
## References
|
|
34
34
|
|
|
35
35
|
- [Website](https://intlayer.org)
|
|
36
|
-
- [Doc](https://intlayer.org/doc/concept/cli)
|
|
36
|
+
- [Doc](https://intlayer.org/doc/concept/cli.md)
|
|
37
37
|
|
|
38
38
|
- [Astro](https://intlayer.org/doc/environment/astro.md)
|
|
39
39
|
- [Intlayer Exports](https://intlayer.org/doc/packages/intlayer/exports.md)
|
|
@@ -63,7 +63,7 @@ npm install intlayer-cli
|
|
|
63
63
|
### Packages
|
|
64
64
|
|
|
65
65
|
- [Website](https://intlayer.org)
|
|
66
|
-
- [Doc](https://intlayer.org/doc/concept/cli)
|
|
66
|
+
- [Doc](https://intlayer.org/doc/concept/cli.md)
|
|
67
67
|
|
|
68
68
|
- [Intlayer CLI](https://intlayer.org/doc/packages/intlayer-cli/exports.md)
|
|
69
69
|
- [Intlayer CLI Exports](https://intlayer.org/doc/packages/intlayer-cli/exports.md)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: intlayer-compiler
|
|
3
|
+
description: Intlayer Compiler setup and usage. Configures automatic content extraction for your components without the need to define .content files manually.
|
|
4
|
+
metadata:
|
|
5
|
+
author: Intlayer
|
|
6
|
+
url: https://intlayer.org
|
|
7
|
+
license: Apache-2.0
|
|
8
|
+
category: productivity
|
|
9
|
+
tags: [i18n, compiler]
|
|
10
|
+
documentation: https://intlayer.org/doc/compiler
|
|
11
|
+
support: contact@intlayer.org
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Intlayer Compiler Skill
|
|
15
|
+
|
|
16
|
+
The **Intlayer Compiler Skill** provides instructions on how to set up and use the Intlayer compiler to automatically extract content from your application.
|
|
17
|
+
|
|
18
|
+
## Key Features
|
|
19
|
+
|
|
20
|
+
- **Automatic Content Extraction**: All content will be extracted automatically from your components.
|
|
21
|
+
- **No Manual Content Files**: Alleviates the need to manually create `.content` files.
|
|
22
|
+
|
|
23
|
+
## Setup and Usage
|
|
24
|
+
|
|
25
|
+
To set up the Intlayer compiler for your project, refer to the documentation for your framework:
|
|
26
|
+
|
|
27
|
+
- [Vite + React Compiler Documentation](https://intlayer.org/doc/environment/vite-and-react/compiler)
|
|
28
|
+
- [Next.js Compiler Documentation](https://intlayer.org/doc/environment/nextjs/compiler)
|
|
29
|
+
|
|
30
|
+
Once the compiler plugins are properly configured, simply write your translatable strings inline according to the framework's specifics, and the Intlayer compiler will automatically generate the dictionaries.
|
|
31
|
+
|
|
32
|
+
For more information, visit the [Intlayer Compiler Architecture Documentation](https://intlayer.org/doc/compiler).
|
|
@@ -104,8 +104,7 @@ export const MyClientComponent = () => {
|
|
|
104
104
|
};
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
[Next.js package Documentation](https://intlayer.org/doc/packages/next-intlayer.md)
|
|
108
|
-
[Next.js package Documentation](https://intlayer.org/doc/packages/next-intlayer.md)
|
|
107
|
+
[Next.js package Documentation](https://intlayer.org/doc/packages/next-intlayer/exports.md)
|
|
109
108
|
|
|
110
109
|
## References
|
|
111
110
|
|
package/dist/cjs/build.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./buildIntlayerDictionary/buildIntlayerDictionary.cjs`),t=require(`./buildIntlayerDictionary/processContentDeclaration.cjs`),n=require(`./cleanOutputDir.cjs`),r=require(`./createDictionaryEntryPoint/generateDictionaryListContent.cjs`),i=require(`./createDictionaryEntryPoint/getBuiltDictionariesPath.cjs`),a=require(`./createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs`),o=require(`./createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs`),s=require(`./createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs`),c=require(`./createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs`),l=require(`./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs`),u=require(`./createType/createModuleAugmentation.cjs`),d=require(`./createType/createType.cjs`),f=require(`./formatDictionary.cjs`),p=require(`./loadDictionaries/loadContentDeclaration.cjs`),m=require(`./loadDictionaries/loadRemoteDictionaries.cjs`),h=require(`./loadDictionaries/loadDictionaries.cjs`),g=require(`./loadDictionaries/loadLocalDictionaries.cjs`),_=require(`./writeConfiguration/index.cjs`),v=require(`./prepareIntlayer.cjs`),y=require(`./writeContentDeclaration/detectExportedComponentName.cjs`),b=require(`./writeContentDeclaration/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./buildIntlayerDictionary/buildIntlayerDictionary.cjs`),t=require(`./buildIntlayerDictionary/processContentDeclaration.cjs`),n=require(`./cleanOutputDir.cjs`),r=require(`./createDictionaryEntryPoint/generateDictionaryListContent.cjs`),i=require(`./createDictionaryEntryPoint/getBuiltDictionariesPath.cjs`),a=require(`./createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs`),o=require(`./createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs`),s=require(`./createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs`),c=require(`./createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs`),l=require(`./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs`),u=require(`./createType/createModuleAugmentation.cjs`),d=require(`./createType/createType.cjs`),f=require(`./formatDictionary.cjs`),p=require(`./loadDictionaries/loadContentDeclaration.cjs`),m=require(`./loadDictionaries/loadRemoteDictionaries.cjs`),h=require(`./loadDictionaries/loadDictionaries.cjs`),g=require(`./loadDictionaries/loadLocalDictionaries.cjs`),_=require(`./writeConfiguration/index.cjs`),v=require(`./prepareIntlayer.cjs`),y=require(`./writeContentDeclaration/detectExportedComponentName.cjs`),b=require(`./writeContentDeclaration/transformJSFile.cjs`),x=require(`./writeContentDeclaration/writeJSFile.cjs`),S=require(`./writeContentDeclaration/writeContentDeclaration.cjs`);exports.buildDictionary=e.buildDictionary,exports.cleanOutputDir=n.cleanOutputDir,exports.createDictionaryEntryPoint=l.createDictionaryEntryPoint,exports.createModuleAugmentation=u.createModuleAugmentation,exports.createTypes=d.createTypes,exports.detectExportedComponentName=y.detectExportedComponentName,exports.formatDictionaries=f.formatDictionaries,exports.formatDictionariesOutput=f.formatDictionariesOutput,exports.formatDictionary=f.formatDictionary,exports.formatDictionaryOutput=f.formatDictionaryOutput,exports.formatDistantDictionaries=m.formatDistantDictionaries,exports.formatLocalDictionaries=p.formatLocalDictionaries,exports.generateDictionaryListContent=r.generateDictionaryListContent,exports.generateTypeScriptType=d.generateTypeScriptType,exports.getBuiltDictionariesPath=i.getBuiltDictionariesPath,exports.getBuiltDynamicDictionariesPath=a.getBuiltDynamicDictionariesPath,exports.getBuiltFetchDictionariesPath=o.getBuiltFetchDictionariesPath,exports.getBuiltRemoteDictionariesPath=s.getBuiltRemoteDictionariesPath,exports.getBuiltUnmergedDictionariesPath=c.getBuiltUnmergedDictionariesPath,exports.getTypeName=u.getTypeName,exports.isCachedConfigurationUpToDate=_.isCachedConfigurationUpToDate,exports.loadContentDeclarations=p.loadContentDeclarations,exports.loadDictionaries=h.loadDictionaries,exports.loadLocalDictionaries=g.loadLocalDictionaries,exports.loadRemoteDictionaries=m.loadRemoteDictionaries,exports.prepareIntlayer=v.prepareIntlayer,exports.processContentDeclaration=t.processContentDeclaration,exports.transformJSFile=b.transformJSFile,exports.writeConfiguration=_.writeConfiguration,exports.writeContentDeclaration=S.writeContentDeclaration,exports.writeJSFile=x.writeJSFile;
|
package/dist/cjs/cli.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./listDictionariesPath.cjs`),t=require(`./getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs`),
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./listDictionariesPath.cjs`),t=require(`./detectFormatCommand.cjs`),n=require(`./getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs`),r=require(`./init/index.cjs`),i=require(`./installSkills/index.cjs`),a=require(`./listGitFiles.cjs`),o=require(`./listProjects.cjs`),s=require(`./transformFiles/extractDictionaryKey.cjs`),c=require(`./transformFiles/transformFiles.cjs`);exports.ATTRIBUTES_TO_EXTRACT=c.ATTRIBUTES_TO_EXTRACT,exports.SKILLS=i.SKILLS,exports.SKILLS_METADATA=i.SKILLS_METADATA,exports.detectFormatCommand=t.detectFormatCommand,exports.extractDictionaryKey=s.extractDictionaryKey,exports.extractIntlayer=c.extractIntlayer,exports.getContentDeclarationFileTemplate=n.getContentDeclarationFileTemplate,exports.initIntlayer=r.initIntlayer,exports.installSkills=i.installSkills,exports.listDictionaries=e.listDictionaries,exports.listDictionariesWithStats=e.listDictionariesWithStats,exports.listGitFiles=a.listGitFiles,exports.listGitLines=a.listGitLines,exports.listProjects=o.listProjects,exports.shouldExtract=c.shouldExtract,exports.transformFiles=c.transformFiles;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/config/utils`),t=null;const n=(n,r)=>{let{formatCommand:i,baseDir:a}=n.content,o=r??(0,e.getProjectRequire)(a);if(i)return i;if(t!==null)return t;try{return o.resolve(`prettier`),t=`prettier --write "{{file}}" --log-level silent`,t}catch{}try{return o.resolve(`biome`),t=`biome format "{{file}}" --write --log-level none`,t}catch{}try{return o.resolve(`eslint`),t=`eslint --fix "{{file}}" --quiet`,t}catch{}t=void 0};exports.detectFormatCommand=n;
|
|
2
|
+
//# sourceMappingURL=detectFormatCommand.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectFormatCommand.cjs","names":[],"sources":["../../src/detectFormatCommand.ts"],"sourcesContent":["import { getProjectRequire } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nlet cachedFormatCommand: string | undefined | null = null;\n\nexport const detectFormatCommand = (\n configuration: IntlayerConfig,\n projectRequireProp?: NodeJS.Require\n) => {\n const { formatCommand, baseDir } = configuration.content;\n const projectRequire = projectRequireProp ?? getProjectRequire(baseDir);\n\n // Priority: Explicit configuration\n // We do not cache this because the user might change their config file active-session.\n if (formatCommand) {\n return formatCommand;\n }\n\n // Priority: Cached detection\n // If not null, we have already performed the expensive checks.\n if (cachedFormatCommand !== null) {\n return cachedFormatCommand;\n }\n\n // Perform Detection\n\n // Try Prettier\n try {\n projectRequire.resolve('prettier');\n cachedFormatCommand = 'prettier --write \"{{file}}\" --log-level silent';\n return cachedFormatCommand;\n } catch (_error) {\n // Prettier not found, continue\n }\n\n // Try Biome\n try {\n projectRequire.resolve('biome');\n cachedFormatCommand = 'biome format \"{{file}}\" --write --log-level none';\n return cachedFormatCommand;\n } catch (_error) {\n // Biome not found, continue\n }\n\n // Try ESLint\n try {\n projectRequire.resolve('eslint');\n cachedFormatCommand = 'eslint --fix \"{{file}}\" --quiet';\n return cachedFormatCommand;\n } catch (_error) {\n // ESLint not found\n }\n\n // No formatter found\n // Set to undefined (not null) so we know we checked and found nothing.\n cachedFormatCommand = undefined;\n return undefined;\n};\n"],"mappings":"uJAGI,EAAiD,KAErD,MAAa,GACX,EACA,IACG,CACH,GAAM,CAAE,gBAAe,WAAY,EAAc,QAC3C,EAAiB,IAAA,EAAA,EAAA,mBAAwC,EAAQ,CAIvE,GAAI,EACF,OAAO,EAKT,GAAI,IAAwB,KAC1B,OAAO,EAMT,GAAI,CAGF,OAFA,EAAe,QAAQ,WAAW,CAClC,EAAsB,iDACf,OACQ,EAKjB,GAAI,CAGF,OAFA,EAAe,QAAQ,QAAQ,CAC/B,EAAsB,mDACf,OACQ,EAKjB,GAAI,CAGF,OAFA,EAAe,QAAQ,SAAS,CAChC,EAAsB,kCACf,OACQ,EAMjB,EAAsB,IAAA"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./utils/pLimit.cjs`),t=require(`./utils/parallelize.cjs`),n=require(`./utils/formatter.cjs`),r=require(`./buildIntlayerDictionary/buildIntlayerDictionary.cjs`),i=require(`./utils/autoDecorateContent.cjs`),a=require(`./utils/resolveObjectPromises.cjs`),o=require(`./buildIntlayerDictionary/processContentDeclaration.cjs`),s=require(`./cleanOutputDir.cjs`),c=require(`./utils/getFileHash.cjs`),l=require(`./createDictionaryEntryPoint/generateDictionaryListContent.cjs`),u=require(`./createDictionaryEntryPoint/getBuiltDictionariesPath.cjs`),d=require(`./createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs`),f=require(`./createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs`),p=require(`./createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs`),m=require(`./createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs`),h=require(`./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs`),g=require(`./createType/createModuleAugmentation.cjs`),_=require(`./createType/createType.cjs`),v=require(`./formatDictionary.cjs`),y=require(`./loadDictionaries/loadContentDeclaration.cjs`),b=require(`./utils/sortAlphabetically.cjs`),x=require(`./loadDictionaries/loadRemoteDictionaries.cjs`),S=require(`./loadDictionaries/loadDictionaries.cjs`),C=require(`./loadDictionaries/loadLocalDictionaries.cjs`),w=require(`./listDictionariesPath.cjs`),T=require(`./utils/runOnce.cjs`),E=require(`./writeConfiguration/index.cjs`),D=require(`./prepareIntlayer.cjs`),O=require(`./writeContentDeclaration/detectExportedComponentName.cjs`),k=require(`./writeContentDeclaration/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./utils/pLimit.cjs`),t=require(`./utils/parallelize.cjs`),n=require(`./utils/formatter.cjs`),r=require(`./buildIntlayerDictionary/buildIntlayerDictionary.cjs`),i=require(`./utils/autoDecorateContent.cjs`),a=require(`./utils/resolveObjectPromises.cjs`),o=require(`./buildIntlayerDictionary/processContentDeclaration.cjs`),s=require(`./cleanOutputDir.cjs`),c=require(`./utils/getFileHash.cjs`),l=require(`./createDictionaryEntryPoint/generateDictionaryListContent.cjs`),u=require(`./createDictionaryEntryPoint/getBuiltDictionariesPath.cjs`),d=require(`./createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs`),f=require(`./createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs`),p=require(`./createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs`),m=require(`./createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs`),h=require(`./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs`),g=require(`./createType/createModuleAugmentation.cjs`),_=require(`./createType/createType.cjs`),v=require(`./formatDictionary.cjs`),y=require(`./loadDictionaries/loadContentDeclaration.cjs`),b=require(`./utils/sortAlphabetically.cjs`),x=require(`./loadDictionaries/loadRemoteDictionaries.cjs`),S=require(`./loadDictionaries/loadDictionaries.cjs`),C=require(`./loadDictionaries/loadLocalDictionaries.cjs`),w=require(`./listDictionariesPath.cjs`),T=require(`./utils/runOnce.cjs`),E=require(`./writeConfiguration/index.cjs`),D=require(`./prepareIntlayer.cjs`),O=require(`./writeContentDeclaration/detectExportedComponentName.cjs`),k=require(`./writeContentDeclaration/transformJSFile.cjs`),A=require(`./utils/getFormatFromExtension.cjs`),j=require(`./detectFormatCommand.cjs`),M=require(`./getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs`),N=require(`./writeContentDeclaration/writeJSFile.cjs`),P=require(`./writeContentDeclaration/writeContentDeclaration.cjs`),F=require(`./init/index.cjs`),I=require(`./installSkills/index.cjs`),L=require(`./listGitFiles.cjs`),R=require(`./listProjects.cjs`),z=require(`./transformFiles/extractDictionaryKey.cjs`),B=require(`./transformFiles/transformFiles.cjs`),V=require(`./utils/buildFilesList.cjs`),H=require(`./utils/splitTextByLine.cjs`),U=require(`./utils/getChunk.cjs`),W=require(`./utils/chunkJSON.cjs`),G=require(`./utils/getComponentTransformPattern.cjs`),K=require(`./utils/mergeChunks.cjs`),q=require(`./utils/parallelizeGlobal.cjs`),J=require(`./utils/reduceObjectFormat.cjs`),Y=require(`./utils/runParallel/index.cjs`),X=require(`./utils/verifyIdenticObjectFormat.cjs`),Z=require(`./watcher.cjs`);exports.ATTRIBUTES_TO_EXTRACT=B.ATTRIBUTES_TO_EXTRACT,exports.Queue=e.Queue,exports.SKILLS=I.SKILLS,exports.SKILLS_METADATA=I.SKILLS_METADATA,exports.assembleJSON=W.assembleJSON,exports.autoDecorateContent=i.autoDecorateContent,exports.buildAndWatchIntlayer=Z.buildAndWatchIntlayer,exports.buildDictionary=r.buildDictionary,exports.buildFilesList=V.buildFilesList,exports.chunkJSON=W.chunkJSON,exports.cleanOutputDir=s.cleanOutputDir,exports.createDictionaryEntryPoint=h.createDictionaryEntryPoint,exports.createModuleAugmentation=g.createModuleAugmentation,exports.createTypes=_.createTypes,exports.detectExportedComponentName=O.detectExportedComponentName,exports.detectFormatCommand=j.detectFormatCommand,exports.extractDictionaryKey=z.extractDictionaryKey,exports.extractIntlayer=B.extractIntlayer,exports.formatDictionaries=v.formatDictionaries,exports.formatDictionariesOutput=v.formatDictionariesOutput,exports.formatDictionary=v.formatDictionary,exports.formatDictionaryOutput=v.formatDictionaryOutput,exports.formatDistantDictionaries=x.formatDistantDictionaries,exports.formatLocalDictionaries=y.formatLocalDictionaries,exports.formatLocale=n.formatLocale,exports.formatPath=n.formatPath,exports.generateDictionaryListContent=l.generateDictionaryListContent,exports.generateTypeScriptType=_.generateTypeScriptType,exports.getBuiltDictionariesPath=u.getBuiltDictionariesPath,exports.getBuiltDynamicDictionariesPath=d.getBuiltDynamicDictionariesPath,exports.getBuiltFetchDictionariesPath=f.getBuiltFetchDictionariesPath,exports.getBuiltRemoteDictionariesPath=p.getBuiltRemoteDictionariesPath,exports.getBuiltUnmergedDictionariesPath=m.getBuiltUnmergedDictionariesPath,exports.getChunk=U.getChunk,exports.getComponentTransformPattern=G.getComponentTransformPattern,exports.getComponentTransformPatternSync=G.getComponentTransformPatternSync,exports.getContentDeclarationFileTemplate=M.getContentDeclarationFileTemplate,exports.getExtensionFromFormat=A.getExtensionFromFormat,exports.getFileHash=c.getFileHash,exports.getFormatFromExtension=A.getFormatFromExtension,exports.getGlobalLimiter=q.getGlobalLimiter,exports.getTaskLimiter=q.getTaskLimiter,exports.getTypeName=g.getTypeName,exports.initIntlayer=F.initIntlayer,exports.installSkills=I.installSkills,exports.isCachedConfigurationUpToDate=E.isCachedConfigurationUpToDate,exports.listDictionaries=w.listDictionaries,exports.listDictionariesWithStats=w.listDictionariesWithStats,exports.listGitFiles=L.listGitFiles,exports.listGitLines=L.listGitLines,exports.listProjects=R.listProjects,exports.loadContentDeclarations=y.loadContentDeclarations,exports.loadDictionaries=S.loadDictionaries,exports.loadLocalDictionaries=C.loadLocalDictionaries,exports.loadRemoteDictionaries=x.loadRemoteDictionaries,exports.mergeChunks=K.mergeChunks,exports.pLimit=e.pLimit,exports.parallelize=t.parallelize,exports.parallelizeGlobal=q.parallelizeGlobal,exports.prepareIntlayer=D.prepareIntlayer,exports.processContentDeclaration=o.processContentDeclaration,exports.reconstructFromSingleChunk=W.reconstructFromSingleChunk,exports.reduceObjectFormat=J.reduceObjectFormat,exports.resolveObjectPromises=a.resolveObjectPromises,exports.runOnce=T.runOnce,exports.runParallel=Y.runParallel,exports.shouldExtract=B.shouldExtract,exports.sortAlphabetically=b.sortAlphabetically,exports.splitTextByLines=H.splitTextByLines,exports.transformFiles=B.transformFiles,exports.transformJSFile=k.transformJSFile,exports.verifyIdenticObjectFormat=X.verifyIdenticObjectFormat,exports.watch=Z.watch,exports.writeConfiguration=E.writeConfiguration,exports.writeContentDeclaration=P.writeContentDeclaration,exports.writeJSFile=N.writeJSFile;
|
package/dist/cjs/init/index.cjs
CHANGED
|
@@ -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(`@intlayer/config/node`),o=require(`@intlayer/config/logger`),
|
|
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(`@intlayer/config/node`),o=require(`node:path`),s=require(`@intlayer/config/logger`),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,s.logger)((0,s.colorize)(`Checking Intlayer configuration...`,s.ANSIColors.CYAN));let d=`package.json`;await n.exists(l,d)||((0,s.logger)(`${s.x} No ${(0,s.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,s.logger)(`${s.x} Could not parse ${(0,s.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,s.logger)(`${s.v} ${(0,s.colorizePath)(h)} already includes .intlayer`):(await n.writeFileToRoot(l,h,`${e}\n# Intlayer\n.intlayer\n`),(0,s.logger)(`${s.v} Added ${(0,s.colorizePath)(`.intlayer`)} to ${(0,s.colorizePath)(h)}`))}let g=`.vscode`,_=(0,o.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,s.logger)(`${s.v} ${(0,s.colorizePath)(_)} already includes ${(0,s.colorize)(v,s.ANSIColors.MAGENTA)}`):(e.recommendations.push(v),await n.writeFileToRoot(l,_,JSON.stringify(e,null,2)),(0,s.logger)(`${s.v} Added ${(0,s.colorize)(v,s.ANSIColors.MAGENTA)} to ${(0,s.colorizePath)(_)}`))}catch{(0,s.logger)(`${s.x} Could not update ${(0,s.colorizePath)(_)}. You may need to add ${(0,s.colorize)(v,s.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,s.logger)(`${s.v} ${(0,s.colorizePath)(e)} already includes intlayer types`)),a&&(await n.writeFileToRoot(l,e,JSON.stringify(t,null,2)),(0,s.logger)(`${s.v} Updated ${(0,s.colorizePath)(e)} to include intlayer types`))}catch{(0,s.logger)(`${s.x} Could not parse or update ${(0,s.colorizePath)(e)}. You may need to add ${(0,s.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,s.logger)(`${s.v} Updated ${(0,s.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,s.logger)(`${s.v} Updated ${(0,s.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,s.logger)(`${s.v} Found ${(0,s.colorizePath)(e)}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`);break}if(!x){let e=(0,c.getAlias)({configuration:(0,a.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,s.logger)(`${s.v} Updated ${(0,s.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,s.logger)(`${s.v} Updated ${(0,s.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,s.logger)(`${s.v} Updated ${(0,s.colorizePath)(d)} to include Intlayer imports`))}}}(0,s.logger)(`${s.v} ${(0,s.colorize)(`Intlayer init setup complete.`,s.ANSIColors.GREEN)}`),(0,s.logger)([(0,s.colorize)(`Next →`,s.ANSIColors.MAGENTA),(0,s.colorize)(`Follow the instructions in the documentation to complete the setup:`,s.ANSIColors.GREY_LIGHT),(0,s.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","findTsConfigFiles","parseJSONWithComments","initConfig","updateViteConfig","updateNextConfig"],"sources":["../../../src/init/index.ts"],"sourcesContent":["import {\n ANSIColors,\n colorize,\n colorizePath,\n logger,\n v,\n x,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport { initConfig } from '../initConfig';\nimport {\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 // 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":"iaAwBA,MAAM,EAAsB,CAC1B,OAAQ,iDACR,UAAW,oDACX,UAAW,oDACX,IAAK,2DACL,MAAO,gDACP,aAAc,yDACd,2BACE,yEACF,oCACE,mFACF,WAAY,uDACZ,aAAc,yDACd,cAAe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,gBAEpC,sEACAA,EAAAA,WAAW,WACZ,oBACY,EAAS,CACvB,CAAC"}
|
|
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":"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,UA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,EAAU,KAEZ,CAEE,IACF,MAAMC,EAAAA,gBACJ,EACA,EACA,KAAK,UAAU,EAAQ,KAAM,EAAE,CAChC,EACD,EAAA,EAAA,QACE,GAAGC,EAAAA,EAAE,YAAA,EAAA,EAAA,cACH,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,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
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`node:fs/promises`),t=require(`node:path`);const n=async(n,r)=>{try{return await(0,e.access)((0,t.join)(n,r)),!0}catch{return!1}},r=async(n,r)=>await(0,e.readFile)((0,t.join)(n,r),`utf8`),i=async(n,r,i)=>await(0,e.writeFile)((0,t.join)(n,r),i,`utf8`);exports.exists=n,exports.readFileFromRoot=r,exports.writeFileToRoot=i;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`node:fs/promises`),t=require(`node:path`);const n=async(n,r)=>{try{return await(0,e.access)((0,t.join)(n,r)),!0}catch{return!1}},r=async(n,r)=>await(0,e.readFile)((0,t.join)(n,r),`utf8`),i=async(n,r,i)=>await(0,e.writeFile)((0,t.join)(n,r),i,`utf8`),a=async(n,r)=>{try{await(0,e.mkdir)((0,t.join)(n,r),{recursive:!0})}catch{}};exports.ensureDirectory=a,exports.exists=n,exports.readFileFromRoot=r,exports.writeFileToRoot=i;
|
|
2
2
|
//# sourceMappingURL=fileSystem.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileSystem.cjs","names":[],"sources":["../../../../src/init/utils/fileSystem.ts"],"sourcesContent":["import { access, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n * Helper to check if a file exists\n */\nexport const exists = async (rootDir: string, filePath: string) => {\n try {\n await access(join(rootDir, filePath));\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * Helper to read a file\n */\nexport const readFileFromRoot = async (rootDir: string, filePath: string) =>\n await readFile(join(rootDir, filePath), 'utf8');\n\n/**\n * Helper to write a file\n */\nexport const writeFileToRoot = async (\n rootDir: string,\n filePath: string,\n content: string\n) => await writeFile(join(rootDir, filePath), content, 'utf8');\n"],"mappings":"4KAMA,MAAa,EAAS,MAAO,EAAiB,IAAqB,CACjE,GAAI,CAEF,OADA,MAAA,EAAA,EAAA,SAAA,EAAA,EAAA,MAAkB,EAAS,EAAS,CAAC,CAC9B,QACD,CACN,MAAO,KAOE,EAAmB,MAAO,EAAiB,IACtD,MAAA,EAAA,EAAA,WAAA,EAAA,EAAA,MAAoB,EAAS,EAAS,CAAE,OAAO,CAKpC,EAAkB,MAC7B,EACA,EACA,IACG,MAAA,EAAA,EAAA,YAAA,EAAA,EAAA,MAAqB,EAAS,EAAS,CAAE,EAAS,OAAO"}
|
|
1
|
+
{"version":3,"file":"fileSystem.cjs","names":[],"sources":["../../../../src/init/utils/fileSystem.ts"],"sourcesContent":["import { access, mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n * Helper to check if a file exists\n */\nexport const exists = async (rootDir: string, filePath: string) => {\n try {\n await access(join(rootDir, filePath));\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * Helper to read a file\n */\nexport const readFileFromRoot = async (rootDir: string, filePath: string) =>\n await readFile(join(rootDir, filePath), 'utf8');\n\n/**\n * Helper to write a file\n */\nexport const writeFileToRoot = async (\n rootDir: string,\n filePath: string,\n content: string\n) => await writeFile(join(rootDir, filePath), content, 'utf8');\n\n/**\n * Helper to ensure a directory exists\n */\nexport const ensureDirectory = async (rootDir: string, dirPath: string) => {\n try {\n await mkdir(join(rootDir, dirPath), { recursive: true });\n } catch {\n // Directory already exists or could not be created\n }\n};\n"],"mappings":"4KAMA,MAAa,EAAS,MAAO,EAAiB,IAAqB,CACjE,GAAI,CAEF,OADA,MAAA,EAAA,EAAA,SAAA,EAAA,EAAA,MAAkB,EAAS,EAAS,CAAC,CAC9B,QACD,CACN,MAAO,KAOE,EAAmB,MAAO,EAAiB,IACtD,MAAA,EAAA,EAAA,WAAA,EAAA,EAAA,MAAoB,EAAS,EAAS,CAAE,OAAO,CAKpC,EAAkB,MAC7B,EACA,EACA,IACG,MAAA,EAAA,EAAA,YAAA,EAAA,EAAA,MAAqB,EAAS,EAAS,CAAE,EAAS,OAAO,CAKjD,EAAkB,MAAO,EAAiB,IAAoB,CACzE,GAAI,CACF,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,MAAiB,EAAS,EAAQ,CAAE,CAAE,UAAW,GAAM,CAAC,MAClD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./configManipulation.cjs`),t=require(`./fileSystem.cjs`),n=require(`./jsonParser.cjs`),r=require(`./tsConfig.cjs`);exports.exists=t.exists,exports.findTsConfigFiles=r.findTsConfigFiles,exports.parseJSONWithComments=n.parseJSONWithComments,exports.readFileFromRoot=t.readFileFromRoot,exports.updateNextConfig=e.updateNextConfig,exports.updateViteConfig=e.updateViteConfig,exports.writeFileToRoot=t.writeFileToRoot;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./configManipulation.cjs`),t=require(`./fileSystem.cjs`),n=require(`./jsonParser.cjs`),r=require(`./tsConfig.cjs`);exports.ensureDirectory=t.ensureDirectory,exports.exists=t.exists,exports.findTsConfigFiles=r.findTsConfigFiles,exports.parseJSONWithComments=n.parseJSONWithComments,exports.readFileFromRoot=t.readFileFromRoot,exports.updateNextConfig=e.updateNextConfig,exports.updateViteConfig=e.updateViteConfig,exports.writeFileToRoot=t.writeFileToRoot;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../_virtual/_utils_asset.cjs`);let n=require(`node:path`);n=e.__toESM(n);let r=require(`node:fs`),i=require(`@intlayer/core/markdown`);const a={Usage:`How to use Intlayer in your project`,RemoteContent:`How to use Intlayer with Remote/CMS/Server-side content`,Config:`Intlayer configuration documentation`,Content:`Reference for all Intlayer content node types (t, enu, etc.)`,React:`React-specific syntax and hooks usage`,Angular:`Angular-specific syntax and Injectable Function usage`,NextJS:`Next.js-specific usage (Server & Client components)`,Vue:`Vue-specific composables and syntax`,Preact:`Preact-specific syntax and hooks usage`,Solid:`Integrates Intlayer internationalization with SolidJS components. Use when the user asks to "setup SolidJS i18n", use the "useIntlayer" hook in Solid, or manage locales in a SolidJS application.`,Svelte:`Svelte-specific stores and syntax`,Astro:`Astro-specific usage and getIntlayer`,CLI:`Intlayer CLI commands and usage`},o=Object.keys(a),s={},c={Cursor:`.cursor/skills`,Windsurf:`.windsurf/skills`,Trae:`.trae/skills`,OpenCode:`.opencode/skills`,GitHub:`.github/skills`,Claude:`.claude/skills`,VSCode:`.vscode/skills`,Antigravity:`.agent/skills`,Augment:`.augment/skills`,OpenClaw:`skills`,Cline:`.cline/skills`,CodeBuddy:`.codebuddy/skills`,CommandCode:`.commandcode/skills`,Continue:`.continue/skills`,Crush:`.crush/skills`,Droid:`.factory/skills`,Goose:`.goose/skills`,Junie:`.junie/skills`,IFlow:`.iflow/skills`,KiloCode:`.kilocode/skills`,Kiro:`.kiro/skills`,Kode:`.kode/skills`,MCPJam:`.mcpjam/skills`,MistralVibe:`.vibe/skills`,Mux:`.mux/skills`,OpenHands:`.openhands/skills`,Pi:`.pi/skills`,Qoder:`.qoder/skills`,Qwen:`.qwen/skills`,RooCode:`.roo/skills`,TraeCN:`.trae/skills`,Zencoder:`.zencoder/skills`,Neovate:`.neovate/skills`,Pochi:`.pochi/skills`,Other:`skills`},l=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),u=e=>{let n=`./skills/${s[e]??l(e)}.md`;try{return t.readAsset(n)}catch{return console.warn(`Warning: Could not read asset for skill: ${e} at ${n}`),``}},d=()=>{try{return t.readAsset(`./LICENCE.md`)}catch{return console.warn(`Warning: Could not read LICENCE.md asset`),``}},f=async e=>{let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch ${e}: ${t.statusText}`);return t.text()},p=async(e,t,a)=>{let o=c[t]??`skills`,p=n.default.join(e,o),m=t!==`VSCode`;await r.promises.mkdir(p,{recursive:!0});let h=[],g=d();for(let e of a){let t=`intlayer-${s[e]??l(e)}`,a=u(e);if(!a)continue;let o=Array.from(new Set(a.match(/https:\/\/intlayer\.org\/doc\/[^\s)]+\.md/g)||[]));if(m){let s=n.default.join(p,t),c=n.default.join(s,`references`);await r.promises.mkdir(c,{recursive:!0}),g&&await r.promises.writeFile(n.default.join(s,`LICENCE.md`),g,`utf-8`);let l=a,u=o.map(async t=>{try{let e=await f(t),n=(0,i.getMarkdownMetadata)(e),r=``;return r=Array.isArray(n.slugs)?n.slugs.filter(e=>e!==`doc`).join(`_`):new URL(t).pathname.split(`/`).filter(e=>e&&e!==`doc`).map(e=>e.replace(`.md`,``)).join(`_`),r=r?`${r}.md`:`index.md`,{url:t,localRefPath:`references/${r}`,fileName:r,content:e,success:!0}}catch(n){return console.warn(`Warning: Failed to download ref ${t} for skill ${e}`,n),{url:t,success:!1}}}),d=await Promise.all(u);for(let e of d)e.success&&e.fileName&&e.content&&e.localRefPath&&(await r.promises.writeFile(n.default.join(c,e.fileName),e.content,`utf-8`),l=l.replaceAll(e.url,e.localRefPath));let m=n.default.join(s,`SKILL.md`);await r.promises.writeFile(m,l,`utf-8`),h.push(`${t}/SKILL.md`)}else{let e=`${t}.md`,i=n.default.join(p,e);await r.promises.writeFile(i,a,`utf-8`),h.push(e)}}return h.length===0?`No skill files were created. Check your asset paths.`:`Created ${h.length} skills in ${p}`};exports.SKILLS=o,exports.SKILLS_METADATA=a,exports.installSkills=p;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../_virtual/_utils_asset.cjs`);let n=require(`node:path`);n=e.__toESM(n);let r=require(`node:fs`),i=require(`@intlayer/core/markdown`);const a={Usage:`How to use Intlayer in your project`,RemoteContent:`How to use Intlayer with Remote/CMS/Server-side content`,Config:`Intlayer configuration documentation`,Content:`Reference for all Intlayer content node types (t, enu, etc.)`,React:`React-specific syntax and hooks usage`,Angular:`Angular-specific syntax and Injectable Function usage`,NextJS:`Next.js-specific usage (Server & Client components)`,Vue:`Vue-specific composables and syntax`,Preact:`Preact-specific syntax and hooks usage`,Solid:`Integrates Intlayer internationalization with SolidJS components. Use when the user asks to "setup SolidJS i18n", use the "useIntlayer" hook in Solid, or manage locales in a SolidJS application.`,Svelte:`Svelte-specific stores and syntax`,Astro:`Astro-specific usage and getIntlayer`,CLI:`Intlayer CLI commands and usage`,Compiler:`Intlayer Compiler setup and usage for automatic content extraction without .content files`},o=Object.keys(a),s={},c={Cursor:`.cursor/skills`,Windsurf:`.windsurf/skills`,Trae:`.trae/skills`,OpenCode:`.opencode/skills`,GitHub:`.github/skills`,Claude:`.claude/skills`,VSCode:`.vscode/skills`,Antigravity:`.agent/skills`,Augment:`.augment/skills`,OpenClaw:`skills`,Cline:`.cline/skills`,CodeBuddy:`.codebuddy/skills`,CommandCode:`.commandcode/skills`,Continue:`.continue/skills`,Crush:`.crush/skills`,Droid:`.factory/skills`,Goose:`.goose/skills`,Junie:`.junie/skills`,IFlow:`.iflow/skills`,KiloCode:`.kilocode/skills`,Kiro:`.kiro/skills`,Kode:`.kode/skills`,MCPJam:`.mcpjam/skills`,MistralVibe:`.vibe/skills`,Mux:`.mux/skills`,OpenHands:`.openhands/skills`,Pi:`.pi/skills`,Qoder:`.qoder/skills`,Qwen:`.qwen/skills`,RooCode:`.roo/skills`,TraeCN:`.trae/skills`,Zencoder:`.zencoder/skills`,Neovate:`.neovate/skills`,Pochi:`.pochi/skills`,Other:`skills`},l=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),u=e=>{let n=`./skills/${s[e]??l(e)}.md`;try{return t.readAsset(n)}catch{return console.warn(`Warning: Could not read asset for skill: ${e} at ${n}`),``}},d=()=>{try{return t.readAsset(`./LICENCE.md`)}catch{return console.warn(`Warning: Could not read LICENCE.md asset`),``}},f=async e=>{let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch ${e}: ${t.statusText}`);return t.text()},p=async(e,t,a)=>{let o=c[t]??`skills`,p=n.default.join(e,o),m=t!==`VSCode`;await r.promises.mkdir(p,{recursive:!0});let h=[],g=d();for(let e of a){let t=`intlayer-${s[e]??l(e)}`,a=u(e);if(!a)continue;let o=Array.from(new Set(a.match(/https:\/\/intlayer\.org\/doc\/[^\s)]+\.md/g)||[]));if(m){let s=n.default.join(p,t),c=n.default.join(s,`references`);await r.promises.mkdir(c,{recursive:!0}),g&&await r.promises.writeFile(n.default.join(s,`LICENCE.md`),g,`utf-8`);let l=a,u=o.map(async t=>{try{let e=await f(t),n=(0,i.getMarkdownMetadata)(e),r=``;return r=Array.isArray(n.slugs)?n.slugs.filter(e=>e!==`doc`).join(`_`):new URL(t).pathname.split(`/`).filter(e=>e&&e!==`doc`).map(e=>e.replace(`.md`,``)).join(`_`),r=r?`${r}.md`:`index.md`,{url:t,localRefPath:`references/${r}`,fileName:r,content:e,success:!0}}catch(n){return console.warn(`Warning: Failed to download ref ${t} for skill ${e}`,n),{url:t,success:!1}}}),d=await Promise.all(u);for(let e of d)e.success&&e.fileName&&e.content&&e.localRefPath&&(await r.promises.writeFile(n.default.join(c,e.fileName),e.content,`utf-8`),l=l.replaceAll(e.url,e.localRefPath));let m=n.default.join(s,`SKILL.md`);await r.promises.writeFile(m,l,`utf-8`),h.push(`${t}/SKILL.md`)}else{let e=`${t}.md`,i=n.default.join(p,e);await r.promises.writeFile(i,a,`utf-8`),h.push(e)}}return h.length===0?`No skill files were created. Check your asset paths.`:`Created ${h.length} skills in ${p}`};exports.SKILLS=o,exports.SKILLS_METADATA=a,exports.installSkills=p;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["readAsset","path","fs"],"sources":["../../../src/installSkills/index.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport path from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport { getMarkdownMetadata } from '@intlayer/core/markdown';\n\nexport const SKILLS_METADATA = {\n Usage: 'How to use Intlayer in your project',\n RemoteContent: 'How to use Intlayer with Remote/CMS/Server-side content',\n Config: 'Intlayer configuration documentation',\n Content: 'Reference for all Intlayer content node types (t, enu, etc.)',\n React: 'React-specific syntax and hooks usage',\n Angular: 'Angular-specific syntax and Injectable Function usage',\n NextJS: 'Next.js-specific usage (Server & Client components)',\n Vue: 'Vue-specific composables and syntax',\n Preact: 'Preact-specific syntax and hooks usage',\n Solid:\n 'Integrates Intlayer internationalization with SolidJS components. Use when the user asks to \"setup SolidJS i18n\", use the \"useIntlayer\" hook in Solid, or manage locales in a SolidJS application.',\n Svelte: 'Svelte-specific stores and syntax',\n Astro: 'Astro-specific usage and getIntlayer',\n CLI: 'Intlayer CLI commands and usage',\n} as const;\n\nexport const SKILLS = Object.keys(\n SKILLS_METADATA\n) as (keyof typeof SKILLS_METADATA)[];\n\nexport type Skill = (typeof SKILLS)[number];\n\n/**\n * Maps specific skill keys to special filenames if they differ from standard snake_case.\n */\nconst SKILL_FILENAME_MAP: Partial<Record<Skill, string>> = {};\n\n/**\n * Configuration for Platform paths to keep code clean.\n */\nconst PLATFORM_DIRS = {\n Cursor: '.cursor/skills',\n Windsurf: '.windsurf/skills',\n Trae: '.trae/skills',\n OpenCode: '.opencode/skills',\n GitHub: '.github/skills',\n Claude: '.claude/skills',\n VSCode: '.vscode/skills', // Fixed: VSCode usually uses .vscode, not .github\n Antigravity: '.agent/skills',\n Augment: '.augment/skills',\n OpenClaw: 'skills',\n Cline: '.cline/skills',\n CodeBuddy: '.codebuddy/skills',\n CommandCode: '.commandcode/skills',\n Continue: '.continue/skills',\n Crush: '.crush/skills',\n Droid: '.factory/skills',\n Goose: '.goose/skills',\n Junie: '.junie/skills',\n IFlow: '.iflow/skills',\n KiloCode: '.kilocode/skills',\n Kiro: '.kiro/skills',\n Kode: '.kode/skills',\n MCPJam: '.mcpjam/skills',\n MistralVibe: '.vibe/skills',\n Mux: '.mux/skills',\n OpenHands: '.openhands/skills',\n Pi: '.pi/skills',\n Qoder: '.qoder/skills',\n Qwen: '.qwen/skills',\n RooCode: '.roo/skills',\n TraeCN: '.trae/skills',\n Zencoder: '.zencoder/skills',\n Neovate: '.neovate/skills',\n Pochi: '.pochi/skills',\n Other: 'skills',\n};\n\nexport type Platform = keyof typeof PLATFORM_DIRS;\n\n/**\n * Helper to convert CamelCase to kebab-case for directory naming\n */\nconst camelToKebabCase = (str: string) =>\n str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\n/**\n * Reads the raw markdown content for a specific skill from the assets folder.\n */\nconst getSkillContent = (skill: Skill): string => {\n const baseName = SKILL_FILENAME_MAP[skill] ?? camelToKebabCase(skill);\n const fileName = `./skills/${baseName}.md`;\n\n try {\n return readAsset(fileName);\n } catch {\n console.warn(\n `Warning: Could not read asset for skill: ${skill} at ${fileName}`\n );\n return '';\n }\n};\n\n/**\n * Reads the licence content from the assets folder.\n */\nconst getLicenceContent = (): string => {\n try {\n return readAsset('./LICENCE.md');\n } catch {\n console.warn('Warning: Could not read LICENCE.md asset');\n return '';\n }\n};\n\n/**\n * Fetches the content of a URL using native fetch.\n */\nconst fetchUrlContent = async (url: string): Promise<string> => {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Failed to fetch ${url}: ${response.statusText}`);\n }\n return response.text();\n};\n\n/**\n * Installs skills using the \"Agent Skills\" directory standard.\n * Standard: <PROJECT_ROOT>/<CONFIG_DIR>/skills/<SKILL_NAME>/SKILL.md\n */\nexport const installSkills = async (\n projectRoot: string,\n platform: Platform,\n skills: Skill[]\n): Promise<string> => {\n // 1. Determine destination directory\n const relativeDir = PLATFORM_DIRS[platform] ?? 'skills';\n const skillsBaseDir = path.join(projectRoot, relativeDir);\n\n const useAgentStructure = platform !== 'VSCode';\n\n // Ensure the base directory exists\n await fs.mkdir(skillsBaseDir, { recursive: true });\n\n const createdSkills: string[] = [];\n const licenceContent = getLicenceContent();\n\n for (const skill of skills) {\n const baseName = SKILL_FILENAME_MAP[skill] ?? camelToKebabCase(skill);\n const skillName = `intlayer-${baseName}`;\n const skillContent = getSkillContent(skill);\n\n if (!skillContent) continue;\n\n // Extract unique URLs\n const urls = Array.from(\n new Set(\n skillContent.match(/https:\\/\\/intlayer\\.org\\/doc\\/[^\\s)]+\\.md/g) || []\n )\n );\n\n if (useAgentStructure) {\n // Agent Standard: .../skills/<skill-name>/SKILL.md\n const skillDir = path.join(skillsBaseDir, skillName);\n const referenceDir = path.join(skillDir, 'references');\n\n // Ensure directories exist\n await fs.mkdir(referenceDir, { recursive: true });\n\n // Write License\n if (licenceContent) {\n await fs.writeFile(\n path.join(skillDir, 'LICENCE.md'),\n licenceContent,\n 'utf-8'\n );\n }\n\n let updatedSkillContent = skillContent;\n\n // Parallel download of references\n const downloadPromises = urls.map(async (url) => {\n try {\n const content = await fetchUrlContent(url);\n const metadata = getMarkdownMetadata<{ slugs?: string[] }>(content);\n\n let fileName = '';\n\n // Determine filename from slugs or URL path\n if (Array.isArray(metadata.slugs)) {\n fileName = metadata.slugs\n .filter((slug) => slug !== 'doc')\n .join('_');\n } else {\n const urlPath = new URL(url).pathname;\n fileName = urlPath\n .split('/')\n .filter((part) => part && part !== 'doc')\n .map((part) => part.replace('.md', '')) // Clean extension for joining\n .join('_');\n }\n\n // Ensure it ends with .md\n fileName = fileName ? `${fileName}.md` : 'index.md';\n const localRefPath = `references/${fileName}`;\n\n return {\n url,\n localRefPath,\n fileName,\n content,\n success: true,\n };\n } catch (error) {\n console.warn(\n `Warning: Failed to download ref ${url} for skill ${skill}`,\n error\n );\n return { url, success: false };\n }\n });\n\n const results = await Promise.all(downloadPromises);\n\n // Process results: Write files and update content string\n for (const res of results) {\n if (res.success && res.fileName && res.content && res.localRefPath) {\n // Write the reference file\n await fs.writeFile(\n path.join(referenceDir, res.fileName),\n res.content,\n 'utf-8'\n );\n\n // Update the main content to point to local file\n updatedSkillContent = updatedSkillContent.replaceAll(\n res.url,\n res.localRefPath\n );\n }\n }\n\n // Write the main SKILL.md\n const filePath = path.join(skillDir, 'SKILL.md');\n await fs.writeFile(filePath, updatedSkillContent, 'utf-8');\n createdSkills.push(`${skillName}/SKILL.md`);\n } else {\n // Flat Structure (Generic/VSCode): .../skills/<skill-name>.md\n const fileName = `${skillName}.md`;\n const filePath = path.join(skillsBaseDir, fileName);\n\n await fs.writeFile(filePath, skillContent, 'utf-8');\n createdSkills.push(fileName);\n }\n }\n\n if (createdSkills.length === 0) {\n return `No skill files were created. Check your asset paths.`;\n }\n\n return `Created ${createdSkills.length} skills in ${skillsBaseDir}`;\n};\n"],"mappings":"0QAKA,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mC,EAAI,aAAa,IACpD,EACD,CACM,CAAE,MAAK,QAAS,GAAO,GAEhC,CAEI,EAAU,MAAM,QAAQ,IAAI,EAAiB,CAGnD,IAAK,IAAM,KAAO,EACZ,EAAI,SAAW,EAAI,UAAY,EAAI,SAAW,EAAI,eAEpD,MAAMC,EAAAA,SAAG,UACPD,EAAAA,QAAK,KAAK,EAAc,EAAI,SAAS,CACrC,EAAI,QACJ,QACD,CAGD,EAAsB,EAAoB,WACxC,EAAI,IACJ,EAAI,aACL,EAKL,IAAM,EAAWA,EAAAA,QAAK,KAAK,EAAU,WAAW,CAChD,MAAMC,EAAAA,SAAG,UAAU,EAAU,EAAqB,QAAQ,CAC1D,EAAc,KAAK,GAAG,EAAU,WAAW,KACtC,CAEL,IAAM,EAAW,GAAG,EAAU,KACxB,EAAWD,EAAAA,QAAK,KAAK,EAAe,EAAS,CAEnD,MAAMC,EAAAA,SAAG,UAAU,EAAU,EAAc,QAAQ,CACnD,EAAc,KAAK,EAAS,EAQhC,OAJI,EAAc,SAAW,EACpB,uDAGF,WAAW,EAAc,OAAO,aAAa"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["readAsset","path","fs"],"sources":["../../../src/installSkills/index.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport path from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport { getMarkdownMetadata } from '@intlayer/core/markdown';\n\nexport const SKILLS_METADATA = {\n Usage: 'How to use Intlayer in your project',\n RemoteContent: 'How to use Intlayer with Remote/CMS/Server-side content',\n Config: 'Intlayer configuration documentation',\n Content: 'Reference for all Intlayer content node types (t, enu, etc.)',\n React: 'React-specific syntax and hooks usage',\n Angular: 'Angular-specific syntax and Injectable Function usage',\n NextJS: 'Next.js-specific usage (Server & Client components)',\n Vue: 'Vue-specific composables and syntax',\n Preact: 'Preact-specific syntax and hooks usage',\n Solid:\n 'Integrates Intlayer internationalization with SolidJS components. Use when the user asks to \"setup SolidJS i18n\", use the \"useIntlayer\" hook in Solid, or manage locales in a SolidJS application.',\n Svelte: 'Svelte-specific stores and syntax',\n Astro: 'Astro-specific usage and getIntlayer',\n CLI: 'Intlayer CLI commands and usage',\n Compiler:\n 'Intlayer Compiler setup and usage for automatic content extraction without .content files',\n} as const;\n\nexport const SKILLS = Object.keys(\n SKILLS_METADATA\n) as (keyof typeof SKILLS_METADATA)[];\n\nexport type Skill = (typeof SKILLS)[number];\n\n/**\n * Maps specific skill keys to special filenames if they differ from standard snake_case.\n */\nconst SKILL_FILENAME_MAP: Partial<Record<Skill, string>> = {};\n\n/**\n * Configuration for Platform paths to keep code clean.\n */\nconst PLATFORM_DIRS = {\n Cursor: '.cursor/skills',\n Windsurf: '.windsurf/skills',\n Trae: '.trae/skills',\n OpenCode: '.opencode/skills',\n GitHub: '.github/skills',\n Claude: '.claude/skills',\n VSCode: '.vscode/skills', // Fixed: VSCode usually uses .vscode, not .github\n Antigravity: '.agent/skills',\n Augment: '.augment/skills',\n OpenClaw: 'skills',\n Cline: '.cline/skills',\n CodeBuddy: '.codebuddy/skills',\n CommandCode: '.commandcode/skills',\n Continue: '.continue/skills',\n Crush: '.crush/skills',\n Droid: '.factory/skills',\n Goose: '.goose/skills',\n Junie: '.junie/skills',\n IFlow: '.iflow/skills',\n KiloCode: '.kilocode/skills',\n Kiro: '.kiro/skills',\n Kode: '.kode/skills',\n MCPJam: '.mcpjam/skills',\n MistralVibe: '.vibe/skills',\n Mux: '.mux/skills',\n OpenHands: '.openhands/skills',\n Pi: '.pi/skills',\n Qoder: '.qoder/skills',\n Qwen: '.qwen/skills',\n RooCode: '.roo/skills',\n TraeCN: '.trae/skills',\n Zencoder: '.zencoder/skills',\n Neovate: '.neovate/skills',\n Pochi: '.pochi/skills',\n Other: 'skills',\n};\n\nexport type Platform = keyof typeof PLATFORM_DIRS;\n\n/**\n * Helper to convert CamelCase to kebab-case for directory naming\n */\nconst camelToKebabCase = (str: string) =>\n str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\n/**\n * Reads the raw markdown content for a specific skill from the assets folder.\n */\nconst getSkillContent = (skill: Skill): string => {\n const baseName = SKILL_FILENAME_MAP[skill] ?? camelToKebabCase(skill);\n const fileName = `./skills/${baseName}.md`;\n\n try {\n return readAsset(fileName);\n } catch {\n console.warn(\n `Warning: Could not read asset for skill: ${skill} at ${fileName}`\n );\n return '';\n }\n};\n\n/**\n * Reads the licence content from the assets folder.\n */\nconst getLicenceContent = (): string => {\n try {\n return readAsset('./LICENCE.md');\n } catch {\n console.warn('Warning: Could not read LICENCE.md asset');\n return '';\n }\n};\n\n/**\n * Fetches the content of a URL using native fetch.\n */\nconst fetchUrlContent = async (url: string): Promise<string> => {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Failed to fetch ${url}: ${response.statusText}`);\n }\n return response.text();\n};\n\n/**\n * Installs skills using the \"Agent Skills\" directory standard.\n * Standard: <PROJECT_ROOT>/<CONFIG_DIR>/skills/<SKILL_NAME>/SKILL.md\n */\nexport const installSkills = async (\n projectRoot: string,\n platform: Platform,\n skills: Skill[]\n): Promise<string> => {\n // 1. Determine destination directory\n const relativeDir = PLATFORM_DIRS[platform] ?? 'skills';\n const skillsBaseDir = path.join(projectRoot, relativeDir);\n\n const useAgentStructure = platform !== 'VSCode';\n\n // Ensure the base directory exists\n await fs.mkdir(skillsBaseDir, { recursive: true });\n\n const createdSkills: string[] = [];\n const licenceContent = getLicenceContent();\n\n for (const skill of skills) {\n const baseName = SKILL_FILENAME_MAP[skill] ?? camelToKebabCase(skill);\n const skillName = `intlayer-${baseName}`;\n const skillContent = getSkillContent(skill);\n\n if (!skillContent) continue;\n\n // Extract unique URLs\n const urls = Array.from(\n new Set(\n skillContent.match(/https:\\/\\/intlayer\\.org\\/doc\\/[^\\s)]+\\.md/g) || []\n )\n );\n\n if (useAgentStructure) {\n // Agent Standard: .../skills/<skill-name>/SKILL.md\n const skillDir = path.join(skillsBaseDir, skillName);\n const referenceDir = path.join(skillDir, 'references');\n\n // Ensure directories exist\n await fs.mkdir(referenceDir, { recursive: true });\n\n // Write License\n if (licenceContent) {\n await fs.writeFile(\n path.join(skillDir, 'LICENCE.md'),\n licenceContent,\n 'utf-8'\n );\n }\n\n let updatedSkillContent = skillContent;\n\n // Parallel download of references\n const downloadPromises = urls.map(async (url) => {\n try {\n const content = await fetchUrlContent(url);\n const metadata = getMarkdownMetadata<{ slugs?: string[] }>(content);\n\n let fileName = '';\n\n // Determine filename from slugs or URL path\n if (Array.isArray(metadata.slugs)) {\n fileName = metadata.slugs\n .filter((slug) => slug !== 'doc')\n .join('_');\n } else {\n const urlPath = new URL(url).pathname;\n fileName = urlPath\n .split('/')\n .filter((part) => part && part !== 'doc')\n .map((part) => part.replace('.md', '')) // Clean extension for joining\n .join('_');\n }\n\n // Ensure it ends with .md\n fileName = fileName ? `${fileName}.md` : 'index.md';\n const localRefPath = `references/${fileName}`;\n\n return {\n url,\n localRefPath,\n fileName,\n content,\n success: true,\n };\n } catch (error) {\n console.warn(\n `Warning: Failed to download ref ${url} for skill ${skill}`,\n error\n );\n return { url, success: false };\n }\n });\n\n const results = await Promise.all(downloadPromises);\n\n // Process results: Write files and update content string\n for (const res of results) {\n if (res.success && res.fileName && res.content && res.localRefPath) {\n // Write the reference file\n await fs.writeFile(\n path.join(referenceDir, res.fileName),\n res.content,\n 'utf-8'\n );\n\n // Update the main content to point to local file\n updatedSkillContent = updatedSkillContent.replaceAll(\n res.url,\n res.localRefPath\n );\n }\n }\n\n // Write the main SKILL.md\n const filePath = path.join(skillDir, 'SKILL.md');\n await fs.writeFile(filePath, updatedSkillContent, 'utf-8');\n createdSkills.push(`${skillName}/SKILL.md`);\n } else {\n // Flat Structure (Generic/VSCode): .../skills/<skill-name>.md\n const fileName = `${skillName}.md`;\n const filePath = path.join(skillsBaseDir, fileName);\n\n await fs.writeFile(filePath, skillContent, 'utf-8');\n createdSkills.push(fileName);\n }\n }\n\n if (createdSkills.length === 0) {\n return `No skill files were created. Check your asset paths.`;\n }\n\n return `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