@depup/graphql-codegen__cli 7.3.0-depup.0 → 7.3.1-depup.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.
package/README.md CHANGED
@@ -13,8 +13,8 @@ npm install @depup/graphql-codegen__cli
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [@graphql-codegen/cli](https://www.npmjs.com/package/@graphql-codegen/cli) @ 7.3.0 |
17
- | Processed | 2026-08-22 |
16
+ | Original | [@graphql-codegen/cli](https://www.npmjs.com/package/@graphql-codegen/cli) @ 7.3.1 |
17
+ | Processed | 2026-08-23 |
18
18
  | Smoke test | passed |
19
19
  | Deps updated | 28 |
20
20
 
package/changes.json CHANGED
@@ -113,6 +113,6 @@
113
113
  "to": "^18.1.0"
114
114
  }
115
115
  },
116
- "timestamp": "2026-08-22T08:07:12.460Z",
116
+ "timestamp": "2026-08-23T16:05:30.633Z",
117
117
  "totalUpdated": 28
118
118
  }
package/cjs/config.js CHANGED
@@ -263,7 +263,6 @@ class CodegenContext {
263
263
  cwd;
264
264
  filepath;
265
265
  profiler;
266
- profilerOutput;
267
266
  checkModeStaleFiles = [];
268
267
  constructor({ config, graphqlConfig, filepath, }) {
269
268
  this._config = config;
@@ -317,10 +316,6 @@ class CodegenContext {
317
316
  }
318
317
  useProfiler() {
319
318
  this.profiler = (0, plugin_helpers_1.createProfiler)();
320
- const now = new Date(); // 2011-10-05T14:48:00.000Z
321
- const datetime = now.toISOString().split('.')[0]; // 2011-10-05T14:48:00
322
- const datetimeNormalized = datetime.replace(/-|:/g, ''); // 20111005T144800
323
- this.profilerOutput = `codegen-${datetimeNormalized}.json`;
324
319
  }
325
320
  getPluginContext() {
326
321
  return this._pluginContext;
@@ -98,9 +98,20 @@ async function generate(input, saveToFile = true) {
98
98
  await context.profiler.run(() => (0, hooks_js_1.lifecycleHooks)(config.hooks).afterAllFileWrite(generationResult.map(r => r.filename)), 'Lifecycle: afterAllFileWrite');
99
99
  return generationResult;
100
100
  }
101
+ // Flush the collected profiler events to disk, then reset the profiler so the
102
+ // next run produces its own trace under a fresh filename. No-op when profiling
103
+ // is disabled (the noop profiler has no `outputName`).
104
+ async function writeProfilerOutput() {
105
+ const { profiler } = context;
106
+ if (!profiler.outputName) {
107
+ return;
108
+ }
109
+ await (0, file_system_js_1.writeFile)((0, path_1.join)(context.cwd, profiler.outputName), JSON.stringify(profiler.collect()));
110
+ profiler.clear();
111
+ }
101
112
  // watch mode
102
113
  if (config.watch) {
103
- return (0, watcher_js_1.createWatcher)(context, writeOutput).runningWatcher;
114
+ return (0, watcher_js_1.createWatcher)(context, writeOutput, writeProfilerOutput).runningWatcher;
104
115
  }
105
116
  const { result: outputFiles, error } = await context.profiler.run(() => (0, codegen_js_1.executeCodegen)(context), 'executeCodegen');
106
117
  if (error) {
@@ -118,9 +129,7 @@ async function generate(input, saveToFile = true) {
118
129
  }
119
130
  await context.profiler.run(() => writeOutput(outputFiles), 'writeOutput');
120
131
  await context.profiler.run(() => (0, hooks_js_1.lifecycleHooks)(config.hooks).beforeDone(), 'Lifecycle: beforeDone');
121
- if (context.profilerOutput) {
122
- await (0, file_system_js_1.writeFile)((0, path_1.join)(context.cwd, context.profilerOutput), JSON.stringify(context.profiler.collect()));
123
- }
132
+ await writeProfilerOutput();
124
133
  return outputFiles;
125
134
  }
126
135
  function normalizeOverwriteConfig(config, outputPath) {
@@ -21,7 +21,13 @@ function log(msg) {
21
21
  function emitWatching(watchDir) {
22
22
  log(`${log_symbols_1.default.info} Watching for changes in ${watchDir}...`);
23
23
  }
24
- const createWatcher = (initialContext, onNext) => {
24
+ const createWatcher = (initialContext, onNext,
25
+ /**
26
+ * Called after a successful run (initial build or rebuild) once `onNext` has
27
+ * finished. Used to flush profiler output per run; a no-op when profiling is
28
+ * disabled.
29
+ */
30
+ afterRun = () => Promise.resolve()) => {
25
31
  (0, debugging_js_1.debugLog)(`[Watcher] Starting watcher...`);
26
32
  let config = initialContext.getConfig();
27
33
  const globalPatternSet = (0, patterns_js_1.makeGlobalPatternSet)(initialContext);
@@ -52,8 +58,9 @@ const createWatcher = (initialContext, onNext) => {
52
58
  let isShutdown = false;
53
59
  const debouncedExec = (0, debounce_1.default)(() => {
54
60
  if (!isShutdown) {
55
- (0, codegen_js_1.executeCodegen)(initialContext)
56
- .then(({ result, error }) => {
61
+ initialContext.profiler
62
+ .run(() => (0, codegen_js_1.executeCodegen)(initialContext), 'executeCodegen')
63
+ .then(async ({ result, error }) => {
57
64
  // FIXME: this is a quick fix to stop `onNext` (writeOutput) from
58
65
  // removing all files when there is an error.
59
66
  //
@@ -64,9 +71,13 @@ const createWatcher = (initialContext, onNext) => {
64
71
  //
65
72
  // This also means we don't have config.allowPartialOutputs in watch mode
66
73
  if (error) {
74
+ // Discard this failed run's profiler events so they don't leak
75
+ // into the next successful run's trace.
76
+ initialContext.profiler.clear();
67
77
  return;
68
78
  }
69
- onNext(result);
79
+ await onNext(result);
80
+ await afterRun();
70
81
  }, () => Promise.resolve())
71
82
  .then(() => emitWatching(watchDirectory));
72
83
  }
@@ -164,14 +175,19 @@ const createWatcher = (initialContext, onNext) => {
164
175
  * stopWatching() was called or there was an error inside it
165
176
  */
166
177
  stopWatching.runningWatcher = new Promise((resolve, reject) => {
167
- (0, codegen_js_1.executeCodegen)(initialContext)
168
- .then(({ result, error }) => {
178
+ initialContext.profiler
179
+ .run(() => (0, codegen_js_1.executeCodegen)(initialContext), 'executeCodegen')
180
+ .then(async ({ result, error }) => {
169
181
  // TODO: this is the initial run, the logic here mimics the above watcher logic.
170
182
  // We need to check whether it's ok to deviate between these two.
171
183
  if (error) {
184
+ // Discard this failed run's profiler events so they don't leak
185
+ // into the next successful run's trace.
186
+ initialContext.profiler.clear();
172
187
  return;
173
188
  }
174
- onNext(result);
189
+ await onNext(result);
190
+ await afterRun();
175
191
  }, () => Promise.resolve())
176
192
  .then(() => runWatcher(abortController.signal))
177
193
  .catch(err => {
package/cjs/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- exports.version = '7.3.0';
4
+ exports.version = '7.3.1';
package/esm/config.js CHANGED
@@ -251,7 +251,6 @@ export class CodegenContext {
251
251
  cwd;
252
252
  filepath;
253
253
  profiler;
254
- profilerOutput;
255
254
  checkModeStaleFiles = [];
256
255
  constructor({ config, graphqlConfig, filepath, }) {
257
256
  this._config = config;
@@ -305,10 +304,6 @@ export class CodegenContext {
305
304
  }
306
305
  useProfiler() {
307
306
  this.profiler = createProfiler();
308
- const now = new Date(); // 2011-10-05T14:48:00.000Z
309
- const datetime = now.toISOString().split('.')[0]; // 2011-10-05T14:48:00
310
- const datetimeNormalized = datetime.replace(/-|:/g, ''); // 20111005T144800
311
- this.profilerOutput = `codegen-${datetimeNormalized}.json`;
312
307
  }
313
308
  getPluginContext() {
314
309
  return this._pluginContext;
@@ -94,9 +94,20 @@ export async function generate(input, saveToFile = true) {
94
94
  await context.profiler.run(() => lifecycleHooks(config.hooks).afterAllFileWrite(generationResult.map(r => r.filename)), 'Lifecycle: afterAllFileWrite');
95
95
  return generationResult;
96
96
  }
97
+ // Flush the collected profiler events to disk, then reset the profiler so the
98
+ // next run produces its own trace under a fresh filename. No-op when profiling
99
+ // is disabled (the noop profiler has no `outputName`).
100
+ async function writeProfilerOutput() {
101
+ const { profiler } = context;
102
+ if (!profiler.outputName) {
103
+ return;
104
+ }
105
+ await writeFile(join(context.cwd, profiler.outputName), JSON.stringify(profiler.collect()));
106
+ profiler.clear();
107
+ }
97
108
  // watch mode
98
109
  if (config.watch) {
99
- return createWatcher(context, writeOutput).runningWatcher;
110
+ return createWatcher(context, writeOutput, writeProfilerOutput).runningWatcher;
100
111
  }
101
112
  const { result: outputFiles, error } = await context.profiler.run(() => executeCodegen(context), 'executeCodegen');
102
113
  if (error) {
@@ -114,9 +125,7 @@ export async function generate(input, saveToFile = true) {
114
125
  }
115
126
  await context.profiler.run(() => writeOutput(outputFiles), 'writeOutput');
116
127
  await context.profiler.run(() => lifecycleHooks(config.hooks).beforeDone(), 'Lifecycle: beforeDone');
117
- if (context.profilerOutput) {
118
- await writeFile(join(context.cwd, context.profilerOutput), JSON.stringify(context.profiler.collect()));
119
- }
128
+ await writeProfilerOutput();
120
129
  return outputFiles;
121
130
  }
122
131
  function normalizeOverwriteConfig(config, outputPath) {
@@ -17,7 +17,13 @@ function log(msg) {
17
17
  function emitWatching(watchDir) {
18
18
  log(`${logSymbols.info} Watching for changes in ${watchDir}...`);
19
19
  }
20
- export const createWatcher = (initialContext, onNext) => {
20
+ export const createWatcher = (initialContext, onNext,
21
+ /**
22
+ * Called after a successful run (initial build or rebuild) once `onNext` has
23
+ * finished. Used to flush profiler output per run; a no-op when profiling is
24
+ * disabled.
25
+ */
26
+ afterRun = () => Promise.resolve()) => {
21
27
  debugLog(`[Watcher] Starting watcher...`);
22
28
  let config = initialContext.getConfig();
23
29
  const globalPatternSet = makeGlobalPatternSet(initialContext);
@@ -48,8 +54,9 @@ export const createWatcher = (initialContext, onNext) => {
48
54
  let isShutdown = false;
49
55
  const debouncedExec = debounce(() => {
50
56
  if (!isShutdown) {
51
- executeCodegen(initialContext)
52
- .then(({ result, error }) => {
57
+ initialContext.profiler
58
+ .run(() => executeCodegen(initialContext), 'executeCodegen')
59
+ .then(async ({ result, error }) => {
53
60
  // FIXME: this is a quick fix to stop `onNext` (writeOutput) from
54
61
  // removing all files when there is an error.
55
62
  //
@@ -60,9 +67,13 @@ export const createWatcher = (initialContext, onNext) => {
60
67
  //
61
68
  // This also means we don't have config.allowPartialOutputs in watch mode
62
69
  if (error) {
70
+ // Discard this failed run's profiler events so they don't leak
71
+ // into the next successful run's trace.
72
+ initialContext.profiler.clear();
63
73
  return;
64
74
  }
65
- onNext(result);
75
+ await onNext(result);
76
+ await afterRun();
66
77
  }, () => Promise.resolve())
67
78
  .then(() => emitWatching(watchDirectory));
68
79
  }
@@ -160,14 +171,19 @@ export const createWatcher = (initialContext, onNext) => {
160
171
  * stopWatching() was called or there was an error inside it
161
172
  */
162
173
  stopWatching.runningWatcher = new Promise((resolve, reject) => {
163
- executeCodegen(initialContext)
164
- .then(({ result, error }) => {
174
+ initialContext.profiler
175
+ .run(() => executeCodegen(initialContext), 'executeCodegen')
176
+ .then(async ({ result, error }) => {
165
177
  // TODO: this is the initial run, the logic here mimics the above watcher logic.
166
178
  // We need to check whether it's ok to deviate between these two.
167
179
  if (error) {
180
+ // Discard this failed run's profiler events so they don't leak
181
+ // into the next successful run's trace.
182
+ initialContext.profiler.clear();
168
183
  return;
169
184
  }
170
- onNext(result);
185
+ await onNext(result);
186
+ await afterRun();
171
187
  }, () => Promise.resolve())
172
188
  .then(() => runWatcher(abortController.signal))
173
189
  .catch(err => {
package/esm/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '7.3.0';
1
+ export const version = '7.3.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depup/graphql-codegen__cli",
3
- "version": "7.3.0-depup.0",
3
+ "version": "7.3.1-depup.0",
4
4
  "peerDependenciesMeta": {
5
5
  "@parcel/watcher": {
6
6
  "optional": true
@@ -45,7 +45,7 @@
45
45
  "yargs": "^18.1.0",
46
46
  "@graphql-codegen/client-preset": "^6.1.3",
47
47
  "@graphql-codegen/core": "^6.2.0",
48
- "@graphql-codegen/plugin-helpers": "^7.2.0"
48
+ "@graphql-codegen/plugin-helpers": "^7.2.1"
49
49
  },
50
50
  "repository": {
51
51
  "type": "git",
@@ -229,8 +229,8 @@
229
229
  },
230
230
  "depsUpdated": 28,
231
231
  "originalPackage": "@graphql-codegen/cli",
232
- "originalVersion": "7.3.0",
233
- "processedAt": "2026-08-22T08:07:27.602Z",
232
+ "originalVersion": "7.3.1",
233
+ "processedAt": "2026-08-23T16:05:44.949Z",
234
234
  "smokeTest": "passed"
235
235
  }
236
236
  }
@@ -131,7 +131,6 @@ export declare class CodegenContext {
131
131
  cwd: string;
132
132
  filepath: string;
133
133
  profiler: Profiler;
134
- profilerOutput?: string;
135
134
  checkModeStaleFiles: any[];
136
135
  constructor({ config, graphqlConfig, filepath, }: {
137
136
  config?: Types.Config;
@@ -131,7 +131,6 @@ export declare class CodegenContext {
131
131
  cwd: string;
132
132
  filepath: string;
133
133
  profiler: Profiler;
134
- profilerOutput?: string;
135
134
  checkModeStaleFiles: any[];
136
135
  constructor({ config, graphqlConfig, filepath, }: {
137
136
  config?: Types.Config;
@@ -1,6 +1,12 @@
1
1
  import { Types } from '@graphql-codegen/plugin-helpers';
2
2
  import { CodegenContext } from '../config.cjs';
3
- export declare const createWatcher: (initialContext: CodegenContext, onNext: (result: Types.FileOutput[]) => Promise<Types.FileOutput[]>) => {
3
+ export declare const createWatcher: (initialContext: CodegenContext, onNext: (result: Types.FileOutput[]) => Promise<Types.FileOutput[]>,
4
+ /**
5
+ * Called after a successful run (initial build or rebuild) once `onNext` has
6
+ * finished. Used to flush profiler output per run; a no-op when profiling is
7
+ * disabled.
8
+ */
9
+ afterRun?: () => Promise<void>) => {
4
10
  /**
5
11
  * Call this function to stop the running watch server
6
12
  *
@@ -1,6 +1,12 @@
1
1
  import { Types } from '@graphql-codegen/plugin-helpers';
2
2
  import { CodegenContext } from '../config.js';
3
- export declare const createWatcher: (initialContext: CodegenContext, onNext: (result: Types.FileOutput[]) => Promise<Types.FileOutput[]>) => {
3
+ export declare const createWatcher: (initialContext: CodegenContext, onNext: (result: Types.FileOutput[]) => Promise<Types.FileOutput[]>,
4
+ /**
5
+ * Called after a successful run (initial build or rebuild) once `onNext` has
6
+ * finished. Used to flush profiler output per run; a no-op when profiling is
7
+ * disabled.
8
+ */
9
+ afterRun?: () => Promise<void>) => {
4
10
  /**
5
11
  * Call this function to stop the running watch server
6
12
  *