vite-plus 0.1.1-alpha.0 → 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.
@@ -1,9 +1,9 @@
1
1
  import { C as log, D as select, T as note, b as cancel, d as getAgentById, h as pkgRoot, i as promptGitHooks, k as Ct, l as detectAgents, n as defaultInteractive } from "./prompts-CAIahN1u.js";
2
2
  import { t as lib_default } from "./lib-CibYHP32.js";
3
- import { i as writeJsonFile, r as readJsonFile } from "./json-Bfvtp2rL.js";
3
+ import { i as writeJsonFile, o as VITE_PLUS_NAME, r as readJsonFile } from "./json-Bfvtp2rL.js";
4
4
  import { a as renderCliDoc, n as log$1 } from "./terminal-Cb-NuRkb.js";
5
5
  import { dirname, join, relative } from "node:path";
6
- import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
6
+ import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, realpathSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
7
7
  import { vitePlusHeader } from "../../binding/index.js";
8
8
  import { spawnSync } from "node:child_process";
9
9
 
@@ -84,8 +84,18 @@ function linkSkills(root, skillsDir, skills, agentSkillsDir) {
84
84
  }
85
85
  return linked;
86
86
  }
87
+ function getStableSkillsDir(root) {
88
+ const resolvedSkillsDir = join(pkgRoot, "skills");
89
+ const logicalSkillsDir = join(root, "node_modules", VITE_PLUS_NAME, "skills");
90
+ try {
91
+ if (realpathSync(logicalSkillsDir) === realpathSync(resolvedSkillsDir)) {
92
+ return logicalSkillsDir;
93
+ }
94
+ } catch {}
95
+ return resolvedSkillsDir;
96
+ }
87
97
  function linkSkillsForSpecificAgents(root, agentConfigs) {
88
- const skillsDir = join(pkgRoot, "skills");
98
+ const skillsDir = getStableSkillsDir(root);
89
99
  const skills = parseSkills(skillsDir);
90
100
  if (skills.length === 0) {
91
101
  return 0;
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, t as __commonJSMin } from "./chunk-CtfvYSle.js";
2
2
  import { C as log, D as select, E as outro, O as text, S as intro, _ as templatesDir, a as runViteFmt, b as cancel, f as selectAgentTargetPaths, i as promptGitHooks, k as Ct, m as displayRelative, n as defaultInteractive, o as runViteInstall, p as writeAgentInstructions, r as downloadPackageManager$1, s as selectPackageManager, u as detectExistingAgentTargetPaths, v as DependencyType, w as multiselect, x as confirm, y as PackageManager } from "./prompts-CAIahN1u.js";
3
3
  import { t as lib_default } from "./lib-CibYHP32.js";
4
- import { a as selectEditor, d as rewriteMonorepo, f as rewriteMonorepoProject, i as detectExistingEditor, l as installGitHooks, n as updatePackageJsonWithDeps, o as writeEditorConfigs, p as rewriteStandaloneProject, r as updateWorkspaceConfig, t as detectWorkspace$1 } from "./workspace-De4OKHV7.js";
4
+ import { a as selectEditor, d as rewriteMonorepo, f as rewriteMonorepoProject, i as detectExistingEditor, l as installGitHooks, n as updatePackageJsonWithDeps, o as writeEditorConfigs, p as rewriteStandaloneProject, r as updateWorkspaceConfig, t as detectWorkspace$1 } from "./workspace-MTwAF3M9.js";
5
5
  import "./browser-CY4NBwxR.js";
6
6
  import { r as readJsonFile, t as editJsonFile } from "./json-Bfvtp2rL.js";
7
7
  import "./package-Pq2biU7_.js";
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM } from "./chunk-CtfvYSle.js";
2
2
  import { C as log, E as outro, S as intro, c as upgradeYarn, f as selectAgentTargetPaths, i as promptGitHooks, k as Ct, n as defaultInteractive, o as runViteInstall, p as writeAgentInstructions, r as downloadPackageManager$1, s as selectPackageManager, t as cancelAndExit, x as confirm, y as PackageManager } from "./prompts-CAIahN1u.js";
3
3
  import { t as lib_default } from "./lib-CibYHP32.js";
4
- import { a as selectEditor, c as checkVitestVersion, d as rewriteMonorepo, l as installGitHooks, m as require_semver, o as writeEditorConfigs, p as rewriteStandaloneProject, s as checkViteVersion, t as detectWorkspace$1, u as preflightGitHooksSetup } from "./workspace-De4OKHV7.js";
4
+ import { a as selectEditor, c as checkVitestVersion, d as rewriteMonorepo, l as installGitHooks, m as require_semver, o as writeEditorConfigs, p as rewriteStandaloneProject, s as checkViteVersion, t as detectWorkspace$1, u as preflightGitHooksSetup } from "./workspace-MTwAF3M9.js";
5
5
  import "./browser-CY4NBwxR.js";
6
6
  import "./json-Bfvtp2rL.js";
7
7
  import { i as readNearestPackageJson, r as hasVitePlusDependency } from "./package-Pq2biU7_.js";
@@ -115,8 +115,19 @@ async function main() {
115
115
  }
116
116
  intro(vitePlusHeader());
117
117
  const workspaceInfoOptional = await detectWorkspace$1(projectPath);
118
- if (hasVitePlusDependency(readNearestPackageJson(workspaceInfoOptional.rootDir))) {
119
- outro(`This project is already using Vite+! ${accent(`Happy coding!`)}`);
118
+ const rootPkg = readNearestPackageJson(workspaceInfoOptional.rootDir);
119
+ if (hasVitePlusDependency(rootPkg)) {
120
+ const hasHooksToMigrate = rootPkg?.devDependencies?.husky || rootPkg?.dependencies?.husky || rootPkg?.devDependencies?.["lint-staged"] || rootPkg?.dependencies?.["lint-staged"];
121
+ if (!hasHooksToMigrate) {
122
+ outro(`This project is already using Vite+! ${accent(`Happy coding!`)}`);
123
+ return;
124
+ }
125
+ const shouldSetupHooks = await promptGitHooks(options);
126
+ if (shouldSetupHooks && installGitHooks(workspaceInfoOptional.rootDir)) {
127
+ outro(green("✔ Migration completed!"));
128
+ } else {
129
+ outro(`This project is already using Vite+! ${accent(`Happy coding!`)}`);
130
+ }
120
131
  return;
121
132
  }
122
133
  if (options.interactive) {
@@ -10,7 +10,7 @@ import { detectWorkspace, mergeJsonConfig, mergeTsdownConfig, rewriteImportsInDi
10
10
  import spawn from "cross-spawn";
11
11
  import fsPromises, { lstat, readdir, readlink, realpath } from "node:fs/promises";
12
12
  import { fileURLToPath } from "node:url";
13
- import { lstatSync as lstatSync$1, readdir as readdir$1, readdirSync as readdirSync$1, readlinkSync as readlinkSync$1, realpathSync } from "fs";
13
+ import { lstatSync as lstatSync$1, readdir as readdir$1, readdirSync as readdirSync$1, readlinkSync as readlinkSync$1, realpathSync as realpathSync$1 } from "fs";
14
14
  import { EventEmitter } from "node:events";
15
15
  import Stream from "node:stream";
16
16
  import { StringDecoder } from "node:string_decoder";
@@ -2589,7 +2589,11 @@ function setupGitHooks(projectPath, oldHooksDir) {
2589
2589
  let stagedMerged = hasStagedConfigInViteConfig(projectPath);
2590
2590
  const hasStandaloneConfig = hasStandaloneLintStagedConfig(projectPath);
2591
2591
  if (!stagedMerged && !hasStandaloneConfig) {
2592
- stagedMerged = mergeStagedConfigToViteConfig(projectPath, { "*": "vp check --fix" });
2592
+ const pkgData = readJsonFile(packageJsonPath);
2593
+ const stagedConfig = pkgData?.["lint-staged"] ?? { "*": "vp check --fix" };
2594
+ const updated = rewriteScripts(JSON.stringify(stagedConfig), readRulesYaml());
2595
+ const finalConfig = updated ? JSON.parse(updated) : stagedConfig;
2596
+ stagedMerged = mergeStagedConfigToViteConfig(projectPath, finalConfig);
2593
2597
  }
2594
2598
  if (stagedMerged) {
2595
2599
  removeLintStagedFromPackageJson(packageJsonPath);
@@ -2608,6 +2612,10 @@ function setupGitHooks(projectPath, oldHooksDir) {
2608
2612
  fs.copyFileSync(src, dest);
2609
2613
  fs.chmodSync(dest, 493);
2610
2614
  }
2615
+ fs.rmSync(oldDir, {
2616
+ recursive: true,
2617
+ force: true
2618
+ });
2611
2619
  }
2612
2620
  }
2613
2621
  if (stagedMerged) {
@@ -2617,6 +2625,28 @@ function setupGitHooks(projectPath, oldHooksDir) {
2617
2625
  removeReplacedHookPackages(packageJsonPath);
2618
2626
  return true;
2619
2627
  }
2628
+ if (oldHooksDir) {
2629
+ const checkResult = spawn.sync("git", [
2630
+ "config",
2631
+ "--local",
2632
+ "core.hooksPath"
2633
+ ], {
2634
+ cwd: projectPath,
2635
+ stdio: "pipe"
2636
+ });
2637
+ const existingPath = checkResult.status === 0 ? checkResult.stdout?.toString().trim() : "";
2638
+ if (existingPath === `${oldHooksDir}/_` || existingPath === oldHooksDir) {
2639
+ spawn.sync("git", [
2640
+ "config",
2641
+ "--local",
2642
+ "--unset",
2643
+ "core.hooksPath"
2644
+ ], {
2645
+ cwd: projectPath,
2646
+ stdio: "pipe"
2647
+ });
2648
+ }
2649
+ }
2620
2650
  const vpBin = process.env.VITE_PLUS_CLI_BIN ?? "vp";
2621
2651
  const configArgs = isCustomDir ? [
2622
2652
  "config",
@@ -6907,13 +6937,13 @@ var Minipass = class extends EventEmitter {
6907
6937
 
6908
6938
  //#endregion
6909
6939
  //#region ../../node_modules/.pnpm/path-scurry@2.0.1/node_modules/path-scurry/dist/esm/index.js
6910
- const realpathSync$1 = realpathSync.native;
6940
+ const realpathSync$2 = realpathSync$1.native;
6911
6941
  const defaultFS = {
6912
6942
  lstatSync: lstatSync$1,
6913
6943
  readdir: readdir$1,
6914
6944
  readdirSync: readdirSync$1,
6915
6945
  readlinkSync: readlinkSync$1,
6916
- realpathSync: realpathSync$1,
6946
+ realpathSync: realpathSync$2,
6917
6947
  promises: {
6918
6948
  lstat,
6919
6949
  readdir,
package/dist/lint.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { type AllowWarnDeny, type DummyRule, type DummyRuleMap, type ExternalPluginEntry, type ExternalPluginsConfig, type OxlintConfig, type OxlintEnv, type OxlintGlobals, type OxlintOverride, type RuleCategories, defineConfig, } from 'oxlint';
package/dist/lint.js ADDED
@@ -0,0 +1 @@
1
+ export { defineConfig, } from 'oxlint';
@@ -26,6 +26,23 @@ export type Task = {
26
26
  * Environment variable names to be passed to the task without fingerprinting.
27
27
  */
28
28
  passThroughEnvs?: Array<string>;
29
+ /**
30
+ * Files to include in the cache fingerprint.
31
+ *
32
+ * - Omitted: automatically tracks which files the task reads
33
+ * - `[]` (empty): disables file tracking entirely
34
+ * - Glob patterns (e.g. `"src/**"`) select specific files
35
+ * - `{auto: true}` enables automatic file tracking
36
+ * - Negative patterns (e.g. `"!dist/**"`) exclude matched files
37
+ *
38
+ * Patterns are relative to the package directory.
39
+ */
40
+ inputs?: Array<string | {
41
+ /**
42
+ * Automatically track which files the task reads
43
+ */
44
+ auto: boolean;
45
+ }>;
29
46
  } | {
30
47
  /**
31
48
  * Whether to cache the task
@@ -1,7 +1,8 @@
1
- import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, symlinkSync, } from 'node:fs';
1
+ import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, realpathSync, symlinkSync, } from 'node:fs';
2
2
  import { join, relative } from 'node:path';
3
3
  import * as prompts from '@voidzero-dev/vite-plus-prompts';
4
4
  import {} from './agent.js';
5
+ import { VITE_PLUS_NAME } from './constants.js';
5
6
  import { pkgRoot } from './path.js';
6
7
  export function parseSkills(skillsDir) {
7
8
  if (!existsSync(skillsDir)) {
@@ -82,8 +83,23 @@ function linkSkills(root, skillsDir, skills, agentSkillsDir) {
82
83
  }
83
84
  return linked;
84
85
  }
86
+ function getStableSkillsDir(root) {
87
+ const resolvedSkillsDir = join(pkgRoot, 'skills');
88
+ // Prefer the logical node_modules path for a cleaner, stable symlink
89
+ // (avoids pnpm's versioned .pnpm/pkg@version/... real path)
90
+ const logicalSkillsDir = join(root, 'node_modules', VITE_PLUS_NAME, 'skills');
91
+ try {
92
+ if (realpathSync(logicalSkillsDir) === realpathSync(resolvedSkillsDir)) {
93
+ return logicalSkillsDir;
94
+ }
95
+ }
96
+ catch {
97
+ // Fall through to resolved path
98
+ }
99
+ return resolvedSkillsDir;
100
+ }
85
101
  export function linkSkillsForSpecificAgents(root, agentConfigs) {
86
- const skillsDir = join(pkgRoot, 'skills');
102
+ const skillsDir = getStableSkillsDir(root);
87
103
  const skills = parseSkills(skillsDir);
88
104
  if (skills.length === 0) {
89
105
  return 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plus",
3
- "version": "0.1.1-alpha.0",
3
+ "version": "0.1.2",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "oxfmt": "./bin/oxfmt",
@@ -55,6 +55,10 @@
55
55
  "import": "./binding/index.cjs",
56
56
  "require": "./binding/index.cjs"
57
57
  },
58
+ "./lint": {
59
+ "types": "./dist/lint.d.ts",
60
+ "import": "./dist/lint.js"
61
+ },
58
62
  "./package.json": "./package.json",
59
63
  "./pack": {
60
64
  "types": "./dist/pack.d.ts",
@@ -297,8 +301,8 @@
297
301
  "oxlint": "^1.51.0",
298
302
  "oxlint-tsgolint": "^0.15.0",
299
303
  "picocolors": "^1.1.1",
300
- "@voidzero-dev/vite-plus-test": "0.1.1-alpha.0",
301
- "@voidzero-dev/vite-plus-core": "0.1.1-alpha.0"
304
+ "@voidzero-dev/vite-plus-core": "0.1.2",
305
+ "@voidzero-dev/vite-plus-test": "0.1.2"
302
306
  },
303
307
  "devDependencies": {
304
308
  "@napi-rs/cli": "^3.4.1",
@@ -316,12 +320,12 @@
316
320
  "mri": "^1.2.0",
317
321
  "rolldown-plugin-dts": "^0.22.0",
318
322
  "semver": "^7.7.3",
319
- "tsdown": "^0.21.0-beta.2",
323
+ "tsdown": "^0.21.0",
320
324
  "validate-npm-package-name": "^7.0.2",
321
325
  "yaml": "^2.8.1",
322
- "@voidzero-dev/vite-plus-prompts": "0.0.0",
323
- "vite": "npm:@voidzero-dev/vite-plus-core@0.1.1-alpha.0",
324
- "rolldown": "1.0.0-rc.6"
326
+ "rolldown": "1.0.0-rc.6",
327
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.1.2",
328
+ "@voidzero-dev/vite-plus-prompts": "0.0.0"
325
329
  },
326
330
  "napi": {
327
331
  "binaryName": "vite-plus",
@@ -339,12 +343,12 @@
339
343
  "node": "^20.19.0 || >=22.12.0"
340
344
  },
341
345
  "optionalDependencies": {
342
- "@voidzero-dev/vite-plus-darwin-arm64": "0.1.1-alpha.0",
343
- "@voidzero-dev/vite-plus-darwin-x64": "0.1.1-alpha.0",
344
- "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.1-alpha.0",
345
- "@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.1-alpha.0",
346
- "@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.1-alpha.0",
347
- "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.1-alpha.0"
346
+ "@voidzero-dev/vite-plus-darwin-arm64": "0.1.2",
347
+ "@voidzero-dev/vite-plus-darwin-x64": "0.1.2",
348
+ "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.2",
349
+ "@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.2",
350
+ "@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.2",
351
+ "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.2"
348
352
  },
349
353
  "scripts": {
350
354
  "build": "oxnode -C dev ./build.ts",