From 29baafffd16d1d36f8f68b3f329ec06839642179 Mon Sep 17 00:00:00 2001 From: dobromirts Date: Wed, 18 Dec 2024 10:51:25 +0200 Subject: [PATCH] Update typedoc version and migrato to ESM type --- components/convert-component.ts | 16 ++-- components/render-component.ts | 11 ++- components/theme-component.ts | 4 +- index.ts | 19 ++-- package-lock.json | 124 +++++++++++++++++++-------- package.json | 10 ++- tsconfig.json | 31 +++---- utils/factories/base-factory.ts | 2 +- utils/factories/class-factory.ts | 4 +- utils/factories/enum-factory.ts | 4 +- utils/factories/function-factory.ts | 2 +- utils/factories/interface-factory.ts | 4 +- utils/file-operations.ts | 4 +- utils/helpers/localize.ts | 4 +- utils/options.ts | 2 +- 15 files changed, 140 insertions(+), 101 deletions(-) diff --git a/components/convert-component.ts b/components/convert-component.ts index 2dc49aa..2720d7a 100644 --- a/components/convert-component.ts +++ b/components/convert-component.ts @@ -3,14 +3,14 @@ import { Converter, ReflectionKind, } from 'typedoc'; -import { FileOperations } from '../utils/file-operations'; -import { ClassFactory } from '../utils/factories/class-factory'; -import { BaseFactory } from '../utils/factories/base-factory'; -import { EnumFactory } from '../utils/factories/enum-factory'; -import { Parser } from '../utils/parser'; -import { Constants } from '../utils/constants'; -import { InterfaceFactory } from '../utils/factories/interface-factory'; -import { FunctionFactory } from '../utils/factories/function-factory'; +import { FileOperations } from '../utils/file-operations.js'; +import { ClassFactory } from '../utils/factories/class-factory.js'; +import { BaseFactory } from '../utils/factories/base-factory.js'; +import { EnumFactory } from '../utils/factories/enum-factory.js'; +import { Parser } from '../utils/parser.js'; +import { Constants } from '../utils/constants.js'; +import { InterfaceFactory } from '../utils/factories/interface-factory.js'; +import { FunctionFactory } from '../utils/factories/function-factory.js'; export class ConvertComponent { /** diff --git a/components/render-component.ts b/components/render-component.ts index 724f5d0..9c2f433 100644 --- a/components/render-component.ts +++ b/components/render-component.ts @@ -1,10 +1,9 @@ -import * as path from 'path'; - +import path from 'path'; import { ReflectionKind, RendererEvent, LogLevel, Application } from 'typedoc'; -import { FileOperations } from '../utils/file-operations'; -import { AttributeType } from '../utils/enums/json-keys'; -import { Constants } from '../utils/constants'; -import { Parser } from '../utils/parser'; +import { FileOperations } from '../utils/file-operations.js'; +import { AttributeType } from '../utils/enums/json-keys.js'; +import { Constants } from '../utils/constants.js'; +import { Parser } from '../utils/parser.js'; export class RenderComponenet { private warns: boolean; diff --git a/components/theme-component.ts b/components/theme-component.ts index 2f7594d..9eeb849 100644 --- a/components/theme-component.ts +++ b/components/theme-component.ts @@ -1,6 +1,6 @@ import { RendererEvent, ReflectionKind, Application } from "typedoc"; -import { GlobalFuncs } from '../utils/global-funcs'; -import { HardcodedStrings } from '../utils/template-strings'; +import { GlobalFuncs } from '../utils/global-funcs.js'; +import { HardcodedStrings } from '../utils/template-strings.js'; export class ThemeComponent { public app: Application; diff --git a/index.ts b/index.ts index 33a5977..1c8295b 100644 --- a/index.ts +++ b/index.ts @@ -1,15 +1,14 @@ -import * as process from 'process'; -import * as fs from 'fs-extra'; - +import process from 'process'; +import fs from 'fs-extra'; import { Application, Converter, Renderer } from 'typedoc' -import { ConvertComponent } from './components/convert-component'; -import { RenderComponenet } from './components/render-component'; -import { Constants } from './utils/constants'; -import { HardcodedStrings } from './utils/template-strings'; -import { ThemeComponent } from './components/theme-component'; -import { pluginOptions } from './utils/options'; +import { ConvertComponent } from './components/convert-component.js'; +import { RenderComponenet } from './components/render-component.js'; +import { Constants } from './utils/constants.js'; +import { HardcodedStrings } from './utils/template-strings.js'; +import { ThemeComponent } from './components/theme-component.js'; +import { pluginOptions } from './utils/options.js'; -export * from './utils/helpers/localize'; +export * from './utils/helpers/localize.js'; export function load(PluginHost: Application) { const app = PluginHost.owner; diff --git a/package-lock.json b/package-lock.json index 166387f..7b8020a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,26 +12,79 @@ "fs-extra": "^11.2.0" }, "devDependencies": { - "@types/node": "^18.11.0", - "typedoc": "^0.26.2", - "typescript": "^5.5.2" + "@types/node": "^20.17.6", + "typedoc": "^0.27.0", + "typescript": "^5.6.3" } }, - "node_modules/@shikijs/core": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.9.1.tgz", - "integrity": "sha512-EmUful2MQtY8KgCF1OkBtOuMcvaZEvmdubhW0UHCGXi21O9dRLeADVCj+k6ZS+de7Mz9d2qixOXJ+GLhcK3pXg==", - "dev": true + "node_modules/@gerrit0/mini-shiki": { + "version": "1.24.4", + "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-1.24.4.tgz", + "integrity": "sha512-YEHW1QeAg6UmxEmswiQbOVEg1CW22b1XUD/lNTliOsu0LD0wqoyleFMnmbTp697QE0pcadQiR5cVtbbAPncvpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/engine-oniguruma": "^1.24.2", + "@shikijs/types": "^1.24.2", + "@shikijs/vscode-textmate": "^9.3.1" + } + }, + "node_modules/@shikijs/engine-oniguruma": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.24.2.tgz", + "integrity": "sha512-ZN6k//aDNWRJs1uKB12pturKHh7GejKugowOFGAuG7TxDRLod1Bd5JhpOikOiFqPmKjKEPtEA6mRCf7q3ulDyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "1.24.2", + "@shikijs/vscode-textmate": "^9.3.0" + } + }, + "node_modules/@shikijs/types": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.24.2.tgz", + "integrity": "sha512-bdeWZiDtajGLG9BudI0AHet0b6e7FbR0EsE4jpGaI0YwHm/XJunI9+3uZnzFtX65gsyJ6ngCIWUfA4NWRPnBkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^9.3.0", + "@types/hast": "^3.0.4" + } + }, + "node_modules/@shikijs/vscode-textmate": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-9.3.1.tgz", + "integrity": "sha512-79QfK1393x9Ho60QFyLti+QfdJzRQCVLFb97kOIV7Eo9vQU/roINgk7m24uv0a7AUvN//RDH36FLjjK48v0s9g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } }, "node_modules/@types/node": { - "version": "18.19.39", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.39.tgz", - "integrity": "sha512-nPwTRDKUctxw3di5b4TfT3I0sWDiWoPQCZjXhvdkINntwr8lcoVCKsTgnXeRubKIlfnV+eN/HYk6Jb40tbcEAQ==", + "version": "20.17.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.10.tgz", + "integrity": "sha512-/jrvh5h6NXhEauFFexRin69nA0uHJ5gwk4iDivp/DeoEua3uwCUto6PC86IpRITBOs4+6i2I56K5x5b6WYGXHA==", "dev": true, + "license": "MIT", "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~6.19.2" } }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true, + "license": "MIT" + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -156,26 +209,18 @@ "node": ">=6" } }, - "node_modules/shiki": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.9.1.tgz", - "integrity": "sha512-8PDkgb5ja3nfujTjvC4VytL6wGOGCtFAClUb2r3QROevYXxcq+/shVJK5s6gy0HZnjaJgFxd6BpPqpRfqne5rA==", - "dev": true, - "dependencies": { - "@shikijs/core": "1.9.1" - } - }, "node_modules/typedoc": { - "version": "0.26.2", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.26.2.tgz", - "integrity": "sha512-q/t+M+PZqhN9gPWLBZ3CCvP+KT8O1tyYkSzEYbcQ6mo89avdIrMlBEl3vfo5BgSzwC6Lbmq0W64E8RkY+eVsLA==", + "version": "0.27.5", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.27.5.tgz", + "integrity": "sha512-x+fhKJtTg4ozXwKayh/ek4wxZQI/+2hmZUdO2i2NGDBRUflDble70z+ewHod3d4gRpXSO6fnlnjbDTnJk7HlkQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { + "@gerrit0/mini-shiki": "^1.24.0", "lunr": "^2.3.9", "markdown-it": "^14.1.0", - "minimatch": "^9.0.4", - "shiki": "^1.9.0", - "yaml": "^2.4.5" + "minimatch": "^9.0.5", + "yaml": "^2.6.1" }, "bin": { "typedoc": "bin/typedoc" @@ -184,14 +229,15 @@ "node": ">= 18" }, "peerDependencies": { - "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x" + "typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x" } }, "node_modules/typescript": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz", - "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -207,10 +253,11 @@ "dev": true }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true, + "license": "MIT" }, "node_modules/universalify": { "version": "2.0.1", @@ -221,10 +268,11 @@ } }, "node_modules/yaml": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.5.tgz", - "integrity": "sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz", + "integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==", "dev": true, + "license": "ISC", "bin": { "yaml": "bin.mjs" }, diff --git a/package.json b/package.json index bd50df1..c1a44d8 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "Typedoc plugin which localize your documentation", "author": "Infragistics", "license": "MIT", + "type": "module", "main": "dist/index.js", "files": [ "dist/" @@ -19,14 +20,15 @@ "typedoc", "localizaiton", "plugin", - "typedocplugin" + "typedocplugin", + "typedoc-plugin" ], "dependencies": { "fs-extra": "^11.2.0" }, "devDependencies": { - "@types/node": "^18.11.0", - "typedoc": "^0.26.2", - "typescript": "^5.5.2" + "@types/node": "^20.17.6", + "typedoc": "^0.27.0", + "typescript": "^5.6.3" } } diff --git a/tsconfig.json b/tsconfig.json index 7c38405..8444ee6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,30 +1,21 @@ { "compilerOptions": { - /* Basic Options */ - "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + "target": "ES2022", + "module": "NodeNext", "lib": [ - "es2017", + "ES2022", "dom" - ], /* Concatenate and emit output to single file. */ - "outDir": "./dist", /* Redirect output structure to the directory. */ - - /* Strict Type-Checking Options */ - "strict": false, /* Enable all strict type-checking options. */ - "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */ - - /* Module Resolution Options */ - "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + ], + "declaration": true, + "outDir": "./dist", + "strict": false, + "noImplicitAny": false, + "moduleResolution": "NodeNext", "typeRoots": [ "node_modules/@types" - ], /* List of folders to include type definitions from. */ + ], "types": [ "node" - ], /* Type declaration files to be included in compilation. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - - /* Experimental Options */ - "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */ + ], } } diff --git a/utils/factories/base-factory.ts b/utils/factories/base-factory.ts index 13491d6..7d546ae 100644 --- a/utils/factories/base-factory.ts +++ b/utils/factories/base-factory.ts @@ -1,4 +1,4 @@ -import { AttributeType } from "../enums/json-keys"; +import { AttributeType } from "../enums/json-keys.js"; export abstract class BaseFactory { public name; diff --git a/utils/factories/class-factory.ts b/utils/factories/class-factory.ts index b3baec3..1595b67 100644 --- a/utils/factories/class-factory.ts +++ b/utils/factories/class-factory.ts @@ -1,5 +1,5 @@ -import { BaseFactory } from './base-factory'; -import { AttributeType } from '../enums/json-keys'; +import { BaseFactory } from './base-factory.js'; +import { AttributeType } from '../enums/json-keys.js'; const PROPERTIES_KEY = AttributeType[AttributeType.properties]; const METHODS_KEY = AttributeType[AttributeType.methods]; diff --git a/utils/factories/enum-factory.ts b/utils/factories/enum-factory.ts index 1f86732..7383599 100644 --- a/utils/factories/enum-factory.ts +++ b/utils/factories/enum-factory.ts @@ -1,5 +1,5 @@ -import { AttributeType } from "../enums/json-keys"; -import { BaseFactory } from "./base-factory"; +import { AttributeType } from "../enums/json-keys.js"; +import { BaseFactory } from "./base-factory.js"; const ENUM_MEMBER_KEY = AttributeType[AttributeType.members]; diff --git a/utils/factories/function-factory.ts b/utils/factories/function-factory.ts index 5d9c0f6..d0a9585 100644 --- a/utils/factories/function-factory.ts +++ b/utils/factories/function-factory.ts @@ -1,4 +1,4 @@ -import { BaseFactory } from "./base-factory"; +import { BaseFactory } from "./base-factory.js"; export class FunctionFactory extends BaseFactory { diff --git a/utils/factories/interface-factory.ts b/utils/factories/interface-factory.ts index 29b98d7..66877b2 100644 --- a/utils/factories/interface-factory.ts +++ b/utils/factories/interface-factory.ts @@ -1,5 +1,5 @@ -import { AttributeType } from "../enums/json-keys"; -import { BaseFactory } from "./base-factory"; +import { AttributeType } from "../enums/json-keys.js"; +import { BaseFactory } from "./base-factory.js"; const PROPERTIES_KEY = AttributeType[AttributeType.properties]; const METHODS_KEY = AttributeType[AttributeType.methods]; diff --git a/utils/file-operations.ts b/utils/file-operations.ts index 76957be..a6311e5 100644 --- a/utils/file-operations.ts +++ b/utils/file-operations.ts @@ -1,5 +1,5 @@ -import * as fs from 'fs-extra'; -import * as path from 'path'; +import fs from 'fs-extra'; +import path from 'path'; import { Logger } from 'typedoc'; export class FileOperations { diff --git a/utils/helpers/localize.ts b/utils/helpers/localize.ts index e31ef88..5b06061 100644 --- a/utils/helpers/localize.ts +++ b/utils/helpers/localize.ts @@ -1,5 +1,5 @@ -import { GlobalFuncs } from '../global-funcs'; -import { HardcodedStrings } from '../template-strings'; +import { GlobalFuncs } from '../global-funcs.js'; +import { HardcodedStrings } from '../template-strings.js'; /** * Helper function which loclize the hardcoded template strings. diff --git a/utils/options.ts b/utils/options.ts index f713f6c..7ccd763 100644 --- a/utils/options.ts +++ b/utils/options.ts @@ -1,5 +1,5 @@ import { Options, ParameterType } from 'typedoc' -import { Constants } from './constants'; +import { Constants } from './constants.js'; export function pluginOptions(options: Pick) {