@nckrtl/launch-ui 0.0.25 → 0.0.27

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.
@@ -50,7 +50,7 @@ export function mountAgentation() {
50
50
  if (loaded) return;
51
51
  loaded = true;
52
52
 
53
- import("agentation").then(({ Agentation }) => {
53
+ import(/* @vite-ignore */ "agentation").then(({ Agentation }) => {
54
54
  import("react-dom/client").then(({ createRoot }) => {
55
55
  import("react/jsx-runtime").then(({ jsx }) => {
56
56
  const container = document.createElement("div");
@@ -25,7 +25,7 @@ export function initI18n(options) {
25
25
  locale = options.locale ?? "en";
26
26
  fallbackLocale = options.fallbackLocale ?? "en";
27
27
  for (const [path, mod] of Object.entries(options.files)) {
28
- const match = path.match(/\\/([a-z]{2}(?:[-_][a-zA-Z]+)?)\\json$/);
28
+ const match = path.match(/\\/([a-z]{2}(?:[-_][a-zA-Z]+)?)\\.json$/);
29
29
  if (!match) continue;
30
30
  const lang = match[1].replace("-", "_");
31
31
  const translations = "default" in mod ? mod.default : mod;
@@ -73,15 +73,15 @@ export function __(key, replacements) {
73
73
  */
74
74
  function launchI18nPlugin(i18n) {
75
75
  const opts = typeof i18n === "object" ? i18n : {};
76
- opts.locale;
77
- opts.fallbackLocale;
78
- opts.langPath;
76
+ const locale = opts.locale ?? "en";
77
+ const fallbackLocale = opts.fallbackLocale ?? "en";
78
+ const langPath = opts.langPath ?? "/lang/*.json";
79
79
  const initCode = `
80
80
  import { initI18n } from "virtual:launch-i18n";
81
81
  initI18n({
82
- locale: "",
83
- fallbackLocale: "",
84
- files: import.meta.glob("", { eager: true }),
82
+ locale: ${JSON.stringify(locale)},
83
+ fallbackLocale: ${JSON.stringify(fallbackLocale)},
84
+ files: import.meta.glob(${JSON.stringify(langPath)}, { eager: true }),
85
85
  });
86
86
  `;
87
87
  return {
package/dist/index.mjs CHANGED
@@ -56,7 +56,7 @@ async function getPlugins(options) {
56
56
  }));
57
57
  }
58
58
  if (options.i18n) {
59
- const { launchI18nPlugin } = await import("./i18n-plugin-D--fPPUj.mjs");
59
+ const { launchI18nPlugin } = await import("./i18n-plugin-6AdekIa0.mjs");
60
60
  plugins.push(launchI18nPlugin(options.i18n));
61
61
  }
62
62
  if (options.agentation !== false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nckrtl/launch-ui",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "description": "A React component library and Vite toolchain for building Laravel + React + Inertia apps. Built on Base UI and shadcn with Agentation integration.",
5
5
  "author": "nckrtl <nick.retel@gmail.com>",
6
6
  "license": "MIT",
@@ -31,6 +31,7 @@
31
31
  }
32
32
  },
33
33
  "scripts": {
34
+ "test": "node --test tests/*.test.ts",
34
35
  "dev": "storybook dev -p 6006",
35
36
  "build": "shadcn build",
36
37
  "build:lib": "vp pack src/vite/index.ts src/vite/agentation-plugin.ts --dts --format esm --out-dir dist",