Socket
Socket
Sign inDemoInstall

grunt-ts

Package Overview
Dependencies
Maintainers
5
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-ts - npm Package Compare versions

Comparing version 5.0.0-beta.1 to 5.0.0-beta.2

src/.baseDir.js

2

package.json

@@ -5,3 +5,3 @@ {

"description": "Compile and manage your TypeScript project",
"version": "5.0.0-beta.1",
"version": "5.0.0-beta.2",
"homepage": "https://github.com/grunt-ts/grunt-ts",

@@ -8,0 +8,0 @@ "repository": {

@@ -85,3 +85,3 @@ /// <reference path="../../defs/tsd.d.ts"/>

newFiles = getChangedFiles(files, options.targetName);
if (newFiles.length !== 0) {
if (newFiles.length !== 0 || options.testExecute) {
files = newFiles;

@@ -88,0 +88,0 @@ // If outDir is specified but no baseDir is specified we need to determine one

@@ -110,3 +110,3 @@ /// <reference path="../../defs/tsd.d.ts"/>

if (newFiles.length !== 0) {
if (newFiles.length !== 0 || options.testExecute) {
files = newFiles;

@@ -312,3 +312,3 @@

} else {
let invalidTestExecuteError = 'Invalid testExecute node present on target "' +
const invalidTestExecuteError = 'Invalid testExecute node present on target "' +
options.targetName + '". Value of testExecute must be a function.';

@@ -315,0 +315,0 @@ throw (new Error(invalidTestExecuteError));

@@ -15,10 +15,21 @@ /// <reference path="../../defs/tsd.d.ts"/>

'noEmitHelpers', 'noEmitOnError', 'noImplicitAny', 'noResolve', 'preserveConstEnums', 'removeComments', 'sourceRoot',
'sourceMap', 'suppressImplicitAnyIndexErrors', 'target', 'verbose'];
function resolveAsync(rawTaskOptions, rawTargetOptions, targetName, files) {
'sourceMap', 'suppressImplicitAnyIndexErrors', 'target', 'verbose'], delayTemplateExpansion = ['htmlModuleTemplate', 'htmlVarTemplate'];
var templateProcessor = null;
function noopTemplateProcessor(templateString, options) {
return templateString;
}
function resolveAsync(rawTaskOptions, rawTargetOptions, targetName, files, theTemplateProcessor) {
if (targetName === void 0) { targetName = ''; }
if (files === void 0) { files = []; }
if (theTemplateProcessor === void 0) { theTemplateProcessor = null; }
return new es6_promise_1.Promise(function (resolve, reject) {
if (theTemplateProcessor && typeof theTemplateProcessor === 'function') {
templateProcessor = theTemplateProcessor;
}
else {
templateProcessor = noopTemplateProcessor;
}
fixMissingOptions(rawTaskOptions);
fixMissingOptions(rawTargetOptions);
var _a = resolveAndWarnOnCapitalizationErrors(rawTaskOptions, rawTargetOptions, targetName), errors = _a.errors, warnings = _a.warnings;
var _a = resolveAndWarnOnConfigurationIssues(rawTaskOptions, rawTargetOptions, targetName), errors = _a.errors, warnings = _a.warnings;
var result = emptyOptionsResolveResult();

@@ -30,4 +41,4 @@ (_b = result.errors).push.apply(_b, errors);

result = copyCompilationTasks(result, files);
visualStudioOptionsResolver_1.resolveVSOptionsAsync(result, rawTaskOptions, rawTargetOptions).then(function (result) {
tsconfig_1.resolveAsync(result, rawTaskOptions, rawTargetOptions).then(function (result) {
visualStudioOptionsResolver_1.resolveVSOptionsAsync(result, rawTaskOptions, rawTargetOptions, templateProcessor).then(function (result) {
tsconfig_1.resolveAsync(result, rawTaskOptions, rawTargetOptions, templateProcessor).then(function (result) {
result = addressAssociatedOptionsAndResolveConflicts(result);

@@ -64,3 +75,3 @@ result = applyGruntTSDefaults(result);

}
function resolveAndWarnOnCapitalizationErrors(task, target, targetName) {
function resolveAndWarnOnConfigurationIssues(task, target, targetName) {
var errors = [], warnings = [];

@@ -75,2 +86,3 @@ var lowercaseTargetProps = _.map(propertiesFromTarget, function (prop) { return prop.toLocaleLowerCase(); });

function checkLocations(task, configName) {
// todo: clean this up. The top and bottom sections are largely the same.
if (task) {

@@ -94,2 +106,21 @@ for (var propertyName in task) {

}
if (task.options) {
for (var propertyName in task.options) {
if (propertiesFromTargetOptions.indexOf(propertyName) === -1) {
if (propertiesFromTarget.indexOf(propertyName) > -1) {
var warningText = ("Property \"" + propertyName + "\" in " + configName + " is possibly in the wrong place and will be ignored. ") +
"It is expected on the task or target, not under options.";
warnings.push(warningText);
}
else if (lowercaseTargetOptionsProps.indexOf(propertyName.toLocaleLowerCase()) === -1
&& lowercaseTargetProps.indexOf(propertyName.toLocaleLowerCase()) > -1) {
var index = lowercaseTargetProps.indexOf(propertyName.toLocaleLowerCase());
var correctPropertyName = propertiesFromTarget[index];
var warningText = ("Property \"" + propertyName + "\" in " + configName + " is possibly in the wrong place and will be ignored. ") +
("It is expected on the task or target, not under options. It is also the wrong case and should be " + correctPropertyName + ".");
warnings.push(warningText);
}
}
}
}
}

@@ -133,3 +164,9 @@ }

if (propertyName in gruntOptions && propertyName !== 'vs') {
applyTo[propertyName] = gruntOptions[propertyName];
if (typeof gruntOptions[propertyName] === 'string' && utils.hasValue(gruntOptions[propertyName]) &&
delayTemplateExpansion.indexOf(propertyName) === -1) {
applyTo[propertyName] = templateProcessor(gruntOptions[propertyName], {});
}
else {
applyTo[propertyName] = gruntOptions[propertyName];
}
}

@@ -141,3 +178,9 @@ }

if (propertyName in gruntOptions.options) {
applyTo[propertyName] = gruntOptions.options[propertyName];
if (typeof gruntOptions.options[propertyName] === 'string' && utils.hasValue(gruntOptions.options[propertyName]) &&
delayTemplateExpansion.indexOf(propertyName) === -1) {
applyTo[propertyName] = templateProcessor(gruntOptions.options[propertyName], {});
}
else {
applyTo[propertyName] = gruntOptions.options[propertyName];
}
}

@@ -144,0 +187,0 @@ }

@@ -19,15 +19,30 @@ /// <reference path="../../defs/tsd.d.ts"/>

'noEmitHelpers', 'noEmitOnError', 'noImplicitAny', 'noResolve', 'preserveConstEnums', 'removeComments', 'sourceRoot',
'sourceMap', 'suppressImplicitAnyIndexErrors', 'target', 'verbose'];
'sourceMap', 'suppressImplicitAnyIndexErrors', 'target', 'verbose'],
delayTemplateExpansion = ['htmlModuleTemplate', 'htmlVarTemplate'];
let templateProcessor: (templateString: string, options: any) => string = null;
function noopTemplateProcessor(templateString: string, options: any) {
return templateString;
}
export function resolveAsync(rawTaskOptions: ITargetOptions,
rawTargetOptions: ITargetOptions,
targetName = '',
files: IGruntTSCompilationInfo[] = []): Promise<IGruntTSOptions> {
files: IGruntTSCompilationInfo[] = [],
theTemplateProcessor: (templateString: string, options: any) => string = null): Promise<IGruntTSOptions> {
return new Promise<IGruntTSOptions>((resolve, reject) => {
if (theTemplateProcessor && typeof theTemplateProcessor === 'function') {
templateProcessor = theTemplateProcessor;
} else {
templateProcessor = noopTemplateProcessor;
}
fixMissingOptions(rawTaskOptions);
fixMissingOptions(rawTargetOptions);
let {errors, warnings} = resolveAndWarnOnCapitalizationErrors(rawTaskOptions, rawTargetOptions, targetName);
let {errors, warnings} = resolveAndWarnOnConfigurationIssues(rawTaskOptions, rawTargetOptions, targetName);
let result = emptyOptionsResolveResult();

@@ -41,4 +56,4 @@ result.errors.push(...errors);

resolveVSOptionsAsync(result, rawTaskOptions, rawTargetOptions).then((result) => {
resolveTSConfigAsync(result, rawTaskOptions, rawTargetOptions).then((result) => {
resolveVSOptionsAsync(result, rawTaskOptions, rawTargetOptions, templateProcessor).then((result) => {
resolveTSConfigAsync(result, rawTaskOptions, rawTargetOptions, templateProcessor).then((result) => {

@@ -79,3 +94,3 @@ result = addressAssociatedOptionsAndResolveConflicts(result);

function resolveAndWarnOnCapitalizationErrors(task: ITargetOptions,
function resolveAndWarnOnConfigurationIssues(task: ITargetOptions,
target: ITargetOptions, targetName: string) {

@@ -95,2 +110,3 @@

function checkLocations(task: ITargetOptions, configName: string) {
// todo: clean this up. The top and bottom sections are largely the same.
if (task) {

@@ -114,2 +130,21 @@ for (let propertyName in task) {

}
if (task.options) {
for (let propertyName in task.options) {
if (propertiesFromTargetOptions.indexOf(propertyName) === -1) {
if (propertiesFromTarget.indexOf(propertyName) > -1) {
let warningText = `Property "${propertyName}" in ${configName} is possibly in the wrong place and will be ignored. ` +
`It is expected on the task or target, not under options.`;
warnings.push(warningText);
} else if (lowercaseTargetOptionsProps.indexOf(propertyName.toLocaleLowerCase()) === -1
&& lowercaseTargetProps.indexOf(propertyName.toLocaleLowerCase()) > -1) {
let index = lowercaseTargetProps.indexOf(propertyName.toLocaleLowerCase());
let correctPropertyName = propertiesFromTarget[index];
let warningText = `Property "${propertyName}" in ${configName} is possibly in the wrong place and will be ignored. ` +
`It is expected on the task or target, not under options. It is also the wrong case and should be ${correctPropertyName}.`;
warnings.push(warningText);
}
}
}
}
}

@@ -162,3 +197,8 @@ }

if (propertyName in gruntOptions && propertyName !== 'vs') {
applyTo[propertyName] = gruntOptions[propertyName];
if (typeof gruntOptions[propertyName] === 'string' && utils.hasValue(gruntOptions[propertyName]) &&
delayTemplateExpansion.indexOf(propertyName) === -1) {
applyTo[propertyName] = templateProcessor(gruntOptions[propertyName], {});
} else {
applyTo[propertyName] = gruntOptions[propertyName];
}
}

@@ -170,3 +210,8 @@ }

if (propertyName in gruntOptions.options) {
applyTo[propertyName] = gruntOptions.options[propertyName];
if (typeof gruntOptions.options[propertyName] === 'string' && utils.hasValue(gruntOptions.options[propertyName]) &&
delayTemplateExpansion.indexOf(propertyName) === -1) {
applyTo[propertyName] = templateProcessor(gruntOptions.options[propertyName], {});
} else {
applyTo[propertyName] = gruntOptions.options[propertyName];
}
}

@@ -173,0 +218,0 @@ }

@@ -7,3 +7,5 @@ 'use strict';

var _ = require('lodash');
function resolveAsync(applyTo, taskOptions, targetOptions) {
var templateProcessor = null;
function resolveAsync(applyTo, taskOptions, targetOptions, theTemplateProcessor) {
templateProcessor = theTemplateProcessor;
return new es6_promise_1.Promise(function (resolve, reject) {

@@ -22,3 +24,3 @@ try {

if ('tsconfig' in targetTSConfig) {
tsconfig.tsconfig = targetTSConfig.tsconfig;
tsconfig.tsconfig = templateProcessor(targetTSConfig.tsconfig, {});
}

@@ -91,3 +93,3 @@ if ('ignoreSettings' in targetTSConfig) {

else if (typeof raw.tsconfig === 'string') {
var tsconfigName = raw.tsconfig;
var tsconfigName = templateProcessor(raw.tsconfig, {});
var fileInfo = fs.lstatSync(tsconfigName);

@@ -94,0 +96,0 @@ if (fileInfo.isDirectory()) {

@@ -9,5 +9,11 @@ 'use strict';

let templateProcessor: (templateString: string, options: any) => string = null;
export function resolveAsync(applyTo: IGruntTSOptions,
taskOptions: ITargetOptions,
targetOptions: ITargetOptions) {
targetOptions: ITargetOptions,
theTemplateProcessor: (templateString: string, options: any) => string) {
templateProcessor = theTemplateProcessor;
return new Promise<IGruntTSOptions>((resolve, reject) => {

@@ -30,3 +36,3 @@

if ('tsconfig' in targetTSConfig) {
tsconfig.tsconfig = targetTSConfig.tsconfig;
tsconfig.tsconfig = templateProcessor(targetTSConfig.tsconfig, {});
}

@@ -103,3 +109,3 @@ if ('ignoreSettings' in targetTSConfig) {

let tsconfigName = <string>raw.tsconfig;
let tsconfigName = templateProcessor(<string>raw.tsconfig, {});
let fileInfo = fs.lstatSync(tsconfigName);

@@ -106,0 +112,0 @@

@@ -7,3 +7,5 @@ 'use strict';

var _ = require('lodash');
function resolveVSOptionsAsync(applyTo, taskOptions, targetOptions) {
var templateProcessor = null;
function resolveVSOptionsAsync(applyTo, taskOptions, targetOptions, theTemplateProcessor) {
templateProcessor = theTemplateProcessor;
return new es6_promise_1.Promise(function (resolve, reject) {

@@ -35,2 +37,8 @@ {

applyTo.vs = vs;
if (typeof applyTo.vs.project === 'string') {
applyTo.vs.project = templateProcessor(applyTo.vs.project, {});
}
if (typeof applyTo.vs.config === 'string') {
applyTo.vs.config = templateProcessor(applyTo.vs.config, {});
}
}

@@ -43,6 +51,12 @@ }

}).then(function (vsConfig) {
applyTo = applyVSOptions(applyTo, vsConfig);
applyTo = resolve_out_and_outDir(applyTo, taskOptions, targetOptions);
resolve(applyTo);
return;
try {
applyTo = applyVSOptions(applyTo, vsConfig);
applyTo = resolve_out_and_outDir(applyTo, taskOptions, targetOptions);
resolve(applyTo);
return;
}
catch (ex) {
reject(ex);
return;
}
}).catch(function (error) {

@@ -49,0 +63,0 @@ if (error.errno === 34) {

@@ -9,6 +9,11 @@ 'use strict';

let templateProcessor: (templateString: string, options: any) => string = null;
export function resolveVSOptionsAsync(applyTo: IGruntTSOptions,
taskOptions: ITargetOptions,
targetOptions: ITargetOptions) {
targetOptions: ITargetOptions,
theTemplateProcessor: (templateString: string, options: any) => string) {
templateProcessor = theTemplateProcessor;
return new Promise<IGruntTSOptions>((resolve, reject) => {

@@ -43,2 +48,8 @@

applyTo.vs = vs;
if (typeof (<IVisualStudioProjectSupport>applyTo.vs).project === 'string') {
(<IVisualStudioProjectSupport>applyTo.vs).project = templateProcessor((<IVisualStudioProjectSupport>applyTo.vs).project, {});
}
if (typeof (<IVisualStudioProjectSupport>applyTo.vs).config === 'string') {
(<IVisualStudioProjectSupport>applyTo.vs).config = templateProcessor((<IVisualStudioProjectSupport>applyTo.vs).config, {});
}
}

@@ -52,7 +63,11 @@ }

}).then((vsConfig) => {
applyTo = applyVSOptions(applyTo, vsConfig);
applyTo = resolve_out_and_outDir(applyTo, taskOptions, targetOptions);
resolve(applyTo);
return;
try {
applyTo = applyVSOptions(applyTo, vsConfig);
applyTo = resolve_out_and_outDir(applyTo, taskOptions, targetOptions);
resolve(applyTo);
return;
} catch (ex) {
reject(ex);
return;
}
}).catch((error) => {

@@ -59,0 +74,0 @@ if (error.errno === 34) {

@@ -38,3 +38,3 @@ /// <reference path="../defs/tsd.d.ts"/>

var rawTargetConfig = (grunt.config.getRaw(currentTask.name + '.' + currentTask.target) || {});
optionsResolver.resolveAsync(rawTaskConfig, rawTargetConfig, currentTask.target, files).then(function (result) {
optionsResolver.resolveAsync(rawTaskConfig, rawTargetConfig, currentTask.target, files, grunt.template.process).then(function (result) {
options = result;

@@ -285,4 +285,3 @@ options.warnings.forEach(function (warning) {

if (options.compile) {
// Compile, if there are any files to compile!
if (filesToCompile.length > 0) {
if (filesToCompile.length > 0 || options.testExecute) {
return runCompilation(options, currentFiles).then(function (success) {

@@ -293,2 +292,3 @@ return success;

else {
// Nothing to do
grunt.log.writeln('No files to compile'.red);

@@ -371,9 +371,2 @@ return es6_promise_1.Promise.resolve(true);

});
// function processAllTargetTemplates(targetCfg: ITargetOptions, targetOpt: ITaskOptions) {
// targetCfg.out = processIndividualTemplate(targetCfg.out);
// targetCfg.outDir = processIndividualTemplate(targetCfg.outDir);
// targetCfg.reference = processIndividualTemplate(targetCfg.reference);
// targetOpt.mapRoot = processIndividualTemplate(targetOpt.mapRoot);
// targetOpt.sourceRoot = processIndividualTemplate(targetOpt.sourceRoot);
// }
function processIndividualTemplate(template) {

@@ -380,0 +373,0 @@ if (template) {

@@ -51,3 +51,4 @@ /// <reference path="../defs/tsd.d.ts"/>

optionsResolver.resolveAsync(rawTaskConfig, rawTargetConfig, currentTask.target, files).then((result) => {
optionsResolver.resolveAsync(rawTaskConfig, rawTargetConfig, currentTask.target, files,
grunt.template.process).then((result) => {
options = result;

@@ -350,5 +351,3 @@

if (options.compile) {
// Compile, if there are any files to compile!
if (filesToCompile.length > 0) {
if (filesToCompile.length > 0 || options.testExecute) {
return runCompilation(options, currentFiles).then((success: boolean) => {

@@ -358,3 +357,4 @@ return success;

}
else { // Nothing to do
else {
// Nothing to do
grunt.log.writeln('No files to compile'.red);

@@ -451,10 +451,2 @@ return Promise.resolve(true);

// function processAllTargetTemplates(targetCfg: ITargetOptions, targetOpt: ITaskOptions) {
// targetCfg.out = processIndividualTemplate(targetCfg.out);
// targetCfg.outDir = processIndividualTemplate(targetCfg.outDir);
// targetCfg.reference = processIndividualTemplate(targetCfg.reference);
// targetOpt.mapRoot = processIndividualTemplate(targetOpt.mapRoot);
// targetOpt.sourceRoot = processIndividualTemplate(targetOpt.sourceRoot);
// }
function processIndividualTemplate(template: string) {

@@ -461,0 +453,0 @@ if (template) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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