@inlang/paraglide-js 2.24.1 → 2.25.1

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 (85) hide show
  1. package/dist/bundler-plugins/esbuild.d.ts +1 -1
  2. package/dist/bundler-plugins/per-locale-build/index.d.ts +3 -3
  3. package/dist/bundler-plugins/per-locale-build/index.js +59 -15
  4. package/dist/bundler-plugins/per-locale-build/index.js.map +1 -1
  5. package/dist/bundler-plugins/rolldown.d.ts +1 -1
  6. package/dist/bundler-plugins/rollup.d.ts +1 -1
  7. package/dist/bundler-plugins/rspack.d.ts +1 -1
  8. package/dist/bundler-plugins/unplugin.d.ts +35 -1
  9. package/dist/bundler-plugins/unplugin.js +404 -123
  10. package/dist/bundler-plugins/unplugin.js.map +1 -1
  11. package/dist/bundler-plugins/unplugin.test.js +357 -202
  12. package/dist/bundler-plugins/unplugin.test.js.map +1 -1
  13. package/dist/bundler-plugins/vite.d.ts +2 -2
  14. package/dist/bundler-plugins/vite.js.map +1 -1
  15. package/dist/bundler-plugins/vite.test.js +2 -1
  16. package/dist/bundler-plugins/vite.test.js.map +1 -1
  17. package/dist/bundler-plugins/webpack.d.ts +1 -1
  18. package/dist/cli/commands/compile/command.js +156 -36
  19. package/dist/cli/commands/compile/command.js.map +1 -1
  20. package/dist/cli/commands/compile/command.test.js +311 -7
  21. package/dist/cli/commands/compile/command.test.js.map +1 -1
  22. package/dist/cli/defaults.d.ts +0 -2
  23. package/dist/cli/defaults.js +0 -2
  24. package/dist/cli/defaults.js.map +1 -1
  25. package/dist/cli/steps/initialize-inlang-project.js +2 -1
  26. package/dist/cli/steps/initialize-inlang-project.js.map +1 -1
  27. package/dist/cli/steps/prompt-for-outdir.js +1 -1
  28. package/dist/cli/steps/prompt-for-outdir.js.map +1 -1
  29. package/dist/compiler/compile-annotation.d.ts +2 -2
  30. package/dist/compiler/compile-annotation.js +9 -9
  31. package/dist/compiler/compile-annotation.js.map +1 -1
  32. package/dist/compiler/compile-local-variable.d.ts +2 -1
  33. package/dist/compiler/compile-local-variable.js +4 -4
  34. package/dist/compiler/compile-local-variable.js.map +1 -1
  35. package/dist/compiler/compile-local-variable.test.js +82 -0
  36. package/dist/compiler/compile-local-variable.test.js.map +1 -1
  37. package/dist/compiler/compile-message.js +10 -2
  38. package/dist/compiler/compile-message.js.map +1 -1
  39. package/dist/compiler/compile-message.test.js +132 -2
  40. package/dist/compiler/compile-message.test.js.map +1 -1
  41. package/dist/compiler/compile-pattern.js +4 -2
  42. package/dist/compiler/compile-pattern.js.map +1 -1
  43. package/dist/compiler/compile-pattern.test.js +31 -0
  44. package/dist/compiler/compile-pattern.test.js.map +1 -1
  45. package/dist/compiler/compiler-options.d.ts +1 -1
  46. package/dist/compiler/compiler-options.js.map +1 -1
  47. package/dist/compiler/server/create-server-file.js +18 -4
  48. package/dist/compiler/server/create-server-file.js.map +1 -1
  49. package/dist/compiler/server/create-server-file.test.js +76 -0
  50. package/dist/compiler/server/create-server-file.test.js.map +1 -1
  51. package/dist/compiler/variable-access.d.ts +2 -0
  52. package/dist/compiler/variable-access.js +6 -0
  53. package/dist/compiler/variable-access.js.map +1 -1
  54. package/dist/index.d.ts +1 -0
  55. package/dist/index.js +1 -0
  56. package/dist/index.js.map +1 -1
  57. package/dist/services/config/config-schema.d.ts +69 -0
  58. package/dist/services/config/config-schema.js +78 -0
  59. package/dist/services/config/config-schema.js.map +1 -0
  60. package/dist/services/config/defaults.d.ts +11 -0
  61. package/dist/services/config/defaults.js +12 -0
  62. package/dist/services/config/defaults.js.map +1 -0
  63. package/dist/services/config/discover-config-file.d.ts +19 -0
  64. package/dist/services/config/discover-config-file.js +39 -0
  65. package/dist/services/config/discover-config-file.js.map +1 -0
  66. package/dist/services/config/index.d.ts +24 -0
  67. package/dist/services/config/index.js +25 -0
  68. package/dist/services/config/index.js.map +1 -0
  69. package/dist/services/config/load-paraglide-config.d.ts +44 -0
  70. package/dist/services/config/load-paraglide-config.js +109 -0
  71. package/dist/services/config/load-paraglide-config.js.map +1 -0
  72. package/dist/services/config/load-paraglide-config.test.d.ts +1 -0
  73. package/dist/services/config/load-paraglide-config.test.js +201 -0
  74. package/dist/services/config/load-paraglide-config.test.js.map +1 -0
  75. package/dist/services/config/resolve-compiler-options.d.ts +24 -0
  76. package/dist/services/config/resolve-compiler-options.js +51 -0
  77. package/dist/services/config/resolve-compiler-options.js.map +1 -0
  78. package/dist/services/config/resolve-compiler-options.test.d.ts +1 -0
  79. package/dist/services/config/resolve-compiler-options.test.js +60 -0
  80. package/dist/services/config/resolve-compiler-options.test.js.map +1 -0
  81. package/dist/services/env-variables/index.js +1 -1
  82. package/dist/services/env-variables/index.js.map +1 -1
  83. package/dist/services/logger/index.js +2 -0
  84. package/dist/services/logger/index.js.map +1 -1
  85. package/package.json +5 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-paraglide-config.test.js","sourceRoot":"","sources":["../../../src/services/config/load-paraglide-config.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EACN,yBAAyB,EACzB,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,IAAI,eAAe,GAAa,EAAE,CAAC;AAEnC,KAAK,UAAU,sBAAsB;IACpC,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE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AAC,MAAM,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChD,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, test, vi, beforeEach, afterEach } from \"vitest\";\nimport { mkdtemp, rm, writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport path from \"node:path\";\nimport consola from \"consola\";\nimport {\n\tclearParaglideConfigCache,\n\tloadParaglideConfig,\n\tCONFIG_FILE_NAMES,\n\tresolveConfigCandidate,\n\tisConfigFileName,\n} from \"./index.js\";\nimport { Logger } from \"../logger/index.js\";\n\nlet testDirectories: string[] = [];\n\nasync function createProjectDirectory(): Promise<string> {\n\tconst directory = await mkdtemp(path.join(tmpdir(), \"paraglide-config-\"));\n\ttestDirectories.push(directory);\n\treturn directory;\n}\n\nbeforeEach(() => {\n\tclearParaglideConfigCache();\n\tvi.spyOn(consola, \"warn\").mockImplementation(() => {});\n});\n\nafterEach(async () => {\n\tvi.restoreAllMocks();\n\tfor (const directory of testDirectories.splice(0)) {\n\t\tawait rm(directory, { recursive: true, force: true });\n\t}\n});\n\ndescribe(\"resolveConfigCandidate\", () => {\n\ttest(\"returns undefined when no config file exists\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\texpect(await resolveConfigCandidate(projectDir)).toBeUndefined();\n\t});\n\n\ttest(\"prefers .js over .mjs over .ts over .cjs\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tfor (const fileName of CONFIG_FILE_NAMES) {\n\t\t\tawait writeFile(path.join(projectDir, fileName), \"export default {}\");\n\t\t}\n\t\texpect(await resolveConfigCandidate(projectDir)).toBe(\n\t\t\tpath.join(projectDir, \"paraglide.config.js\")\n\t\t);\n\t\tawait rm(path.join(projectDir, \"paraglide.config.js\"));\n\t\texpect(await resolveConfigCandidate(projectDir)).toBe(\n\t\t\tpath.join(projectDir, \"paraglide.config.mjs\")\n\t\t);\n\t\tawait rm(path.join(projectDir, \"paraglide.config.mjs\"));\n\t\texpect(await resolveConfigCandidate(projectDir)).toBe(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\")\n\t\t);\n\t\tawait rm(path.join(projectDir, \"paraglide.config.ts\"));\n\t\texpect(await resolveConfigCandidate(projectDir)).toBe(\n\t\t\tpath.join(projectDir, \"paraglide.config.cjs\")\n\t\t);\n\t});\n\n\ttest(\"isConfigFileName matches exactly the config names\", () => {\n\t\texpect(isConfigFileName(\"/x/paraglide.config.js\")).toBe(true);\n\t\texpect(isConfigFileName(\"/x/paraglide.config.cjs\")).toBe(true);\n\t\texpect(isConfigFileName(\"/x/README.md\")).toBe(false);\n\t\texpect(isConfigFileName(\"/x/other.config.js\")).toBe(false);\n\t});\n});\n\ndescribe(\"loadParaglideConfig\", () => {\n\ttest(\"returns undefined when no config file exists\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\texpect(await loadParaglideConfig({ projectDir })).toBeUndefined();\n\t});\n\n\ttest(\"loads every supported file format with a default export\", async () => {\n\t\tconst cases: Array<[string, string]> = [\n\t\t\t[\"paraglide.config.js\", `export default { outdir: './out-js' }`],\n\t\t\t[\"paraglide.config.mjs\", `export default { outdir: './out-mjs' }`],\n\t\t\t[\"paraglide.config.cjs\", `module.exports = { outdir: './out-cjs' }`],\n\t\t\t[\n\t\t\t\t\"paraglide.config.ts\",\n\t\t\t\t[\n\t\t\t\t\t\"const config = {\",\n\t\t\t\t\t' outdir: \"./out-ts\",',\n\t\t\t\t\t' strategy: [\"cookie\", \"baseLocale\"],',\n\t\t\t\t\t\"}\",\n\t\t\t\t\t\"export default config\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t],\n\t\t];\n\n\t\tfor (const [fileName, content] of cases) {\n\t\t\tconst projectDir = await createProjectDirectory();\n\t\t\tawait writeFile(path.join(projectDir, fileName), content);\n\n\t\t\tconst loaded = await loadParaglideConfig({ projectDir });\n\t\t\texpect(loaded?.path).toBe(path.join(projectDir, fileName));\n\t\t}\n\t});\n\ttest(\"leaves outdir paths untouched — the integration resolves them\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tawait writeFile(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\"),\n\t\t\t\"export default { outdir: '../out' }\"\n\t\t);\n\t\texpect((await loadParaglideConfig({ projectDir }))?.config.outdir).toBe(\n\t\t\t\"../out\"\n\t\t);\n\n\t\tclearParaglideConfigCache();\n\t\tconst absoluteOut = path.join(projectDir, \"abs-out\");\n\t\tawait writeFile(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\"),\n\t\t\t`export default { outdir: ${JSON.stringify(absoluteOut)} }`\n\t\t);\n\t\texpect((await loadParaglideConfig({ projectDir }))?.config.outdir).toBe(\n\t\t\tabsoluteOut\n\t\t);\n\t});\n\ttest(\"throws when the config file has no object export\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tawait writeFile(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\"),\n\t\t\t\"export default 42\"\n\t\t);\n\n\t\tawait expect(loadParaglideConfig({ projectDir })).rejects.toThrow(\n\t\t\t/expected an object/\n\t\t);\n\t});\n\n\ttest(\"throws when an option has an invalid value\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tawait writeFile(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\"),\n\t\t\t\"export default { cookieMaxAge: 'forever' }\"\n\t\t);\n\n\t\tawait expect(loadParaglideConfig({ projectDir })).rejects.toThrow(\n\t\t\t/\"cookieMaxAge\"/\n\t\t);\n\t});\n\n\ttest(\"throws when a strategy name is unknown\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tawait writeFile(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\"),\n\t\t\t\"export default { strategy: ['cookie', 'cookies'] }\"\n\t\t);\n\n\t\tawait expect(loadParaglideConfig({ projectDir })).rejects.toThrow(\n\t\t\t/\"strategy\\.1\"/\n\t\t);\n\t});\n\n\ttest(\"accepts custom strategies matching the runtime pattern\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tawait writeFile(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\"),\n\t\t\t\"export default { strategy: ['custom-server', 'custom-my_strategy-2', 'cookie'] }\"\n\t\t);\n\n\t\tconst loaded = await loadParaglideConfig({ projectDir });\n\t\texpect(loaded?.config.strategy).toEqual([\n\t\t\t\"custom-server\",\n\t\t\t\"custom-my_strategy-2\",\n\t\t\t\"cookie\",\n\t\t]);\n\t});\n\n\ttest(\"rejects malformed custom strategy names\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tawait writeFile(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\"),\n\t\t\t\"export default { strategy: ['custom-', 'custom-my strategy'] }\"\n\t\t);\n\n\t\tawait expect(loadParaglideConfig({ projectDir })).rejects.toThrow(\n\t\t\t/\"strategy\\.0\"/\n\t\t);\n\t});\n\n\ttest(\"throws when routeStrategies combine strategy and exclude\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tawait writeFile(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\"),\n\t\t\t[\n\t\t\t\t\"export default {\",\n\t\t\t\t\" routeStrategies: [{ match: '/admin', strategy: ['url'], exclude: true }],\",\n\t\t\t\t\"}\",\n\t\t\t].join(\"\\n\")\n\t\t);\n\n\t\tawait expect(loadParaglideConfig({ projectDir })).rejects.toThrow(\n\t\t\t/routeStrategies/\n\t\t);\n\t});\n\n\ttest(\"throws when outputStructure is invalid\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tawait writeFile(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\"),\n\t\t\t\"export default { outputStructure: 'modules' }\"\n\t\t);\n\n\t\tawait expect(loadParaglideConfig({ projectDir })).rejects.toThrow(\n\t\t\t/\"outputStructure\"/\n\t\t);\n\t});\n\n\ttest(\"rejects an empty outdir\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tawait writeFile(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\"),\n\t\t\t\"export default { outdir: '' }\"\n\t\t);\n\t\tawait expect(loadParaglideConfig({ projectDir })).rejects.toThrow(\n\t\t\t/\"outdir\"/\n\t\t);\n\t});\n\n\ttest(\"warns about unknown options but loads the rest\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tawait writeFile(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\"),\n\t\t\t\"export default { outdir: './out', outdirKye: './typo' }\"\n\t\t);\n\n\t\tconst loaded = await loadParaglideConfig({ projectDir });\n\t\texpect(loaded?.config.outdir).toBe(\"./out\");\n\t\texpect(consola.warn).toHaveBeenCalledWith(\n\t\t\texpect.stringContaining('\"outdirKye\"')\n\t\t);\n\t});\n\n\ttest(\"treats a legacy project key as an unknown option\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tawait writeFile(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\"),\n\t\t\t\"export default { project: './elsewhere.inlang', outdir: './out' }\"\n\t\t);\n\n\t\tconst loaded = await loadParaglideConfig({ projectDir });\n\t\texpect(loaded?.config.outdir).toBe(\"./out\");\n\t\texpect(consola.warn).toHaveBeenCalledWith(\n\t\t\texpect.stringContaining('\"project\"')\n\t\t);\n\t});\n\n\ttest(\"accepts cleanOutdir silently (it is ignored)\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tawait writeFile(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\"),\n\t\t\t\"export default { outdir: './out', cleanOutdir: true }\"\n\t\t);\n\n\t\tconst loaded = await loadParaglideConfig({ projectDir });\n\t\texpect(loaded?.config.cleanOutdir).toBe(true);\n\t\tfor (const call of vi.mocked(consola.warn).mock.calls) {\n\t\t\texpect(String(call[0])).not.toContain(\"cleanOutdir\");\n\t\t}\n\t});\n\ttest(\"respects a silent logger for warnings\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tawait writeFile(\n\t\t\tpath.join(projectDir, \"paraglide.config.ts\"),\n\t\t\t\"export default { outdir: './out', cleanOutdir: true, typoKey: 1 }\"\n\t\t);\n\n\t\tconst loaded = await loadParaglideConfig({\n\t\t\tprojectDir,\n\t\t\tlogger: new Logger({ silent: true, prefix: true }),\n\t\t});\n\t\texpect(loaded?.config.outdir).toBe(\"./out\");\n\t\texpect(consola.warn).not.toHaveBeenCalled();\n\t});\n\n\ttest(\"caches results until the cache is cleared\", async () => {\n\t\tconst projectDir = await createProjectDirectory();\n\t\tconst configPath = path.join(projectDir, \"paraglide.config.ts\");\n\t\tawait writeFile(configPath, \"export default { outdir: './first' }\");\n\n\t\tconst first = await loadParaglideConfig({ projectDir });\n\t\tconst second = await loadParaglideConfig({ projectDir });\n\t\texpect(second).toBe(first);\n\n\t\tawait writeFile(configPath, \"export default { outdir: './second' }\");\n\t\tconst stale = await loadParaglideConfig({ projectDir });\n\t\texpect(stale?.config.outdir).toBe(\"./first\");\n\n\t\tclearParaglideConfigCache();\n\t\tconst fresh = await loadParaglideConfig({ projectDir });\n\t\texpect(fresh?.config.outdir).toBe(\"./second\");\n\t});\n\n\t// Reloading must pick up new content for every config file format —\n\t// async module imports would keep serving stale content for .mjs/.cjs.\n\ttest(\"reloading picks up changed content for every file format\", async () => {\n\t\tfor (const fileName of CONFIG_FILE_NAMES) {\n\t\t\tconst projectDir = await createProjectDirectory();\n\t\t\tconst configPath = path.join(projectDir, fileName);\n\t\t\tconst write = (outdir: string) =>\n\t\t\t\twriteFile(\n\t\t\t\t\tconfigPath,\n\t\t\t\t\tfileName.endsWith(\".cjs\")\n\t\t\t\t\t\t? `module.exports = { outdir: './${outdir}' }`\n\t\t\t\t\t\t: `export default { outdir: './${outdir}' }`\n\t\t\t\t);\n\n\t\t\tawait write(\"first\");\n\t\t\tconst first = await loadParaglideConfig({ projectDir });\n\t\t\texpect(first?.config.outdir).toBe(\"./first\");\n\n\t\t\tclearParaglideConfigCache();\n\t\t\tawait write(\"second\");\n\t\t\tconst second = await loadParaglideConfig({ projectDir });\n\t\t\texpect(second?.config.outdir).toBe(\"./second\");\n\t\t}\n\t});\n});\n"]}
@@ -0,0 +1,24 @@
1
+ import { type CompilerOptions } from "../../compiler/compiler-options.js";
2
+ import type { ParaglideConfig } from "./config-schema.js";
3
+ /**
4
+ * Merges configuration sources into a full set of compiler options.
5
+ *
6
+ * Precedence (highest last):
7
+ * 1. built-in defaults (without `project`, `outdir`, `outputStructure`)
8
+ * 2. `config` — values from a paraglide config file
9
+ * 3. `overrides` — explicitly passed values, e.g. CLI flags or plugin options
10
+ *
11
+ * `undefined` values in `config` and `overrides` are ignored, so an absent
12
+ * CLI flag or plugin option never shadows the config file. `project` and
13
+ * `outdir` have no built-in defaults here — the CLI applies (and announces)
14
+ * the conventional paths, while bundler plugins require them explicitly
15
+ * (or via config file).
16
+ */
17
+ export declare function resolveCompilerOptions(args: {
18
+ config: ParaglideConfig | undefined;
19
+ /** Directory used to resolve relative paths. */
20
+ root?: string | undefined;
21
+ overrides: Partial<Omit<CompilerOptions, "project">> & {
22
+ project: string;
23
+ };
24
+ }): CompilerOptions;
@@ -0,0 +1,51 @@
1
+ import { defaultCompilerOptions, } from "../../compiler/compiler-options.js";
2
+ import { resolve } from "node:path";
3
+ /**
4
+ * Merges configuration sources into a full set of compiler options.
5
+ *
6
+ * Precedence (highest last):
7
+ * 1. built-in defaults (without `project`, `outdir`, `outputStructure`)
8
+ * 2. `config` — values from a paraglide config file
9
+ * 3. `overrides` — explicitly passed values, e.g. CLI flags or plugin options
10
+ *
11
+ * `undefined` values in `config` and `overrides` are ignored, so an absent
12
+ * CLI flag or plugin option never shadows the config file. `project` and
13
+ * `outdir` have no built-in defaults here — the CLI applies (and announces)
14
+ * the conventional paths, while bundler plugins require them explicitly
15
+ * (or via config file).
16
+ */
17
+ export function resolveCompilerOptions(args) {
18
+ const clonedDefaults = structuredClone(defaultsTemplate);
19
+ const options = {
20
+ ...clonedDefaults,
21
+ ...omitUndefinedEntries(args.config ?? {}),
22
+ ...omitUndefinedEntries(args.overrides ?? {}),
23
+ };
24
+ if (typeof options.project !== "string") {
25
+ throw new Error('The "project" option is required — the path to your inlang project directory (e.g. "./project.inlang").');
26
+ }
27
+ if (typeof options.outdir !== "string") {
28
+ throw new Error('The "outdir" option is required — the path to the output directory (e.g. "./src/paraglide").');
29
+ }
30
+ const resolved = options;
31
+ if (args.root !== undefined) {
32
+ resolved.project = resolve(args.root, resolved.project);
33
+ resolved.outdir = resolve(args.root, resolved.outdir);
34
+ }
35
+ return resolved;
36
+ }
37
+ // `outputStructure` is deliberately NOT pinned here: its default differs
38
+ // per surface — bundler plugins switch to "locale-modules" in development
39
+ // (#486), while the CLI always uses "message-modules". Surfaces that need
40
+ // a pinned value pass it explicitly as an override.
41
+ // `project` and `outdir` have no built-in defaults here either: the CLI
42
+ // decides whether to apply (and announce) the conventional paths, while
43
+ // bundler plugins require them explicitly (or via config file).
44
+ const defaultsTemplate = (() => {
45
+ const { outputStructure: _outputStructure, ...rest } = defaultCompilerOptions;
46
+ return rest;
47
+ })();
48
+ function omitUndefinedEntries(object) {
49
+ return Object.fromEntries(Object.entries(object).filter(([, value]) => value !== undefined));
50
+ }
51
+ //# sourceMappingURL=resolve-compiler-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-compiler-options.js","sourceRoot":"","sources":["../../../src/services/config/resolve-compiler-options.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,sBAAsB,GAEtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;;;;;;;;;;;GAaG;AAEH,MAAM,UAAU,sBAAsB,CAAC,IAOtC;IACA,MAAM,cAAc,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC;IACzD,MAAM,OAAO,GAA6B;QACzC,GAAG,cAAc;QACjB,GAAG,oBAAoB,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;QAC1C,GAAG,oBAAoB,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;KAC7C,CAAC;IAEF,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CACd,yGAAyG,CACzG,CAAC;IACH,CAAC;IACD,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CACd,8FAA8F,CAC9F,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAAG,OAA0B,CAAC;IAC5C,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC7B,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;QACxD,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED,yEAAyE;AACzE,0EAA0E;AAC1E,0EAA0E;AAC1E,oDAAoD;AACpD,wEAAwE;AACxE,wEAAwE;AACxE,gEAAgE;AAChE,MAAM,gBAAgB,GAGlB,CAAC,GAAG,EAAE;IACT,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,GACnD,sBAAsB,CAAC;IACxB,OAAO,IAAI,CAAC;AACb,CAAC,CAAC,EAAE,CAAC;AAEL,SAAS,oBAAoB,CAAmB,MAAS;IACxD,OAAO,MAAM,CAAC,WAAW,CACxB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAC5D,CAAC;AACR,CAAC","sourcesContent":["import {\n\tdefaultCompilerOptions,\n\ttype CompilerOptions,\n} from \"../../compiler/compiler-options.js\";\nimport { resolve } from \"node:path\";\nimport type { ParaglideConfig } from \"./config-schema.js\";\n\n/**\n * Merges configuration sources into a full set of compiler options.\n *\n * Precedence (highest last):\n * 1. built-in defaults (without `project`, `outdir`, `outputStructure`)\n * 2. `config` — values from a paraglide config file\n * 3. `overrides` — explicitly passed values, e.g. CLI flags or plugin options\n *\n * `undefined` values in `config` and `overrides` are ignored, so an absent\n * CLI flag or plugin option never shadows the config file. `project` and\n * `outdir` have no built-in defaults here — the CLI applies (and announces)\n * the conventional paths, while bundler plugins require them explicitly\n * (or via config file).\n */\n\nexport function resolveCompilerOptions(args: {\n\tconfig: ParaglideConfig | undefined;\n\t/** Directory used to resolve relative paths. */\n\troot?: string | undefined;\n\toverrides: Partial<Omit<CompilerOptions, \"project\">> & {\n\t\tproject: string;\n\t};\n}): CompilerOptions {\n\tconst clonedDefaults = structuredClone(defaultsTemplate);\n\tconst options: Partial<CompilerOptions> = {\n\t\t...clonedDefaults,\n\t\t...omitUndefinedEntries(args.config ?? {}),\n\t\t...omitUndefinedEntries(args.overrides ?? {}),\n\t};\n\n\tif (typeof options.project !== \"string\") {\n\t\tthrow new Error(\n\t\t\t'The \"project\" option is required — the path to your inlang project directory (e.g. \"./project.inlang\").'\n\t\t);\n\t}\n\tif (typeof options.outdir !== \"string\") {\n\t\tthrow new Error(\n\t\t\t'The \"outdir\" option is required — the path to the output directory (e.g. \"./src/paraglide\").'\n\t\t);\n\t}\n\n\tconst resolved = options as CompilerOptions;\n\tif (args.root !== undefined) {\n\t\tresolved.project = resolve(args.root, resolved.project);\n\t\tresolved.outdir = resolve(args.root, resolved.outdir);\n\t}\n\treturn resolved;\n}\n\n// `outputStructure` is deliberately NOT pinned here: its default differs\n// per surface — bundler plugins switch to \"locale-modules\" in development\n// (#486), while the CLI always uses \"message-modules\". Surfaces that need\n// a pinned value pass it explicitly as an override.\n// `project` and `outdir` have no built-in defaults here either: the CLI\n// decides whether to apply (and announce) the conventional paths, while\n// bundler plugins require them explicitly (or via config file).\nconst defaultsTemplate: Omit<\n\tCompilerOptions,\n\t\"outputStructure\" | \"project\" | \"outdir\"\n> = (() => {\n\tconst { outputStructure: _outputStructure, ...rest } =\n\t\tdefaultCompilerOptions;\n\treturn rest;\n})();\n\nfunction omitUndefinedEntries<T extends object>(object: T): T {\n\treturn Object.fromEntries(\n\t\tObject.entries(object).filter(([, value]) => value !== undefined)\n\t) as T;\n}\n"]}
@@ -0,0 +1,60 @@
1
+ import { describe, expect, test } from "vitest";
2
+ import { resolveCompilerOptions } from "./resolve-compiler-options.js";
3
+ describe("resolveCompilerOptions", () => {
4
+ test("throws when outdir is missing", () => {
5
+ expect(() => resolveCompilerOptions({
6
+ config: undefined,
7
+ overrides: { project: "/repo/app/project.inlang" },
8
+ })).toThrow(/outdir.*required/i);
9
+ });
10
+ test("resolves relative paths against the supplied root", () => {
11
+ const options = resolveCompilerOptions({
12
+ config: { outdir: "./src/paraglide" },
13
+ overrides: { project: "project.inlang" },
14
+ root: "/repo/app",
15
+ });
16
+ expect(options.project).toBe("/repo/app/project.inlang");
17
+ expect(options.outdir).toBe("/repo/app/src/paraglide");
18
+ });
19
+ test("config values override the defaults", () => {
20
+ const options = resolveCompilerOptions({
21
+ config: { outdir: "./from-config" },
22
+ overrides: { project: "/base/project.inlang" },
23
+ root: "/base",
24
+ });
25
+ expect(options.outdir).toBe("/base/from-config");
26
+ });
27
+ test("overrides win over config values", () => {
28
+ const options = resolveCompilerOptions({
29
+ config: { outdir: "./from-config" },
30
+ overrides: { project: "/p", outdir: "/from-override" },
31
+ root: "/base",
32
+ });
33
+ expect(options.outdir).toBe("/from-override");
34
+ });
35
+ test("explicit relative paths are resolved against the root", () => {
36
+ const options = resolveCompilerOptions({
37
+ config: { outdir: "./src/paraglide" },
38
+ overrides: { project: "packages/app/project.inlang" },
39
+ root: "/monorepo",
40
+ });
41
+ expect(options.project).toBe("/monorepo/packages/app/project.inlang");
42
+ });
43
+ test("undefined overrides do not shadow config values", () => {
44
+ const options = resolveCompilerOptions({
45
+ config: { strategy: ["url"], outdir: "/kept" },
46
+ overrides: { strategy: undefined, project: "/p" },
47
+ });
48
+ expect(options.strategy).toEqual(["url"]);
49
+ expect(options.outdir).toBe("/kept");
50
+ });
51
+ test("absolute paths from the config survive root resolution", () => {
52
+ const options = resolveCompilerOptions({
53
+ config: { outdir: "/abs/out" },
54
+ overrides: { project: "/p" },
55
+ root: "/base",
56
+ });
57
+ expect(options.outdir).toBe("/abs/out");
58
+ });
59
+ });
60
+ //# sourceMappingURL=resolve-compiler-options.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-compiler-options.test.js","sourceRoot":"","sources":["../../../src/services/config/resolve-compiler-options.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACvC,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE;QAC1C,MAAM,CAAC,GAAG,EAAE,CACX,sBAAsB,CAAC;YACtB,MAAM,EAAE,SAAS;YACjB,SAAS,EAAE,EAAE,OAAO,EAAE,0BAA0B,EAAE;SAClD,CAAC,CACF,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC9D,MAAM,OAAO,GAAG,sBAAsB,CAAC;YACtC,MAAM,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE;YACrC,SAAS,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;YACxC,IAAI,EAAE,WAAW;SACjB,CAAC,CAAC;QACH,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACzD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,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AE,IAAI,EAAE;SACjD,CAAC,CAAC;QACH,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1C,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,wDAAwD,EAAE,GAAG,EAAE;QACnE,MAAM,OAAO,GAAG,sBAAsB,CAAC;YACtC,MAAM,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;YAC9B,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;YAC5B,IAAI,EAAE,OAAO;SACb,CAAC,CAAC;QACH,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, test } from \"vitest\";\nimport { resolveCompilerOptions } from \"./resolve-compiler-options.js\";\n\ndescribe(\"resolveCompilerOptions\", () => {\n\ttest(\"throws when outdir is missing\", () => {\n\t\texpect(() =>\n\t\t\tresolveCompilerOptions({\n\t\t\t\tconfig: undefined,\n\t\t\t\toverrides: { project: \"/repo/app/project.inlang\" },\n\t\t\t})\n\t\t).toThrow(/outdir.*required/i);\n\t});\n\n\ttest(\"resolves relative paths against the supplied root\", () => {\n\t\tconst options = resolveCompilerOptions({\n\t\t\tconfig: { outdir: \"./src/paraglide\" },\n\t\t\toverrides: { project: \"project.inlang\" },\n\t\t\troot: \"/repo/app\",\n\t\t});\n\t\texpect(options.project).toBe(\"/repo/app/project.inlang\");\n\t\texpect(options.outdir).toBe(\"/repo/app/src/paraglide\");\n\t});\n\n\ttest(\"config values override the defaults\", () => {\n\t\tconst options = resolveCompilerOptions({\n\t\t\tconfig: { outdir: \"./from-config\" },\n\t\t\toverrides: { project: \"/base/project.inlang\" },\n\t\t\troot: \"/base\",\n\t\t});\n\t\texpect(options.outdir).toBe(\"/base/from-config\");\n\t});\n\n\ttest(\"overrides win over config values\", () => {\n\t\tconst options = resolveCompilerOptions({\n\t\t\tconfig: { outdir: \"./from-config\" },\n\t\t\toverrides: { project: \"/p\", outdir: \"/from-override\" },\n\t\t\troot: \"/base\",\n\t\t});\n\t\texpect(options.outdir).toBe(\"/from-override\");\n\t});\n\n\ttest(\"explicit relative paths are resolved against the root\", () => {\n\t\tconst options = resolveCompilerOptions({\n\t\t\tconfig: { outdir: \"./src/paraglide\" },\n\t\t\toverrides: { project: \"packages/app/project.inlang\" },\n\t\t\troot: \"/monorepo\",\n\t\t});\n\t\texpect(options.project).toBe(\"/monorepo/packages/app/project.inlang\");\n\t});\n\n\ttest(\"undefined overrides do not shadow config values\", () => {\n\t\tconst options = resolveCompilerOptions({\n\t\t\tconfig: { strategy: [\"url\"], outdir: \"/kept\" },\n\t\t\toverrides: { strategy: undefined, project: \"/p\" },\n\t\t});\n\t\texpect(options.strategy).toEqual([\"url\"]);\n\t\texpect(options.outdir).toBe(\"/kept\");\n\t});\n\n\ttest(\"absolute paths from the config survive root resolution\", () => {\n\t\tconst options = resolveCompilerOptions({\n\t\t\tconfig: { outdir: \"/abs/out\" },\n\t\t\toverrides: { project: \"/p\" },\n\t\t\troot: \"/base\",\n\t\t});\n\t\texpect(options.outdir).toBe(\"/abs/out\");\n\t});\n});\n"]}
@@ -1,4 +1,4 @@
1
1
  export const ENV_VARIABLES = {
2
- PARJS_PACKAGE_VERSION: "2.24.1",
2
+ PARJS_PACKAGE_VERSION: "2.25.1",
3
3
  };
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/env-variables/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B,qBAAqB,EAAE,QAAQ;CAC/B,CAAA","sourcesContent":["\nexport const ENV_VARIABLES = {\n\tPARJS_PACKAGE_VERSION: \"2.24.1\",\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/env-variables/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B,qBAAqB,EAAE,QAAQ;CAC/B,CAAA","sourcesContent":["\nexport const ENV_VARIABLES = {\n\tPARJS_PACKAGE_VERSION: \"2.25.1\",\n}\n"]}
@@ -35,6 +35,8 @@ export class Logger {
35
35
  return this;
36
36
  }
37
37
  warn(message, ...args) {
38
+ if (this.options.silent)
39
+ return this;
38
40
  const prefix = this.options.prefix
39
41
  ? colors.bold(colors.yellow("[paraglide-js] "))
40
42
  : "";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,CAAC,OAAO,GAAG;IACjB,GAAG,OAAO,CAAC,OAAO;IAClB,aAAa,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;CAC9B,CAAC;AAWF,MAAM,OAAO,MAAM;IAET,OAAO;IADhB,YACS,OAAO,GAAkB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE;uBAAxD,OAAO;IACb,CAAC;IAEG,GAAG,CAAC,OAAe;QACzB,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,IAAI,CAAC,OAAe;QAC1B,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM;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AO,EAAE,GAAG,IAAI,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,GAAG,CAAC,OAAY,EAAE,GAAG,IAAW;QACtC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QACrC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["import { colors } from \"consola/utils\";\nimport consola from \"consola\";\n\nconsola.options = {\n\t...consola.options,\n\tformatOptions: { date: false },\n};\n\nexport type LoggerOptions = {\n\tsilent: boolean;\n\n\t/**\n\t * If the [paraglide] prefix should be printed before each log message.\n\t */\n\tprefix: boolean;\n};\n\nexport class Logger {\n\tconstructor(\n\t\tprivate options: LoggerOptions = { silent: false, prefix: true }\n\t) {}\n\n\tpublic log(message: string): Logger {\n\t\tif (this.options.silent) return this;\n\t\tconst prefix = this.options.prefix ? colors.bold(\"[paraglide-js] \") : \"\";\n\t\tconsola.log(prefix + message);\n\t\treturn this;\n\t}\n\n\tpublic info(message: string): Logger {\n\t\tif (this.options.silent) return this;\n\t\tconst prefix = this.options.prefix\n\t\t\t? colors.bold(colors.blue(\"[paraglide-js] \"))\n\t\t\t: \"\";\n\t\tconsola.info(prefix + message);\n\t\treturn this;\n\t}\n\n\tpublic success(message: string): Logger {\n\t\tif (this.options.silent) return this;\n\t\tconst prefix = this.options.prefix\n\t\t\t? colors.bold(colors.green(\"[paraglide-js] \"))\n\t\t\t: \"\";\n\t\tconsola.success(prefix + message);\n\t\treturn this;\n\t}\n\n\tpublic warn(message: any, ...args: any[]): Logger {\n\t\tconst prefix = this.options.prefix\n\t\t\t? colors.bold(colors.yellow(\"[paraglide-js] \"))\n\t\t\t: \"\";\n\t\tconsola.warn(prefix + message, ...args);\n\t\treturn this;\n\t}\n\n\tpublic error(message: any, ...args: any[]): Logger {\n\t\tconst prefix = this.options.prefix\n\t\t\t? colors.bold(colors.red(\"[paraglide-js] \"))\n\t\t\t: \"\";\n\t\tconsola.error(prefix + message, ...args);\n\t\treturn this;\n\t}\n\n\tpublic box(message: any, ...args: any[]): Logger {\n\t\tif (this.options.silent) return this;\n\t\tconsola.box(message, ...args);\n\t\treturn this;\n\t}\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,CAAC,OAAO,GAAG;IACjB,GAAG,OAAO,CAAC,OAAO;IAClB,aAAa,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;CAC9B,CAAC;AAWF,MAAM,OAAO,MAAM;IAET,OAAO;IADhB,YACS,OAAO,GAAkB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE;uBAAxD,OAAO;IACb,CAAC;IAEG,GAAG,CAAC,OAAe;QACzB,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,IAAI,CAAC,OAAe;QAC1B,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM;YACjC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAC7C,CAAC,CAAC,EAAE,CAAC;QACN,OAAO,CAAC,IAAI,CAAC,MAAM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,IAAI,CAAC;QACrC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["import { colors } from \"consola/utils\";\nimport consola from \"consola\";\n\nconsola.options = {\n\t...consola.options,\n\tformatOptions: { date: false },\n};\n\nexport type LoggerOptions = {\n\tsilent: boolean;\n\n\t/**\n\t * If the [paraglide] prefix should be printed before each log message.\n\t */\n\tprefix: boolean;\n};\n\nexport class Logger {\n\tconstructor(\n\t\tprivate options: LoggerOptions = { silent: false, prefix: true }\n\t) {}\n\n\tpublic log(message: string): Logger {\n\t\tif (this.options.silent) return this;\n\t\tconst prefix = this.options.prefix ? colors.bold(\"[paraglide-js] \") : \"\";\n\t\tconsola.log(prefix + message);\n\t\treturn this;\n\t}\n\n\tpublic info(message: string): Logger {\n\t\tif (this.options.silent) return this;\n\t\tconst prefix = this.options.prefix\n\t\t\t? colors.bold(colors.blue(\"[paraglide-js] \"))\n\t\t\t: \"\";\n\t\tconsola.info(prefix + message);\n\t\treturn this;\n\t}\n\n\tpublic success(message: string): Logger {\n\t\tif (this.options.silent) return this;\n\t\tconst prefix = this.options.prefix\n\t\t\t? colors.bold(colors.green(\"[paraglide-js] \"))\n\t\t\t: \"\";\n\t\tconsola.success(prefix + message);\n\t\treturn this;\n\t}\n\n\tpublic warn(message: any, ...args: any[]): Logger {\n\t\tif (this.options.silent) return this;\n\t\tconst prefix = this.options.prefix\n\t\t\t? colors.bold(colors.yellow(\"[paraglide-js] \"))\n\t\t\t: \"\";\n\t\tconsola.warn(prefix + message, ...args);\n\t\treturn this;\n\t}\n\n\tpublic error(message: any, ...args: any[]): Logger {\n\t\tconst prefix = this.options.prefix\n\t\t\t? colors.bold(colors.red(\"[paraglide-js] \"))\n\t\t\t: \"\";\n\t\tconsola.error(prefix + message, ...args);\n\t\treturn this;\n\t}\n\n\tpublic box(message: any, ...args: any[]): Logger {\n\t\tif (this.options.silent) return this;\n\t\tconsola.box(message, ...args);\n\t\treturn this;\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inlang/paraglide-js",
3
3
  "type": "module",
4
- "version": "2.24.1",
4
+ "version": "2.25.1",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -27,12 +27,14 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@inlang/recommend-sherlock": "^0.2.1",
30
- "@inlang/sdk": "^3.0.1",
30
+ "@inlang/sdk": "^3.0.4",
31
31
  "commander": "11.1.0",
32
32
  "consola": "3.4.0",
33
+ "jiti": "^2.7.0",
33
34
  "json5": "2.2.3",
34
35
  "unplugin": "^2.1.2",
35
- "urlpattern-polyfill": "^10.0.0"
36
+ "urlpattern-polyfill": "^10.0.0",
37
+ "valibot": "^1.4.2"
36
38
  },
37
39
  "peerDependencies": {
38
40
  "typescript": ">=5.6",