@rayburst/cli 0.4.11 → 0.4.12
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/dist/{chunk-DWQK6WKX.js → chunk-ANVJHFHG.js} +69 -89
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/vite-plugin.d.ts +5 -3
- package/dist/vite-plugin.js +7 -3
- package/package.json +2 -2
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/vite-plugin.ts
|
|
2
|
+
import { createUnplugin } from "unplugin";
|
|
3
|
+
|
|
1
4
|
// src/analysis/analyze-project.ts
|
|
2
5
|
import { Project, SyntaxKind, Node } from "ts-morph";
|
|
3
6
|
import { execSync as execSync2 } from "child_process";
|
|
@@ -1977,8 +1980,7 @@ function generateChangeHistoryEntry(diff, trigger, gitCommitHash, newPlanData) {
|
|
|
1977
1980
|
import chalk2 from "chalk";
|
|
1978
1981
|
import * as fs3 from "fs";
|
|
1979
1982
|
import * as path5 from "path";
|
|
1980
|
-
|
|
1981
|
-
function rayburstPlugin(options = {}) {
|
|
1983
|
+
var unpluginFactory = (options = {}) => {
|
|
1982
1984
|
const {
|
|
1983
1985
|
enabled = process.env.CI !== "true",
|
|
1984
1986
|
// Disabled in CI by default
|
|
@@ -1989,7 +1991,6 @@ function rayburstPlugin(options = {}) {
|
|
|
1989
1991
|
let isAnalyzing = false;
|
|
1990
1992
|
let lastGitState = null;
|
|
1991
1993
|
let gitPollInterval = null;
|
|
1992
|
-
let fileWatcher = null;
|
|
1993
1994
|
const checkGitState = (projectPath) => {
|
|
1994
1995
|
try {
|
|
1995
1996
|
const gitDir = path5.join(projectPath, ".git");
|
|
@@ -2086,103 +2087,80 @@ function rayburstPlugin(options = {}) {
|
|
|
2086
2087
|
};
|
|
2087
2088
|
return {
|
|
2088
2089
|
name: "rayburst-analyzer",
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2090
|
+
enforce: "pre",
|
|
2091
|
+
// This hook is automatically called by Vite/Rollup when files change!
|
|
2092
|
+
async watchChange(id, { event }) {
|
|
2093
|
+
if (!enabled) return;
|
|
2094
|
+
console.log(chalk2.gray(`[Rayburst] Raw file event: ${event} ${id}`));
|
|
2095
|
+
if (!id.match(/\.(ts|tsx|js|jsx)$/)) {
|
|
2096
|
+
console.log(chalk2.gray(`[Rayburst] Skipping (not TS/JS): ${id}`));
|
|
2096
2097
|
return;
|
|
2097
2098
|
}
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2099
|
+
if (id.includes("node_modules") || id.includes(".rayburst") || id.includes(".test.") || id.includes(".spec.")) {
|
|
2100
|
+
console.log(chalk2.gray(`[Rayburst] Skipping (filtered): ${id}`));
|
|
2101
|
+
return;
|
|
2102
|
+
}
|
|
2103
|
+
console.log(chalk2.yellow(`[Rayburst] Accepted file ${event}: ${id}`));
|
|
2104
|
+
if (debounceTimer) {
|
|
2105
|
+
clearTimeout(debounceTimer);
|
|
2106
|
+
}
|
|
2107
|
+
debounceTimer = setTimeout(() => {
|
|
2108
|
+
const relativePath = id.replace(config.root, "").replace(/^\//, "");
|
|
2109
|
+
console.log(chalk2.dim(`[Rayburst] Triggering analysis after debounce for: ${relativePath}`));
|
|
2110
|
+
runAnalysis(id);
|
|
2111
|
+
}, debounceMs);
|
|
2103
2112
|
},
|
|
2104
|
-
//
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
if (!
|
|
2111
|
-
console.log(chalk2.gray(`[Rayburst] Skipping (not TS/JS): ${filePath}`));
|
|
2112
|
-
return;
|
|
2113
|
-
}
|
|
2114
|
-
if (filePath.includes("node_modules") || filePath.includes(".rayburst") || filePath.includes(".test.") || filePath.includes(".spec.")) {
|
|
2115
|
-
console.log(chalk2.gray(`[Rayburst] Skipping (filtered): ${filePath}`));
|
|
2113
|
+
// Vite-specific hooks
|
|
2114
|
+
vite: {
|
|
2115
|
+
configResolved(resolvedConfig) {
|
|
2116
|
+
config = resolvedConfig;
|
|
2117
|
+
},
|
|
2118
|
+
async buildStart() {
|
|
2119
|
+
if (!enabled || config.command !== "serve") {
|
|
2116
2120
|
return;
|
|
2117
2121
|
}
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2122
|
+
const projectPath = config.root;
|
|
2123
|
+
await ensureRayburstDir(projectPath);
|
|
2124
|
+
await addGitignoreEntry(projectPath);
|
|
2125
|
+
console.log(chalk2.blue("[Rayburst] Starting code analysis..."));
|
|
2126
|
+
await runAnalysis();
|
|
2127
|
+
},
|
|
2128
|
+
configureServer(server) {
|
|
2129
|
+
if (!enabled) return;
|
|
2130
|
+
console.log(chalk2.blue("[Rayburst] Configuring git watcher..."));
|
|
2131
|
+
const gitHeadPath = path5.join(config.root, ".git", "HEAD");
|
|
2132
|
+
if (fs3.existsSync(gitHeadPath)) {
|
|
2133
|
+
server.watcher.add(gitHeadPath);
|
|
2134
|
+
const handleGitChange = (changedPath) => {
|
|
2135
|
+
if (changedPath === gitHeadPath || changedPath.includes(".git/refs/heads/")) {
|
|
2136
|
+
console.log(chalk2.dim("[Rayburst] Git state changed, re-analyzing..."));
|
|
2137
|
+
runAnalysis("git-event");
|
|
2138
|
+
}
|
|
2139
|
+
};
|
|
2140
|
+
server.watcher.on("change", handleGitChange);
|
|
2141
|
+
checkGitState(config.root);
|
|
2142
|
+
gitPollInterval = setInterval(() => {
|
|
2143
|
+
if (checkGitState(config.root)) {
|
|
2144
|
+
console.log(chalk2.dim("[Rayburst] Git state changed (poll), re-analyzing..."));
|
|
2145
|
+
runAnalysis("git-poll");
|
|
2146
|
+
}
|
|
2147
|
+
}, 5e3);
|
|
2121
2148
|
}
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
runAnalysis(filePath);
|
|
2126
|
-
}, debounceMs);
|
|
2127
|
-
};
|
|
2128
|
-
const srcPath = path5.join(config.root, "src");
|
|
2129
|
-
if (fs3.existsSync(srcPath)) {
|
|
2130
|
-
console.log(chalk2.blue("[Rayburst] Creating dedicated file watcher..."));
|
|
2131
|
-
fileWatcher = chokidar.watch(srcPath, {
|
|
2132
|
-
ignored: [
|
|
2133
|
-
"**/node_modules/**",
|
|
2134
|
-
"**/.rayburst/**",
|
|
2135
|
-
"**/*.test.*",
|
|
2136
|
-
"**/*.spec.*",
|
|
2137
|
-
"**/.git/**"
|
|
2138
|
-
],
|
|
2139
|
-
persistent: true,
|
|
2140
|
-
ignoreInitial: true,
|
|
2141
|
-
awaitWriteFinish: {
|
|
2142
|
-
stabilityThreshold: 100,
|
|
2143
|
-
pollInterval: 100
|
|
2149
|
+
return () => {
|
|
2150
|
+
if (debounceTimer) {
|
|
2151
|
+
clearTimeout(debounceTimer);
|
|
2144
2152
|
}
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
console.log(chalk2.green("[Rayburst] File watcher is ready and monitoring changes"));
|
|
2148
|
-
});
|
|
2149
|
-
fileWatcher.on("change", handleFileChange);
|
|
2150
|
-
fileWatcher.on("add", handleFileChange);
|
|
2151
|
-
fileWatcher.on("unlink", handleFileChange);
|
|
2152
|
-
console.log(chalk2.dim(`[Rayburst] Watching directory: ${srcPath}`));
|
|
2153
|
-
}
|
|
2154
|
-
const gitHeadPath = path5.join(config.root, ".git", "HEAD");
|
|
2155
|
-
if (fs3.existsSync(gitHeadPath)) {
|
|
2156
|
-
server.watcher.add(gitHeadPath);
|
|
2157
|
-
const handleGitChange = (changedPath) => {
|
|
2158
|
-
if (changedPath === gitHeadPath || changedPath.includes(".git/refs/heads/")) {
|
|
2159
|
-
console.log(chalk2.dim("[Rayburst] Git state changed, re-analyzing..."));
|
|
2160
|
-
runAnalysis("git-event");
|
|
2153
|
+
if (gitPollInterval) {
|
|
2154
|
+
clearInterval(gitPollInterval);
|
|
2161
2155
|
}
|
|
2162
2156
|
};
|
|
2163
|
-
server.watcher.on("change", handleGitChange);
|
|
2164
|
-
checkGitState(config.root);
|
|
2165
|
-
gitPollInterval = setInterval(() => {
|
|
2166
|
-
if (checkGitState(config.root)) {
|
|
2167
|
-
console.log(chalk2.dim("[Rayburst] Git state changed (poll), re-analyzing..."));
|
|
2168
|
-
runAnalysis("git-poll");
|
|
2169
|
-
}
|
|
2170
|
-
}, 5e3);
|
|
2171
2157
|
}
|
|
2172
|
-
return () => {
|
|
2173
|
-
if (fileWatcher) {
|
|
2174
|
-
fileWatcher.close();
|
|
2175
|
-
}
|
|
2176
|
-
if (debounceTimer) {
|
|
2177
|
-
clearTimeout(debounceTimer);
|
|
2178
|
-
}
|
|
2179
|
-
if (gitPollInterval) {
|
|
2180
|
-
clearInterval(gitPollInterval);
|
|
2181
|
-
}
|
|
2182
|
-
};
|
|
2183
2158
|
}
|
|
2184
2159
|
};
|
|
2185
|
-
}
|
|
2160
|
+
};
|
|
2161
|
+
var unplugin = createUnplugin(unpluginFactory);
|
|
2162
|
+
var rayburstPlugin = unplugin.vite;
|
|
2163
|
+
var vite_plugin_default = rayburstPlugin;
|
|
2186
2164
|
|
|
2187
2165
|
export {
|
|
2188
2166
|
analyzeProject,
|
|
@@ -2194,5 +2172,7 @@ export {
|
|
|
2194
2172
|
addGitignoreEntry,
|
|
2195
2173
|
isProjectInitialized,
|
|
2196
2174
|
initializeProject,
|
|
2197
|
-
|
|
2175
|
+
unpluginFactory,
|
|
2176
|
+
rayburstPlugin,
|
|
2177
|
+
vite_plugin_default
|
|
2198
2178
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { RayburstPluginOptions, rayburstPlugin } from './vite-plugin.js';
|
|
1
|
+
export { RayburstPluginOptions, default as rayburstPlugin } from './vite-plugin.js';
|
|
2
2
|
import { AnalysisResult } from '@rayburst/types';
|
|
3
3
|
export { AnalysisResult } from '@rayburst/types';
|
|
4
4
|
import 'vite';
|
|
5
|
+
import 'unplugin';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Analyze a TypeScript/React project and generate nodes/edges data
|
package/dist/index.js
CHANGED
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as vite from 'vite';
|
|
2
|
+
import { UnpluginFactory } from 'unplugin';
|
|
2
3
|
|
|
3
4
|
interface RayburstPluginOptions {
|
|
4
5
|
enabled?: boolean;
|
|
5
6
|
debounceMs?: number;
|
|
6
7
|
outputPath?: string;
|
|
7
8
|
}
|
|
8
|
-
declare
|
|
9
|
+
declare const unpluginFactory: UnpluginFactory<RayburstPluginOptions | undefined>;
|
|
10
|
+
declare const rayburstPlugin: (options?: RayburstPluginOptions) => vite.Plugin<any> | vite.Plugin<any>[];
|
|
9
11
|
|
|
10
|
-
export { type RayburstPluginOptions, rayburstPlugin };
|
|
12
|
+
export { type RayburstPluginOptions, rayburstPlugin as default, rayburstPlugin, unpluginFactory };
|
package/dist/vite-plugin.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rayburst/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.12",
|
|
4
4
|
"description": "Rayburst - Automatic code analysis for TypeScript/JavaScript projects via Vite plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@rayburst/cli": "^0.4.9",
|
|
46
46
|
"chalk": "^5.3.0",
|
|
47
|
-
"chokidar": "^3.6.0",
|
|
48
47
|
"ts-morph": "^21.0.1",
|
|
48
|
+
"unplugin": "^1.16.1",
|
|
49
49
|
"zod": "^4.2.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|