vite-plus 1.0.0 → 1.1.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.
Files changed (55) hide show
  1. package/LICENSE +30 -5
  2. package/README.md +7 -7
  3. package/binding/index.cjs +54 -55
  4. package/binding/index.d.cts +50 -12
  5. package/dist/{agent-CKMI1a8W.js → agent-eISuMXJb.js} +2 -2
  6. package/dist/bin.js +9 -6
  7. package/dist/config/bin.js +3 -3
  8. package/dist/{constants-BqJiMVVU.js → constants-CCQkpaxK.js} +2 -2
  9. package/dist/create/bin.js +42 -10
  10. package/dist/{define-config-C_KGDLUZ.cjs → define-config-CREUiMmM.cjs} +2 -2
  11. package/dist/{define-config-Cf_5GHmY.d.ts → define-config-CeW9DETl.d.ts} +24 -8
  12. package/dist/{define-config-DhEJaYRc.js → define-config-Ro6PS4dP.js} +2 -2
  13. package/dist/define-config.cjs +1 -1
  14. package/dist/define-config.d.ts +1 -1
  15. package/dist/define-config.js +1 -1
  16. package/dist/{dist-BWiANxFS.js → dist-DUsqQuw8.js} +117 -1395
  17. package/dist/{editor-CHfGUhxP.js → editor-B8tkz7nL.js} +94 -52
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/lint-plugins.cjs +1 -1
  22. package/dist/migration/bin.js +54 -50
  23. package/dist/{oxlint-plugin-config-lMMD5fAC.js → oxlint-plugin-config-CbG58Kzr.js} +1 -1
  24. package/dist/oxlint-plugin.js +2 -2
  25. package/dist/pack-bin.js +3 -2
  26. package/dist/{package-Cgdlhamw.js → package-BS84eWrW.js} +7 -2
  27. package/dist/package-overrides-CpoQngt3.js +411 -0
  28. package/dist/{prompts-jMH8S4Wp.js → prompts-ByOzbMBG.js} +537 -252
  29. package/dist/{resolve-vite-config-BJYYtfY3.js → resolve-vite-config-Be237LWp.js} +2 -2
  30. package/dist/{resolve-vite-config-BPgpYMYp.js → resolve-vite-config-CofpYgnY.js} +1 -1
  31. package/dist/staged/bin.js +791 -742
  32. package/dist/sync-versions/bin.js +4 -6
  33. package/dist/sync-versions/bin.mjs +247 -1419
  34. package/dist/toolchain.js +9 -9
  35. package/dist/toolchain.json +9 -9
  36. package/dist/{tsconfig-CmKidmRD.js → tsconfig-3ONY2k2K.js} +1 -1
  37. package/dist/{tsconfig-BoYTBNX_.js → tsconfig-DzZ-nrx2.js} +2 -2
  38. package/dist/version.js +2 -2
  39. package/dist/versions.js +5 -5
  40. package/docs/guide/ci.md +3 -4
  41. package/docs/guide/env.md +10 -5
  42. package/docs/guide/github-actions-cache.md +1 -3
  43. package/docs/guide/ide-integration.md +3 -1
  44. package/docs/guide/implode.md +2 -0
  45. package/docs/guide/install.md +3 -0
  46. package/docs/guide/local-cli.md +7 -7
  47. package/docs/guide/migrate-rules.md +8 -0
  48. package/docs/guide/migrate.md +7 -7
  49. package/docs/guide/test.md +1 -1
  50. package/docs/guide/troubleshooting.md +2 -2
  51. package/docs/guide/upgrade-project.md +1 -1
  52. package/docs/guide/vitest-v5.md +2 -2
  53. package/docs/guide/vpx.md +2 -2
  54. package/package.json +31 -28
  55. package/dist/package-overrides-Dpn4scvN.js +0 -17
package/dist/bin.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { t as documentationUrl$1 } from "./documentation-DqcZSthV.js";
2
2
  import { t as renderCliDoc } from "./help-BmKpeOP9.js";
3
3
  import { c as warnMsg, i as log, n as errorMsg, o as printHeader, t as accent } from "./terminal-MKGAuy-p.js";
4
- import { g as resolveBundled, h as resolve$1, i as DEFAULT_ENVS, l as VITE_CONFIG_FILES, n as BASEURL_TSCONFIG_WARNING, r as CONFIG_METADATA_ENV, u as VITE_PLUS_NAME } from "./constants-BqJiMVVU.js";
5
- import { r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-lMMD5fAC.js";
6
- import { a as readNearestPackageJson } from "./package-Cgdlhamw.js";
4
+ import { g as resolveBundled, h as resolve$1, i as DEFAULT_ENVS, l as VITE_CONFIG_FILES, n as BASEURL_TSCONFIG_WARNING, r as CONFIG_METADATA_ENV, u as VITE_PLUS_NAME } from "./constants-CCQkpaxK.js";
5
+ import { r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-CbG58Kzr.js";
6
+ import { o as readNearestPackageJson } from "./package-BS84eWrW.js";
7
7
  import { t as cac } from "./dist-DfmT__Aw.js";
8
8
  import { createRequire } from "node:module";
9
9
  import path, { dirname, join, resolve } from "node:path";
@@ -1527,7 +1527,7 @@ async function applyToolInitConfigToViteConfig(command, args, projectPath = proc
1527
1527
  }
1528
1528
  if (spec.configKey === "lint" && hasTriggerFlag(args, ["--init"])) {
1529
1529
  const lintInitConfigPath = path.join(projectPath, ".vite-plus-lint-init.oxlintrc.json");
1530
- const { fixBaseUrlInTsconfig, hasBaseUrlInTsconfig } = await import("./tsconfig-CmKidmRD.js");
1530
+ const { fixBaseUrlInTsconfig, hasBaseUrlInTsconfig } = await import("./tsconfig-3ONY2k2K.js");
1531
1531
  await fixBaseUrlInTsconfig(projectPath);
1532
1532
  const hasBaseUrl = hasBaseUrlInTsconfig(projectPath);
1533
1533
  const initConfig = createDefaultVitePlusLintConfig({ includeTypeAwareDefaults: !hasBaseUrl });
@@ -1857,7 +1857,6 @@ else if (command === "hooks") await import("./hooks/bin.js");
1857
1857
  else if (command === "--version" || command === "-V") await import("./version.js");
1858
1858
  else if (command === "staged") await import("./staged/bin.js");
1859
1859
  else try {
1860
- const { resolveUniversalViteConfig } = await import("./resolve-vite-config-BPgpYMYp.js");
1861
1860
  const initInspection = inspectInitCommand(command, args.slice(1));
1862
1861
  if (initInspection.handled && initInspection.configKey && initInspection.hasExistingConfigKey && initInspection.existingViteConfigPath) {
1863
1862
  log(`Skipped initialization: '${accent(initInspection.configKey)}' already exists in '${accent(path.basename(initInspection.existingViteConfigPath))}'.`);
@@ -1873,7 +1872,11 @@ else try {
1873
1872
  doc,
1874
1873
  toolchainManifestPath: path.join(cliDistDir, "toolchain.json"),
1875
1874
  vitePlusPackagePath,
1876
- resolveUniversalViteConfig,
1875
+ resolveUniversalViteConfig: async (err, cwd) => {
1876
+ const { resolveUniversalViteConfig } = await import("./resolve-vite-config-CofpYgnY.js");
1877
+ return resolveUniversalViteConfig(err, cwd);
1878
+ },
1879
+ nodeVersion: process.version,
1877
1880
  explicitChdir,
1878
1881
  args: rustCliArgs
1879
1882
  });
@@ -1,7 +1,7 @@
1
1
  import { i as log, n as errorMsg } from "../terminal-MKGAuy-p.js";
2
- import { i as promptGitHooks, n as defaultInteractive } from "../prompts-jMH8S4Wp.js";
3
- import { t as require_dist } from "../dist-BWiANxFS.js";
4
- import { o as updateExistingAgentInstructions } from "../agent-CKMI1a8W.js";
2
+ import { i as promptGitHooks, n as defaultInteractive } from "../prompts-ByOzbMBG.js";
3
+ import { t as require_dist } from "../dist-DUsqQuw8.js";
4
+ import { o as updateExistingAgentInstructions } from "../agent-eISuMXJb.js";
5
5
  import { a as install, c as resolveHooksLocation, o as isGitHooksEnvDisabled, s as isHooksUserDisabled } from "../hooks-C-4gykWR.js";
6
6
  import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
7
7
  import path, { join, relative } from "node:path";
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
2
  //#region package.json
3
- var version = "1.0.0";
3
+ var version = "1.1.0";
4
4
  var exports = {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",
@@ -289,7 +289,7 @@ const VITE_CONFIG_FILES = [
289
289
  "vite.config.mts",
290
290
  "vite.config.cts"
291
291
  ];
292
- const VITEST_VERSION = "5.0.1";
292
+ const VITEST_VERSION = "5.0.3";
293
293
  const SETUP_VP_VERSION = "v1.21.1";
294
294
  const TSDOWN_MIGRATION_SKILL_URL = "https://github.com/rolldown/tsdown/blob/main/skills/tsdown-migrate/SKILL.md";
295
295
  const VITE_PLUS_OVERRIDE_PACKAGES = process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : {
@@ -2,14 +2,14 @@ import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-CMFfr-1z.j
2
2
  import { t as documentationUrl$1 } from "../documentation-DqcZSthV.js";
3
3
  import { t as renderCliDoc } from "../help-BmKpeOP9.js";
4
4
  import { a as muted, i as log, o as printHeader, r as formatDuration, s as success, t as accent } from "../terminal-MKGAuy-p.js";
5
- import { u as VITE_PLUS_NAME } from "../constants-BqJiMVVU.js";
5
+ import { d as VITE_PLUS_OVERRIDE_PACKAGES, f as VITE_PLUS_VERSION, u as VITE_PLUS_NAME } from "../constants-CCQkpaxK.js";
6
6
  import { i as readJsonFile, n as editJsonFile } from "../json-JP24qHUF.js";
7
- import { o as fetchNpmResource, r as getScopeFromPackageName, s as getNpmRegistry, t as checkNpmPackageExists } from "../package-Cgdlhamw.js";
8
- import { i as hasViteConfig, o as resolveViteConfig, r as findWorkspaceRoot, t as findViteConfig } from "../resolve-vite-config-BJYYtfY3.js";
9
- import { C as multiselect, D as text, E as spinner, O as require_picocolors, S as log$1, T as select, a as resolveGitInit, c as selectPackageManager, d as readYamlFile, h as resolveApproveBuildTargets, i as promptGitHooks, k as isCancel, m as detectGatedBuilds, n as defaultInteractive, o as runViteFmt, p as approveBuilds, r as downloadPackageManager$1, s as runViteInstall, t as cancelAndExit, u as editYamlFile, v as DependencyType, x as intro, y as PackageManager } from "../prompts-jMH8S4Wp.js";
10
- import { n as require_semver } from "../dist-BWiANxFS.js";
11
- import { a as selectAgentTargets, c as writeCopilotSetupWorkflow, d as templatesDir, l as displayRelative, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID } from "../agent-CKMI1a8W.js";
12
- import { B as addFrameworkShim, F as updateWorkspaceConfig, H as hasFrameworkShim, K as promptTsupMigration, L as findGitRoot, M as detectWorkspace$1, N as isBingoTemplate, P as updatePackageJsonWithDeps, R as initGitRepository, V as detectFramework, W as detectTsupProject, Y as detectPrettierProject, Z as promptPrettierMigration, _ as installGitHooks, a as selectEditors, b as injectCreateDefaultTemplate, c as rewriteMonorepoProject, et as detectEslintProject, h as setPackageManager, j as supportsCatalog, l as rewriteStandaloneProject, n as detectExistingEditors, o as writeEditorConfigs, rt as promptEslintMigration, s as rewriteMonorepo, y as shouldSkipStagedMigrationForHooks } from "../editor-CHfGUhxP.js";
7
+ import { c as getNpmRegistry, r as getScopeFromPackageName, s as fetchNpmResource, t as checkNpmPackageExists } from "../package-BS84eWrW.js";
8
+ import { i as hasViteConfig, o as resolveViteConfig, r as findWorkspaceRoot, t as findViteConfig } from "../resolve-vite-config-Be237LWp.js";
9
+ import { A as text, E as multiselect, M as isCancel, O as select, S as normalize$1, T as log$1, a as resolveGitInit, c as selectPackageManager, d as readYamlFile, h as resolveApproveBuildTargets, i as promptGitHooks, j as require_picocolors, k as spinner, m as detectGatedBuilds, n as defaultInteractive, o as runViteFmt, p as approveBuilds, r as downloadPackageManager$1, s as runViteInstall, t as cancelAndExit, u as editYamlFile, v as DependencyType, w as intro, y as PackageManager } from "../prompts-ByOzbMBG.js";
10
+ import { t as require_dist } from "../dist-DUsqQuw8.js";
11
+ import { a as selectAgentTargets, c as writeCopilotSetupWorkflow, d as templatesDir, l as displayRelative, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID } from "../agent-eISuMXJb.js";
12
+ import { A as createCatalogDependencyResolver, B as addFrameworkShim, F as updateWorkspaceConfig, H as hasFrameworkShim, K as promptTsupMigration, L as findGitRoot, M as detectWorkspace$1, N as isBingoTemplate, P as updatePackageJsonWithDeps, R as initGitRepository, V as detectFramework, W as detectTsupProject, Y as detectPrettierProject, Z as promptPrettierMigration, _ as installGitHooks, a as selectEditors, b as injectCreateDefaultTemplate, c as rewriteMonorepoProject, et as detectEslintProject, h as setPackageManager, j as supportsCatalog, l as rewriteStandaloneProject, n as detectExistingEditors, o as writeEditorConfigs, rt as promptEslintMigration, s as rewriteMonorepo, y as shouldSkipStagedMigrationForHooks } from "../editor-B8tkz7nL.js";
13
13
  import { n as runCommandSilently, t as runCommand$1 } from "../command-CguLh2KL.js";
14
14
  import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
15
15
  import path from "node:path";
@@ -98,7 +98,6 @@ function prependToPathToEnvs(extraPath, envs) {
98
98
  }
99
99
  //#endregion
100
100
  //#region ../../node_modules/.pnpm/nanotar@0.3.0/node_modules/nanotar/dist/index.mjs
101
- var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
102
101
  const tarItemTypeMap = {
103
102
  "0": "file",
104
103
  "1": "hardLink",
@@ -677,7 +676,7 @@ async function readOrgManifest(scope, requestedVersion) {
677
676
  resolvedVersion = packument["dist-tags"]?.latest;
678
677
  if (!resolvedVersion) return null;
679
678
  }
680
- if (import_semver.default.valid(resolvedVersion) === null) throw new OrgManifestSchemaError(`invalid version "${resolvedVersion}" (expected a semantic version)`, packageName);
679
+ if (normalize$1(resolvedVersion) === null) throw new OrgManifestSchemaError(`invalid version "${resolvedVersion}" (expected a semantic version)`, packageName);
681
680
  const meta = packument.versions?.[resolvedVersion];
682
681
  if (!meta) return null;
683
682
  let templates = validateManifest(meta, packageName);
@@ -3984,6 +3983,36 @@ function getRandomProjectName(options = {}) {
3984
3983
  }
3985
3984
  //#endregion
3986
3985
  //#region src/create/utils.ts
3986
+ var import_dist = require_dist();
3987
+ /** Complete only the managed catalog references of a newly created workspace member.
3988
+ * Running the full root migrator here would also change unrelated packages and overrides.
3989
+ */
3990
+ function ensurePnpmCreateCatalogEntries(rootDir, projectDir) {
3991
+ const workspacePath = path.join(rootDir, "pnpm-workspace.yaml");
3992
+ const packageJsonPath = path.join(projectDir, "package.json");
3993
+ if (!fs.existsSync(workspacePath) || !fs.existsSync(packageJsonPath)) return;
3994
+ const doc = (0, import_dist.parseDocument)(fs.readFileSync(workspacePath, "utf8"));
3995
+ const pkg = readJsonFile(packageJsonPath);
3996
+ const versions = {
3997
+ ...VITE_PLUS_OVERRIDE_PACKAGES,
3998
+ [VITE_PLUS_NAME]: VITE_PLUS_VERSION
3999
+ };
4000
+ let changed = false;
4001
+ for (const field of [
4002
+ "dependencies",
4003
+ "devDependencies",
4004
+ "optionalDependencies"
4005
+ ]) for (const [name, spec] of Object.entries(pkg[field] ?? {})) {
4006
+ if (!Object.hasOwn(versions, name) || !spec.startsWith("catalog:")) continue;
4007
+ const catalogName = spec.slice(8);
4008
+ const entryPath = [...catalogName && catalogName !== "default" ? ["catalogs", catalogName] : doc.has("catalog") || !doc.hasIn(["catalogs", "default"]) ? ["catalog"] : ["catalogs", "default"], name];
4009
+ if (!doc.hasIn(entryPath)) {
4010
+ doc.setIn(entryPath, versions[name]);
4011
+ changed = true;
4012
+ }
4013
+ }
4014
+ if (changed) fs.writeFileSync(workspacePath, doc.toString({ singleQuote: true }));
4015
+ }
3987
4016
  function hasExplicitEditorOptIn(editor) {
3988
4017
  return typeof editor === "string" && editor.trim() !== "";
3989
4018
  }
@@ -5200,6 +5229,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5200
5229
  updateCreateProgress("Integrating monorepo");
5201
5230
  const skipStagedMigration = shouldSkipStagedMigrationForHooks(fullPath, shouldSetupHooks, workspaceInfo.packageManager, workspaceInfo.packages);
5202
5231
  rewriteMonorepo(workspaceInfo, skipStagedMigration, compactOutput);
5232
+ setPackageManager(fullPath, workspaceInfo.downloadPackageManager);
5203
5233
  if (bundled?.monorepo) injectCreateDefaultTemplate(fullPath, bundled.scope, compactOutput);
5204
5234
  if (shouldSetupHooks) installGitHooks(fullPath, compactOutput, void 0, workspaceInfo.packageManager, workspaceInfo.packages);
5205
5235
  updateCreateProgress("Installing dependencies");
@@ -5374,7 +5404,8 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5374
5404
  if (shouldMigrateLintFmtTools) await installAndMigrate(workspaceInfo.rootDir);
5375
5405
  updateCreateProgress("Integrating into monorepo");
5376
5406
  const skipStagedMigration = shouldSkipStagedMigrationForHooks(fullPath, shouldSetupHooks, workspaceInfo.packageManager);
5377
- rewriteMonorepoProject(fullPath, workspaceInfo.packageManager, skipStagedMigration, compactOutput);
5407
+ rewriteMonorepoProject(fullPath, workspaceInfo.packageManager, skipStagedMigration, compactOutput, void 0, workspaceInfo.packageManager === PackageManager.pnpm ? createCatalogDependencyResolver(workspaceInfo.rootDir, workspaceInfo.packageManager) : void 0);
5408
+ if (workspaceInfo.packageManager === PackageManager.pnpm) ensurePnpmCreateCatalogEntries(workspaceInfo.rootDir, fullPath);
5378
5409
  for (const framework of detectFramework(fullPath)) if (!hasFrameworkShim(fullPath, framework)) addFrameworkShim(fullPath, framework);
5379
5410
  updateCreateProgress("Installing dependencies");
5380
5411
  installSummary = await runViteInstall(workspaceInfo.rootDir, options.interactive, installArgs, {
@@ -5397,6 +5428,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
5397
5428
  updateCreateProgress("Applying Vite+ project setup");
5398
5429
  const skipStagedMigration = shouldSkipStagedMigrationForHooks(fullPath, shouldSetupHooks, workspaceInfo.packageManager);
5399
5430
  rewriteStandaloneProject(fullPath, workspaceInfo, skipStagedMigration, compactOutput);
5431
+ setPackageManager(fullPath, workspaceInfo.downloadPackageManager);
5400
5432
  for (const framework of detectFramework(fullPath)) if (!hasFrameworkShim(fullPath, framework)) addFrameworkShim(fullPath, framework);
5401
5433
  if (shouldSetupHooks) installGitHooks(fullPath, compactOutput, void 0, workspaceInfo.packageManager);
5402
5434
  updateCreateProgress("Installing dependencies");
@@ -38,10 +38,10 @@ let node_path = require("node:path");
38
38
  let node_url = require("node:url");
39
39
  let vitest_config = require("vitest/config");
40
40
  //#region package.json
41
- var version = "1.0.0", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
41
+ var version = "1.1.0", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
42
42
  var init_constants = __esmMin((() => {
43
43
  VITE_PLUS_VERSION = process.env.VP_VERSION || version;
44
- VITEST_VERSION = "5.0.1";
44
+ VITEST_VERSION = "5.0.3";
45
45
  process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : `${VITE_PLUS_VERSION}`;
46
46
  (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
47
47
  process.versions.node, process.release.name;
@@ -157,38 +157,54 @@ type RunConfig = {
157
157
  enablePrePostScripts?: boolean;
158
158
  };
159
159
  //#endregion
160
- //#region ../../node_modules/.pnpm/lint-staged@17.5.1/node_modules/lint-staged/lib/config.d.ts
160
+ //#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/config.d.ts
161
161
  /**
162
162
  * A single task that will be spawned
163
163
  *
164
164
  * @example "eslint --fix"
165
165
  */
166
166
  type SpawnedTask = string;
167
- type SyncGenerateTask = (files: readonly string[]) => string | string[];
168
- type AsyncGenerateTask = (files: readonly string[]) => Promise<string | string[]>;
167
+ type SyncGenerateTask<Result> = (files: readonly string[]) => Result;
168
+ type AsyncGenerateTask<Result> = (files: readonly string[]) => Promise<Result>;
169
169
  /**
170
170
  * A function that returns one or more tasks that will be spawned and run sequentially, in order.
171
- * The function receives list of the matched staged files as its argument. Can be sync or async.
171
+ * Tasks can be nested in one extra level of array to run them in parallel.
172
+ * The function receives list of the matched staged files as its argument and should return the
173
+ * complete command to be run, including passing filenames. Can be sync or async.
172
174
  *
173
175
  * @example <caption>Return a command after manipulating list of staged files</caption>
174
176
  * (files: string) => `eslint --fix ${files.map((f) => `'${f}'`).join(' ')}`
175
177
  *
176
178
  * @example <caption>Ignore staged files and run "tsc" and "vitest" without any arguments</caption>
177
179
  * () => ['tsc', 'vitest']
180
+ *
181
+ * @example <caption>Run "tsc" and "vitest" concurrently</caption>
182
+ * () => [['tsc', 'vitest']]
178
183
  */
179
- type GenerateTask = SyncGenerateTask | AsyncGenerateTask;
184
+ type GenerateTask<Result = string | (string | string[])[]> = SyncGenerateTask<Result> | AsyncGenerateTask<Result>;
180
185
  /**
181
186
  * List of tasks that will be run in parallel
182
187
  *
183
188
  * @example ["prettier --write", "eslint --fix"]
184
189
  */
185
- type ParallelTasks = (SpawnedTask | GenerateTask)[];
190
+ type ParallelTasks = (SpawnedTask | GenerateTask<string>)[];
186
191
  /**
187
192
  * List of tasks that will be run sequentially, in order
188
193
  *
189
194
  * @example ["prettier --write", "eslint --fix"]
190
195
  */
191
- type SequentialTasks = (SpawnedTask | GenerateTask | ParallelTasks)[];
196
+ type SequentialTasks = (SpawnedTask | GenerateTask<string | string[]> | ParallelTasks)[];
197
+ type TaskFunctionContext = {
198
+ /**
199
+ * Emit output from the task. All arguments of the call will be passed to Node.js `util.format()`.
200
+ * The output will only be shown on error, unless `--verbose` is used.
201
+ *
202
+ * @example log('Hello from task')
203
+ *
204
+ * @see https://nodejs.org/api/util.html#utilformatformat-args
205
+ */
206
+ log: (format: any, ...param: any[]) => void;
207
+ };
192
208
  /**
193
209
  * A single Node.js/JavaScript task that defines its title and the function which will be
194
210
  * run with the list of the matched staged files as its argument.
@@ -203,7 +219,7 @@ type SequentialTasks = (SpawnedTask | GenerateTask | ParallelTasks)[];
203
219
  */
204
220
  type TaskFunction = {
205
221
  title: string;
206
- task: (filepaths: readonly string[]) => void | Promise<void>;
222
+ task: (filepaths: readonly string[], context: TaskFunctionContext) => void | Promise<void>;
207
223
  };
208
224
  /** An entire `lint-staged` configuration, or a function that returns one */
209
225
  type Configuration = Record<string, SpawnedTask | TaskFunction | GenerateTask | SequentialTasks> | GenerateTask;
@@ -1,11 +1,11 @@
1
- import { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-BqJiMVVU.js";
1
+ import { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-CCQkpaxK.js";
2
2
  import { t as VITEST_RESOLVER_PACKAGES } from "./vitest-ecosystem-BU0AqZq-.js";
3
3
  import { createRequire } from "node:module";
4
4
  import path, { resolve } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { readFileSync } from "node:fs";
7
7
  import { defineConfig, defineProject } from "vitest/config";
8
- //#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@type_540e13d22e6879071cae9cd3610e4dea/node_modules/tsdown/esm-shims.js
8
+ //#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@type_7b08cc352732b21e77c25829520d559f/node_modules/tsdown/esm-shims.js
9
9
  const getFilename = () => fileURLToPath(import.meta.url);
10
10
  const getDirname = () => path.dirname(getFilename());
11
11
  const __dirname = /* @__PURE__ */ getDirname();
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_define_config = require("./define-config-C_KGDLUZ.cjs");
2
+ const require_define_config = require("./define-config-CREUiMmM.cjs");
3
3
  require_define_config.init_define_config();
4
4
  exports.AUTO_INLINE_DEPS = require_define_config.AUTO_INLINE_DEPS;
5
5
  exports.assertCoverageProviderVersionMatch = require_define_config.assertCoverageProviderVersionMatch;
@@ -1,2 +1,2 @@
1
- import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-Cf_5GHmY.js";
1
+ import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-CeW9DETl.js";
2
2
  export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };
@@ -1,2 +1,2 @@
1
- import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-DhEJaYRc.js";
1
+ import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-Ro6PS4dP.js";
2
2
  export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };