Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typedoc-plugin-resolve-crossmodule-references

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typedoc-plugin-resolve-crossmodule-references - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

40

dist/index.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.load = void 0;
const convert_source_map_1 = require("convert-source-map");
const path_1 = __importDefault(require("path"));
const typedoc_1 = require("typedoc");

@@ -91,37 +86,10 @@ function load(app) {

return type;
return getSourcesReferenceType(type, context.project) ?? type;
return findReferenceType(type, context.project) ?? type;
}
function getSourcesReferenceType(type, project) {
const srcFile = findSymbolSourceFile(type.getSymbol(), project);
if (!srcFile)
return null;
const newTargetReflection = srcFile.reflections.find(({ name }) => name === type.name);
function findReferenceType(type, project) {
const newTargetReflection = project.getReflectionsByKind(typedoc_1.ReflectionKind.All).find(({ name }) => name === type.name);
if (!newTargetReflection)
return null;
const newTargetSymbol = project.getSymbolFromReflection(newTargetReflection);
if (!newTargetSymbol)
return null;
return new typedoc_1.ReferenceType(type.name, newTargetSymbol, project);
return typedoc_1.ReferenceType.createResolvedReference(type.name, newTargetReflection, project);
}
function findSymbolSourceFile(symbol, project) {
const declarations = symbol.getDeclarations();
if (!declarations)
return undefined;
for (const declaration of declarations) {
const declSrcFile = declaration.getSourceFile();
const srcDirPath = path_1.default.dirname(declSrcFile.fileName);
const srcMapConverter = (0, convert_source_map_1.fromSource)(declSrcFile.text) ?? (0, convert_source_map_1.fromMapFileSource)(declSrcFile.text, srcDirPath);
if (!srcMapConverter)
continue;
const sources = srcMapConverter.toObject().sources;
for (const source of sources) {
const srcFileName = path_1.default.resolve(srcDirPath, source);
const srcFile = project.files.find(({ fullFileName }) => fullFileName === srcFileName);
if (!srcFile)
continue;
return srcFile;
}
}
return undefined;
}
function isReferenceType(type) {

@@ -128,0 +96,0 @@ return type?.type === 'reference';

30

package.json
{
"name": "typedoc-plugin-resolve-crossmodule-references",
"version": "0.1.1",
"version": "0.2.0",
"description": "TypeDoc plugin for resolving cross module reference in a mono-repository",

@@ -15,2 +15,5 @@ "main": "dist",

],
"engines": {
"node": ">=16"
},
"files": [

@@ -24,20 +27,17 @@ "dist"

"peerDependencies": {
"typedoc": "*"
"typedoc": ">=0.22 <=0.23"
},
"dependencies": {
"convert-source-map": "^1.8.0"
},
"devDependencies": {
"@ava/typescript": "^3.0.1",
"@tsconfig/node14": "^1.0.1",
"@types/convert-source-map": "^1.5.2",
"@types/node": "^17.0.8",
"ava": "^4.0.1",
"prettier": "^2.5.1",
"ts-node": "^10.4.0",
"@tsconfig/node16": "^1.0.3",
"@types/node": "^18.0.6",
"ava": "^4.3.1",
"prettier": "^2.7.1",
"rimraf": "^3.0.2",
"ts-node": "^10.9.1",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.3.0",
"typedoc": "^0.22.10",
"typescript": "^4.5.4"
"typedoc": "^0.23.8",
"typescript": "^4.7.4"
},

@@ -47,7 +47,7 @@ "scripts": {

"ci": "yarn build && yarn lint && yarn test",
"clean": "rm -rf dist",
"clean": "rimraf dist",
"lint": "tslint -p .",
"test": "yarn test:clean && yarn test:build && yarn test:generate && ava",
"test:build": "yarn workspaces foreach -t --from '{@typedoc-plugin-resolve-crossmodule-references/a,@typedoc-plugin-resolve-crossmodule-references/b}' run build",
"test:clean": "rm -rf test/docs.json test/packages/a/dist test/packages/b/dist",
"test:clean": "rimraf test/docs.json test/packages/a/dist test/packages/b/dist",
"test:generate": "cd test && yarn typedoc"

@@ -54,0 +54,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc