nestjs-docfy 0.4.0 → 0.5.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/LICENSE +21 -0
- package/README.md +119 -66
- package/dist/apply-docfy-metadata.d.ts +37 -0
- package/dist/apply-docfy-metadata.js +55 -0
- package/dist/apply-docfy-metadata.js.map +1 -0
- package/dist/cli/build-openapi-patch.d.ts +16 -12
- package/dist/cli/build-openapi-patch.js +98 -15
- package/dist/cli/build-openapi-patch.js.map +1 -1
- package/dist/cli/check.js.map +1 -1
- package/dist/cli/coverage.js +1 -3
- package/dist/cli/coverage.js.map +1 -1
- package/dist/cli/detect-project.js +1 -5
- package/dist/cli/detect-project.js.map +1 -1
- package/dist/cli/errors.js.map +1 -1
- package/dist/cli/eval-decorator-args.d.ts +5 -3
- package/dist/cli/eval-decorator-args.js +64 -11
- package/dist/cli/eval-decorator-args.js.map +1 -1
- package/dist/cli/extract-docs-config.d.ts +21 -1
- package/dist/cli/extract-docs-config.js +18 -6
- package/dist/cli/extract-docs-config.js.map +1 -1
- package/dist/cli/extract-methods.d.ts +11 -0
- package/dist/cli/extract-methods.js +113 -29
- package/dist/cli/extract-methods.js.map +1 -1
- package/dist/cli/generate-file.js +24 -24
- package/dist/cli/generate-file.js.map +1 -1
- package/dist/cli/index.js +5 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/lint.js +1 -3
- package/dist/cli/lint.js.map +1 -1
- package/dist/cli/logger.js +12 -6
- package/dist/cli/logger.js.map +1 -1
- package/dist/cli/merge-docs.js.map +1 -1
- package/dist/cli/merge-spec-patch.d.ts +15 -8
- package/dist/cli/merge-spec-patch.js +20 -4
- package/dist/cli/merge-spec-patch.js.map +1 -1
- package/dist/cli/parse-args.js +2 -6
- package/dist/cli/parse-args.js.map +1 -1
- package/dist/cli/patch-spec.d.ts +32 -8
- package/dist/cli/patch-spec.js +37 -15
- package/dist/cli/patch-spec.js.map +1 -1
- package/dist/cli/resolve-tsconfig.js +1 -5
- package/dist/cli/resolve-tsconfig.js.map +1 -1
- package/dist/cli/scan-controllers.d.ts +11 -0
- package/dist/cli/scan-controllers.js +10 -3
- package/dist/cli/scan-controllers.js.map +1 -1
- package/dist/cli/watch.js +3 -1
- package/dist/cli/watch.js.map +1 -1
- package/dist/cli/writer.js.map +1 -1
- package/dist/docfy-ui.module.js +2 -2
- package/dist/docfy-ui.module.js.map +1 -1
- package/dist/docfy.module.js +1 -1
- package/dist/docfy.module.js.map +1 -1
- package/dist/docs.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin/generate-metadata.d.ts +35 -0
- package/dist/plugin/generate-metadata.js +46 -0
- package/dist/plugin/generate-metadata.js.map +1 -0
- package/dist/plugin/index.d.ts +30 -0
- package/dist/plugin/index.js +62 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/registry.d.ts +3 -3
- package/dist/registry.js.map +1 -1
- package/dist/resolve-docs-path.d.ts +1 -1
- package/dist/resolve-docs-path.js.map +1 -1
- package/dist/resolve-source-from-stack.js.map +1 -1
- package/dist/with-docs.decorator.js.map +1 -1
- package/package.json +23 -3
package/dist/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export { docs, DocsConfig } from './docs';
|
|
|
3
3
|
export { DocfyModule, DocfyModuleOptions } from './docfy.module';
|
|
4
4
|
export { attachTagGroups } from './attach-tag-groups';
|
|
5
5
|
export { TagGroup } from './tag-group-registry';
|
|
6
|
-
export { DocfyUiModule, DocfyUiSetupTarget, DocfyUiSetupOptions, DocfyUiHttpAdapter
|
|
6
|
+
export { DocfyUiModule, DocfyUiSetupTarget, DocfyUiSetupOptions, DocfyUiHttpAdapter } from './docfy-ui.module';
|
|
7
|
+
export { applyDocfyMetadata, ApplyDocfyMetadataOptions } from './apply-docfy-metadata';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DocfyUiModule = exports.attachTagGroups = exports.DocfyModule = exports.docs = exports.DOCFY_MARKER = exports.WithDocs = void 0;
|
|
3
|
+
exports.applyDocfyMetadata = exports.DocfyUiModule = exports.attachTagGroups = exports.DocfyModule = exports.docs = exports.DOCFY_MARKER = exports.WithDocs = void 0;
|
|
4
4
|
var with_docs_decorator_1 = require("./with-docs.decorator");
|
|
5
5
|
Object.defineProperty(exports, "WithDocs", { enumerable: true, get: function () { return with_docs_decorator_1.WithDocs; } });
|
|
6
6
|
Object.defineProperty(exports, "DOCFY_MARKER", { enumerable: true, get: function () { return with_docs_decorator_1.DOCFY_MARKER; } });
|
|
@@ -12,4 +12,6 @@ var attach_tag_groups_1 = require("./attach-tag-groups");
|
|
|
12
12
|
Object.defineProperty(exports, "attachTagGroups", { enumerable: true, get: function () { return attach_tag_groups_1.attachTagGroups; } });
|
|
13
13
|
var docfy_ui_module_1 = require("./docfy-ui.module");
|
|
14
14
|
Object.defineProperty(exports, "DocfyUiModule", { enumerable: true, get: function () { return docfy_ui_module_1.DocfyUiModule; } });
|
|
15
|
+
var apply_docfy_metadata_1 = require("./apply-docfy-metadata");
|
|
16
|
+
Object.defineProperty(exports, "applyDocfyMetadata", { enumerable: true, get: function () { return apply_docfy_metadata_1.applyDocfyMetadata; } });
|
|
15
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAA+D;AAAtD,+GAAA,QAAQ,OAAA;AAAE,mHAAA,YAAY,OAAA;AAC/B,+BAA0C;AAAjC,4FAAA,IAAI,OAAA;AACb,+CAAiE;AAAxD,2GAAA,WAAW,OAAA;AACpB,yDAAsD;AAA7C,oHAAA,eAAe,OAAA;AAExB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAA+D;AAAtD,+GAAA,QAAQ,OAAA;AAAE,mHAAA,YAAY,OAAA;AAC/B,+BAA0C;AAAjC,4FAAA,IAAI,OAAA;AACb,+CAAiE;AAAxD,2GAAA,WAAW,OAAA;AACpB,yDAAsD;AAA7C,oHAAA,eAAe,OAAA;AAExB,qDAA+G;AAAtG,gHAAA,aAAa,OAAA;AACtB,+DAAuF;AAA9E,0HAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Filename the CLI plugin writes into the build output dir, and `applyDocfyMetadata()` reads by default. */
|
|
2
|
+
export declare const DOCFY_METADATA_FILENAME = "docfy-metadata.json";
|
|
3
|
+
export interface GenerateMetadataOptions {
|
|
4
|
+
/** Absolute path to the project's tsconfig — the same one the build is using. */
|
|
5
|
+
tsConfigFilePath: string;
|
|
6
|
+
/** Absolute path to the project root, used for the same symlink/path-traversal safety check `scanApp` always applies. */
|
|
7
|
+
projectRoot: string;
|
|
8
|
+
/** Absolute path to the directory the metadata file should be written into (typically the build's outDir). */
|
|
9
|
+
outDir: string;
|
|
10
|
+
/** Controller glob override — same convention as the CLI's `--pattern` flag. Defaults to `**\/*.controller.ts`. */
|
|
11
|
+
controllerGlob?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface GenerateMetadataResult {
|
|
14
|
+
/** Absolute path the metadata file was written to. */
|
|
15
|
+
outFile: string;
|
|
16
|
+
/** How many "METHOD /path" operations the generated patch touches. */
|
|
17
|
+
patchedOperationCount: number;
|
|
18
|
+
controllersWithoutDocs: string[];
|
|
19
|
+
unparseableDocsFiles: string[];
|
|
20
|
+
scanErrors: {
|
|
21
|
+
file: string;
|
|
22
|
+
message: string;
|
|
23
|
+
}[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Scans every controller in the project via static analysis (ts-morph — the
|
|
27
|
+
* same engine `generate`/`check`/`patch-spec` already use) and writes the
|
|
28
|
+
* resulting SpecPatch to a JSON file in the build output directory.
|
|
29
|
+
*
|
|
30
|
+
* This is the piece the CLI plugin (`src/plugin/index.ts`) calls once per
|
|
31
|
+
* compilation. Unlike the `patch-spec` CLI command, it needs no base OpenAPI
|
|
32
|
+
* document — `applyDocfyMetadata()` reads the written file at runtime and
|
|
33
|
+
* merges it into whatever `SwaggerModule.createDocument()` produces then.
|
|
34
|
+
*/
|
|
35
|
+
export declare function generateDocfyMetadata(options: GenerateMetadataOptions): GenerateMetadataResult;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DOCFY_METADATA_FILENAME = void 0;
|
|
7
|
+
exports.generateDocfyMetadata = generateDocfyMetadata;
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const scan_controllers_1 = require("../cli/scan-controllers");
|
|
11
|
+
const patch_spec_1 = require("../cli/patch-spec");
|
|
12
|
+
/** Filename the CLI plugin writes into the build output dir, and `applyDocfyMetadata()` reads by default. */
|
|
13
|
+
exports.DOCFY_METADATA_FILENAME = 'docfy-metadata.json';
|
|
14
|
+
/**
|
|
15
|
+
* Scans every controller in the project via static analysis (ts-morph — the
|
|
16
|
+
* same engine `generate`/`check`/`patch-spec` already use) and writes the
|
|
17
|
+
* resulting SpecPatch to a JSON file in the build output directory.
|
|
18
|
+
*
|
|
19
|
+
* This is the piece the CLI plugin (`src/plugin/index.ts`) calls once per
|
|
20
|
+
* compilation. Unlike the `patch-spec` CLI command, it needs no base OpenAPI
|
|
21
|
+
* document — `applyDocfyMetadata()` reads the written file at runtime and
|
|
22
|
+
* merges it into whatever `SwaggerModule.createDocument()` produces then.
|
|
23
|
+
*/
|
|
24
|
+
function generateDocfyMetadata(options) {
|
|
25
|
+
const app = {
|
|
26
|
+
name: 'app',
|
|
27
|
+
root: options.projectRoot,
|
|
28
|
+
tsconfig: options.tsConfigFilePath,
|
|
29
|
+
controllerGlob: options.controllerGlob ?? '**/*.controller.ts',
|
|
30
|
+
};
|
|
31
|
+
const { controllers, errors: scanErrors, projectsByControllerPath, } = (0, scan_controllers_1.scanApp)(app, options.projectRoot, options.controllerGlob, 'ts');
|
|
32
|
+
const { patch, controllersWithoutDocs, unparseableDocsFiles } = (0, patch_spec_1.computeSpecPatch)(controllers, 'ts', (absolutePath) => {
|
|
33
|
+
try {
|
|
34
|
+
return fs_1.default.readFileSync(absolutePath, 'utf8');
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}, projectsByControllerPath);
|
|
40
|
+
fs_1.default.mkdirSync(options.outDir, { recursive: true });
|
|
41
|
+
const outFile = path_1.default.join(options.outDir, exports.DOCFY_METADATA_FILENAME);
|
|
42
|
+
fs_1.default.writeFileSync(outFile, JSON.stringify(patch, null, 2), 'utf8');
|
|
43
|
+
const patchedOperationCount = Object.values(patch).reduce((count, methods) => count + Object.keys(methods).length, 0);
|
|
44
|
+
return { outFile, patchedOperationCount, controllersWithoutDocs, unparseableDocsFiles, scanErrors };
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=generate-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-metadata.js","sourceRoot":"","sources":["../../src/plugin/generate-metadata.ts"],"names":[],"mappings":";;;;;;AAwCA,sDAiCC;AAzED,4CAAoB;AACpB,gDAAwB;AACxB,8DAAkD;AAClD,kDAAqD;AAGrD,6GAA6G;AAChG,QAAA,uBAAuB,GAAG,qBAAqB,CAAC;AAuB7D;;;;;;;;;GASG;AACH,SAAgB,qBAAqB,CAAC,OAAgC;IACpE,MAAM,GAAG,GAAe;QACtB,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,OAA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}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type * as ts from 'typescript';
|
|
2
|
+
export { DOCFY_METADATA_FILENAME } from './generate-metadata';
|
|
3
|
+
export interface DocfyPluginOptions {
|
|
4
|
+
/** Root directory to scan for controllers. Defaults to the directory containing the resolved tsconfig. */
|
|
5
|
+
projectRoot?: string;
|
|
6
|
+
/** Controller glob override — same convention as the CLI's `--pattern` flag. */
|
|
7
|
+
controllerGlob?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* NestJS CLI "compiler plugin" entry point — register it in `nest-cli.json`:
|
|
11
|
+
* `"compilerOptions": { "plugins": ["nestjs-docfy"] }`. The Nest CLI's plugin
|
|
12
|
+
* loader calls exactly this `before(options, program)` shape for both the
|
|
13
|
+
* `tsc` and the `webpack` builder (see `@nestjs/cli`'s `PluginsLoader` and
|
|
14
|
+
* `ts-loader`'s `getCustomTransformers` wiring) — the same mechanism
|
|
15
|
+
* `@nestjs/swagger/plugin` already relies on to work under `webpack: true`,
|
|
16
|
+
* which is the one thing `DocfyModule`'s `require.cache`-based discovery
|
|
17
|
+
* structurally cannot do (see the README's "Not supported: webpack: true"
|
|
18
|
+
* section).
|
|
19
|
+
*
|
|
20
|
+
* Unlike `@nestjs/swagger/plugin`, this does not rewrite any AST node — it
|
|
21
|
+
* returns an identity transformer. Its only job is a build-time side
|
|
22
|
+
* effect: run the exact same static analysis `generate`/`check`/`patch-spec`
|
|
23
|
+
* already do, once per compilation, and write the resulting patch to a JSON
|
|
24
|
+
* file next to the compiled output. `applyDocfyMetadata()` (exported from
|
|
25
|
+
* the package root) reads that file at runtime and merges it into the
|
|
26
|
+
* document right after `SwaggerModule.createDocument()` — the same merge
|
|
27
|
+
* `patch-spec` does, just automatic on every build instead of a separate
|
|
28
|
+
* manual CLI invocation.
|
|
29
|
+
*/
|
|
30
|
+
export declare function before(options?: DocfyPluginOptions, program?: ts.Program): ts.TransformerFactory<ts.SourceFile>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DOCFY_METADATA_FILENAME = void 0;
|
|
7
|
+
exports.before = before;
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const generate_metadata_1 = require("./generate-metadata");
|
|
10
|
+
var generate_metadata_2 = require("./generate-metadata");
|
|
11
|
+
Object.defineProperty(exports, "DOCFY_METADATA_FILENAME", { enumerable: true, get: function () { return generate_metadata_2.DOCFY_METADATA_FILENAME; } });
|
|
12
|
+
/**
|
|
13
|
+
* NestJS CLI "compiler plugin" entry point — register it in `nest-cli.json`:
|
|
14
|
+
* `"compilerOptions": { "plugins": ["nestjs-docfy"] }`. The Nest CLI's plugin
|
|
15
|
+
* loader calls exactly this `before(options, program)` shape for both the
|
|
16
|
+
* `tsc` and the `webpack` builder (see `@nestjs/cli`'s `PluginsLoader` and
|
|
17
|
+
* `ts-loader`'s `getCustomTransformers` wiring) — the same mechanism
|
|
18
|
+
* `@nestjs/swagger/plugin` already relies on to work under `webpack: true`,
|
|
19
|
+
* which is the one thing `DocfyModule`'s `require.cache`-based discovery
|
|
20
|
+
* structurally cannot do (see the README's "Not supported: webpack: true"
|
|
21
|
+
* section).
|
|
22
|
+
*
|
|
23
|
+
* Unlike `@nestjs/swagger/plugin`, this does not rewrite any AST node — it
|
|
24
|
+
* returns an identity transformer. Its only job is a build-time side
|
|
25
|
+
* effect: run the exact same static analysis `generate`/`check`/`patch-spec`
|
|
26
|
+
* already do, once per compilation, and write the resulting patch to a JSON
|
|
27
|
+
* file next to the compiled output. `applyDocfyMetadata()` (exported from
|
|
28
|
+
* the package root) reads that file at runtime and merges it into the
|
|
29
|
+
* document right after `SwaggerModule.createDocument()` — the same merge
|
|
30
|
+
* `patch-spec` does, just automatic on every build instead of a separate
|
|
31
|
+
* manual CLI invocation.
|
|
32
|
+
*/
|
|
33
|
+
function before(options = {}, program) {
|
|
34
|
+
if (!program) {
|
|
35
|
+
throw new Error('nestjs-docfy plugin: the "program" reference must be provided when using the CLI plugin. ' +
|
|
36
|
+
'This is usually caused by "isolatedModules" being set to true in your tsconfig.');
|
|
37
|
+
}
|
|
38
|
+
const compilerOptions = program.getCompilerOptions();
|
|
39
|
+
const configFilePath = compilerOptions.configFilePath;
|
|
40
|
+
if (!configFilePath) {
|
|
41
|
+
throw new Error('nestjs-docfy plugin: could not determine the tsconfig path from the TypeScript program. ' +
|
|
42
|
+
'This plugin must be registered via nest-cli.json\'s "compilerOptions.plugins".');
|
|
43
|
+
}
|
|
44
|
+
const projectRoot = options.projectRoot ?? path_1.default.dirname(configFilePath);
|
|
45
|
+
const outDir = compilerOptions.outDir ?? path_1.default.join(projectRoot, 'dist');
|
|
46
|
+
try {
|
|
47
|
+
(0, generate_metadata_1.generateDocfyMetadata)({
|
|
48
|
+
tsConfigFilePath: configFilePath,
|
|
49
|
+
projectRoot,
|
|
50
|
+
outDir,
|
|
51
|
+
controllerGlob: options.controllerGlob,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
// A build-time analysis failure shouldn't be silently swallowed, but it
|
|
56
|
+
// also shouldn't fail the app's entire build — same "loud warning, not a
|
|
57
|
+
// crash" philosophy DocfyModule already follows for a missing docs file.
|
|
58
|
+
console.warn(`[nestjs-docfy] Failed to generate build-time metadata: ${err instanceof Error ? err.message : String(err)}`);
|
|
59
|
+
}
|
|
60
|
+
return () => (sourceFile) => sourceFile;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":";;;;;;AAkCA,wBAqCC;AAtED,gDAAwB;AACxB,2DAA4D;AAE5D,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getAll(): ReadonlySet<
|
|
4
|
-
getCallSite(target:
|
|
2
|
+
add(target: NewableFunction, callSiteStack?: string): void;
|
|
3
|
+
getAll(): ReadonlySet<NewableFunction>;
|
|
4
|
+
getCallSite(target: NewableFunction): string | undefined;
|
|
5
5
|
_reset(): void;
|
|
6
6
|
};
|
package/dist/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,yEAAyE;AACzE,MAAM,QAAQ,GAAG,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,yEAAyE;AACzE,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;AAE5C,4EAA4E;AAC5E,4EAA4E;AAC5E,wEAAwE;AACxE,2EAA2E;AAC3E,MAAM,SAAS,GAAG,IAAI,OAAO,EAA2B,CAAC;AAE5C,QAAA,aAAa,GAAG;IAC3B,GAAG,CAAC,MAAuB,EAAE,aAAsB;QACjD,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrB,IAAI,aAAa;YAAE,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM;QACJ,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,WAAW,CAAC,MAAuB;QACjC,OAAO,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED,4DAA4D;IAC5D,MAAM;QACJ,QAAQ,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;CACF,CAAC"}
|
|
@@ -23,5 +23,5 @@ type CacheSnapshot = Record<string, {
|
|
|
23
23
|
* the bundle position from the stack trace back to the original file via
|
|
24
24
|
* that bundle's source map (emitted by default by the webpack build).
|
|
25
25
|
*/
|
|
26
|
-
export declare function resolveDocsPath(controllerClass:
|
|
26
|
+
export declare function resolveDocsPath(controllerClass: NewableFunction, readCache?: () => CacheSnapshot, callSiteStack?: string): string | null;
|
|
27
27
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-docs-path.js","sourceRoot":"","sources":["../src/resolve-docs-path.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,
|
|
1
|
+
{"version":3,"file":"resolve-docs-path.js","sourceRoot":"","sources":["../src/resolve-docs-path.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,0CAeC;AA1CD,2CAA6B;AAC7B,2EAAiF;AAIjF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,eAAe,CAC7B,eAAgC,EAChC,YAAiC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAiC,EAChF,aAAsB;IAEtB,MAAM,cAAc,GAAG,eAAe,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,IAAI,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAC3G,IAAI,CAAC,cAAc;QAAE,OAAO,IAAI,CAAC;IAEjC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa;IACvD,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAElD,kFAAkF;IAClF,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;QAAE,OAAO,IAAI,CAAC;IAE/C,OAAO,GAAG,IAAI,QAAQ,GAAG,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,mBAAmB,CAAC,aAAiC;IAC5D,MAAM,GAAG,GAAG,IAAA,yCAAa,EAAC,aAAa,CAAC,CAAC;IACzC,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,OAAO,IAAA,+CAA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AAC,CAAC,CAAC;IAEH,OAAO,UAAU,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-source-from-stack.js","sourceRoot":"","sources":["../src/resolve-source-from-stack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,sCAaC;
|
|
1
|
+
{"version":3,"file":"resolve-source-from-stack.js","sourceRoot":"","sources":["../src/resolve-source-from-stack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,sCAaC;AAoCD,kDAmCC;AAlHD,uCAAyB;AACzB,2CAA6B;AAC7B,2CAA6D;AAQ7D,MAAM,cAAc,GAAG,kCAAkC,CAAC;AAE1D;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,aAAa,CAAC,KAAyB;IACrD,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,2DAA2D;IAErG,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,KAAK;YAAE,SAAS;QACrB,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC;QACxC,IAAI,CAAC,IAAI;YAAE,SAAS;QACpB,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,GAAG,eAAe,IAAI,CAAC,GAAG,EAAE,CAAC;YAAE,SAAS;QAClE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE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file":"with-docs.decorator.js","sourceRoot":"","sources":["../src/with-docs.decorator.ts"],"names":[],"mappings":";;;AAuBA,4BAYC;AAnCD,2CAA6C;AAC7C,yCAA2C;AAE3C;;;;;;;;GAQG;AACU,QAAA,YAAY,GAAG,iBAAiB,CAAC;AAE9C;;;;;;;;GAQG;AACH,SAAgB,QAAQ;IACtB,yEAAyE;IACzE,0EAA0E;IAC1E,0EAA0E;IAC1E,uEAAuE;IACvE,0EAA0E;IAC1E,MAAM,aAAa,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;IAExC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"with-docs.decorator.js","sourceRoot":"","sources":["../src/with-docs.decorator.ts"],"names":[],"mappings":";;;AAuBA,4BAYC;AAnCD,2CAA6C;AAC7C,yCAA2C;AAE3C;;;;;;;;GAQG;AACU,QAAA,YAAY,GAAG,iBAAiB,CAAC;AAE9C;;;;;;;;GAQG;AACH,SAAgB,QAAQ;IACtB,yEAAyE;IACzE,0EAA0E;IAC1E,0EAA0E;IAC1E,uEAAuE;IACvE,0EAA0E;IAC1E,MAAM,aAAa,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;IAExC,OAAO,CAAC,MAAuB,EAAE,EAAE;QACjC,IAAA,oBAAW,EAAC,oBAAY,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;QACxC,wBAAa,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC3C,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nestjs-docfy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Keep your NestJS controllers clean — Swagger docs live in a separate companion file by naming convention",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
"types": "./dist/testing.d.ts",
|
|
15
15
|
"require": "./dist/testing.js",
|
|
16
16
|
"default": "./dist/testing.js"
|
|
17
|
+
},
|
|
18
|
+
"./plugin": {
|
|
19
|
+
"types": "./dist/plugin/index.d.ts",
|
|
20
|
+
"require": "./dist/plugin/index.js",
|
|
21
|
+
"default": "./dist/plugin/index.js"
|
|
17
22
|
}
|
|
18
23
|
},
|
|
19
24
|
"bin": {
|
|
@@ -32,7 +37,12 @@
|
|
|
32
37
|
"test": "jest",
|
|
33
38
|
"test:watch": "jest --watch",
|
|
34
39
|
"test:cov": "jest --coverage",
|
|
35
|
-
"
|
|
40
|
+
"lint": "eslint .",
|
|
41
|
+
"lint:fix": "eslint . --fix",
|
|
42
|
+
"format": "prettier --write .",
|
|
43
|
+
"format:check": "prettier --check .",
|
|
44
|
+
"prepublishOnly": "npm run build",
|
|
45
|
+
"release": "semantic-release"
|
|
36
46
|
},
|
|
37
47
|
"keywords": [
|
|
38
48
|
"nestjs",
|
|
@@ -79,20 +89,30 @@
|
|
|
79
89
|
}
|
|
80
90
|
},
|
|
81
91
|
"devDependencies": {
|
|
92
|
+
"@eslint/js": "^10.0.1",
|
|
82
93
|
"@fastify/static": "^9.3.0",
|
|
83
94
|
"@nestjs/common": "^11.0.0",
|
|
84
95
|
"@nestjs/core": "^11.0.0",
|
|
85
96
|
"@nestjs/platform-fastify": "^11.1.28",
|
|
86
97
|
"@nestjs/swagger": "^11.0.0",
|
|
98
|
+
"@semantic-release/changelog": "^7.0.0",
|
|
99
|
+
"@semantic-release/git": "^11.0.1",
|
|
87
100
|
"@types/express": "^5.0.0",
|
|
88
101
|
"@types/jest": "^29.5.14",
|
|
89
102
|
"@types/node": "^22.0.0",
|
|
103
|
+
"eslint": "^10.8.0",
|
|
104
|
+
"eslint-config-prettier": "^10.1.8",
|
|
105
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
90
106
|
"fastify": "^5.10.0",
|
|
107
|
+
"globals": "^17.7.0",
|
|
91
108
|
"jest": "^29.7.0",
|
|
109
|
+
"prettier": "^3.9.6",
|
|
92
110
|
"reflect-metadata": "^0.2.2",
|
|
111
|
+
"semantic-release": "^25.0.8",
|
|
93
112
|
"ts-jest": "^29.2.5",
|
|
94
113
|
"ts-node": "^10.9.2",
|
|
95
|
-
"typescript": "^5.7.3"
|
|
114
|
+
"typescript": "^5.7.3",
|
|
115
|
+
"typescript-eslint": "^8.65.0"
|
|
96
116
|
},
|
|
97
117
|
"dependencies": {
|
|
98
118
|
"commander": "^15.0.0",
|