@depup/nestjs__cli 12.0.3-depup.0 → 12.0.5-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/nestjs__cli
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [@nestjs/cli](https://www.npmjs.com/package/@nestjs/cli) @ 12.0.3 |
17
- | Processed | 2026-09-16 |
16
+ | Original | [@nestjs/cli](https://www.npmjs.com/package/@nestjs/cli) @ 12.0.5 |
17
+ | Processed | 2026-09-22 |
18
18
  | Smoke test | failed |
19
19
  | Deps updated | 2 |
20
20
 
@@ -22,7 +22,7 @@ npm install @depup/nestjs__cli
22
22
 
23
23
  | Dependency | From | To |
24
24
  |------------|------|-----|
25
- | @nestjs/schematics | ^12.0.0 | ^12.0.3 |
25
+ | @nestjs/schematics | ^12.0.0 | ^12.0.4 |
26
26
  | typescript | ~6.0.2 | ^7.0.2 |
27
27
 
28
28
  ---
package/changes.json CHANGED
@@ -2,13 +2,13 @@
2
2
  "bumped": {
3
3
  "@nestjs/schematics": {
4
4
  "from": "^12.0.0",
5
- "to": "^12.0.3"
5
+ "to": "^12.0.4"
6
6
  },
7
7
  "typescript": {
8
8
  "from": "~6.0.2",
9
9
  "to": "^7.0.2"
10
10
  }
11
11
  },
12
- "timestamp": "2026-09-16T16:10:03.462Z",
12
+ "timestamp": "2026-09-22T16:11:07.853Z",
13
13
  "totalUpdated": 2
14
14
  }
@@ -5,8 +5,15 @@ export declare const swcDefaultsFactory: (tsOptions?: ts.CompilerOptions, config
5
5
  sourceMaps: string | boolean | undefined;
6
6
  module: {
7
7
  type: string;
8
+ resolveFully: boolean;
9
+ } | {
10
+ type: string;
11
+ resolveFully?: undefined;
8
12
  };
9
13
  jsc: {
14
+ experimental?: {
15
+ keepImportAttributes: boolean;
16
+ } | undefined;
10
17
  target: string;
11
18
  parser: {
12
19
  syntax: string;
@@ -62,3 +69,10 @@ export declare const swcDefaultsFactory: (tsOptions?: ts.CompilerOptions, config
62
69
  stripLeadingPaths: boolean;
63
70
  };
64
71
  };
72
+ /**
73
+ * Picks the module format tsc would emit for the project's `.ts` files: ES
74
+ * modules when the package is `"type": "module"`, unless the tsconfig pins an
75
+ * older, non-ES module kind (e.g. `"module": "commonjs"`). Projects without
76
+ * `"type": "module"` keep CommonJS output.
77
+ */
78
+ export declare function resolveSwcModuleType(tsOptions?: ts.CompilerOptions, esmPackage?: boolean): 'es6' | 'commonjs';
@@ -1,13 +1,24 @@
1
+ import * as ts from 'typescript';
2
+ import { isEsmProject } from '../../utils/is-esm-project.js';
1
3
  export const swcDefaultsFactory = (tsOptions, configuration, tsConfigExclude = []) => {
2
4
  const builderOptions = typeof configuration?.compilerOptions?.builder !== 'string'
3
5
  ? configuration?.compilerOptions?.builder?.options
4
6
  : {};
7
+ const esm = resolveSwcModuleType(tsOptions) === 'es6';
5
8
  return {
6
9
  swcOptions: {
7
10
  sourceMaps: tsOptions?.sourceMap || (tsOptions?.inlineSourceMap && 'inline'),
8
- module: {
9
- type: 'commonjs',
10
- },
11
+ module: esm
12
+ ? {
13
+ type: 'es6',
14
+ // Node's ESM resolver requires full specifiers, so give the ones
15
+ // swc rewrites from "paths" (and any extensionless relative ones)
16
+ // the extension of the emitted file, or "/index.js" for directories.
17
+ resolveFully: true,
18
+ }
19
+ : {
20
+ type: 'commonjs',
21
+ },
11
22
  jsc: {
12
23
  target: 'es2021',
13
24
  parser: {
@@ -21,8 +32,11 @@ export const swcDefaultsFactory = (tsOptions, configuration, tsConfigExclude = [
21
32
  useDefineForClassFields: false,
22
33
  },
23
34
  keepClassNames: true,
24
- baseUrl: tsOptions?.baseUrl,
35
+ baseUrl: resolveBaseUrl(tsOptions),
25
36
  paths: tsOptions?.paths,
37
+ // swc drops import attributes by default, but Node needs
38
+ // `with { type: 'json' }` to import JSON from ES modules.
39
+ ...(esm && { experimental: { keepImportAttributes: true } }),
26
40
  },
27
41
  minify: false,
28
42
  swcrc: true,
@@ -42,6 +56,35 @@ export const swcDefaultsFactory = (tsOptions, configuration, tsConfigExclude = [
42
56
  },
43
57
  };
44
58
  };
59
+ /**
60
+ * Picks the module format tsc would emit for the project's `.ts` files: ES
61
+ * modules when the package is `"type": "module"`, unless the tsconfig pins an
62
+ * older, non-ES module kind (e.g. `"module": "commonjs"`). Projects without
63
+ * `"type": "module"` keep CommonJS output.
64
+ */
65
+ export function resolveSwcModuleType(tsOptions, esmPackage = isEsmProject()) {
66
+ if (!esmPackage) {
67
+ return 'commonjs';
68
+ }
69
+ const moduleKind = tsOptions?.module;
70
+ if (moduleKind !== undefined && moduleKind < ts.ModuleKind.ES2015) {
71
+ return 'commonjs';
72
+ }
73
+ return 'es6';
74
+ }
75
+ /**
76
+ * Without "baseUrl" (deprecated as of TypeScript 6), tsc resolves "paths"
77
+ * relative to the directory of the tsconfig that declares them, which the
78
+ * TypeScript parser exposes as "pathsBasePath". swc has no such fallback and
79
+ * panics when "paths" is set without "jsc.baseUrl", so pass that directory.
80
+ */
81
+ function resolveBaseUrl(tsOptions) {
82
+ if (tsOptions?.baseUrl || !tsOptions?.paths) {
83
+ return tsOptions?.baseUrl;
84
+ }
85
+ const pathsBasePath = tsOptions.pathsBasePath;
86
+ return typeof pathsBasePath === 'string' ? pathsBasePath : undefined;
87
+ }
45
88
  /**
46
89
  * Mirrors tsc's output layout: tsc flattens the source directory out of the
47
90
  * output when its (effective) rootDir is the source root, so swc must strip
@@ -2,6 +2,7 @@ import { cyan } from 'ansis';
2
2
  import { fork, spawnSync } from 'child_process';
3
3
  import { readFileSync } from 'fs';
4
4
  import { stat } from 'fs/promises';
5
+ import { parse as parseJsonc, printParseErrorCode, } from 'jsonc-parser';
5
6
  import { minimatch } from 'minimatch';
6
7
  import { createRequire } from 'module';
7
8
  import * as path from 'path';
@@ -186,17 +187,46 @@ export class SwcCompiler extends BaseCompiler {
186
187
  }
187
188
  }
188
189
  getSwcRcFileContentIfExists(swcrcFilePath) {
190
+ const isCustomPath = swcrcFilePath !== undefined;
191
+ const resolvedPath = join(process.cwd(), swcrcFilePath ?? '.swcrc');
192
+ let content;
189
193
  try {
190
- return JSON.parse(readFileSync(join(process.cwd(), swcrcFilePath ?? '.swcrc'), 'utf8'));
194
+ content = readFileSync(resolvedPath, 'utf8');
191
195
  }
192
- catch {
193
- if (swcrcFilePath !== undefined) {
196
+ catch (err) {
197
+ // Only treat ENOENT on the default `.swcrc` as "no user overrides to
198
+ // merge". Any other read error (EACCES, EISDIR, …) or a missing
199
+ // user-specified `swcrcPath` is a fatal misconfiguration.
200
+ const isMissing = err?.code === 'ENOENT';
201
+ if (isCustomPath || !isMissing) {
194
202
  console.error(ERROR_PREFIX +
195
- ` Failed to load "${swcrcFilePath}". Please, check if the file exists and is valid JSON.`);
203
+ ` Failed to load "${swcrcFilePath ?? '.swcrc'}". Please, check if the file exists and is readable.`);
196
204
  process.exit(1);
197
205
  }
198
206
  return {};
199
207
  }
208
+ // SWC strips a leading UTF-8 BOM before parsing
209
+ // (`s.trim_start_matches('\u{feff}')`), so match that here — otherwise
210
+ // `jsonc-parser` fails with `InvalidSymbol` on files SWC accepts.
211
+ const stripped = content.replace(/^/, '');
212
+ // .swcrc is JSON-with-comments in SWC itself, which uses jsonc_parser
213
+ // with `allow_comments` + `allow_trailing_commas` enabled (see swc's
214
+ // `parse_swcrc` in crates/swc/src/lib.rs). Match that here so we don't
215
+ // silently reject a valid `.swcrc` that carries `//` / `/* */` comments
216
+ // or a trailing comma.
217
+ const errors = [];
218
+ const parsed = parseJsonc(stripped, errors, { allowTrailingComma: true });
219
+ if (errors.length > 0) {
220
+ const first = errors[0];
221
+ const before = stripped.slice(0, first.offset).split('\n');
222
+ const position = `${before.length}:${before[before.length - 1].length + 1}`;
223
+ console.error(ERROR_PREFIX +
224
+ ` Failed to parse "${swcrcFilePath ?? '.swcrc'}": ` +
225
+ `${printParseErrorCode(first.error)} at ${position}. ` +
226
+ `The file must be valid JSON with comments (JSONC).`);
227
+ process.exit(1);
228
+ }
229
+ return parsed ?? {};
200
230
  }
201
231
  deepMerge(target, source) {
202
232
  if (typeof target !== 'object' ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depup/nestjs__cli",
3
- "version": "12.0.3-depup.0",
3
+ "version": "12.0.5-depup.0",
4
4
  "type": "module",
5
5
  "description": "Nest - modern, fast, powerful node.js web framework (@cli) (with updated dependencies)",
6
6
  "engines": {
@@ -39,11 +39,12 @@
39
39
  "@angular-devkit/schematics": "22.1.8",
40
40
  "@angular-devkit/schematics-cli": "22.1.8",
41
41
  "@inquirer/prompts": "8.7.2",
42
- "@nestjs/schematics": "^12.0.3",
42
+ "@nestjs/schematics": "^12.0.4",
43
43
  "ansis": "4.4.0",
44
44
  "chokidar": "5.0.0",
45
45
  "cli-table3": "0.6.5",
46
46
  "commander": "15.0.0",
47
+ "jsonc-parser": "3.3.1",
47
48
  "minimatch": "10.2.6",
48
49
  "node-emoji": "2.2.0",
49
50
  "ora": "9.4.1",
@@ -51,12 +52,12 @@
51
52
  "typescript": "^7.0.2"
52
53
  },
53
54
  "devDependencies": {
54
- "@commitlint/cli": "21.2.2",
55
- "@commitlint/config-angular": "21.2.2",
55
+ "@commitlint/cli": "21.2.3",
56
+ "@commitlint/config-angular": "21.2.3",
56
57
  "@rspack/core": "^2.0.0",
57
58
  "@swc/cli": "0.8.1",
58
59
  "@swc/core": "1.16.2",
59
- "@types/node": "25.9.7",
60
+ "@types/node": "25.9.8",
60
61
  "@types/webpack-node-externals": "3.0.4",
61
62
  "delete-empty": "3.0.0",
62
63
  "fork-ts-checker-webpack-plugin": "9.1.0",
@@ -64,14 +65,14 @@
64
65
  "gulp-clean": "0.4.0",
65
66
  "husky": "9.1.7",
66
67
  "lint-staged": "17.5.1",
67
- "oxlint": "1.83.0",
68
- "prettier": "3.9.6",
69
- "release-it": "21.0.3",
68
+ "oxlint": "1.85.0",
69
+ "prettier": "3.9.8",
70
+ "release-it": "21.1.0",
70
71
  "ts-loader": "9.6.2",
71
72
  "tsconfig-paths-webpack-plugin": "4.2.0",
72
73
  "vite": "8.3.0",
73
74
  "vitest": "5.0.1",
74
- "webpack": "5.111.0",
75
+ "webpack": "5.111.1",
75
76
  "webpack-node-externals": "3.0.0"
76
77
  },
77
78
  "lint-staged": {
@@ -125,7 +126,7 @@
125
126
  "changes": {
126
127
  "@nestjs/schematics": {
127
128
  "from": "^12.0.0",
128
- "to": "^12.0.3"
129
+ "to": "^12.0.4"
129
130
  },
130
131
  "typescript": {
131
132
  "from": "~6.0.2",
@@ -134,8 +135,8 @@
134
135
  },
135
136
  "depsUpdated": 2,
136
137
  "originalPackage": "@nestjs/cli",
137
- "originalVersion": "12.0.3",
138
- "processedAt": "2026-09-16T16:10:23.897Z",
138
+ "originalVersion": "12.0.5",
139
+ "processedAt": "2026-09-22T16:11:27.400Z",
139
140
  "smokeTest": "failed"
140
141
  }
141
142
  }