@party-stack/build-config 0.1.1 → 0.1.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
@@ -22,6 +22,7 @@ The preset provides:
22
22
  - `check`, `build`, and `test` tasks, ordered after their prerequisites.
23
23
  - Unbundled ESM, declarations, and source maps in `lib` through `vp pack`.
24
24
  - Vitest discovery under `src`, with package-specific test options.
25
+ - TypeScript path resolution through `resolve.tsconfigPaths` for libraries and apps.
25
26
  - Strict TypeScript settings targeting ES2022, with Node and DOM types.
26
27
 
27
28
  Apps use `defineAppConfig` from the same package. It provides check/build/test/dev
@@ -31,7 +32,7 @@ plugins and app-specific settings in the caller. Apps can extend
31
32
  TanStack Start apps use `@party-stack/tanstack-start-build-config` for framework
32
33
  plugins, React Compiler, Tailwind, and the app TSConfig together.
33
34
 
34
- Package options override the defaults. Individual task options are merged;
35
+ Package options override the defaults. Resolve and individual task options are merged;
35
36
  arrays and task cache options replace their defaults. Lint and formatting remain
36
37
  in the workspace root.
37
38
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;KAGK,YAAY,YAAY;KACxB,iBAAiB,YAAY;KAC7B,cAAc,QAAQ;;YAGf,gBAAgB,KAAK;EAC7B,MAAM,KAAK;IACP,QAAQ,mCAAmC,QAAQ;;;;;;;wBAQ3C,oBAAoB,SAAQ,gBAAqB;YA0CrD,YAAY;;wBAGR,gBAAgB,SAAQ,YAAiB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;KAGK,YAAY,YAAY;KACxB,iBAAiB,YAAY;KAC7B,cAAc,QAAQ;;YAGf,gBAAgB,KAAK;EAC7B,MAAM,KAAK;IACP,QAAQ,mCAAmC,QAAQ;;;;;;;wBAQ3C,oBAAoB,SAAQ,gBAAqB;YA2CrD,YAAY;;wBAGR,gBAAgB,SAAQ,YAAiB"}
package/lib/index.js CHANGED
@@ -6,6 +6,7 @@ import { defineConfig } from "vite-plus";
6
6
  */
7
7
  function defineLibraryConfig(config = {}) {
8
8
  return composeConfig(defineConfig({
9
+ resolve: { tsconfigPaths: true },
9
10
  run: { tasks: {
10
11
  check: {
11
12
  command: "vp check",
@@ -60,6 +61,7 @@ function defineLibraryConfig(config = {}) {
60
61
  /** Configure app tasks while leaving framework plugins with the caller. */
61
62
  function defineAppConfig(config = {}) {
62
63
  return composeConfig(defineConfig({
64
+ resolve: { tsconfigPaths: true },
63
65
  run: { tasks: {
64
66
  check: {
65
67
  command: "vp check",
@@ -120,6 +122,10 @@ function composeConfig(base, config) {
120
122
  return {
121
123
  ...base,
122
124
  ...config,
125
+ resolve: {
126
+ ...base.resolve,
127
+ ...config.resolve
128
+ },
123
129
  ...base.pack || config.pack ? { pack: Array.isArray(config.pack) ? config.pack : {
124
130
  ...Array.isArray(base.pack) ? {} : base.pack,
125
131
  ...config.pack
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { defineConfig } from \"vite-plus\";\nimport type { ViteUserConfig } from \"vite-plus\";\n\ntype RunConfig = NonNullable<ViteUserConfig[\"run\"]>;\ntype TaskDefinition = NonNullable<RunConfig[\"tasks\"]>[string];\ntype TaskOptions = Exclude<TaskDefinition, string | string[]>;\n\n/** Override individual task options without repeating their command or prerequisites. */\nexport type LibraryConfig = Omit<ViteUserConfig, \"run\"> & {\n run?: Omit<RunConfig, \"tasks\"> & {\n tasks?: Record<string, string | string[] | Partial<TaskOptions>>;\n };\n};\n\n/**\n * Configure an ESM library. Package overrides replace arrays and merge the\n * pack, test, and individual task options with these defaults.\n */\nexport function defineLibraryConfig(config: LibraryConfig = {}): ViteUserConfig {\n const base = defineConfig({\n run: {\n tasks: {\n check: {\n command: \"vp check\",\n // Track root files without making generated directory entries inputs.\n cache: {\n input: [{ auto: true }, \"!.\", \"*.{json,jsonc,ts,mts,js,mjs}\"],\n },\n dependsOn: [{ task: \"build\", from: [\"dependencies\", \"devDependencies\"] }],\n },\n build: {\n command: \"vp pack\",\n // Generated outputs and package directory listings must not invalidate their own build.\n cache: {\n input: [{ auto: true }, \"!.\", \"*.{json,jsonc,ts,mts,js,mjs}\", \"!lib/**\"],\n },\n dependsOn: [\"check\", { task: \"build\", from: [\"dependencies\", \"devDependencies\"] }],\n },\n test: { command: \"vp test\", dependsOn: [\"build\"] },\n },\n },\n pack: {\n entry: [\n \"src/**/*.{ts,tsx}\",\n \"!src/**/*.d.ts\",\n \"!src/**/*.test.{ts,tsx}\",\n \"!src/**/*.bench.{ts,tsx}\",\n ],\n outDir: \"lib\",\n root: \"src\",\n target: \"es2022\",\n unbundle: true,\n fixedExtension: false,\n deps: { neverBundle: true },\n },\n test: { include: [\"src/**/*.test.{ts,tsx}\"], passWithNoTests: true },\n });\n return composeConfig(base, config);\n}\n\nexport type AppConfig = LibraryConfig;\n\n/** Configure app tasks while leaving framework plugins with the caller. */\nexport function defineAppConfig(config: AppConfig = {}): ViteUserConfig {\n return composeConfig(\n defineConfig({\n run: {\n tasks: {\n check: {\n command: \"vp check\",\n dependsOn: [{ task: \"build\", from: [\"dependencies\", \"devDependencies\"] }],\n },\n build: {\n command: \"vp build\",\n // Shell nesting changed cache fingerprints without changing app outputs.\n cache: { untrackedEnv: [\"SHLVL\"] },\n dependsOn: [\"check\", { task: \"build\", from: [\"dependencies\", \"devDependencies\"] }],\n },\n test: { command: \"vp test\", dependsOn: [\"build\"] },\n dev: {\n command: \"vp dev\",\n dependsOn: [{ task: \"build\", from: [\"dependencies\", \"devDependencies\"] }],\n cache: false,\n },\n },\n },\n // Preserve Vite 7 browser support after the Vite 8 default target change.\n build: { target: [\"chrome107\", \"edge107\", \"firefox104\", \"safari16\"] },\n test: { include: [\"src/**/*.test.{ts,tsx}\"], passWithNoTests: true },\n }),\n config\n );\n}\n\nfunction composeConfig(base: ViteUserConfig, config: LibraryConfig): ViteUserConfig {\n const tasks = { ...base.run?.tasks };\n for (const [name, override] of Object.entries(config.run?.tasks ?? {})) {\n const original = tasks[name];\n if (typeof override === \"string\" || Array.isArray(override)) {\n tasks[name] = override;\n } else {\n const inherited = typeof original === \"object\" && !Array.isArray(original) ? original : undefined;\n const command = override.command ?? inherited?.command;\n if (command === undefined) {\n throw new Error(`Task \"${name}\" needs a command because it has no preset default.`);\n }\n tasks[name] = { ...inherited, ...override, command };\n }\n }\n return {\n ...base,\n ...config,\n ...(base.pack || config.pack\n ? {\n pack: Array.isArray(config.pack)\n ? config.pack\n : { ...(Array.isArray(base.pack) ? {} : base.pack), ...config.pack },\n }\n : {}),\n ...(base.build || config.build ? { build: { ...base.build, ...config.build } } : {}),\n test: { ...base.test, ...config.test },\n run: { ...base.run, ...config.run, tasks },\n };\n}\n"],"mappings":";;;;;;AAkBA,SAAgB,oBAAoB,SAAwB,CAAC,GAAmB;CAuC5E,OAAO,cAtCM,aAAa;EACtB,KAAK,EACD,OAAO;GACH,OAAO;IACH,SAAS;IAET,OAAO,EACH,OAAO;KAAC,EAAE,MAAM,KAAK;KAAG;KAAM;IAA8B,EAChE;IACA,WAAW,CAAC;KAAE,MAAM;KAAS,MAAM,CAAC,gBAAgB,iBAAiB;IAAE,CAAC;GAC5E;GACA,OAAO;IACH,SAAS;IAET,OAAO,EACH,OAAO;KAAC,EAAE,MAAM,KAAK;KAAG;KAAM;KAAgC;IAAS,EAC3E;IACA,WAAW,CAAC,SAAS;KAAE,MAAM;KAAS,MAAM,CAAC,gBAAgB,iBAAiB;IAAE,CAAC;GACrF;GACA,MAAM;IAAE,SAAS;IAAW,WAAW,CAAC,OAAO;GAAE;EACrD,EACJ;EACA,MAAM;GACF,OAAO;IACH;IACA;IACA;IACA;GACJ;GACA,QAAQ;GACR,MAAM;GACN,QAAQ;GACR,UAAU;GACV,gBAAgB;GAChB,MAAM,EAAE,aAAa,KAAK;EAC9B;EACA,MAAM;GAAE,SAAS,CAAC,wBAAwB;GAAG,iBAAiB;EAAK;C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O;EACH,GAAG;EACH,GAAG;EACH,GAAI,KAAK,QAAQ,OAAO,OAClB,EACI,MAAM,MAAM,QAAQ,OAAO,IAAI,IACzB,OAAO,OACP;GAAE,GAAI,MAAM,QAAQ,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK;GAAO,GAAG,OAAO;EAAK,EAC3E,IACA,CAAC;EACP,GAAI,KAAK,SAAS,OAAO,QAAQ,EAAE,OAAO;GAAE,GAAG,KAAK;GAAO,GAAG,OAAO;EAAM,EAAE,IAAI,CAAC;EAClF,MAAM;GAAE,GAAG,KAAK;GAAM,GAAG,OAAO;EAAK;EACrC,KAAK;GAAE,GAAG,KAAK;GAAK,GAAG,OAAO;GAAK;EAAM;CAC7C;AACJ"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { defineConfig } from \"vite-plus\";\nimport type { ViteUserConfig } from \"vite-plus\";\n\ntype RunConfig = NonNullable<ViteUserConfig[\"run\"]>;\ntype TaskDefinition = NonNullable<RunConfig[\"tasks\"]>[string];\ntype TaskOptions = Exclude<TaskDefinition, string | string[]>;\n\n/** Override individual task options without repeating their command or prerequisites. */\nexport type LibraryConfig = Omit<ViteUserConfig, \"run\"> & {\n run?: Omit<RunConfig, \"tasks\"> & {\n tasks?: Record<string, string | string[] | Partial<TaskOptions>>;\n };\n};\n\n/**\n * Configure an ESM library. Package overrides replace arrays and merge the\n * pack, test, and individual task options with these defaults.\n */\nexport function defineLibraryConfig(config: LibraryConfig = {}): ViteUserConfig {\n const base = defineConfig({\n resolve: { tsconfigPaths: true },\n run: {\n tasks: {\n check: {\n command: \"vp check\",\n // Track root files without making generated directory entries inputs.\n cache: {\n input: [{ auto: true }, \"!.\", \"*.{json,jsonc,ts,mts,js,mjs}\"],\n },\n dependsOn: [{ task: \"build\", from: [\"dependencies\", \"devDependencies\"] }],\n },\n build: {\n command: \"vp pack\",\n // Generated outputs and package directory listings must not invalidate their own build.\n cache: {\n input: [{ auto: true }, \"!.\", \"*.{json,jsonc,ts,mts,js,mjs}\", \"!lib/**\"],\n },\n dependsOn: [\"check\", { task: \"build\", from: [\"dependencies\", \"devDependencies\"] }],\n },\n test: { command: \"vp test\", dependsOn: [\"build\"] },\n },\n },\n pack: {\n entry: [\n \"src/**/*.{ts,tsx}\",\n \"!src/**/*.d.ts\",\n \"!src/**/*.test.{ts,tsx}\",\n \"!src/**/*.bench.{ts,tsx}\",\n ],\n outDir: \"lib\",\n root: \"src\",\n target: \"es2022\",\n unbundle: true,\n fixedExtension: false,\n deps: { neverBundle: true },\n },\n test: { include: [\"src/**/*.test.{ts,tsx}\"], passWithNoTests: true },\n });\n return composeConfig(base, config);\n}\n\nexport type AppConfig = LibraryConfig;\n\n/** Configure app tasks while leaving framework plugins with the caller. */\nexport function defineAppConfig(config: AppConfig = {}): ViteUserConfig {\n return composeConfig(\n defineConfig({\n resolve: { tsconfigPaths: true },\n run: {\n tasks: {\n check: {\n command: \"vp check\",\n dependsOn: [{ task: \"build\", from: [\"dependencies\", \"devDependencies\"] }],\n },\n build: {\n command: \"vp build\",\n // Shell nesting changed cache fingerprints without changing app outputs.\n cache: { untrackedEnv: [\"SHLVL\"] },\n dependsOn: [\"check\", { task: \"build\", from: [\"dependencies\", \"devDependencies\"] }],\n },\n test: { command: \"vp test\", dependsOn: [\"build\"] },\n dev: {\n command: \"vp dev\",\n dependsOn: [{ task: \"build\", from: [\"dependencies\", \"devDependencies\"] }],\n cache: false,\n },\n },\n },\n // Preserve Vite 7 browser support after the Vite 8 default target change.\n build: { target: [\"chrome107\", \"edge107\", \"firefox104\", \"safari16\"] },\n test: { include: [\"src/**/*.test.{ts,tsx}\"], passWithNoTests: true },\n }),\n config\n );\n}\n\nfunction composeConfig(base: ViteUserConfig, config: LibraryConfig): ViteUserConfig {\n const tasks = { ...base.run?.tasks };\n for (const [name, override] of Object.entries(config.run?.tasks ?? {})) {\n const original = tasks[name];\n if (typeof override === \"string\" || Array.isArray(override)) {\n tasks[name] = override;\n } else {\n const inherited = typeof original === \"object\" && !Array.isArray(original) ? original : undefined;\n const command = override.command ?? inherited?.command;\n if (command === undefined) {\n throw new Error(`Task \"${name}\" needs a command because it has no preset default.`);\n }\n tasks[name] = { ...inherited, ...override, command };\n }\n }\n return {\n ...base,\n ...config,\n resolve: { ...base.resolve, ...config.resolve },\n ...(base.pack || config.pack\n ? {\n pack: Array.isArray(config.pack)\n ? config.pack\n : { ...(Array.isArray(base.pack) ? {} : base.pack), ...config.pack },\n }\n : {}),\n ...(base.build || config.build ? { build: { ...base.build, ...config.build } } : {}),\n test: { ...base.test, ...config.test },\n run: { ...base.run, ...config.run, tasks },\n };\n}\n"],"mappings":";;;;;;AAkBA,SAAgB,oBAAoB,SAAwB,CAAC,GAAmB;CAwC5E,OAAO,cAvCM,aAAa;EACtB,SAAS,EAAE,eAAe,KAAK;EAC/B,KAAK,EACD,OAAO;GACH,OAAO;IACH,SAAS;IAET,OAAO,EACH,OAAO;KAAC,EAAE,MAAM,KAAK;KAAG;KAAM;IAA8B,EAChE;IACA,WAAW,CAAC;KAAE,MAAM;KAAS,MAAM,CAAC,gBAAgB,iBAAiB;IAAE,CAAC;GAC5E;GACA,OAAO;IACH,SAAS;IAET,OAAO,EACH,OAAO;KAAC,EAAE,MAAM,KAAK;KAAG;KAAM;KAAgC;IAAS,EAC3E;IACA,WAAW,CAAC,SAAS;KAAE,MAAM;KAAS,MAAM,CAAC,gBAAgB,iBAAiB;IAAE,CAAC;GACrF;GACA,MAAM;IAAE,SAAS;IAAW,WAAW,CAAC,OAAO;GAAE;EACrD,EACJ;EACA,MAAM;GACF,OAAO;IACH;IACA;IACA;IACA;GACJ;GACA,QAAQ;GACR,MAAM;GACN,QAAQ;GACR,UAAU;GACV,gBAAgB;GAChB,MAAM,EAAE,aAAa,KAAK;EAC9B;EACA,MAAM;GAAE,SAAS,CAAC,wBAAwB;GAAG,iBAAiB;EAAK;CACvE,CACwB,GAAG,MAAM;AACrC;;AAKA,SAAgB,gBAAgB,SAAoB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