tempest-react-sdk 0.71.0 → 0.72.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.
@@ -1,2 +1,2 @@
1
- const e=require("../_virtual/_rolldown/runtime.cjs"),t=require("./tempest-icons.cjs");let n=require("node:path"),r=require("vite"),i=require("@vitejs/plugin-react");i=e.__toESM(i,1);function a(e){let t={};for(let[n,r]of Object.entries(e))t[n]=typeof r==`string`?{target:r,changeOrigin:!0}:r;return t}function o(e={}){let{srcDir:o=`src`,port:s=5173,host:c=`127.0.0.1`,open:l=!1,proxy:u,alias:d={},plugins:f=[],icons:p=!0,overrides:m={}}=e,h=m,g=p?[t.tempestIcons({dir:o,...typeof p==`object`?p:{}})]:[],_={plugins:[(0,i.default)(),...g,...f],resolve:{alias:{"@":(0,n.resolve)(process.cwd(),o),...d}},server:{port:s,host:c,open:l,...u?{proxy:a(u)}:{}}},v={..._,...h,plugins:[..._.plugins??[],...h.plugins??[]],resolve:{..._.resolve,...h.resolve},server:{..._.server,...h.server}};return(0,r.defineConfig)(v)}exports.createViteConfig=o;
1
+ const e=require("../_virtual/_rolldown/runtime.cjs"),t=require("./tempest-icons.cjs"),n=require("./tempest-vitest.cjs");let r=require("node:path"),i=require("vite"),a=require("@vitejs/plugin-react");a=e.__toESM(a,1);function o(e){let t={};for(let[n,r]of Object.entries(e))t[n]=typeof r==`string`?{target:r,changeOrigin:!0}:r;return t}function s(e={}){let{srcDir:s=`src`,port:c=5173,host:l=`127.0.0.1`,open:u=!1,proxy:d,alias:f={},plugins:p=[],icons:m=!0,overrides:h={}}=e,g=h,_=m?[t.tempestIcons({dir:s,...typeof m==`object`?m:{}})]:[],v={plugins:[(0,a.default)(),..._,n.tempestVitest(),...p],resolve:{alias:{"@":(0,r.resolve)(process.cwd(),s),...f}},server:{port:c,host:l,open:u,...d?{proxy:o(d)}:{}}},y={...v,...g,plugins:[...v.plugins??[],...g.plugins??[]],resolve:{...v.resolve,...g.resolve},server:{...v.server,...g.server}};return(0,i.defineConfig)(y)}exports.createViteConfig=s;
2
2
  //# sourceMappingURL=create-vite-config.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-vite-config.cjs","names":[],"sources":["../../src/vite/create-vite-config.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport { defineConfig } from \"vite\";\nimport type { ProxyOptions, UserConfig } from \"vite\";\nimport react from \"@vitejs/plugin-react\";\n\nimport { tempestIcons, type TempestIconsOptions } from \"./tempest-icons\";\n\n/**\n * A Vite proxy entry: either a target URL string (expanded to\n * `{ target, changeOrigin: true }`) or a raw Vite `ProxyOptions` object.\n */\nexport type ProxyEntry = string | Record<string, unknown>;\n\nexport interface CreateViteConfigOptions {\n /**\n * Source directory aliased to `@`, relative to the project root.\n * Default: `\"src\"` (so `@/components/Button` → `<root>/src/components/Button`).\n */\n srcDir?: string;\n /** Dev server port. Default: `5173`. */\n port?: number;\n /** Dev server host. Default: `\"127.0.0.1\"`. */\n host?: string | boolean;\n /** Open the browser on `dev` start. Default: `false`. */\n open?: boolean;\n /**\n * Dev proxy table. String values are expanded to\n * `{ target, changeOrigin: true }`; objects are passed through untouched.\n *\n * @example { \"/api\": \"http://127.0.0.1:8000\" }\n */\n proxy?: Record<string, ProxyEntry>;\n /** Extra path aliases merged on top of the default `@` → src alias. */\n alias?: Record<string, string>;\n /** Vite plugins appended after `@vitejs/plugin-react`. */\n plugins?: unknown[];\n /**\n * The `tempestIcons()` plugin, which generates `virtual:tempest-icons` from the\n * icon slugs your source mentions. On by default — it only ever removes\n * requests. Pass `false` to leave it out, or an options object to configure the\n * scan.\n */\n icons?: boolean | TempestIconsOptions;\n /**\n * Arbitrary Vite config (a `UserConfig` object) deep-merged last, for\n * escape-hatch overrides (build target, define, extra `server` keys, …).\n */\n overrides?: Record<string, unknown>;\n}\n\n/**\n * The resulting Vite config object. Typed loosely so the SDK's published\n * declarations stay free of `vite`'s internal types; assign it straight to a\n * `vite.config.ts` default export.\n */\nexport type TempestViteConfig = Record<string, unknown>;\n\nfunction normalizeProxy(proxy: Record<string, ProxyEntry>): Record<string, ProxyOptions> {\n const out: Record<string, ProxyOptions> = {};\n for (const [path, value] of Object.entries(proxy)) {\n out[path] =\n typeof value === \"string\"\n ? { target: value, changeOrigin: true }\n : (value as ProxyOptions);\n }\n return out;\n}\n\n/**\n * Build a Tempest-flavored Vite config for a React app: the `@vitejs/plugin-react`\n * plugin, the `@` → `src` import alias, and sane dev-server defaults — so a\n * consuming app's `vite.config.ts` is a single call instead of repeated\n * boilerplate. Everything is overridable.\n *\n * Import it from the dedicated Node entry point:\n *\n * @example\n * // vite.config.ts\n * import { createViteConfig } from \"tempest-react-sdk/vite\";\n *\n * export default createViteConfig({\n * proxy: { \"/api\": \"http://127.0.0.1:8000\" },\n * });\n */\nexport function createViteConfig(options: CreateViteConfigOptions = {}): TempestViteConfig {\n const {\n srcDir = \"src\",\n port = 5173,\n host = \"127.0.0.1\",\n open = false,\n proxy,\n alias = {},\n plugins = [],\n icons = true,\n overrides = {},\n } = options;\n\n const overridesConfig = overrides as UserConfig;\n const iconsPlugin = icons\n ? [tempestIcons({ dir: srcDir, ...(typeof icons === \"object\" ? icons : {}) })]\n : [];\n\n const base: UserConfig = {\n plugins: [react(), ...iconsPlugin, ...plugins] as UserConfig[\"plugins\"],\n resolve: {\n alias: {\n \"@\": resolve(process.cwd(), srcDir),\n ...alias,\n },\n },\n server: {\n port,\n host,\n open,\n ...(proxy ? { proxy: normalizeProxy(proxy) } : {}),\n },\n };\n\n const merged: UserConfig = {\n ...base,\n ...overridesConfig,\n plugins: [...(base.plugins ?? []), ...(overridesConfig.plugins ?? [])],\n resolve: { ...base.resolve, ...overridesConfig.resolve },\n server: { ...base.server, ...overridesConfig.server },\n };\n\n return defineConfig(merged) as TempestViteConfig;\n}\n"],"mappings":"sLAyDA,SAAS,EAAe,EAAiE,CACrF,IAAM,EAAoC,CAAC,EAC3C,IAAK,GAAM,CAAC,EAAM,KAAU,OAAO,QAAQ,CAAK,EAC5C,EAAI,GACA,OAAO,GAAU,SACX,CAAE,OAAQ,EAAO,aAAc,EAAK,EACnC,EAEf,OAAO,CACX,CAkBA,SAAgB,EAAiB,EAAmC,CAAC,EAAsB,CACvF,GAAM,CACF,SAAS,MACT,OAAO,KACP,OAAO,YACP,OAAO,GACP,QACA,QAAQ,CAAC,EACT,UAAU,CAAC,EACX,QAAQ,GACR,YAAY,CAAC,GACb,EAEE,EAAkB,EAClB,EAAc,EACd,CAAC,EAAA,aAAa,CAAE,IAAK,EAAQ,GAAI,OAAO,GAAU,SAAW,EAAQ,CAAC,CAAG,CAAC,CAAC,EAC3E,CAAC,EAED,EAAmB,CACrB,QAAS,EAAC,EAAA,EAAA,QAAA,CAAM,EAAG,GAAG,EAAa,GAAG,CAAO,EAC7C,QAAS,CACL,MAAO,CACH,KAAA,EAAK,EAAA,QAAA,CAAQ,QAAQ,IAAI,EAAG,CAAM,EAClC,GAAG,CACP,CACJ,EACA,OAAQ,CACJ,OACA,OACA,OACA,GAAI,EAAQ,CAAE,MAAO,EAAe,CAAK,CAAE,EAAI,CAAC,CACpD,CACJ,EAEM,EAAqB,CACvB,GAAG,EACH,GAAG,EACH,QAAS,CAAC,GAAI,EAAK,SAAW,CAAC,EAAI,GAAI,EAAgB,SAAW,CAAC,CAAE,EACrE,QAAS,CAAE,GAAG,EAAK,QAAS,GAAG,EAAgB,OAAQ,EACvD,OAAQ,CAAE,GAAG,EAAK,OAAQ,GAAG,EAAgB,MAAO,CACxD,EAEA,OAAA,EAAO,EAAA,aAAA,CAAa,CAAM,CAC9B"}
1
+ {"version":3,"file":"create-vite-config.cjs","names":[],"sources":["../../src/vite/create-vite-config.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport { defineConfig } from \"vite\";\nimport type { ProxyOptions, UserConfig } from \"vite\";\nimport react from \"@vitejs/plugin-react\";\n\nimport { tempestIcons, type TempestIconsOptions } from \"./tempest-icons\";\nimport { tempestVitest } from \"./tempest-vitest\";\n\n/**\n * A Vite proxy entry: either a target URL string (expanded to\n * `{ target, changeOrigin: true }`) or a raw Vite `ProxyOptions` object.\n */\nexport type ProxyEntry = string | Record<string, unknown>;\n\nexport interface CreateViteConfigOptions {\n /**\n * Source directory aliased to `@`, relative to the project root.\n * Default: `\"src\"` (so `@/components/Button` → `<root>/src/components/Button`).\n */\n srcDir?: string;\n /** Dev server port. Default: `5173`. */\n port?: number;\n /** Dev server host. Default: `\"127.0.0.1\"`. */\n host?: string | boolean;\n /** Open the browser on `dev` start. Default: `false`. */\n open?: boolean;\n /**\n * Dev proxy table. String values are expanded to\n * `{ target, changeOrigin: true }`; objects are passed through untouched.\n *\n * @example { \"/api\": \"http://127.0.0.1:8000\" }\n */\n proxy?: Record<string, ProxyEntry>;\n /** Extra path aliases merged on top of the default `@` → src alias. */\n alias?: Record<string, string>;\n /** Vite plugins appended after `@vitejs/plugin-react`. */\n plugins?: unknown[];\n /**\n * The `tempestIcons()` plugin, which generates `virtual:tempest-icons` from the\n * icon slugs your source mentions. On by default — it only ever removes\n * requests. Pass `false` to leave it out, or an options object to configure the\n * scan.\n */\n icons?: boolean | TempestIconsOptions;\n /**\n * Arbitrary Vite config (a `UserConfig` object) deep-merged last, for\n * escape-hatch overrides (build target, define, extra `server` keys, …).\n */\n overrides?: Record<string, unknown>;\n}\n\n/**\n * The resulting Vite config object. Typed loosely so the SDK's published\n * declarations stay free of `vite`'s internal types; assign it straight to a\n * `vite.config.ts` default export.\n */\nexport type TempestViteConfig = Record<string, unknown>;\n\nfunction normalizeProxy(proxy: Record<string, ProxyEntry>): Record<string, ProxyOptions> {\n const out: Record<string, ProxyOptions> = {};\n for (const [path, value] of Object.entries(proxy)) {\n out[path] =\n typeof value === \"string\"\n ? { target: value, changeOrigin: true }\n : (value as ProxyOptions);\n }\n return out;\n}\n\n/**\n * Build a Tempest-flavored Vite config for a React app: the `@vitejs/plugin-react`\n * plugin, the `@` → `src` import alias, sane dev-server defaults and\n * {@link tempestVitest}, which lets a Vitest suite import the SDK — so a\n * consuming app's `vite.config.ts` is a single call instead of repeated\n * boilerplate. Everything is overridable.\n *\n * Import it from the dedicated Node entry point:\n *\n * @example\n * // vite.config.ts\n * import { createViteConfig } from \"tempest-react-sdk/vite\";\n *\n * export default createViteConfig({\n * proxy: { \"/api\": \"http://127.0.0.1:8000\" },\n * });\n */\nexport function createViteConfig(options: CreateViteConfigOptions = {}): TempestViteConfig {\n const {\n srcDir = \"src\",\n port = 5173,\n host = \"127.0.0.1\",\n open = false,\n proxy,\n alias = {},\n plugins = [],\n icons = true,\n overrides = {},\n } = options;\n\n const overridesConfig = overrides as UserConfig;\n const iconsPlugin = icons\n ? [tempestIcons({ dir: srcDir, ...(typeof icons === \"object\" ? icons : {}) })]\n : [];\n\n const base: UserConfig = {\n plugins: [react(), ...iconsPlugin, tempestVitest(), ...plugins] as UserConfig[\"plugins\"],\n resolve: {\n alias: {\n \"@\": resolve(process.cwd(), srcDir),\n ...alias,\n },\n },\n server: {\n port,\n host,\n open,\n ...(proxy ? { proxy: normalizeProxy(proxy) } : {}),\n },\n };\n\n const merged: UserConfig = {\n ...base,\n ...overridesConfig,\n plugins: [...(base.plugins ?? []), ...(overridesConfig.plugins ?? [])],\n resolve: { ...base.resolve, ...overridesConfig.resolve },\n server: { ...base.server, ...overridesConfig.server },\n };\n\n return defineConfig(merged) as TempestViteConfig;\n}\n"],"mappings":"wNA0DA,SAAS,EAAe,EAAiE,CACrF,IAAM,EAAoC,CAAC,EAC3C,IAAK,GAAM,CAAC,EAAM,KAAU,OAAO,QAAQ,CAAK,EAC5C,EAAI,GACA,OAAO,GAAU,SACX,CAAE,OAAQ,EAAO,aAAc,EAAK,EACnC,EAEf,OAAO,CACX,CAmBA,SAAgB,EAAiB,EAAmC,CAAC,EAAsB,CACvF,GAAM,CACF,SAAS,MACT,OAAO,KACP,OAAO,YACP,OAAO,GACP,QACA,QAAQ,CAAC,EACT,UAAU,CAAC,EACX,QAAQ,GACR,YAAY,CAAC,GACb,EAEE,EAAkB,EAClB,EAAc,EACd,CAAC,EAAA,aAAa,CAAE,IAAK,EAAQ,GAAI,OAAO,GAAU,SAAW,EAAQ,CAAC,CAAG,CAAC,CAAC,EAC3E,CAAC,EAED,EAAmB,CACrB,QAAS,EAAC,EAAA,EAAA,QAAA,CAAM,EAAG,GAAG,EAAa,EAAA,cAAc,EAAG,GAAG,CAAO,EAC9D,QAAS,CACL,MAAO,CACH,KAAA,EAAK,EAAA,QAAA,CAAQ,QAAQ,IAAI,EAAG,CAAM,EAClC,GAAG,CACP,CACJ,EACA,OAAQ,CACJ,OACA,OACA,OACA,GAAI,EAAQ,CAAE,MAAO,EAAe,CAAK,CAAE,EAAI,CAAC,CACpD,CACJ,EAEM,EAAqB,CACvB,GAAG,EACH,GAAG,EACH,QAAS,CAAC,GAAI,EAAK,SAAW,CAAC,EAAI,GAAI,EAAgB,SAAW,CAAC,CAAE,EACrE,QAAS,CAAE,GAAG,EAAK,QAAS,GAAG,EAAgB,OAAQ,EACvD,OAAQ,CAAE,GAAG,EAAK,OAAQ,GAAG,EAAgB,MAAO,CACxD,EAEA,OAAA,EAAO,EAAA,aAAA,CAAa,CAAM,CAC9B"}
@@ -1,9 +1,10 @@
1
1
  import { tempestIcons as e } from "./tempest-icons.js";
2
- import { resolve as t } from "node:path";
3
- import { defineConfig as n } from "vite";
4
- import r from "@vitejs/plugin-react";
2
+ import { tempestVitest as t } from "./tempest-vitest.js";
3
+ import { resolve as n } from "node:path";
4
+ import { defineConfig as r } from "vite";
5
+ import i from "@vitejs/plugin-react";
5
6
  //#region src/vite/create-vite-config.ts
6
- function i(e) {
7
+ function a(e) {
7
8
  let t = {};
8
9
  for (let [n, r] of Object.entries(e)) t[n] = typeof r == "string" ? {
9
10
  target: r,
@@ -11,42 +12,43 @@ function i(e) {
11
12
  } : r;
12
13
  return t;
13
14
  }
14
- function a(a = {}) {
15
- let { srcDir: o = "src", port: s = 5173, host: c = "127.0.0.1", open: l = !1, proxy: u, alias: d = {}, plugins: f = [], icons: p = !0, overrides: m = {} } = a, h = m, g = p ? [e({
16
- dir: o,
17
- ...typeof p == "object" ? p : {}
18
- })] : [], _ = {
15
+ function o(o = {}) {
16
+ let { srcDir: s = "src", port: c = 5173, host: l = "127.0.0.1", open: u = !1, proxy: d, alias: f = {}, plugins: p = [], icons: m = !0, overrides: h = {} } = o, g = h, _ = m ? [e({
17
+ dir: s,
18
+ ...typeof m == "object" ? m : {}
19
+ })] : [], v = {
19
20
  plugins: [
20
- r(),
21
- ...g,
22
- ...f
21
+ i(),
22
+ ..._,
23
+ t(),
24
+ ...p
23
25
  ],
24
26
  resolve: { alias: {
25
- "@": t(process.cwd(), o),
26
- ...d
27
+ "@": n(process.cwd(), s),
28
+ ...f
27
29
  } },
28
30
  server: {
29
- port: s,
30
- host: c,
31
- open: l,
32
- ...u ? { proxy: i(u) } : {}
31
+ port: c,
32
+ host: l,
33
+ open: u,
34
+ ...d ? { proxy: a(d) } : {}
33
35
  }
34
- }, v = {
35
- ..._,
36
- ...h,
37
- plugins: [..._.plugins ?? [], ...h.plugins ?? []],
36
+ }, y = {
37
+ ...v,
38
+ ...g,
39
+ plugins: [...v.plugins ?? [], ...g.plugins ?? []],
38
40
  resolve: {
39
- ..._.resolve,
40
- ...h.resolve
41
+ ...v.resolve,
42
+ ...g.resolve
41
43
  },
42
44
  server: {
43
- ..._.server,
44
- ...h.server
45
+ ...v.server,
46
+ ...g.server
45
47
  }
46
48
  };
47
- return n(v);
49
+ return r(y);
48
50
  }
49
51
  //#endregion
50
- export { a as createViteConfig };
52
+ export { o as createViteConfig };
51
53
 
52
54
  //# sourceMappingURL=create-vite-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-vite-config.js","names":[],"sources":["../../src/vite/create-vite-config.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport { defineConfig } from \"vite\";\nimport type { ProxyOptions, UserConfig } from \"vite\";\nimport react from \"@vitejs/plugin-react\";\n\nimport { tempestIcons, type TempestIconsOptions } from \"./tempest-icons\";\n\n/**\n * A Vite proxy entry: either a target URL string (expanded to\n * `{ target, changeOrigin: true }`) or a raw Vite `ProxyOptions` object.\n */\nexport type ProxyEntry = string | Record<string, unknown>;\n\nexport interface CreateViteConfigOptions {\n /**\n * Source directory aliased to `@`, relative to the project root.\n * Default: `\"src\"` (so `@/components/Button` → `<root>/src/components/Button`).\n */\n srcDir?: string;\n /** Dev server port. Default: `5173`. */\n port?: number;\n /** Dev server host. Default: `\"127.0.0.1\"`. */\n host?: string | boolean;\n /** Open the browser on `dev` start. Default: `false`. */\n open?: boolean;\n /**\n * Dev proxy table. String values are expanded to\n * `{ target, changeOrigin: true }`; objects are passed through untouched.\n *\n * @example { \"/api\": \"http://127.0.0.1:8000\" }\n */\n proxy?: Record<string, ProxyEntry>;\n /** Extra path aliases merged on top of the default `@` → src alias. */\n alias?: Record<string, string>;\n /** Vite plugins appended after `@vitejs/plugin-react`. */\n plugins?: unknown[];\n /**\n * The `tempestIcons()` plugin, which generates `virtual:tempest-icons` from the\n * icon slugs your source mentions. On by default — it only ever removes\n * requests. Pass `false` to leave it out, or an options object to configure the\n * scan.\n */\n icons?: boolean | TempestIconsOptions;\n /**\n * Arbitrary Vite config (a `UserConfig` object) deep-merged last, for\n * escape-hatch overrides (build target, define, extra `server` keys, …).\n */\n overrides?: Record<string, unknown>;\n}\n\n/**\n * The resulting Vite config object. Typed loosely so the SDK's published\n * declarations stay free of `vite`'s internal types; assign it straight to a\n * `vite.config.ts` default export.\n */\nexport type TempestViteConfig = Record<string, unknown>;\n\nfunction normalizeProxy(proxy: Record<string, ProxyEntry>): Record<string, ProxyOptions> {\n const out: Record<string, ProxyOptions> = {};\n for (const [path, value] of Object.entries(proxy)) {\n out[path] =\n typeof value === \"string\"\n ? { target: value, changeOrigin: true }\n : (value as ProxyOptions);\n }\n return out;\n}\n\n/**\n * Build a Tempest-flavored Vite config for a React app: the `@vitejs/plugin-react`\n * plugin, the `@` → `src` import alias, and sane dev-server defaults — so a\n * consuming app's `vite.config.ts` is a single call instead of repeated\n * boilerplate. Everything is overridable.\n *\n * Import it from the dedicated Node entry point:\n *\n * @example\n * // vite.config.ts\n * import { createViteConfig } from \"tempest-react-sdk/vite\";\n *\n * export default createViteConfig({\n * proxy: { \"/api\": \"http://127.0.0.1:8000\" },\n * });\n */\nexport function createViteConfig(options: CreateViteConfigOptions = {}): TempestViteConfig {\n const {\n srcDir = \"src\",\n port = 5173,\n host = \"127.0.0.1\",\n open = false,\n proxy,\n alias = {},\n plugins = [],\n icons = true,\n overrides = {},\n } = options;\n\n const overridesConfig = overrides as UserConfig;\n const iconsPlugin = icons\n ? [tempestIcons({ dir: srcDir, ...(typeof icons === \"object\" ? icons : {}) })]\n : [];\n\n const base: UserConfig = {\n plugins: [react(), ...iconsPlugin, ...plugins] as UserConfig[\"plugins\"],\n resolve: {\n alias: {\n \"@\": resolve(process.cwd(), srcDir),\n ...alias,\n },\n },\n server: {\n port,\n host,\n open,\n ...(proxy ? { proxy: normalizeProxy(proxy) } : {}),\n },\n };\n\n const merged: UserConfig = {\n ...base,\n ...overridesConfig,\n plugins: [...(base.plugins ?? []), ...(overridesConfig.plugins ?? [])],\n resolve: { ...base.resolve, ...overridesConfig.resolve },\n server: { ...base.server, ...overridesConfig.server },\n };\n\n return defineConfig(merged) as TempestViteConfig;\n}\n"],"mappings":";;;;;AAyDA,SAAS,EAAe,GAAiE;CACrF,IAAM,IAAoC,CAAC;CAC3C,KAAK,IAAM,CAAC,GAAM,MAAU,OAAO,QAAQ,CAAK,GAC5C,EAAI,KACA,OAAO,KAAU,WACX;EAAE,QAAQ;EAAO,cAAc;CAAK,IACnC;CAEf,OAAO;AACX;AAkBA,SAAgB,EAAiB,IAAmC,CAAC,GAAsB;CACvF,IAAM,EACF,YAAS,OACT,UAAO,MACP,UAAO,aACP,UAAO,IACP,UACA,WAAQ,CAAC,GACT,aAAU,CAAC,GACX,WAAQ,IACR,eAAY,CAAC,MACb,GAEE,IAAkB,GAClB,IAAc,IACd,CAAC,EAAa;EAAE,KAAK;EAAQ,GAAI,OAAO,KAAU,WAAW,IAAQ,CAAC;CAAG,CAAC,CAAC,IAC3E,CAAC,GAED,IAAmB;EACrB,SAAS;GAAC,EAAM;GAAG,GAAG;GAAa,GAAG;EAAO;EAC7C,SAAS,EACL,OAAO;GACH,KAAK,EAAQ,QAAQ,IAAI,GAAG,CAAM;GAClC,GAAG;EACP,EACJ;EACA,QAAQ;GACJ;GACA;GACA;GACA,GAAI,IAAQ,EAAE,OAAO,EAAe,CAAK,EAAE,IAAI,CAAC;EACpD;CACJ,GAEM,IAAqB;EACvB,GAAG;EACH,GAAG;EACH,SAAS,CAAC,GAAI,EAAK,WAAW,CAAC,GAAI,GAAI,EAAgB,WAAW,CAAC,CAAE;EACrE,SAAS;GAAE,GAAG,EAAK;GAAS,GAAG,EAAgB;EAAQ;EACvD,QAAQ;GAAE,GAAG,EAAK;GAAQ,GAAG,EAAgB;EAAO;CACxD;CAEA,OAAO,EAAa,CAAM;AAC9B"}
1
+ {"version":3,"file":"create-vite-config.js","names":[],"sources":["../../src/vite/create-vite-config.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport { defineConfig } from \"vite\";\nimport type { ProxyOptions, UserConfig } from \"vite\";\nimport react from \"@vitejs/plugin-react\";\n\nimport { tempestIcons, type TempestIconsOptions } from \"./tempest-icons\";\nimport { tempestVitest } from \"./tempest-vitest\";\n\n/**\n * A Vite proxy entry: either a target URL string (expanded to\n * `{ target, changeOrigin: true }`) or a raw Vite `ProxyOptions` object.\n */\nexport type ProxyEntry = string | Record<string, unknown>;\n\nexport interface CreateViteConfigOptions {\n /**\n * Source directory aliased to `@`, relative to the project root.\n * Default: `\"src\"` (so `@/components/Button` → `<root>/src/components/Button`).\n */\n srcDir?: string;\n /** Dev server port. Default: `5173`. */\n port?: number;\n /** Dev server host. Default: `\"127.0.0.1\"`. */\n host?: string | boolean;\n /** Open the browser on `dev` start. Default: `false`. */\n open?: boolean;\n /**\n * Dev proxy table. String values are expanded to\n * `{ target, changeOrigin: true }`; objects are passed through untouched.\n *\n * @example { \"/api\": \"http://127.0.0.1:8000\" }\n */\n proxy?: Record<string, ProxyEntry>;\n /** Extra path aliases merged on top of the default `@` → src alias. */\n alias?: Record<string, string>;\n /** Vite plugins appended after `@vitejs/plugin-react`. */\n plugins?: unknown[];\n /**\n * The `tempestIcons()` plugin, which generates `virtual:tempest-icons` from the\n * icon slugs your source mentions. On by default — it only ever removes\n * requests. Pass `false` to leave it out, or an options object to configure the\n * scan.\n */\n icons?: boolean | TempestIconsOptions;\n /**\n * Arbitrary Vite config (a `UserConfig` object) deep-merged last, for\n * escape-hatch overrides (build target, define, extra `server` keys, …).\n */\n overrides?: Record<string, unknown>;\n}\n\n/**\n * The resulting Vite config object. Typed loosely so the SDK's published\n * declarations stay free of `vite`'s internal types; assign it straight to a\n * `vite.config.ts` default export.\n */\nexport type TempestViteConfig = Record<string, unknown>;\n\nfunction normalizeProxy(proxy: Record<string, ProxyEntry>): Record<string, ProxyOptions> {\n const out: Record<string, ProxyOptions> = {};\n for (const [path, value] of Object.entries(proxy)) {\n out[path] =\n typeof value === \"string\"\n ? { target: value, changeOrigin: true }\n : (value as ProxyOptions);\n }\n return out;\n}\n\n/**\n * Build a Tempest-flavored Vite config for a React app: the `@vitejs/plugin-react`\n * plugin, the `@` → `src` import alias, sane dev-server defaults and\n * {@link tempestVitest}, which lets a Vitest suite import the SDK — so a\n * consuming app's `vite.config.ts` is a single call instead of repeated\n * boilerplate. Everything is overridable.\n *\n * Import it from the dedicated Node entry point:\n *\n * @example\n * // vite.config.ts\n * import { createViteConfig } from \"tempest-react-sdk/vite\";\n *\n * export default createViteConfig({\n * proxy: { \"/api\": \"http://127.0.0.1:8000\" },\n * });\n */\nexport function createViteConfig(options: CreateViteConfigOptions = {}): TempestViteConfig {\n const {\n srcDir = \"src\",\n port = 5173,\n host = \"127.0.0.1\",\n open = false,\n proxy,\n alias = {},\n plugins = [],\n icons = true,\n overrides = {},\n } = options;\n\n const overridesConfig = overrides as UserConfig;\n const iconsPlugin = icons\n ? [tempestIcons({ dir: srcDir, ...(typeof icons === \"object\" ? icons : {}) })]\n : [];\n\n const base: UserConfig = {\n plugins: [react(), ...iconsPlugin, tempestVitest(), ...plugins] as UserConfig[\"plugins\"],\n resolve: {\n alias: {\n \"@\": resolve(process.cwd(), srcDir),\n ...alias,\n },\n },\n server: {\n port,\n host,\n open,\n ...(proxy ? { proxy: normalizeProxy(proxy) } : {}),\n },\n };\n\n const merged: UserConfig = {\n ...base,\n ...overridesConfig,\n plugins: [...(base.plugins ?? []), ...(overridesConfig.plugins ?? [])],\n resolve: { ...base.resolve, ...overridesConfig.resolve },\n server: { ...base.server, ...overridesConfig.server },\n };\n\n return defineConfig(merged) as TempestViteConfig;\n}\n"],"mappings":";;;;;;AA0DA,SAAS,EAAe,GAAiE;CACrF,IAAM,IAAoC,CAAC;CAC3C,KAAK,IAAM,CAAC,GAAM,MAAU,OAAO,QAAQ,CAAK,GAC5C,EAAI,KACA,OAAO,KAAU,WACX;EAAE,QAAQ;EAAO,cAAc;CAAK,IACnC;CAEf,OAAO;AACX;AAmBA,SAAgB,EAAiB,IAAmC,CAAC,GAAsB;CACvF,IAAM,EACF,YAAS,OACT,UAAO,MACP,UAAO,aACP,UAAO,IACP,UACA,WAAQ,CAAC,GACT,aAAU,CAAC,GACX,WAAQ,IACR,eAAY,CAAC,MACb,GAEE,IAAkB,GAClB,IAAc,IACd,CAAC,EAAa;EAAE,KAAK;EAAQ,GAAI,OAAO,KAAU,WAAW,IAAQ,CAAC;CAAG,CAAC,CAAC,IAC3E,CAAC,GAED,IAAmB;EACrB,SAAS;GAAC,EAAM;GAAG,GAAG;GAAa,EAAc;GAAG,GAAG;EAAO;EAC9D,SAAS,EACL,OAAO;GACH,KAAK,EAAQ,QAAQ,IAAI,GAAG,CAAM;GAClC,GAAG;EACP,EACJ;EACA,QAAQ;GACJ;GACA;GACA;GACA,GAAI,IAAQ,EAAE,OAAO,EAAe,CAAK,EAAE,IAAI,CAAC;EACpD;CACJ,GAEM,IAAqB;EACvB,GAAG;EACH,GAAG;EACH,SAAS,CAAC,GAAI,EAAK,WAAW,CAAC,GAAI,GAAI,EAAgB,WAAW,CAAC,CAAE;EACrE,SAAS;GAAE,GAAG,EAAK;GAAS,GAAG,EAAgB;EAAQ;EACvD,QAAQ;GAAE,GAAG,EAAK;GAAQ,GAAG,EAAgB;EAAO;CACxD;CAEA,OAAO,EAAa,CAAM;AAC9B"}
@@ -0,0 +1,2 @@
1
+ function e(){return{name:`tempest-vitest`,config(e){if(e.test?.server?.deps?.inline!==!0)return{test:{server:{deps:{inline:[`tempest-react-sdk`]}}}}}}}exports.tempestVitest=e;
2
+ //# sourceMappingURL=tempest-vitest.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tempest-vitest.cjs","names":[],"sources":["../../src/vite/tempest-vitest.ts"],"sourcesContent":["import type { TempestVitePlugin } from \"./tempest-pwa-manifest\";\n\n/**\n * The `server.deps.inline` entry that makes Vitest transform the SDK instead of\n * handing it to Node.\n *\n * Vitest matches a string entry as `/node_modules/tempest-react-sdk` anywhere in\n * the module id, which covers npm, Yarn and pnpm's\n * `.pnpm/<name>@<version>/node_modules/` layout alike, without catching an app\n * that merely lives in a folder of the same name — which a bare regex would.\n */\nconst TEMPEST_VITEST_INLINE = \"tempest-react-sdk\";\n\n/** The slice of a user config this plugin reads to stay out of the way. */\ninterface VitestUserConfig {\n test?: { server?: { deps?: { inline?: unknown } } };\n}\n\n/**\n * Make Vitest load the SDK the way the app's bundler does.\n *\n * Every component module imports its own stylesheet. Vitest externalizes an ESM\n * package from `node_modules` to plain Node, and Node has no loader for `.css`, so\n * any test that imports the real barrel dies before running with\n * `TypeError: Unknown file extension \".css\"`. Inlining the package sends it through\n * Vite's pipeline, where the stylesheet import is processed like in the app.\n *\n * Measured with `tempest-react-sdk@0.70.0` and a one-line test importing `Button`:\n * Vitest 2.1.9, 3.2.7 and 4.1.11 all fail under the default config and pass with\n * this plugin.\n *\n * The entry is contributed through the `config` hook, so Vite concatenates it onto\n * whatever `test.server.deps.inline` list the app declares. The one value it must\n * not merge into is `true` (inline everything): Vite's merge would turn it into\n * `[true, \"tempest-react-sdk\"]`, and Vitest 4 then crashes with\n * `ex.test is not a function` matching ids against it. That config already inlines\n * the SDK, so the plugin contributes nothing.\n *\n * Outside Vitest the `test` key is ignored by Vite, so the plugin is inert in\n * `vite dev` and `vite build` — which is why `createViteConfig` always includes it.\n *\n * @returns A Vite plugin; add it to `plugins` in `vite.config.ts` or\n * `vitest.config.ts`.\n *\n * @example\n * // vitest.config.ts\n * import { defineConfig } from \"vitest/config\";\n * import { tempestVitest } from \"tempest-react-sdk/vite\";\n *\n * export default defineConfig({\n * plugins: [tempestVitest()],\n * test: { environment: \"jsdom\" },\n * });\n */\nexport function tempestVitest(): TempestVitePlugin {\n return {\n name: \"tempest-vitest\",\n config(userConfig: VitestUserConfig): VitestUserConfig | undefined {\n if (userConfig.test?.server?.deps?.inline === true) return undefined;\n return { test: { server: { deps: { inline: [TEMPEST_VITEST_INLINE] } } } };\n },\n };\n}\n"],"mappings":"AAsDA,SAAgB,GAAmC,CAC/C,MAAO,CACH,KAAM,iBACN,OAAO,EAA4D,CAC3D,KAAW,MAAM,QAAQ,MAAM,SAAW,GAC9C,MAAO,CAAE,KAAM,CAAE,OAAQ,CAAE,KAAM,CAAE,OAAQ,CAAC,mBAAqB,CAAE,CAAE,CAAE,CAAE,CAC7E,CACJ,CACJ"}
@@ -0,0 +1,12 @@
1
+ function e() {
2
+ return {
3
+ name: "tempest-vitest",
4
+ config(e) {
5
+ if (e.test?.server?.deps?.inline !== !0) return { test: { server: { deps: { inline: ["tempest-react-sdk"] } } } };
6
+ }
7
+ };
8
+ }
9
+ //#endregion
10
+ export { e as tempestVitest };
11
+
12
+ //# sourceMappingURL=tempest-vitest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tempest-vitest.js","names":[],"sources":["../../src/vite/tempest-vitest.ts"],"sourcesContent":["import type { TempestVitePlugin } from \"./tempest-pwa-manifest\";\n\n/**\n * The `server.deps.inline` entry that makes Vitest transform the SDK instead of\n * handing it to Node.\n *\n * Vitest matches a string entry as `/node_modules/tempest-react-sdk` anywhere in\n * the module id, which covers npm, Yarn and pnpm's\n * `.pnpm/<name>@<version>/node_modules/` layout alike, without catching an app\n * that merely lives in a folder of the same name — which a bare regex would.\n */\nconst TEMPEST_VITEST_INLINE = \"tempest-react-sdk\";\n\n/** The slice of a user config this plugin reads to stay out of the way. */\ninterface VitestUserConfig {\n test?: { server?: { deps?: { inline?: unknown } } };\n}\n\n/**\n * Make Vitest load the SDK the way the app's bundler does.\n *\n * Every component module imports its own stylesheet. Vitest externalizes an ESM\n * package from `node_modules` to plain Node, and Node has no loader for `.css`, so\n * any test that imports the real barrel dies before running with\n * `TypeError: Unknown file extension \".css\"`. Inlining the package sends it through\n * Vite's pipeline, where the stylesheet import is processed like in the app.\n *\n * Measured with `tempest-react-sdk@0.70.0` and a one-line test importing `Button`:\n * Vitest 2.1.9, 3.2.7 and 4.1.11 all fail under the default config and pass with\n * this plugin.\n *\n * The entry is contributed through the `config` hook, so Vite concatenates it onto\n * whatever `test.server.deps.inline` list the app declares. The one value it must\n * not merge into is `true` (inline everything): Vite's merge would turn it into\n * `[true, \"tempest-react-sdk\"]`, and Vitest 4 then crashes with\n * `ex.test is not a function` matching ids against it. That config already inlines\n * the SDK, so the plugin contributes nothing.\n *\n * Outside Vitest the `test` key is ignored by Vite, so the plugin is inert in\n * `vite dev` and `vite build` — which is why `createViteConfig` always includes it.\n *\n * @returns A Vite plugin; add it to `plugins` in `vite.config.ts` or\n * `vitest.config.ts`.\n *\n * @example\n * // vitest.config.ts\n * import { defineConfig } from \"vitest/config\";\n * import { tempestVitest } from \"tempest-react-sdk/vite\";\n *\n * export default defineConfig({\n * plugins: [tempestVitest()],\n * test: { environment: \"jsdom\" },\n * });\n */\nexport function tempestVitest(): TempestVitePlugin {\n return {\n name: \"tempest-vitest\",\n config(userConfig: VitestUserConfig): VitestUserConfig | undefined {\n if (userConfig.test?.server?.deps?.inline === true) return undefined;\n return { test: { server: { deps: { inline: [TEMPEST_VITEST_INLINE] } } } };\n },\n };\n}\n"],"mappings":"AAsDA,SAAgB,IAAmC;CAC/C,OAAO;EACH,MAAM;EACN,OAAO,GAA4D;GAC3D,MAAW,MAAM,QAAQ,MAAM,WAAW,IAC9C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,mBAAqB,EAAE,EAAE,EAAE,EAAE;EAC7E;CACJ;AACJ"}
package/dist/vite.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./vite/tempest-icons.cjs"),t=require("./vite/create-vite-config.cjs"),n=require("./vite/tempest-pwa-manifest.cjs"),r=require("./vite/tempest-pwa-icons.cjs"),i=require("./vite/tempest-pwa-dev-sw.cjs"),a=require("./vite/tempest-styles.cjs"),o=require("./vite/tempest-csp.cjs");exports.createViteConfig=t.createViteConfig,exports.tempestCsp=o.tempestCsp,exports.tempestIcons=e.tempestIcons,exports.tempestPwaDevSw=i.tempestPwaDevSw,exports.tempestPwaIcons=r.tempestPwaIcons,exports.tempestPwaManifest=n.tempestPwaManifest,exports.tempestStyles=a.tempestStyles;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./vite/tempest-icons.cjs"),t=require("./vite/tempest-vitest.cjs"),n=require("./vite/create-vite-config.cjs"),r=require("./vite/tempest-pwa-manifest.cjs"),i=require("./vite/tempest-pwa-icons.cjs"),a=require("./vite/tempest-pwa-dev-sw.cjs"),o=require("./vite/tempest-styles.cjs"),s=require("./vite/tempest-csp.cjs");exports.createViteConfig=n.createViteConfig,exports.tempestCsp=s.tempestCsp,exports.tempestIcons=e.tempestIcons,exports.tempestPwaDevSw=a.tempestPwaDevSw,exports.tempestPwaIcons=i.tempestPwaIcons,exports.tempestPwaManifest=r.tempestPwaManifest,exports.tempestStyles=o.tempestStyles,exports.tempestVitest=t.tempestVitest;
package/dist/vite.d.ts CHANGED
@@ -10,7 +10,8 @@ export declare interface AppleSplashSpec {
10
10
 
11
11
  /**
12
12
  * Build a Tempest-flavored Vite config for a React app: the `@vitejs/plugin-react`
13
- * plugin, the `@` → `src` import alias, and sane dev-server defaults — so a
13
+ * plugin, the `@` → `src` import alias, sane dev-server defaults and
14
+ * {@link tempestVitest}, which lets a Vitest suite import the SDK — so a
14
15
  * consuming app's `vite.config.ts` is a single call instead of repeated
15
16
  * boilerplate. Everything is overridable.
16
17
  *
@@ -501,6 +502,44 @@ export declare type TempestVitePlugin = {
501
502
  name: string;
502
503
  } & Record<string, unknown>;
503
504
 
505
+ /**
506
+ * Make Vitest load the SDK the way the app's bundler does.
507
+ *
508
+ * Every component module imports its own stylesheet. Vitest externalizes an ESM
509
+ * package from `node_modules` to plain Node, and Node has no loader for `.css`, so
510
+ * any test that imports the real barrel dies before running with
511
+ * `TypeError: Unknown file extension ".css"`. Inlining the package sends it through
512
+ * Vite's pipeline, where the stylesheet import is processed like in the app.
513
+ *
514
+ * Measured with `tempest-react-sdk@0.70.0` and a one-line test importing `Button`:
515
+ * Vitest 2.1.9, 3.2.7 and 4.1.11 all fail under the default config and pass with
516
+ * this plugin.
517
+ *
518
+ * The entry is contributed through the `config` hook, so Vite concatenates it onto
519
+ * whatever `test.server.deps.inline` list the app declares. The one value it must
520
+ * not merge into is `true` (inline everything): Vite's merge would turn it into
521
+ * `[true, "tempest-react-sdk"]`, and Vitest 4 then crashes with
522
+ * `ex.test is not a function` matching ids against it. That config already inlines
523
+ * the SDK, so the plugin contributes nothing.
524
+ *
525
+ * Outside Vitest the `test` key is ignored by Vite, so the plugin is inert in
526
+ * `vite dev` and `vite build` — which is why `createViteConfig` always includes it.
527
+ *
528
+ * @returns A Vite plugin; add it to `plugins` in `vite.config.ts` or
529
+ * `vitest.config.ts`.
530
+ *
531
+ * @example
532
+ * // vitest.config.ts
533
+ * import { defineConfig } from "vitest/config";
534
+ * import { tempestVitest } from "tempest-react-sdk/vite";
535
+ *
536
+ * export default defineConfig({
537
+ * plugins: [tempestVitest()],
538
+ * test: { environment: "jsdom" },
539
+ * });
540
+ */
541
+ export declare function tempestVitest(): TempestVitePlugin;
542
+
504
543
  /**
505
544
  * How much of the token sheet an app takes.
506
545
  *
package/dist/vite.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { tempestIcons as e } from "./vite/tempest-icons.js";
2
- import { createViteConfig as t } from "./vite/create-vite-config.js";
3
- import { tempestPwaManifest as n } from "./vite/tempest-pwa-manifest.js";
4
- import { tempestPwaIcons as r } from "./vite/tempest-pwa-icons.js";
5
- import { tempestPwaDevSw as i } from "./vite/tempest-pwa-dev-sw.js";
6
- import { tempestStyles as a } from "./vite/tempest-styles.js";
7
- import { tempestCsp as o } from "./vite/tempest-csp.js";
8
- export { t as createViteConfig, o as tempestCsp, e as tempestIcons, i as tempestPwaDevSw, r as tempestPwaIcons, n as tempestPwaManifest, a as tempestStyles };
2
+ import { tempestVitest as t } from "./vite/tempest-vitest.js";
3
+ import { createViteConfig as n } from "./vite/create-vite-config.js";
4
+ import { tempestPwaManifest as r } from "./vite/tempest-pwa-manifest.js";
5
+ import { tempestPwaIcons as i } from "./vite/tempest-pwa-icons.js";
6
+ import { tempestPwaDevSw as a } from "./vite/tempest-pwa-dev-sw.js";
7
+ import { tempestStyles as o } from "./vite/tempest-styles.js";
8
+ import { tempestCsp as s } from "./vite/tempest-csp.js";
9
+ export { n as createViteConfig, s as tempestCsp, e as tempestIcons, a as tempestPwaDevSw, i as tempestPwaIcons, r as tempestPwaManifest, o as tempestStyles, t as tempestVitest };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tempest-react-sdk",
3
- "version": "0.71.0",
3
+ "version": "0.72.0",
4
4
  "description": "SDK público da Tempest com componentes, hooks e integrações para projetos React.",
5
5
  "type": "module",
6
6
  "license": "MIT",