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

dts-dom

Package Overview
Dependencies
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dts-dom - npm Package Compare versions

Comparing version 0.1.12 to 0.1.13

18

bin/index.d.ts

@@ -6,2 +6,12 @@ export interface DeclarationBase {

}
export interface EnumMemberDeclaration extends DeclarationBase {
kind: "enum-value";
name: string;
}
export interface EnumDeclaration extends DeclarationBase {
kind: "enum";
name: string;
members: EnumMemberDeclaration[];
constant: boolean;
}
export interface PropertyDeclaration extends DeclarationBase {

@@ -119,3 +129,3 @@ kind: "property";

export declare type ModuleMember = InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration | Import;
export declare type TopLevelDeclaration = NamespaceMember | ExportEqualsDeclaration | ModuleDeclaration | Import;
export declare type TopLevelDeclaration = NamespaceMember | ExportEqualsDeclaration | ModuleDeclaration | EnumDeclaration | Import;
export declare enum DeclarationFlags {

@@ -136,5 +146,11 @@ None = 0,

}
export declare const config: {
wrapJsDocComments: boolean;
outputEol: string;
};
export declare const create: {
interface(name: string): InterfaceDeclaration;
class(name: string): ClassDeclaration;
enum(name: string, constant?: boolean): EnumDeclaration;
enumValue(name: string): EnumMemberDeclaration;
property(name: string, type: Type, flags?: DeclarationFlags): PropertyDeclaration;

@@ -141,0 +157,0 @@ method(name: string, parameters: Parameter[], returnType: Type, flags?: DeclarationFlags): MethodDeclaration;

@@ -19,2 +19,6 @@ "use strict";

})(ParameterFlags = exports.ParameterFlags || (exports.ParameterFlags = {}));
exports.config = {
wrapJsDocComments: true,
outputEol: '\r\n',
};
exports.create = {

@@ -37,2 +41,16 @@ interface: function (name) {

},
enum: function (name, constant) {
if (constant === void 0) { constant = false; }
return {
kind: 'enum',
name: name, constant: constant,
members: []
};
},
enumValue: function (name) {
return {
kind: 'enum-value',
name: name
};
},
property: function (name, type, flags) {

@@ -203,2 +221,3 @@ if (flags === void 0) { flags = DeclarationFlags.None; }

writeDeclaration(rootDecl);
newline();
return output;

@@ -259,3 +278,3 @@ function getContextFlags() {

function newline() {
output = output + '\r\n';
output = output + exports.config.outputEol;
}

@@ -282,10 +301,15 @@ function needsParens(d) {

if (decl.jsDocComment) {
start('/**');
newline();
for (var _i = 0, _a = decl.jsDocComment.split(/\n/g); _i < _a.length; _i++) {
var line = _a[_i];
start(" * " + line);
if (exports.config.wrapJsDocComments) {
start('/**');
newline();
for (var _i = 0, _a = decl.jsDocComment.split(/\r?\n/g); _i < _a.length; _i++) {
var line = _a[_i];
start(" * " + line);
newline();
}
start(' */');
}
start(' */');
else {
start(decl.jsDocComment);
}
newline();

@@ -362,2 +386,3 @@ }

break;
case "class":
case "interface":

@@ -442,9 +467,9 @@ print(e.name);

printDeclarationComments(c);
startWithDeclareOrExport(classFlagsToString(c.flags) + "class " + c.name + " ", c.flags);
startWithDeclareOrExport(classFlagsToString(c.flags) + "class " + c.name, c.flags);
if (c.baseType) {
print('extends ');
print(' extends ');
writeReference(c.baseType);
}
if (c.implements && c.implements.length) {
print("implements ");
print(' implements ');
var first = true;

@@ -459,3 +484,3 @@ for (var _i = 0, _a = c.implements; _i < _a.length; _i++) {

}
print('{');
print(' {');
newline();

@@ -466,2 +491,3 @@ indentLevel++;

writeClassMember(m);
newline();
}

@@ -514,2 +540,3 @@ indentLevel--;

writeDeclaration(member);
newline();
}

@@ -548,2 +575,3 @@ indentLevel--;

writeDeclaration(member);
newline();
}

@@ -563,2 +591,21 @@ indentLevel--;

}
function writeEnum(e) {
printDeclarationComments(e);
startWithDeclareOrExport((e.constant ? 'const ' : '') + "enum " + e.name + " {", e.flags);
newline();
indentLevel++;
for (var _i = 0, _a = e.members; _i < _a.length; _i++) {
var member = _a[_i];
writeEnumValue(member);
}
indentLevel--;
start("}");
newline();
}
function writeEnumValue(e) {
printDeclarationComments(e);
start(e.name);
print(',');
newline();
}
function writeDeclaration(d) {

@@ -590,2 +637,4 @@ if (typeof d === 'string') {

return writeImportDefault(d);
case "enum":
return writeEnum(d);
default:

@@ -592,0 +641,0 @@ return never(d, "Unknown declaration kind " + d.kind);

@@ -7,2 +7,14 @@ export interface DeclarationBase {

export interface EnumMemberDeclaration extends DeclarationBase {
kind: "enum-value";
name: string;
}
export interface EnumDeclaration extends DeclarationBase {
kind: "enum";
name: string;
members: EnumMemberDeclaration[];
constant: boolean;
}
export interface PropertyDeclaration extends DeclarationBase {

@@ -146,3 +158,3 @@ kind: "property";

export type ModuleMember = InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration | Import;
export type TopLevelDeclaration = NamespaceMember | ExportEqualsDeclaration | ModuleDeclaration | Import;
export type TopLevelDeclaration = NamespaceMember | ExportEqualsDeclaration | ModuleDeclaration | EnumDeclaration | Import;

@@ -166,2 +178,7 @@ export enum DeclarationFlags {

export const config = {
wrapJsDocComments: true,
outputEol: '\r\n',
};
export const create = {

@@ -186,2 +203,17 @@ interface(name: string): InterfaceDeclaration {

enum(name: string, constant: boolean = false): EnumDeclaration {
return {
kind: 'enum',
name, constant,
members: []
};
},
enumValue(name: string): EnumMemberDeclaration {
return {
kind: 'enum-value',
name
};
},
property(name: string, type: Type, flags = DeclarationFlags.None): PropertyDeclaration {

@@ -374,2 +406,3 @@ return {

writeDeclaration(rootDecl);
newline();
return output;

@@ -441,3 +474,3 @@

function newline() {
output = output + '\r\n';
output = output + config.outputEol;
}

@@ -466,9 +499,15 @@

if (decl.jsDocComment) {
start('/**');
newline();
for(const line of decl.jsDocComment.split(/\n/g)) {
start(` * ${line}`);
if (config.wrapJsDocComments) {
start('/**');
newline();
for(const line of decl.jsDocComment.split(/\r?\n/g)) {
start(` * ${line}`);
newline();
}
start(' */');
}
start(' */');
else {
start(decl.jsDocComment);
}
newline();

@@ -542,2 +581,3 @@ }

case "class":
case "interface":

@@ -634,9 +674,9 @@ print(e.name);

printDeclarationComments(c);
startWithDeclareOrExport(`${classFlagsToString(c.flags)}class ${c.name} `, c.flags);
startWithDeclareOrExport(`${classFlagsToString(c.flags)}class ${c.name}`, c.flags);
if (c.baseType) {
print('extends ');
print(' extends ');
writeReference(c.baseType);
}
if (c.implements && c.implements.length) {
print(`implements `);
print(' implements ');
let first = true;

@@ -649,3 +689,3 @@ for (const impl of c.implements) {

}
print('{');
print(' {');
newline();

@@ -655,2 +695,3 @@ indentLevel++;

writeClassMember(m);
newline();
}

@@ -707,2 +748,3 @@ indentLevel--;

writeDeclaration(member);
newline();
}

@@ -744,2 +786,3 @@ indentLevel--;

writeDeclaration(member);
newline();
}

@@ -762,2 +805,22 @@ indentLevel--;

function writeEnum(e: EnumDeclaration) {
printDeclarationComments(e);
startWithDeclareOrExport(`${e.constant ? 'const ' : ''}enum ${e.name} {`, e.flags);
newline();
indentLevel++;
for (const member of e.members) {
writeEnumValue(member);
}
indentLevel--;
start(`}`);
newline();
}
function writeEnumValue(e: EnumMemberDeclaration) {
printDeclarationComments(e);
start(e.name);
print(',');
newline();
}
function writeDeclaration(d: TopLevelDeclaration) {

@@ -788,2 +851,4 @@ if (typeof d === 'string') {

return writeImportDefault(d);
case "enum":
return writeEnum(d);

@@ -790,0 +855,0 @@ default:

2

package.json
{
"name": "dts-dom",
"version": "0.1.12",
"version": "0.1.13",
"homepage": "https://github.com/RyanCavanaugh/dts-dom",

@@ -5,0 +5,0 @@ "description": "DOM for TypeScript Declaration Files",

Sorry, the diff of this file is not supported yet

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