solid-translate 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -9,8 +9,18 @@ interface SolidTranslatePluginConfig {
9
9
  targetLocales: string[];
10
10
  /** Directory containing locale JSON files, relative to project root (default: "./src/locales") */
11
11
  localesDir?: string;
12
- /** AI model to use for translations (any Vercel AI SDK LanguageModelV1) */
13
- model: LanguageModelV1;
12
+ /**
13
+ * AI model to use for translations (any Vercel AI SDK LanguageModelV1).
14
+ * Required unless `translate` is `false`.
15
+ */
16
+ model?: LanguageModelV1;
17
+ /**
18
+ * When `false`, the plugin only serves the virtual translation modules
19
+ * from the committed locale JSON files — no extraction, no AI calls, no
20
+ * file writes. Use this to keep app builds hermetic and run extraction/
21
+ * translation exclusively through the CLI (e.g. in CI). Default: `true`.
22
+ */
23
+ translate?: boolean;
14
24
  /** Custom system prompt for the AI translator */
15
25
  systemPrompt?: string;
16
26
  /** Max keys per API call (default: 50) */
package/dist/vite.d.ts CHANGED
@@ -9,8 +9,18 @@ interface SolidTranslatePluginConfig {
9
9
  targetLocales: string[];
10
10
  /** Directory containing locale JSON files, relative to project root (default: "./src/locales") */
11
11
  localesDir?: string;
12
- /** AI model to use for translations (any Vercel AI SDK LanguageModelV1) */
13
- model: LanguageModelV1;
12
+ /**
13
+ * AI model to use for translations (any Vercel AI SDK LanguageModelV1).
14
+ * Required unless `translate` is `false`.
15
+ */
16
+ model?: LanguageModelV1;
17
+ /**
18
+ * When `false`, the plugin only serves the virtual translation modules
19
+ * from the committed locale JSON files — no extraction, no AI calls, no
20
+ * file writes. Use this to keep app builds hermetic and run extraction/
21
+ * translation exclusively through the CLI (e.g. in CI). Default: `true`.
22
+ */
23
+ translate?: boolean;
14
24
  /** Custom system prompt for the AI translator */
15
25
  systemPrompt?: string;
16
26
  /** Max keys per API call (default: 50) */
package/dist/vite.js CHANGED
@@ -15150,6 +15150,7 @@ function solidTranslate(config) {
15150
15150
  model,
15151
15151
  systemPrompt,
15152
15152
  batchSize = 50,
15153
+ translate = true,
15153
15154
  autoExtract = false,
15154
15155
  include = ["src/**/*.tsx", "src/**/*.ts", "src/**/*.jsx"]
15155
15156
  } = config;
@@ -15162,6 +15163,14 @@ function solidTranslate(config) {
15162
15163
  resolvedLocalesDir = resolve(root, localesDir);
15163
15164
  },
15164
15165
  async buildStart() {
15166
+ if (!translate) {
15167
+ return;
15168
+ }
15169
+ if (!model) {
15170
+ throw new Error(
15171
+ "[solid-translate] `model` is required unless `translate: false` is set"
15172
+ );
15173
+ }
15165
15174
  if (!existsSync2(resolvedLocalesDir)) {
15166
15175
  mkdirSync(resolvedLocalesDir, { recursive: true });
15167
15176
  }