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.9 to 0.1.10

48

bin/index.d.ts

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

}
export interface ImportAllDeclaration extends DeclarationBase {
kind: "importAll";
name: string;
from: string;
}
export interface ImportDefaultDeclaration extends DeclarationBase {
kind: "importDefault";
name: string;
from: string;
}
export interface NamespaceDeclaration extends DeclarationBase {

@@ -61,2 +71,7 @@ kind: "namespace";

}
export interface ModuleDeclaration extends DeclarationBase {
kind: "module";
name: string;
members: ModuleMember[];
}
export interface ObjectType {

@@ -93,4 +108,6 @@ kind: "object";

export declare type Type = TypeReference | UnionType | IntersectionType | PrimitiveType | ObjectType;
export declare type Import = ImportAllDeclaration | ImportDefaultDeclaration;
export declare type NamespaceMember = InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration;
export declare type TopLevelDeclaration = NamespaceMember | ExportEqualsDeclaration;
export declare type ModuleMember = InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration | Import;
export declare type TopLevelDeclaration = NamespaceMember | ExportEqualsDeclaration | ModuleDeclaration | Import;
export declare enum DeclarationFlags {

@@ -113,21 +130,24 @@ None = 0,

class(name: string): ClassDeclaration;
property(name: string, type: InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration | ExportEqualsDeclaration | NamedTypeReference | ArrayTypeReference | "string" | "number" | "boolean" | "any" | "void" | UnionType | IntersectionType | ObjectType, flags?: DeclarationFlags): PropertyDeclaration;
method(name: string, parameters: Parameter[], returnType: InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration | ExportEqualsDeclaration | NamedTypeReference | ArrayTypeReference | "string" | "number" | "boolean" | "any" | "void" | UnionType | IntersectionType | ObjectType, flags?: DeclarationFlags): MethodDeclaration;
function(name: string, parameters: Parameter[], returnType: InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration | ExportEqualsDeclaration | NamedTypeReference | ArrayTypeReference | "string" | "number" | "boolean" | "any" | "void" | UnionType | IntersectionType | ObjectType): FunctionDeclaration;
parameter(name: string, type: InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration | ExportEqualsDeclaration | NamedTypeReference | ArrayTypeReference | "string" | "number" | "boolean" | "any" | "void" | UnionType | IntersectionType | ObjectType, flags?: ParameterFlags): Parameter;
property(name: string, type: Type, flags?: DeclarationFlags): PropertyDeclaration;
method(name: string, parameters: Parameter[], returnType: Type, flags?: DeclarationFlags): MethodDeclaration;
function(name: string, parameters: Parameter[], returnType: Type): FunctionDeclaration;
parameter(name: string, type: Type, flags?: ParameterFlags): Parameter;
constructor(parameters: Parameter[], flags?: DeclarationFlags): ConstructorDeclaration;
const(name: string, type: InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration | ExportEqualsDeclaration | NamedTypeReference | ArrayTypeReference | "string" | "number" | "boolean" | "any" | "void" | UnionType | IntersectionType | ObjectType): ConstDeclaration;
const(name: string, type: Type): ConstDeclaration;
namespace(name: string): NamespaceDeclaration;
objectType(members: (PropertyDeclaration | MethodDeclaration)[]): ObjectType;
array(type: InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration | ExportEqualsDeclaration | NamedTypeReference | ArrayTypeReference | "string" | "number" | "boolean" | "any" | "void" | UnionType | IntersectionType | ObjectType): ArrayTypeReference;
objectType(members: ObjectTypeMember[]): ObjectType;
array(type: Type): ArrayTypeReference;
namedTypeReference(name: string): NamedTypeReference;
exportEquals(target: string): ExportEqualsDeclaration;
module(name: string): ModuleDeclaration;
importAll(name: string, from: string): ImportAllDeclaration;
importDefault(name: string, from: string): ImportDefaultDeclaration;
};
export declare const type: {
array(type: InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | NamespaceDeclaration | ConstDeclaration | FunctionDeclaration | ExportEqualsDeclaration | NamedTypeReference | ArrayTypeReference | "string" | "number" | "boolean" | "any" | "void" | UnionType | IntersectionType | ObjectType): ArrayTypeReference;
string: "string" | "number" | "boolean" | "any" | "void";
number: "string" | "number" | "boolean" | "any" | "void";
boolean: "string" | "number" | "boolean" | "any" | "void";
any: "string" | "number" | "boolean" | "any" | "void";
void: "string" | "number" | "boolean" | "any" | "void";
array(type: Type): ArrayTypeReference;
string: PrimitiveType;
number: PrimitiveType;
boolean: PrimitiveType;
any: PrimitiveType;
void: PrimitiveType;
};

@@ -134,0 +154,0 @@ export declare const reservedWords: string[];

@@ -104,2 +104,23 @@ "use strict";

};
},
module: function (name) {
return {
kind: 'module',
name: name,
members: []
};
},
importAll: function (name, from) {
return {
kind: 'importAll',
name: name,
from: from
};
},
importDefault: function (name, from) {
return {
kind: 'importDefault',
name: name,
from: from
};
}

@@ -323,3 +344,3 @@ };

printDeclarationComments(d);
start("interface " + d.name + " ");
startWithDeclareOrExport("interface " + d.name + " ", d.flags);
if (d.baseTypes && d.baseTypes.length) {

@@ -462,2 +483,25 @@ print("extends ");

}
function writeModule(m) {
printDeclarationComments(m);
startWithDeclareOrExport("module '" + m.name + "' {", m.flags);
contextStack.push(1 /* Module */);
newline();
indentLevel++;
for (var _i = 0, _a = m.members; _i < _a.length; _i++) {
var member = _a[_i];
writeDeclaration(member);
}
indentLevel--;
start("}");
contextStack.pop();
newline();
}
function writeImportAll(i) {
start("import * as " + i.name + " from '" + i.from + "';");
newline();
}
function writeImportDefault(i) {
start("import " + i.name + " from '" + i.from + "';");
newline();
}
function writeDeclaration(d) {

@@ -483,2 +527,8 @@ if (typeof d === 'string') {

return writeExportEquals(d);
case "module":
return writeModule(d);
case "importAll":
return writeImportAll(d);
case "importDefault":
return writeImportDefault(d);
default:

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

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

export interface ImportAllDeclaration extends DeclarationBase {
kind: "importAll";
name: string;
from: string;
}
export interface ImportDefaultDeclaration extends DeclarationBase {
kind: "importDefault";
name: string;
from: string;
}
export interface NamespaceDeclaration extends DeclarationBase {

@@ -72,2 +84,8 @@ kind: "namespace";

export interface ModuleDeclaration extends DeclarationBase {
kind: "module";
name: string;
members: ModuleMember[];
}
export interface ObjectType {

@@ -114,4 +132,7 @@ kind: "object";

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

@@ -228,2 +249,26 @@ export enum DeclarationFlags {

};
},
module(name: string): ModuleDeclaration {
return {
kind: 'module',
name,
members: []
};
},
importAll(name: string, from: string): ImportAllDeclaration {
return {
kind: 'importAll',
name,
from
};
},
importDefault(name: string, from: string): ImportDefaultDeclaration {
return {
kind: 'importDefault',
name,
from
};
}

@@ -470,3 +515,3 @@ };

printDeclarationComments(d);
start(`interface ${d.name} `);
startWithDeclareOrExport(`interface ${d.name} `, d.flags);
if (d.baseTypes && d.baseTypes.length) {

@@ -618,2 +663,27 @@ print(`extends `);

function writeModule(m: ModuleDeclaration) {
printDeclarationComments(m);
startWithDeclareOrExport(`module '${m.name}' {`, m.flags);
contextStack.push(ContextFlags.Module);
newline();
indentLevel++;
for (const member of m.members) {
writeDeclaration(member);
}
indentLevel--;
start(`}`);
contextStack.pop();
newline();
}
function writeImportAll(i: ImportAllDeclaration) {
start(`import * as ${i.name} from '${i.from}';`);
newline();
}
function writeImportDefault(i: ImportDefaultDeclaration) {
start(`import ${i.name} from '${i.from}';`);
newline();
}
function writeDeclaration(d: TopLevelDeclaration) {

@@ -638,2 +708,8 @@ if (typeof d === 'string') {

return writeExportEquals(d);
case "module":
return writeModule(d);
case "importAll":
return writeImportAll(d);
case "importDefault":
return writeImportDefault(d);

@@ -640,0 +716,0 @@ default:

{
"name": "dts-dom",
"version": "0.1.9",
"version": "0.1.10",
"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