@localey/svelte 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +16 -7
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,12 +1,21 @@
1
- # @localey/adapter-svelte
1
+ # @localey/svelte
2
2
 
3
- Svelte adapter for Localey. Powered by the Svelte compiler to accurately find strings within template blocks.
3
+ Svelte template adapter for Localey.
4
4
 
5
- ## Usage
5
+ The `@localey/svelte` package enables Localey to process `.svelte` files. It leverages the official Svelte compiler to parse templates and identify hardcoded strings within the Svelte syntax.
6
6
 
7
- Automatically active when `"svelte"` is included in your `localey.config.json` frameworks list.
7
+ ## Integration Details
8
8
 
9
- ## Internal Tools
9
+ The adapter integrates directly with the Svelte compiler's internal parsing engine. This ensures that it respects the nuances of Svelte's template logic, such as reactive statements and block-based flow control.
10
10
 
11
- - **Svelte Compiler**: Parses `.svelte` files into a searchable AST.
12
- - **Template Replacement**: Safely handles template text nodes and attributes.
11
+ ### Extraction Capabilities
12
+
13
+ - **Template Text**: Identifies static text nodes within the HTML portion of the Svelte component.
14
+ - **Element Attributes**: Detects string literals used in element attributes and component props within the template.
15
+ - **Mustache Tags**: Automatically wraps extracted strings in Svelte's mustache syntax (`{t("key")}`) for seamless integration with the Localey runtime.
16
+
17
+ ## Component Architecture
18
+
19
+ - **Svelte Compiler API**: Parses the component source into a comprehensive AST.
20
+ - **Template Walker**: Navigates the Svelte-specific AST nodes (MustacheTag, Text, Attribute) to identify localization candidates.
21
+ - **Transformation Layer**: Safely performs string replacements while maintaining the integrity of the component structure.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localey/svelte",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "dependencies": {