@kasoa/vite-plus-config 0.6.1 → 0.6.2

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/README.md CHANGED
@@ -150,7 +150,7 @@ For several pack entries, spread `libraryPackDefaults` into each one instead of
150
150
  ## Cloudflare Workers tests
151
151
 
152
152
  ```bash
153
- pnpm add -D @cloudflare/vitest-plugin@^1.4
153
+ pnpm add -D @cloudflare/vitest-plugin@^1.5
154
154
  ```
155
155
 
156
156
  ```ts
@@ -1,4 +1,4 @@
1
- import { d as DEFAULT_WRANGLER_CONFIG_PATH, t as CLOUDFLARE_CONFIG_PATH } from "../../constants-BYglvKjm.mjs";
1
+ import { d as DEFAULT_WRANGLER_CONFIG_PATH } from "../../constants-BYglvKjm.mjs";
2
2
  import { lazyPlugins } from "vite-plus";
3
3
  import { cloudflareTest } from "@cloudflare/vitest-plugin";
4
4
  import { existsSync } from "node:fs";
@@ -7,17 +7,24 @@ function createLazyPluginInputs(factory) {
7
7
  return lazyPlugins(factory);
8
8
  }
9
9
  function createCloudflareTestConfig(options = {}) {
10
- const { wrangler, ...pluginOptions } = options;
11
- return { plugins: createLazyPluginInputs(() => [wrangler === void 0 && existsSync("./cloudflare.config.ts") ? cloudflareTest({
12
- ...pluginOptions,
13
- experimental: { newConfig: { configPath: CLOUDFLARE_CONFIG_PATH } }
14
- }) : cloudflareTest({
15
- ...pluginOptions,
16
- wrangler: {
17
- configPath: DEFAULT_WRANGLER_CONFIG_PATH,
18
- ...wrangler
19
- }
20
- })]) };
10
+ const { config, wrangler, ...pluginOptions } = options;
11
+ return { plugins: createLazyPluginInputs(() => {
12
+ if (config !== void 0 && config !== false) return [cloudflareTest({
13
+ ...pluginOptions,
14
+ config
15
+ })];
16
+ if (config !== false && wrangler === void 0 && existsSync("./cloudflare.config.ts")) return [cloudflareTest({
17
+ ...pluginOptions,
18
+ config: true
19
+ })];
20
+ return [cloudflareTest({
21
+ ...pluginOptions,
22
+ wrangler: {
23
+ configPath: DEFAULT_WRANGLER_CONFIG_PATH,
24
+ ...wrangler
25
+ }
26
+ })];
27
+ }) };
21
28
  }
22
29
  export { createCloudflareTestConfig };
23
30
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/cloudflare-workers/index.ts"],"sourcesContent":["import { cloudflareTest } from \"@cloudflare/vitest-plugin\";\nimport { existsSync } from \"node:fs\";\nimport { lazyPlugins } from \"vite-plus\";\nimport type { ConfigFragment } from \"../compose.ts\";\nimport { CLOUDFLARE_CONFIG_PATH, DEFAULT_WRANGLER_CONFIG_PATH } from \"../constants.ts\";\n\ntype LazyPluginInput = object | readonly object[] | false | null | undefined;\n\ntype CloudflareTestOptions = Exclude<\n NonNullable<Parameters<typeof cloudflareTest>[0]>,\n (...args: readonly never[]) => unknown\n>;\n\nexport interface CloudflareTestConfigOptions extends Omit<CloudflareTestOptions, \"wrangler\"> {\n readonly wrangler?: CloudflareTestOptions[\"wrangler\"];\n}\n\nfunction createLazyPluginInputs(\n factory: () => readonly LazyPluginInput[],\n): ConfigFragment[\"plugins\"] {\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- Vite 8 plugin types recurse beyond TypeScript's comparison limit; lazyPlugins returns the named Vite plugins represented by this shallow boundary.\n return lazyPlugins(factory as never) as ConfigFragment[\"plugins\"];\n}\n\nexport function createCloudflareTestConfig(\n options: CloudflareTestConfigOptions = {},\n): ConfigFragment {\n const { wrangler, ...pluginOptions } = options;\n\n return {\n plugins: createLazyPluginInputs(() => [\n // Projects managed by the cf CLI keep their Worker in cloudflare.config.ts.\n wrangler === undefined && existsSync(CLOUDFLARE_CONFIG_PATH)\n ? cloudflareTest({\n ...pluginOptions,\n experimental: { newConfig: { configPath: CLOUDFLARE_CONFIG_PATH } },\n })\n : cloudflareTest({\n ...pluginOptions,\n wrangler: { configPath: DEFAULT_WRANGLER_CONFIG_PATH, ...wrangler },\n }),\n ]),\n };\n}\n"],"mappings":";;;;;AAiBA,SAAS,uBACP,SAC2B;CAE3B,OAAO,YAAY,OAAgB;AACrC;AAEA,SAAgB,2BACd,UAAuC,CAAC,GACxB;CAChB,MAAM,EAAE,UAAU,GAAG,kBAAkB;CAEvC,OAAO,EACL,SAAS,6BAA6B,CAEpC,aAAa,KAAA,KAAa,WAAA,wBAAiC,IACvD,eAAe;EACb,GAAG;EACH,cAAc,EAAE,WAAW,EAAE,YAAY,uBAAuB,EAAE;CACpE,CAAC,IACD,eAAe;EACb,GAAG;EACH,UAAU;GAAE,YAAY;GAA8B,GAAG;EAAS;CACpE,CAAC,CACP,CAAC,EACH;AACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/cloudflare-workers/index.ts"],"sourcesContent":["import { cloudflareTest } from \"@cloudflare/vitest-plugin\";\nimport { existsSync } from \"node:fs\";\nimport { lazyPlugins } from \"vite-plus\";\nimport type { ConfigFragment } from \"../compose.ts\";\nimport { CLOUDFLARE_CONFIG_PATH, DEFAULT_WRANGLER_CONFIG_PATH } from \"../constants.ts\";\n\ntype LazyPluginInput = object | readonly object[] | false | null | undefined;\n\ntype CloudflareTestOptions = Exclude<\n NonNullable<Parameters<typeof cloudflareTest>[0]>,\n (...args: readonly never[]) => unknown\n>;\n\nexport interface CloudflareTestConfigOptions extends Omit<CloudflareTestOptions, \"wrangler\"> {\n readonly wrangler?: CloudflareTestOptions[\"wrangler\"];\n}\n\nfunction createLazyPluginInputs(\n factory: () => readonly LazyPluginInput[],\n): ConfigFragment[\"plugins\"] {\n // eslint-disable-next-line typescript/no-unsafe-type-assertion -- Vite 8 plugin types recurse beyond TypeScript's comparison limit; lazyPlugins returns the named Vite plugins represented by this shallow boundary.\n return lazyPlugins(factory as never) as ConfigFragment[\"plugins\"];\n}\n\nexport function createCloudflareTestConfig(\n options: CloudflareTestConfigOptions = {},\n): ConfigFragment {\n const { config, wrangler, ...pluginOptions } = options;\n\n return {\n plugins: createLazyPluginInputs(() => {\n // Projects managed by the cf CLI keep their Worker in cloudflare.config.ts.\n if (config !== undefined && config !== false) {\n return [cloudflareTest({ ...pluginOptions, config })];\n }\n if (config !== false && wrangler === undefined && existsSync(CLOUDFLARE_CONFIG_PATH)) {\n return [cloudflareTest({ ...pluginOptions, config: true })];\n }\n return [\n cloudflareTest({\n ...pluginOptions,\n wrangler: { configPath: DEFAULT_WRANGLER_CONFIG_PATH, ...wrangler },\n }),\n ];\n }),\n };\n}\n"],"mappings":";;;;;AAiBA,SAAS,uBACP,SAC2B;CAE3B,OAAO,YAAY,OAAgB;AACrC;AAEA,SAAgB,2BACd,UAAuC,CAAC,GACxB;CAChB,MAAM,EAAE,QAAQ,UAAU,GAAG,kBAAkB;CAE/C,OAAO,EACL,SAAS,6BAA6B;EAEpC,IAAI,WAAW,KAAA,KAAa,WAAW,OACrC,OAAO,CAAC,eAAe;GAAE,GAAG;GAAe;EAAO,CAAC,CAAC;EAEtD,IAAI,WAAW,SAAS,aAAa,KAAA,KAAa,WAAA,wBAAiC,GACjF,OAAO,CAAC,eAAe;GAAE,GAAG;GAAe,QAAQ;EAAK,CAAC,CAAC;EAE5D,OAAO,CACL,eAAe;GACb,GAAG;GACH,UAAU;IAAE,YAAY;IAA8B,GAAG;GAAS;EACpE,CAAC,CACH;CACF,CAAC,EACH;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kasoa/vite-plus-config",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Kasoa's Vite+ configurations",
5
5
  "keywords": [
6
6
  "config",
@@ -46,13 +46,13 @@
46
46
  "access": "public"
47
47
  },
48
48
  "devDependencies": {
49
- "@cloudflare/vitest-plugin": "1.4.9",
49
+ "@cloudflare/vitest-plugin": "1.9.2",
50
50
  "@types/node": "24.19.2",
51
51
  "typescript": "^7.0.2",
52
52
  "vite-plus": "^1.4.0"
53
53
  },
54
54
  "peerDependencies": {
55
- "@cloudflare/vitest-plugin": "^1.4.0",
55
+ "@cloudflare/vitest-plugin": "^1.5.0",
56
56
  "typescript": ">=7 <8",
57
57
  "vite-plus": ">=1.4.0 <2"
58
58
  },