ts-pkg-installer
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -49,2 +49,3 @@ // ts-pkg-installer.ts | ||
this.secondaryDeclarations = config.secondaryDeclarations || []; | ||
this.noWrap = config.noWrap || false; | ||
this.moduleName = config.moduleName; | ||
@@ -278,2 +279,6 @@ this.localTypingsDir = config.localTypingsDir || 'typings'; | ||
var state = 0 /* Header */; | ||
// We may not be wrapping the main declaration in an ambient external module declaration. | ||
if (this.config.noWrap) { | ||
dlog('Main ambient external module declaration disabled'); | ||
} | ||
var reducer = function (wrapped, line) { | ||
@@ -297,3 +302,5 @@ if (state === 0 /* Header */) { | ||
// Transitioning out of header state, so emit the module declaration. | ||
wrapped.push(_this.moduleDeclaration()); | ||
if (!(_this.config.noWrap)) { | ||
wrapped.push(_this.moduleDeclaration()); | ||
} | ||
state = 1 /* Body */; | ||
@@ -303,3 +310,3 @@ } | ||
} | ||
if (state === 1 /* Body */) { | ||
if (state === 1 /* Body */ && !(_this.config.noWrap)) { | ||
// See if we have a declaration of some sort. | ||
@@ -320,10 +327,12 @@ var declarationMatches = line.match(declarationRegex); | ||
return BluePromise.reduce(lines, reducer, []).then(function (wrapped) { | ||
// If we're still in the header (i.e. we had no body lines), then emit the module declaration now. | ||
if (state === 0 /* Header */) { | ||
wrapped.push(_this.moduleDeclaration()); | ||
state = 1 /* Body */; | ||
if (!(_this.config.noWrap)) { | ||
// If we're still in the header (i.e. we had no body lines), then emit the module declaration now. | ||
if (state === 0 /* Header */) { | ||
wrapped.push(_this.moduleDeclaration()); | ||
state = 1 /* Body */; | ||
} | ||
// End by closing the module declaration | ||
wrapped.push('}'); | ||
wrapped.push(''); | ||
} | ||
// End by closing the module declaration | ||
wrapped.push('}'); | ||
wrapped.push(''); | ||
return wrapped.join('\n'); | ||
@@ -330,0 +339,0 @@ }); |
@@ -76,2 +76,6 @@ // ts-pkg-installer.ts | ||
// Disable wrapping of main declaration in its own ambient external module declaration. This is appropriate for | ||
// processing declaration files that already contain ambient external module declarations. | ||
noWrap: boolean; | ||
// Name of the module as specified in the wrapped declaration file. By default, this is the name of the NPM package. | ||
@@ -103,2 +107,3 @@ moduleName: string; | ||
this.secondaryDeclarations = config.secondaryDeclarations || []; | ||
this.noWrap = config.noWrap || false; | ||
this.moduleName = config.moduleName; | ||
@@ -404,2 +409,7 @@ this.localTypingsDir = config.localTypingsDir || 'typings'; | ||
// We may not be wrapping the main declaration in an ambient external module declaration. | ||
if (this.config.noWrap) { | ||
dlog('Main ambient external module declaration disabled'); | ||
} | ||
var reducer = (wrapped: string[], line: string): string[] => { | ||
@@ -426,3 +436,5 @@ | ||
// Transitioning out of header state, so emit the module declaration. | ||
wrapped.push(this.moduleDeclaration()); | ||
if (!(this.config.noWrap)) { | ||
wrapped.push(this.moduleDeclaration()); | ||
} | ||
state = DeclarationFileState.Body; | ||
@@ -433,3 +445,3 @@ } | ||
if (state === DeclarationFileState.Body) { | ||
if (state === DeclarationFileState.Body && !(this.config.noWrap)) { | ||
// See if we have a declaration of some sort. | ||
@@ -454,12 +466,14 @@ var declarationMatches: string[] = line.match(declarationRegex); | ||
// If we're still in the header (i.e. we had no body lines), then emit the module declaration now. | ||
if (state === DeclarationFileState.Header) { | ||
wrapped.push(this.moduleDeclaration()); | ||
state = DeclarationFileState.Body; | ||
if (!(this.config.noWrap)) { | ||
// If we're still in the header (i.e. we had no body lines), then emit the module declaration now. | ||
if (state === DeclarationFileState.Header) { | ||
wrapped.push(this.moduleDeclaration()); | ||
state = DeclarationFileState.Body; | ||
} | ||
// End by closing the module declaration | ||
wrapped.push('}'); | ||
wrapped.push(''); | ||
} | ||
// End by closing the module declaration | ||
wrapped.push('}'); | ||
wrapped.push(''); | ||
return wrapped.join('\n'); | ||
@@ -466,0 +480,0 @@ }); |
{ | ||
"name": "ts-pkg-installer", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "TypeScript package installer", | ||
@@ -5,0 +5,0 @@ "main": "bin/ts-pkg-installer.js", |
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
99075
17
1476