dtsgenerator 3.16.1 → 3.16.2

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
@@ -86,7 +86,7 @@ export no_proxy=google.com, yahoo.com
86
86
 
87
87
  ## Migration from v2
88
88
 
89
- The dtsgenerator v3 has made the following braking changes from v2.
89
+ The dtsgenerator v3 has made the following breaking changes from v2.
90
90
 
91
91
  - Support Plug-in feature. See the Plug-in section for more information.
92
92
  - Change the command line options.
@@ -143,6 +143,11 @@ Output debug message by [debug](https://www.npmjs.com/package/debug) library.
143
143
 
144
144
  ## ChangeLog
145
145
 
146
+ ### [v3.16.1](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.16.1) (2022-12-20)
147
+
148
+ - fixed:
149
+ - Fix to remove deprecated decorators parameters for #547. Thank you @mcollina :+1:
150
+
146
151
  ### [v3.16.0](https://github.com/horiuchi/dtsgenerator/releases/tag/v3.16.0) (2022-06-10)
147
152
 
148
153
  - features:
@@ -64,7 +64,7 @@ function buildNamespaceNode(name, statements, root) {
64
64
  const modifiers = root
65
65
  ? [ts.factory.createModifier(ts.SyntaxKind.DeclareKeyword)]
66
66
  : undefined;
67
- return ts.factory.createModuleDeclaration(undefined, modifiers, buildTypeNameIdentifier(name), ts.factory.createModuleBlock(statements), ts.NodeFlags.Namespace |
67
+ return ts.factory.createModuleDeclaration(modifiers, buildTypeNameIdentifier(name), ts.factory.createModuleBlock(statements), ts.NodeFlags.Namespace |
68
68
  ts.NodeFlags.ExportContext |
69
69
  ts.NodeFlags.ContextFlags);
70
70
  }
@@ -74,7 +74,7 @@ function buildInterfaceNode(id, members, root) {
74
74
  const modifiers = root
75
75
  ? [ts.factory.createModifier(ts.SyntaxKind.DeclareKeyword)]
76
76
  : [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)];
77
- return ts.factory.createInterfaceDeclaration(undefined, modifiers, buildTypeNameIdentifier(name), undefined, undefined, members);
77
+ return ts.factory.createInterfaceDeclaration(modifiers, buildTypeNameIdentifier(name), undefined, undefined, members);
78
78
  }
79
79
  exports.buildInterfaceNode = buildInterfaceNode;
80
80
  function buildTypeAliasNode(id, type, root) {
@@ -82,7 +82,7 @@ function buildTypeAliasNode(id, type, root) {
82
82
  const modifiers = root
83
83
  ? [ts.factory.createModifier(ts.SyntaxKind.DeclareKeyword)]
84
84
  : [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)];
85
- return ts.factory.createTypeAliasDeclaration(undefined, modifiers, buildTypeNameIdentifier(name), undefined, type);
85
+ return ts.factory.createTypeAliasDeclaration(modifiers, buildTypeNameIdentifier(name), undefined, type);
86
86
  }
87
87
  exports.buildTypeAliasNode = buildTypeAliasNode;
88
88
  function buildPropertySignature(_schema, propertyName, valueType, required, isPattern) {
@@ -91,16 +91,16 @@ function buildPropertySignature(_schema, propertyName, valueType, required, isPa
91
91
  ? ts.factory.createToken(ts.SyntaxKind.QuestionToken)
92
92
  : undefined;
93
93
  if (isPattern) {
94
- return ts.factory.createIndexSignature(undefined, modifiers, [
95
- ts.factory.createParameterDeclaration([], [], undefined, ts.factory.createIdentifier('pattern'), undefined, ts.factory.createTypeReferenceNode('string', []), undefined),
94
+ return ts.factory.createIndexSignature(modifiers, [
95
+ ts.factory.createParameterDeclaration([], undefined, ts.factory.createIdentifier('pattern'), undefined, ts.factory.createTypeReferenceNode('string', []), undefined),
96
96
  ], valueType);
97
97
  }
98
98
  return ts.factory.createPropertySignature(modifiers, buildPropertyNameIdentifier(propertyName), questionToken, valueType);
99
99
  }
100
100
  exports.buildPropertySignature = buildPropertySignature;
101
101
  function buildIndexSignatureNode(name, indexType, valueType) {
102
- return ts.factory.createIndexSignature(undefined, undefined, [
103
- ts.factory.createParameterDeclaration(undefined, undefined, undefined, buildTypeNameIdentifier(name), undefined, indexType, undefined),
102
+ return ts.factory.createIndexSignature(undefined, [
103
+ ts.factory.createParameterDeclaration(undefined, undefined, buildTypeNameIdentifier(name), undefined, indexType, undefined),
104
104
  ], valueType);
105
105
  }
106
106
  exports.buildIndexSignatureNode = buildIndexSignatureNode;
@@ -14,7 +14,7 @@ interface InputConfig {
14
14
  urls: string[];
15
15
  stdin: boolean;
16
16
  }
17
- export declare type PartialConfig = Omit<Partial<Config>, 'input'> & {
17
+ export type PartialConfig = Omit<Partial<Config>, 'input'> & {
18
18
  input?: Partial<InputConfig>;
19
19
  };
20
20
  declare let config: Config;
@@ -2,7 +2,7 @@ import { OpenApisV2 } from './openApiV2';
2
2
  import { OpenApisV3 } from './openApiV3';
3
3
  import SchemaId from './schemaId';
4
4
  import { Schema, JsonSchemaObject, SchemaType, JsonSchema } from './type';
5
- declare type OpenApiSchema = OpenApisV2.SchemaJson | OpenApisV3.SchemaJson;
5
+ type OpenApiSchema = OpenApisV2.SchemaJson | OpenApisV3.SchemaJson;
6
6
  export interface NormalizedSchema extends Schema {
7
7
  content: JsonSchemaObject;
8
8
  }
@@ -5,11 +5,11 @@ import { OpenApisV2 } from './openApiV2';
5
5
  import { OpenApisV3 } from './openApiV3';
6
6
  import SchemaId from './schemaId';
7
7
  export import ts = require('typescript');
8
- export declare type JsonSchema = JsonSchemaDraft04.Schema | JsonSchemaDraft07.Schema;
9
- export declare type JsonSchemaObject = JsonSchemaDraft04.Schema | JsonSchemaDraft07.SchemaObject;
10
- export declare type SchemaType = 'Draft04' | 'Draft07' | '2019-09' | '2020-12' | 'Latest';
8
+ export type JsonSchema = JsonSchemaDraft04.Schema | JsonSchemaDraft07.Schema;
9
+ export type JsonSchemaObject = JsonSchemaDraft04.Schema | JsonSchemaDraft07.SchemaObject;
10
+ export type SchemaType = 'Draft04' | 'Draft07' | '2019-09' | '2020-12' | 'Latest';
11
11
  export declare function isJsonSchemaDraft04(_content: JsonSchemaObject, type: SchemaType): _content is JsonSchemaDraft04.Schema;
12
- export declare type $Ref = OpenApisV3.SchemaJson.Definitions.Reference | OpenApisV2.SchemaJson.Definitions.JsonReference;
12
+ export type $Ref = OpenApisV3.SchemaJson.Definitions.Reference | OpenApisV2.SchemaJson.Definitions.JsonReference;
13
13
  export interface Schema {
14
14
  type: SchemaType;
15
15
  openApiVersion?: 2 | 3;
@@ -26,8 +26,8 @@ export interface PluginContext {
26
26
  option: boolean | Record<string, unknown>;
27
27
  inputSchemas: IterableIterator<[string, Schema]>;
28
28
  }
29
- export declare type PreProcessHandler = (contents: Schema[]) => Schema[];
30
- export declare type Plugin = {
29
+ export type PreProcessHandler = (contents: Schema[]) => Schema[];
30
+ export type Plugin = {
31
31
  meta: {
32
32
  name: string;
33
33
  version: string;
package/dist/core/type.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.loadPlugin = exports.parseFileContent = exports.readSchemaFromUrl = exports.readSchemasFromFile = exports.readSchemaFromStdin = exports.parseSchema = exports.isJsonSchemaDraft04 = void 0;
4
5
  const tslib_1 = require("tslib");
@@ -81,7 +82,7 @@ async function loadPlugin(name, option) {
81
82
  if (!option) {
82
83
  return undefined;
83
84
  }
84
- const mod = (await Promise.resolve().then(() => tslib_1.__importStar(require(name))));
85
+ const mod = (await (_a = name, Promise.resolve().then(() => tslib_1.__importStar(require(_a)))));
85
86
  if (!mod.default) {
86
87
  console.warn(`The plugin (${name}) is invalid module. That is not default export format.`);
87
88
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtsgenerator",
3
- "version": "3.16.1",
3
+ "version": "3.16.2",
4
4
  "description": "TypeScript d.ts file generator for JSON Schema file",
5
5
  "bin": {
6
6
  "dtsgen": "bin/dtsgen"
@@ -44,34 +44,34 @@
44
44
  "node": ">= 14.0"
45
45
  },
46
46
  "dependencies": {
47
- "commander": "^9.4.0",
47
+ "commander": "^9.4.1",
48
48
  "cross-fetch": "^3.1.5",
49
49
  "debug": "^4.3.4",
50
50
  "glob": "^8.0.3",
51
51
  "https-proxy-agent": "^5.0.1",
52
52
  "js-yaml": "^4.1.0",
53
- "tslib": "^2.4.0",
54
- "typescript": "^4.8.2"
53
+ "tslib": "^2.4.1",
54
+ "typescript": "^4.9.4"
55
55
  },
56
56
  "devDependencies": {
57
- "@dtsgenerator/do-nothing": "^2.5.2",
58
- "@dtsgenerator/eslint-config": "^0.6.2",
59
- "@dtsgenerator/replace-namespace": "^1.5.2",
60
- "@dtsgenerator/single-quote": "^1.6.2",
57
+ "@dtsgenerator/do-nothing": "^2.5.3",
58
+ "@dtsgenerator/eslint-config": "^0.6.4",
59
+ "@dtsgenerator/replace-namespace": "^1.5.4",
60
+ "@dtsgenerator/single-quote": "^1.6.3",
61
61
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
62
62
  "@types/debug": "^4.1.7",
63
63
  "@types/glob": "^8.0.0",
64
64
  "@types/js-yaml": "^4.0.5",
65
65
  "@types/mkdirp": "^1.0.2",
66
- "@types/mocha": "^9.1.1",
67
- "@types/node": "^16.11.45",
66
+ "@types/mocha": "^10.0.1",
67
+ "@types/node": "^16.18.10",
68
68
  "cross-env": "^7.0.3",
69
- "eslint": "^8.23.0",
70
- "husky": "^8.0.1",
71
- "lint-staged": "^13.0.3",
72
- "mocha": "^10.0.0",
69
+ "eslint": "^8.30.0",
70
+ "husky": "^8.0.2",
71
+ "lint-staged": "^13.1.0",
72
+ "mocha": "^10.2.0",
73
73
  "nyc": "^15.1.0",
74
- "prettier": "^2.7.1",
74
+ "prettier": "^2.8.1",
75
75
  "rimraf": "^3.0.2",
76
76
  "source-map-support": "^0.5.21",
77
77
  "ts-node": "^10.9.1"
@@ -65,7 +65,6 @@ export function buildNamespaceNode(
65
65
  ? [ts.factory.createModifier(ts.SyntaxKind.DeclareKeyword)]
66
66
  : undefined;
67
67
  return ts.factory.createModuleDeclaration(
68
- undefined,
69
68
  modifiers,
70
69
  buildTypeNameIdentifier(name),
71
70
  ts.factory.createModuleBlock(statements),
@@ -85,7 +84,6 @@ export function buildInterfaceNode(
85
84
  ? [ts.factory.createModifier(ts.SyntaxKind.DeclareKeyword)]
86
85
  : [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)];
87
86
  return ts.factory.createInterfaceDeclaration(
88
- undefined,
89
87
  modifiers,
90
88
  buildTypeNameIdentifier(name),
91
89
  undefined,
@@ -104,7 +102,6 @@ export function buildTypeAliasNode(
104
102
  ? [ts.factory.createModifier(ts.SyntaxKind.DeclareKeyword)]
105
103
  : [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)];
106
104
  return ts.factory.createTypeAliasDeclaration(
107
- undefined,
108
105
  modifiers,
109
106
  buildTypeNameIdentifier(name),
110
107
  undefined,
@@ -126,11 +123,9 @@ export function buildPropertySignature(
126
123
  : undefined;
127
124
  if (isPattern) {
128
125
  return ts.factory.createIndexSignature(
129
- undefined,
130
126
  modifiers,
131
127
  [
132
128
  ts.factory.createParameterDeclaration(
133
- [],
134
129
  [],
135
130
  undefined,
136
131
  ts.factory.createIdentifier('pattern'),
@@ -156,11 +151,9 @@ export function buildIndexSignatureNode(
156
151
  valueType: ts.TypeNode
157
152
  ): ts.IndexSignatureDeclaration {
158
153
  return ts.factory.createIndexSignature(
159
- undefined,
160
154
  undefined,
161
155
  [
162
156
  ts.factory.createParameterDeclaration(
163
- undefined,
164
157
  undefined,
165
158
  undefined,
166
159
  buildTypeNameIdentifier(name),