@synergenius/flow-weaver 0.8.1 → 0.8.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.
@@ -356,7 +356,7 @@ export function generateCode(ast, options) {
356
356
  if (sourceMapGenerator && ast.sourceFile) {
357
357
  try {
358
358
  const sourceContent = fs.readFileSync(ast.sourceFile, 'utf-8');
359
- const sourceLines = sourceContent.split('\n');
359
+ const sourceLines = sourceContent.split(/\r?\n/);
360
360
  const exportLineIndex = sourceLines.findIndex((line) => line.includes(`export`) && line.includes(`function ${ast.functionName}`));
361
361
  if (exportLineIndex >= 0) {
362
362
  addMapping(exportLineIndex + 1, 0); // Line numbers are 1-indexed
@@ -66,7 +66,7 @@ function getCommits(rangeArg) {
66
66
  return [];
67
67
  }
68
68
  const entries = [];
69
- for (const line of logOutput.split('\n')) {
69
+ for (const line of logOutput.split(/\r?\n/)) {
70
70
  if (!line.trim())
71
71
  continue;
72
72
  const spaceIdx = line.indexOf(' ');
@@ -78,7 +78,7 @@ function getCommits(rangeArg) {
78
78
  const filesOutput = execSync(`git diff-tree --no-commit-id --name-only -r ${hash}`, {
79
79
  encoding: 'utf8',
80
80
  }).trim();
81
- files = filesOutput ? filesOutput.split('\n') : [];
81
+ files = filesOutput ? filesOutput.split(/\r?\n/) : [];
82
82
  }
83
83
  catch {
84
84
  files = [];
@@ -21,7 +21,7 @@ function insertIntoFile(filePath, content, line) {
21
21
  return;
22
22
  }
23
23
  const existingContent = fs.readFileSync(filePath, 'utf8');
24
- const lines = existingContent.split('\n');
24
+ const lines = existingContent.split(/\r?\n/);
25
25
  if (line !== undefined && line > 0) {
26
26
  // Insert AFTER specific line (1-indexed)
27
27
  // Line 3 means insert after line 3, so at index 3
@@ -247,7 +247,7 @@ async function runInngestDevMode(filePath, options) {
247
247
  };
248
248
  const stopServer = () => {
249
249
  if (serverProcess && !serverProcess.killed) {
250
- serverProcess.kill('SIGTERM');
250
+ serverProcess.kill();
251
251
  serverProcess = null;
252
252
  }
253
253
  };
@@ -311,7 +311,8 @@ async function runInngestDevMode(filePath, options) {
311
311
  process.exit(0);
312
312
  };
313
313
  process.on('SIGINT', cleanup);
314
- process.on('SIGTERM', cleanup);
314
+ if (process.platform !== 'win32')
315
+ process.on('SIGTERM', cleanup);
315
316
  // Keep process alive
316
317
  await new Promise(() => { });
317
318
  }
@@ -375,7 +376,8 @@ export async function devCommand(input, options = {}) {
375
376
  process.exit(0);
376
377
  };
377
378
  process.on('SIGINT', cleanup);
378
- process.on('SIGTERM', cleanup);
379
+ if (process.platform !== 'win32')
380
+ process.on('SIGTERM', cleanup);
379
381
  // Keep process alive
380
382
  await new Promise(() => {
381
383
  // Never resolves - keeps process running
@@ -67,7 +67,8 @@ export async function serveCommand(dir, options) {
67
67
  process.exit(0);
68
68
  };
69
69
  process.on('SIGINT', () => shutdown('SIGINT'));
70
- process.on('SIGTERM', () => shutdown('SIGTERM'));
70
+ if (process.platform !== 'win32')
71
+ process.on('SIGTERM', () => shutdown('SIGTERM'));
71
72
  try {
72
73
  await server.start();
73
74
  }
@@ -0,0 +1,7 @@
1
+ export interface StripOptions {
2
+ output?: string;
3
+ dryRun?: boolean;
4
+ verbose?: boolean;
5
+ }
6
+ export declare function stripCommand(input: string, options?: StripOptions): Promise<void>;
7
+ //# sourceMappingURL=strip.d.ts.map
@@ -0,0 +1,62 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { glob } from 'glob';
4
+ import { hasInPlaceMarkers, stripGeneratedSections } from '../../api/generate-in-place.js';
5
+ import { logger } from '../utils/logger.js';
6
+ export async function stripCommand(input, options = {}) {
7
+ const { output, dryRun = false, verbose = false } = options;
8
+ // If input is a directory, expand to all .ts files recursively
9
+ let pattern = input;
10
+ try {
11
+ if (fs.existsSync(input) && fs.statSync(input).isDirectory()) {
12
+ pattern = path.join(input, '**/*.ts');
13
+ }
14
+ }
15
+ catch {
16
+ // Not a valid path, use as glob pattern
17
+ }
18
+ const allFiles = await glob(pattern, { absolute: true });
19
+ const files = allFiles.filter((f) => {
20
+ try {
21
+ return fs.statSync(f).isFile();
22
+ }
23
+ catch {
24
+ return false;
25
+ }
26
+ });
27
+ if (files.length === 0) {
28
+ logger.error(`No files found matching pattern: ${input}`);
29
+ process.exit(1);
30
+ }
31
+ let stripped = 0;
32
+ let skipped = 0;
33
+ for (const filePath of files) {
34
+ const content = fs.readFileSync(filePath, 'utf-8');
35
+ if (!hasInPlaceMarkers(content)) {
36
+ skipped++;
37
+ if (verbose) {
38
+ logger.info(`Skipped (no markers): ${path.relative(process.cwd(), filePath)}`);
39
+ }
40
+ continue;
41
+ }
42
+ const result = stripGeneratedSections(content);
43
+ if (dryRun) {
44
+ logger.info(`Would strip: ${path.relative(process.cwd(), filePath)}`);
45
+ stripped++;
46
+ continue;
47
+ }
48
+ const outPath = output
49
+ ? path.join(path.resolve(output), path.basename(filePath))
50
+ : filePath;
51
+ if (output) {
52
+ fs.mkdirSync(path.dirname(outPath), { recursive: true });
53
+ }
54
+ fs.writeFileSync(outPath, result);
55
+ stripped++;
56
+ if (verbose) {
57
+ logger.success(`Stripped: ${path.relative(process.cwd(), outPath)}`);
58
+ }
59
+ }
60
+ logger.success(`${stripped} file${stripped !== 1 ? 's' : ''} stripped, ${skipped} skipped`);
61
+ }
62
+ //# sourceMappingURL=strip.js.map
@@ -61,7 +61,8 @@ export async function watchCommand(input, options = {}) {
61
61
  process.exit(0);
62
62
  };
63
63
  process.on('SIGINT', cleanup);
64
- process.on('SIGTERM', cleanup);
64
+ if (process.platform !== 'win32')
65
+ process.on('SIGTERM', cleanup);
65
66
  // Keep process alive
66
67
  await new Promise(() => {
67
68
  // Never resolves - keeps process running