@dtsgenerator/replace-namespace
Advanced tools
Comparing version 1.5.5 to 1.6.0
@@ -272,3 +272,3 @@ "use strict"; | ||
} | ||
var inter = dtsgenerator_1.ts.visitNode(root, visit); | ||
var inter = dtsgenerator_1.ts.visitNode(root, visit, dtsgenerator_1.ts.isSourceFile); | ||
return [inter, converted]; | ||
@@ -282,3 +282,3 @@ } | ||
function addChildModuleDeclaration(parent, name) { | ||
var newModule = dtsgenerator_1.ts.factory.createModuleDeclaration(undefined, undefined, dtsgenerator_1.ts.factory.createIdentifier(name), parent.body, parent.flags); | ||
var newModule = dtsgenerator_1.ts.factory.createModuleDeclaration(undefined, dtsgenerator_1.ts.factory.createIdentifier(name), parent.body, parent.flags); | ||
Object.assign(parent, { | ||
@@ -303,3 +303,3 @@ body: dtsgenerator_1.ts.factory.createModuleBlock([newModule]), | ||
} | ||
return dtsgenerator_1.ts.visitNode(root, visit); | ||
return dtsgenerator_1.ts.visitNode(root, visit, dtsgenerator_1.ts.isSourceFile); | ||
} | ||
@@ -306,0 +306,0 @@ function flattenEntityName(name) { |
37
index.ts
@@ -39,3 +39,3 @@ import { ts, Plugin, PluginContext } from 'dtsgenerator'; | ||
async function postProcess( | ||
pluginContext: PluginContext | ||
pluginContext: PluginContext, | ||
): Promise<ts.TransformerFactory<ts.SourceFile> | undefined> { | ||
@@ -52,3 +52,3 @@ const config = pluginContext.option as Config; | ||
mapping, | ||
root | ||
root, | ||
); | ||
@@ -96,3 +96,3 @@ const result = replaceTypeReference(context, converted, inter); | ||
throw new Error( | ||
'Invalid configuration: must have the same value for the same key.' | ||
'Invalid configuration: must have the same value for the same key.', | ||
); | ||
@@ -108,3 +108,3 @@ } | ||
mapping: Mapping<T>[], | ||
path: string[] | ||
path: string[], | ||
): Mapping<T>[] { | ||
@@ -126,3 +126,3 @@ let result = mapping; | ||
converted: Mapping<string> | undefined, | ||
key: string | ||
key: string, | ||
): Mapping<string> | undefined { | ||
@@ -138,3 +138,3 @@ if (converted == null) { | ||
key: string, | ||
value: MappingResult | ||
value: MappingResult, | ||
): void { | ||
@@ -188,3 +188,3 @@ let local = converted; | ||
mapping: Mapping<string | boolean>[], | ||
root: ts.SourceFile | ||
root: ts.SourceFile, | ||
): [ts.SourceFile, Mapping<string>] { | ||
@@ -199,3 +199,3 @@ let path: string[] = []; | ||
function replaceModuleName( | ||
statements: ReadonlyArray<ts.Statement> | ||
statements: ReadonlyArray<ts.Statement>, | ||
): ts.NodeArray<ts.Statement> { | ||
@@ -209,3 +209,3 @@ const maps = getMapping(mapping, path); | ||
const map = maps.filter( | ||
(m) => m.key === true || m.key === name.text | ||
(m) => m.key === true || m.key === name.text, | ||
); | ||
@@ -258,3 +258,3 @@ if (map.length === 0) { | ||
} | ||
const inter = ts.visitNode(root, visit); | ||
const inter = ts.visitNode(root, visit, ts.isSourceFile); | ||
return [inter, converted]; | ||
@@ -270,10 +270,9 @@ } | ||
parent: ts.ModuleDeclaration, | ||
name: string | ||
name: string, | ||
): ts.ModuleDeclaration { | ||
const newModule = ts.factory.createModuleDeclaration( | ||
undefined, | ||
undefined, | ||
ts.factory.createIdentifier(name), | ||
parent.body, | ||
parent.flags | ||
parent.flags, | ||
); | ||
@@ -289,3 +288,3 @@ Object.assign<typeof parent, Partial<typeof parent>>(parent, { | ||
mapping: Mapping<string>, | ||
root: ts.SourceFile | ||
root: ts.SourceFile, | ||
): ts.SourceFile { | ||
@@ -308,3 +307,3 @@ function visit(node: ts.Node): ts.VisitResult<ts.Node> { | ||
} | ||
return ts.visitNode(root, visit); | ||
return ts.visitNode(root, visit, ts.isSourceFile); | ||
} | ||
@@ -330,3 +329,3 @@ | ||
result, | ||
ts.factory.createIdentifier(names[i]) | ||
ts.factory.createIdentifier(names[i]), | ||
); | ||
@@ -339,3 +338,3 @@ } | ||
function replaceModifiers( | ||
modifiers?: readonly ts.Modifier[] | ||
modifiers?: readonly ts.Modifier[], | ||
): ts.ModifiersArray { | ||
@@ -357,3 +356,3 @@ const result: ts.Modifier[] = []; | ||
result.push( | ||
ts.factory.createModifier(ts.SyntaxKind.DeclareKeyword) | ||
ts.factory.createModifier(ts.SyntaxKind.DeclareKeyword), | ||
); | ||
@@ -367,3 +366,3 @@ } | ||
: undefined; | ||
Object.assign<typeof state, Partial<typeof state>>(state, { | ||
Object.assign(state, { | ||
modifiers: replaceModifiers(modifiers), | ||
@@ -370,0 +369,0 @@ }); |
{ | ||
"name": "@dtsgenerator/replace-namespace", | ||
"version": "1.5.5", | ||
"version": "1.6.0", | ||
"description": "replace the namespace names", | ||
@@ -39,5 +39,5 @@ "main": "index.js", | ||
"@types/mocha": "^10.0.1", | ||
"@types/node": "^16.18.44", | ||
"@types/node": "^16.18.46", | ||
"cross-env": "^7.0.3", | ||
"dtsgenerator": "^3.18.0", | ||
"dtsgenerator": "^3.19.0", | ||
"eslint": "^8.47.0", | ||
@@ -53,3 +53,3 @@ "husky": "^8.0.3", | ||
"peerDependencies": { | ||
"dtsgenerator": "^3.18.0", | ||
"dtsgenerator": "^3.19.0", | ||
"tslib": "^2.6.2" | ||
@@ -56,0 +56,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34414
780