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.4.0 to 5.5.0-beta.1

CONTRIBUTING.md

3

CHANGELOG.md
# Releases
## Next
* FEAT: Support TypeScript 1.8+ (coming soon)
## v5.4.0 (2016-03-22)
* FIX: amdloader will now work for [`.tsx` extension as well](https://github.com/TypeStrong/grunt-ts/pull/274) [reapplied](https://github.com/TypeStrong/grunt-ts/pull/314)

@@ -5,0 +8,0 @@ * FIX: tsconfig.json exclude support for files (not just directories). Thanks very much to first-time contributor @errorx666 for the PR! Includes PR #337 which keeps exclude performance fast. (#285, #336)

4

package.json

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

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

@@ -49,3 +49,3 @@ "repository": {

"strip-bom": "^2.0.0",
"typescript": "1.7.3",
"typescript": "1.8.9",
"underscore": "1.5.1",

@@ -52,0 +52,0 @@ "underscore.string": "2.3.3"

/// <reference path="../../defs/tsd.d.ts"/>
"use strict";
var _ = require('lodash');

@@ -75,2 +76,17 @@ var _str = require('underscore.string');

if (newLine === void 0) { newLine = utils.eol; }
var commonPath;
var makeRelativeToOutDir = function (files) {
files = _.map(files, function (file) {
// Remove common path and replace with absolute outDir
file = file.replace(commonPath, outDir);
// remove extension '.ts' / '.tsx':
file = file.substr(0, file.lastIndexOf('.'));
// Make relative to amd loader
file = utils.makeRelativePath(loaderPath, file);
// Prepend "./" to prevent "basePath" requirejs setting from interferring:
file = './' + file;
return file;
});
return files;
};
// Read the original file if it exists

@@ -109,3 +125,3 @@ if (fs.existsSync(referenceFile)) {

// Find common path
var commonPath = utils.findCommonPath(files.before.concat(files.generated.concat(files.unordered.concat(files.after))), pathSeperator);
commonPath = utils.findCommonPath(files.before.concat(files.generated.concat(files.unordered.concat(files.after))), pathSeperator);
grunt.log.verbose.writeln('Found common path: ' + commonPath);

@@ -115,16 +131,2 @@ // Make sure outDir is absolute:

grunt.log.verbose.writeln('Using outDir: ' + outDir);
function makeRelativeToOutDir(files) {
files = _.map(files, function (file) {
// Remove common path and replace with absolute outDir
file = file.replace(commonPath, outDir);
// remove extension '.ts' / '.tsx':
file = file.substr(0, file.lastIndexOf('.'));
// Make relative to amd loader
file = utils.makeRelativePath(loaderPath, file);
// Prepend "./" to prevent "basePath" requirejs setting from interferring:
file = './' + file;
return file;
});
return files;
}
grunt.log.verbose.writeln('Making files relative to outDir...');

@@ -131,0 +133,0 @@ files.before = makeRelativeToOutDir(files.before);

@@ -113,2 +113,22 @@ /// <reference path="../../defs/tsd.d.ts"/>

let commonPath: string;
const makeRelativeToOutDir = function(files: string[]) {
files = _.map(files, (file) => {
// Remove common path and replace with absolute outDir
file = file.replace(commonPath, outDir);
// remove extension '.ts' / '.tsx':
file = file.substr(0, file.lastIndexOf('.'));
// Make relative to amd loader
file = utils.makeRelativePath(loaderPath, file);
// Prepend "./" to prevent "basePath" requirejs setting from interferring:
file = './' + file;
return file;
});
return files;
};
// Read the original file if it exists

@@ -149,3 +169,3 @@ if (fs.existsSync(referenceFile)) {

// Find common path
var commonPath = utils.findCommonPath(files.before.concat(files.generated.concat(files.unordered.concat(files.after))), pathSeperator);
commonPath = utils.findCommonPath(files.before.concat(files.generated.concat(files.unordered.concat(files.after))), pathSeperator);
grunt.log.verbose.writeln('Found common path: ' + commonPath);

@@ -157,21 +177,2 @@

function makeRelativeToOutDir(files: string[]) {
files = _.map(files, (file) => {
// Remove common path and replace with absolute outDir
file = file.replace(commonPath, outDir);
// remove extension '.ts' / '.tsx':
file = file.substr(0, file.lastIndexOf('.'));
// Make relative to amd loader
file = utils.makeRelativePath(loaderPath, file);
// Prepend "./" to prevent "basePath" requirejs setting from interferring:
file = './' + file;
return file;
});
return files;
}
grunt.log.verbose.writeln('Making files relative to outDir...');

@@ -178,0 +179,0 @@ files.before = makeRelativeToOutDir(files.before);

/// <reference path="../../defs/tsd.d.ts"/>
"use strict";
// Source based on : https://github.com/tschaub/grunt-newer/blob/master/lib/util.js

@@ -3,0 +4,0 @@ var fs = require('fs');

@@ -67,2 +67,7 @@ /// <reference path="../../defs/tsd.d.ts"/>

}
function compileResultMeansFastCacheShouldBeRefreshed(options, result) {
return (options.fast !== 'never' &&
(result.code === 0 || (result.code === 2 && !options.failOnTypeErrors)));
}
exports.compileResultMeansFastCacheShouldBeRefreshed = compileResultMeansFastCacheShouldBeRefreshed;
function compileAllFiles(options, compilationInfo) {

@@ -127,5 +132,2 @@ var targetFiles = compilationInfo.src;

files = _.map(files, function (item) { return ("\"" + path.resolve(item) + "\""); });
// if (outFile) {
// outFile = `"${path.resolve(outFile)}"`;
// }
var args = files.slice(0);

@@ -215,2 +217,32 @@ var tsconfig = options.tsconfig;

}
if (options.reactNamespace) {
args.push('--reactNamespace', options.reactNamespace);
}
if (options.skipDefaultLibCheck) {
args.push('--skipDefaultLibCheck');
}
if (options.pretty) {
args.push('--pretty');
}
if (options.allowUnusedLabels) {
args.push('--allowUnusedLabels');
}
if (options.noImplicitReturns) {
args.push('--noImplicitReturns');
}
if (options.noFallthroughCasesInSwitch) {
args.push('--noFallthroughCasesInSwitch');
}
if (options.allowUnreachableCode) {
args.push('--allowUnreachableCode');
}
if (options.forceConsistentCasingInFileNames) {
args.push('--forceConsistentCasingInFileNames');
}
if (options.allowJs) {
args.push('--allowJs');
}
if (options.noImplicitUseStrict) {
args.push('--noImplicitUseStrict');
}
args.push('--target', options.target.toUpperCase());

@@ -233,2 +265,5 @@ if (options.module) {

if (compilationInfo.out) {
// We only pass --out instead of --outFile for backward-compatability reasons.
// It is the same for purposes of the command-line (the subtle difference is handled in the tsconfig code
// and the value of --outFile is copied to --out).
args.push('--out', compilationInfo.out);

@@ -320,3 +355,3 @@ }

return executeNode(command, options).then(function (result) {
if (options.fast !== 'never' && (result.code === 0 || !options.failOnTypeErrors && result.code === 2)) {
if (compileResultMeansFastCacheShouldBeRefreshed(options, result)) {
resetChangedFiles(newFiles, options.targetName);

@@ -323,0 +358,0 @@ }

@@ -86,2 +86,7 @@ /// <reference path="../../defs/tsd.d.ts"/>

export function compileResultMeansFastCacheShouldBeRefreshed(options: IGruntTSOptions, result: ICompileResult) {
return (options.fast !== 'never' &&
(result.code === 0 || (result.code === 2 && !options.failOnTypeErrors)));
}
export function compileAllFiles(options: IGruntTSOptions, compilationInfo: IGruntTSCompilationInfo): Promise<ICompileResult> {

@@ -158,6 +163,2 @@

// if (outFile) {
// outFile = `"${path.resolve(outFile)}"`;
// }
var args: string[] = files.slice(0);

@@ -247,2 +248,32 @@ const tsconfig: ITSConfigSupport = options.tsconfig;

}
if (options.reactNamespace) {
args.push('--reactNamespace', options.reactNamespace);
}
if (options.skipDefaultLibCheck) {
args.push('--skipDefaultLibCheck');
}
if (options.pretty) {
args.push('--pretty');
}
if (options.allowUnusedLabels) {
args.push('--allowUnusedLabels');
}
if (options.noImplicitReturns) {
args.push('--noImplicitReturns');
}
if (options.noFallthroughCasesInSwitch) {
args.push('--noFallthroughCasesInSwitch');
}
if (options.allowUnreachableCode) {
args.push('--allowUnreachableCode');
}
if (options.forceConsistentCasingInFileNames) {
args.push('--forceConsistentCasingInFileNames');
}
if (options.allowJs) {
args.push('--allowJs');
}
if (options.noImplicitUseStrict) {
args.push('--noImplicitUseStrict');
}

@@ -268,2 +299,5 @@ args.push('--target', options.target.toUpperCase());

if (compilationInfo.out) {
// We only pass --out instead of --outFile for backward-compatability reasons.
// It is the same for purposes of the command-line (the subtle difference is handled in the tsconfig code
// and the value of --outFile is copied to --out).
args.push('--out', compilationInfo.out);

@@ -362,3 +396,3 @@ }

if (options.fast !== 'never' && (result.code === 0 || !options.failOnTypeErrors && result.code === 2)) {
if (compileResultMeansFastCacheShouldBeRefreshed(options, result)) {
resetChangedFiles(newFiles, options.targetName);

@@ -365,0 +399,0 @@ }

'use strict';
var utils = require('./utils');
var _ = require('lodash');
var TypeScriptDefaults = {

@@ -53,2 +54,12 @@ allowBool: false,

experimentalAsyncFunctions: null,
reactNamespace: null,
skipDefaultLibCheck: null,
pretty: false,
allowUnusedLabels: false,
noImplicitReturns: false,
noFallthroughCasesInSwitch: false,
allowUnreachableCode: false,
forceConsistentCasingInFileNames: false,
allowJs: false,
noImplicitUseStrict: false,
rootDir: null,

@@ -58,4 +69,5 @@ warnings: [],

};
exports.GruntTSDefaults = applyGruntTSDefaults(TypeScriptDefaults);
exports.GruntTSDefaults = applyGruntTSDefaults(_.clone(TypeScriptDefaults));
function applyGruntTSDefaults(options) {
// this function applies defaults where grunt-ts differs from TypeScript
options.sourceMap = true;

@@ -62,0 +74,0 @@ options.target = 'es5';

'use strict';
import * as utils from './utils';
import * as _ from 'lodash';

@@ -55,2 +56,12 @@ const TypeScriptDefaults: IGruntTSOptions = {

experimentalAsyncFunctions: null,
reactNamespace: null,
skipDefaultLibCheck: null,
pretty: false,
allowUnusedLabels: false,
noImplicitReturns: false,
noFallthroughCasesInSwitch: false,
allowUnreachableCode: false,
forceConsistentCasingInFileNames: false,
allowJs: false,
noImplicitUseStrict: false,
rootDir: null,

@@ -62,5 +73,6 @@ warnings: [],

export const GruntTSDefaults = applyGruntTSDefaults(TypeScriptDefaults);
export const GruntTSDefaults = applyGruntTSDefaults(_.clone(TypeScriptDefaults));
function applyGruntTSDefaults(options: IGruntTSOptions) {
// this function applies defaults where grunt-ts differs from TypeScript
options.sourceMap = true;

@@ -77,2 +89,1 @@ options.target = 'es5';

}
/// <reference path="../../defs/tsd.d.ts"/>
"use strict";
var _ = require('lodash');

@@ -3,0 +4,0 @@ var fs = require('fs');

@@ -98,2 +98,22 @@

allowSyntheticDefaultImports: boolean;
/** Specifies the object invoked for createElement and __spread when targeting 'react' JSX emit. */
reactNamespace: string;
/** Treat a file as a default lib if it has '/// <reference no-default-lib="true"/> at the top */
skipDefaultLibCheck: boolean;
/** Stylize errors and messages using color and context. */
pretty: boolean;
/** Do not report errors on unused labels. */
allowUnusedLabels: boolean;
/** Report error when not all code paths in function return a value. */
noImplicitReturns: boolean;
/** Report errors for fallthrough cases in switch statement. */
noFallthroughCasesInSwitch: boolean;
/** Do not report errors on unreachable code. */
allowUnreachableCode: boolean;
/** Disallow inconsistently-cased references to the same file. */
forceConsistentCasingInFileNames: boolean;
/** Allow JavaScript files to be compiled. */
allowJs: boolean;
/** Do not emit "use strict" directives in module output. */
noImplicitUseStrict: boolean;
}

@@ -100,0 +120,0 @@

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

var tsconfig_1 = require('./tsconfig');
// Compiler Options documentation:
// https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Compiler%20Options.md
var propertiesFromTarget = ['amdloader', 'baseDir', 'html', 'htmlOutDir', 'htmlOutDirFlatten', 'reference', 'testExecute', 'tsconfig',
'templateCache', 'vs', 'watch'], propertiesFromTargetOptions = ['additionalFlags', 'allowSyntheticDefaultImports', 'comments', 'compile', 'compiler', 'declaration',
'templateCache', 'vs', 'watch'],
// purposefully not supported: help, version, charset, diagnostics, listFiles
// supported via other code: out, outDir, outFile, project
propertiesFromTargetOptions = ['additionalFlags', 'allowSyntheticDefaultImports', 'comments', 'compile', 'compiler', 'declaration',
'emitBOM', 'emitDecoratorMetadata', 'experimentalDecorators', 'failOnTypeErrors', 'fast', 'htmlModuleTemplate', 'htmlOutDir',

@@ -18,3 +23,4 @@ 'htmlOutputTemplate', 'htmlOutDirFlatten', 'htmlVarTemplate', 'inlineSourceMap', 'inlineSources', 'isolatedModules', 'locale',

'suppressImplicitAnyIndexErrors', 'target', 'verbose', 'jsx', 'moduleResolution', 'experimentalAsyncFunctions', 'rootDir',
'emitGruntEvents'], delayTemplateExpansion = ['htmlModuleTemplate', 'htmlVarTemplate', 'htmlOutputTemplate'];
'emitGruntEvents', 'reactNamespace', 'skipDefaultLibCheck', 'pretty', 'allowUnusedLabels', 'noImplicitReturns',
'noFallthroughCasesInSwitch', 'allowUnreachableCode', 'forceConsistentCasingInFileNames', 'allowJs', 'noImplicitUseStrict'], delayTemplateExpansion = ['htmlModuleTemplate', 'htmlVarTemplate', 'htmlOutputTemplate'];
var templateProcessor = null;

@@ -233,4 +239,4 @@ var globExpander = null;

if (gruntOptions) {
for (var _i = 0; _i < propertiesFromTarget.length; _i++) {
var propertyName = propertiesFromTarget[_i];
for (var _i = 0, propertiesFromTarget_1 = propertiesFromTarget; _i < propertiesFromTarget_1.length; _i++) {
var propertyName = propertiesFromTarget_1[_i];
if (propertyName in gruntOptions && propertyName !== 'vs') {

@@ -247,4 +253,4 @@ if (typeof gruntOptions[propertyName] === 'string' && utils.hasValue(gruntOptions[propertyName]) &&

if (gruntOptions.options) {
for (var _a = 0; _a < propertiesFromTargetOptions.length; _a++) {
var propertyName = propertiesFromTargetOptions[_a];
for (var _a = 0, propertiesFromTargetOptions_1 = propertiesFromTargetOptions; _a < propertiesFromTargetOptions_1.length; _a++) {
var propertyName = propertiesFromTargetOptions_1[_a];
if (propertyName in gruntOptions.options) {

@@ -251,0 +257,0 @@ if (typeof gruntOptions.options[propertyName] === 'string' && utils.hasValue(gruntOptions.options[propertyName]) &&

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

// Compiler Options documentation:
// https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Compiler%20Options.md
const propertiesFromTarget = ['amdloader', 'baseDir', 'html', 'htmlOutDir', 'htmlOutDirFlatten', 'reference', 'testExecute', 'tsconfig',
'templateCache', 'vs', 'watch'],
// purposefully not supported: help, version, charset, diagnostics, listFiles
// supported via other code: out, outDir, outFile, project
propertiesFromTargetOptions = ['additionalFlags', 'allowSyntheticDefaultImports', 'comments', 'compile', 'compiler', 'declaration',

@@ -22,3 +27,4 @@ 'emitBOM', 'emitDecoratorMetadata', 'experimentalDecorators', 'failOnTypeErrors', 'fast', 'htmlModuleTemplate', 'htmlOutDir',

'suppressImplicitAnyIndexErrors', 'target', 'verbose', 'jsx', 'moduleResolution', 'experimentalAsyncFunctions', 'rootDir',
'emitGruntEvents'],
'emitGruntEvents', 'reactNamespace', 'skipDefaultLibCheck', 'pretty', 'allowUnusedLabels', 'noImplicitReturns',
'noFallthroughCasesInSwitch', 'allowUnreachableCode', 'forceConsistentCasingInFileNames', 'allowJs', 'noImplicitUseStrict'],
delayTemplateExpansion = ['htmlModuleTemplate', 'htmlVarTemplate', 'htmlOutputTemplate'];

@@ -25,0 +31,0 @@

/// <reference path="../../defs/tsd.d.ts"/>
"use strict";
var _ = require('lodash');

@@ -3,0 +4,0 @@ var _str = require('underscore.string');

/// <reference path="../../defs/tsd.d.ts"/>
"use strict";
var _ = require('lodash');

@@ -3,0 +4,0 @@ var fs = require('fs');

/// <reference path="../../defs/tsd.d.ts"/>
/// <reference path="./interfaces.d.ts"/>
"use strict";
var __extends = (this && this.__extends) || function (d, b) {

@@ -107,3 +108,3 @@ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];

return BaseTransformer;
})();
}());
// This is a separate class from BaseTransformer to make it easier to add non import/export transforms in the future

@@ -151,3 +152,3 @@ var BaseImportExportTransformer = (function (_super) {

return BaseImportExportTransformer;
})(BaseTransformer);
}(BaseTransformer));
var ImportTransformer = (function (_super) {

@@ -159,3 +160,3 @@ __extends(ImportTransformer, _super);

return ImportTransformer;
})(BaseImportExportTransformer);
}(BaseImportExportTransformer));
var ExportTransformer = (function (_super) {

@@ -173,3 +174,3 @@ __extends(ExportTransformer, _super);

return ExportTransformer;
})(BaseImportExportTransformer);
}(BaseImportExportTransformer));
var ReferenceTransformer = (function (_super) {

@@ -183,3 +184,3 @@ __extends(ReferenceTransformer, _super);

return ReferenceTransformer;
})(BaseImportExportTransformer);
}(BaseImportExportTransformer));
var UnknownTransformer = (function (_super) {

@@ -197,3 +198,3 @@ __extends(UnknownTransformer, _super);

return UnknownTransformer;
})(BaseTransformer);
}(BaseTransformer));
// This code fixes the line encoding to be per os.

@@ -200,0 +201,0 @@ // I think it is the best option available at the moment.

@@ -183,13 +183,54 @@ 'use strict';

function applyCompilerOptions(applyTo, projectSpec) {
var result = applyTo || {};
var co = projectSpec.compilerOptions;
var tsconfig = applyTo.tsconfig;
var result = applyTo || {}, co = projectSpec.compilerOptions, tsconfig = applyTo.tsconfig;
if (!tsconfig.ignoreSettings && co) {
var sameNameInTSConfigAndGruntTS = ['declaration', 'emitDecoratorMetadata',
'experimentalAsyncFunctions', 'experimentalDecorators', 'isolatedModules',
'inlineSourceMap', 'inlineSources', 'jsx', 'mapRoot', 'module',
'moduleResolution', 'newLine', 'noEmit',
'noEmitHelpers', 'noEmitOnError', 'noImplicitAny', 'noLib', 'noResolve',
'out', 'outDir', 'preserveConstEnums', 'removeComments', 'rootDir',
'sourceMap', 'sourceRoot', 'suppressImplicitAnyIndexErrors', 'target'];
// Go here for the tsconfig.json documentation:
// https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/tsconfig.json.md
// There is a link to http://json.schemastore.org/tsconfig
var sameNameInTSConfigAndGruntTS = [
'allowJs',
'allowSyntheticDefaultImports',
'allowUnreachableCode',
'allowUnusedLabels',
// we do not support charset as we assume input files are UTF-8.
'declaration',
'emitBOM',
'emitDecoratorMetadata',
'experimentalAsyncFunctions',
'experimentalDecorators',
'forceConsistentCasingInFileNames',
'isolatedModules',
'inlineSourceMap',
'inlineSources',
'jsx',
// we do not support listFiles.
'locale',
'mapRoot',
'module',
'moduleResolution',
'newLine',
'noEmit',
'noEmitHelpers',
'noEmitOnError',
'noFallthroughCasesInSwitch',
'noImplicitAny',
'noImplicitReturns',
'noImplicitUseStrict',
'noLib',
'noResolve',
'out',
'outDir',
// outFile is handled below.
'preserveConstEnums',
'pretty',
'reactNamespace',
'removeComments',
'rootDir',
'skipDefaultLibCheck',
'sourceMap',
'sourceRoot',
'stripInternal',
'suppressExcessPropertyIndexErrors',
'suppressImplicitAnyIndexErrors',
'target'
];
sameNameInTSConfigAndGruntTS.forEach(function (propertyName) {

@@ -219,4 +260,3 @@ if ((propertyName in co) && !(propertyName in result)) {

}
var relPath = relativePathFromGruntfileToTSConfig();
var gruntGlobsRelativeToTSConfig = [];
var relPath = relativePathFromGruntfileToTSConfig(), gruntGlobsRelativeToTSConfig = [];
for (var i = 0; i < gruntfileGlobs.length; i += 1) {

@@ -245,6 +285,6 @@ gruntfileGlobs[i] = gruntfileGlobs[i].replace(/\\/g, '/');

else {
var validPattern = /\.tsx?$/i;
var excludedPaths = [];
var validPattern_1 = /\.tsx?$/i;
var excludedPaths_1 = [];
if (_.isArray(projectSpec.exclude)) {
excludedPaths = projectSpec.exclude.map(function (filepath) {
excludedPaths_1 = projectSpec.exclude.map(function (filepath) {
return utils.makeRelativePath(absolutePathToTSConfig, path.resolve(absolutePathToTSConfig, filepath));

@@ -254,5 +294,5 @@ });

var files = utils.getFiles(absolutePathToTSConfig, function (filepath) {
return excludedPaths.indexOf(utils.makeRelativePath(absolutePathToTSConfig, filepath)) > -1
return excludedPaths_1.indexOf(utils.makeRelativePath(absolutePathToTSConfig, filepath)) > -1
|| (fs.statSync(filepath).isFile()
&& !validPattern.test(filepath));
&& !validPattern_1.test(filepath));
}).map(function (filepath) {

@@ -259,0 +299,0 @@ return utils.makeRelativePath(absolutePathToTSConfig, filepath);

@@ -214,15 +214,61 @@ 'use strict';

function applyCompilerOptions(applyTo: IGruntTSOptions, projectSpec: ITSConfigFile) {
const result: IGruntTSOptions = applyTo || <any>{};
const co = projectSpec.compilerOptions;
const tsconfig: ITSConfigSupport = applyTo.tsconfig;
const result: IGruntTSOptions = applyTo || <any>{},
co = projectSpec.compilerOptions,
tsconfig: ITSConfigSupport = applyTo.tsconfig;
if (!tsconfig.ignoreSettings && co) {
const sameNameInTSConfigAndGruntTS = ['declaration', 'emitDecoratorMetadata',
'experimentalAsyncFunctions', 'experimentalDecorators', 'isolatedModules',
'inlineSourceMap', 'inlineSources', 'jsx', 'mapRoot', 'module',
'moduleResolution', 'newLine', 'noEmit',
'noEmitHelpers', 'noEmitOnError', 'noImplicitAny', 'noLib', 'noResolve',
'out', 'outDir', 'preserveConstEnums', 'removeComments', 'rootDir',
'sourceMap', 'sourceRoot', 'suppressImplicitAnyIndexErrors', 'target'];
// Go here for the tsconfig.json documentation:
// https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/tsconfig.json.md
// There is a link to http://json.schemastore.org/tsconfig
const sameNameInTSConfigAndGruntTS = [
'allowJs',
'allowSyntheticDefaultImports',
'allowUnreachableCode',
'allowUnusedLabels',
// we do not support charset as we assume input files are UTF-8.
'declaration',
'emitBOM',
'emitDecoratorMetadata',
'experimentalAsyncFunctions',
'experimentalDecorators',
'forceConsistentCasingInFileNames',
'isolatedModules',
'inlineSourceMap',
'inlineSources',
'jsx',
// we do not support listFiles.
'locale',
'mapRoot',
'module',
'moduleResolution',
'newLine',
'noEmit',
'noEmitHelpers',
'noEmitOnError',
'noFallthroughCasesInSwitch',
'noImplicitAny',
'noImplicitReturns',
'noImplicitUseStrict',
'noLib',
'noResolve',
'out',
'outDir',
// outFile is handled below.
'preserveConstEnums',
'pretty',
'reactNamespace',
'removeComments',
'rootDir',
'skipDefaultLibCheck',
'sourceMap',
'sourceRoot',
'stripInternal',
'suppressExcessPropertyIndexErrors',
'suppressImplicitAnyIndexErrors',
'target'
// we do not support the native TypeScript watch.
];
sameNameInTSConfigAndGruntTS.forEach(propertyName => {

@@ -260,4 +306,5 @@ if ((propertyName in co) && !(propertyName in result)) {

const relPath = relativePathFromGruntfileToTSConfig();
const gruntGlobsRelativeToTSConfig: string[] = [];
const relPath = relativePathFromGruntfileToTSConfig(),
gruntGlobsRelativeToTSConfig: string[] = [];
for (let i = 0; i < gruntfileGlobs.length; i += 1) {

@@ -264,0 +311,0 @@ gruntfileGlobs[i] = gruntfileGlobs[i].replace(/\\/g, '/');

/// <reference path="../../defs/tsd.d.ts"/>
"use strict";
var path = require('path');

@@ -346,8 +347,2 @@ var fs = require('fs');

exports.asyncSeries = asyncSeries;
function copyFileSync(srcFile, destFile, encoding) {
if (encoding === void 0) { encoding = 'utf8'; }
var content = fs.readFileSync(srcFile, encoding);
fs.writeFileSync(destFile, content, encoding);
}
exports.copyFileSync = copyFileSync;
function copyFile(srcFile, destFile, callback, encoding) {

@@ -354,0 +349,0 @@ if (encoding === void 0) { encoding = 'utf8'; }

@@ -369,7 +369,2 @@ /// <reference path="../../defs/tsd.d.ts"/>

export function copyFileSync(srcFile: string, destFile: string, encoding = 'utf8') {
var content = fs.readFileSync(srcFile, encoding);
fs.writeFileSync(destFile, content, encoding);
}
export function copyFile(srcFile: string, destFile: string, callback: (err?: Error) => any, encoding = 'utf8') {

@@ -376,0 +371,0 @@ fs.readFile(srcFile, encoding, (err, data) => {

@@ -97,11 +97,11 @@ 'use strict';

}
var src = options.CompilationTasks[0].src;
var absolutePathToVSProjectFolder = path.resolve(vsSettings.VSProjectDetails.ProjectFileName, '..');
var gruntfileFolder = path.resolve('.');
var src_1 = options.CompilationTasks[0].src;
var absolutePathToVSProjectFolder_1 = path.resolve(vsSettings.VSProjectDetails.ProjectFileName, '..');
var gruntfileFolder_1 = path.resolve('.');
_.map(_.uniq(vsSettings.files), function (file) {
var absolutePathToFile = path.normalize(path.join(absolutePathToVSProjectFolder, file));
var relativePathToFileFromGruntfile = path.relative(gruntfileFolder, absolutePathToFile).replace(new RegExp('\\' + path.sep, 'g'), '/');
if (src.indexOf(absolutePathToFile) === -1 &&
src.indexOf(relativePathToFileFromGruntfile) === -1) {
src.push(relativePathToFileFromGruntfile);
var absolutePathToFile = path.normalize(path.join(absolutePathToVSProjectFolder_1, file));
var relativePathToFileFromGruntfile = path.relative(gruntfileFolder_1, absolutePathToFile).replace(new RegExp('\\' + path.sep, 'g'), '/');
if (src_1.indexOf(absolutePathToFile) === -1 &&
src_1.indexOf(relativePathToFileFromGruntfile) === -1) {
src_1.push(relativePathToFileFromGruntfile);
}

@@ -119,4 +119,8 @@ });

function applyVSSettings(options, vsSettings) {
// TODO: support TypeScript 1.5 VS options.
// Visit this page for MSBuild documentation:
// https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Compiler%20Options%20in%20MSBuild.md
var simpleVSSettingsToGruntTSMappings = {
'AllowSyntheticDefaultImports': 'allowSyntheticDefaultImports',
'AllowUnusedLabels': 'allowUnusedLabels',
'AllowUnreachableCode': 'allowUnreachableCode',
'EmitBOM': 'emitBom',

@@ -126,2 +130,3 @@ 'EmitDecoratorMetadata': 'emitDecoratorMetadata',

'ExperimentalDecorators': 'experimentalDecorators',
'ForceConsistentCasingInFileNames': 'forceConsistentCasingInFileNames',
'GeneratesDeclarations': 'declaration',

@@ -138,9 +143,14 @@ 'InlineSourceMap': 'inlineSourceMap',

'NoEmitHelpers': 'NoEmitHelpers',
'NoFallthroughCasesInSwitch': 'noFallthroughCasesInSwitch',
'NoImplicitAny': 'noImplicitAny',
'NoImplicitReturns': 'noImplicitReturns',
'noImplicitUseStrict': 'NoImplicitUseStrict',
'NoLib': 'noLib',
'NoResolve': 'noResolve',
// OutFile and OutDir are resolved elsewhere
// OutFile (both out and outFile) and OutDir are resolved elsewhere
'PreserveConstEnums': 'preserveConstEnums',
'ReactNamespace': 'reactNamespace',
'RemoveComments': 'removeComments',
'RootDir': 'rootDir',
'SkipDefaultLibCheck': 'skipDefaultLibCheck',
'SourceMap': 'sourceMap',

@@ -147,0 +157,0 @@ 'SourceRoot': 'sourceRoot',

@@ -142,4 +142,9 @@ 'use strict';

// TODO: support TypeScript 1.5 VS options.
// Visit this page for MSBuild documentation:
// https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Compiler%20Options%20in%20MSBuild.md
const simpleVSSettingsToGruntTSMappings = {
'AllowSyntheticDefaultImports': 'allowSyntheticDefaultImports',
'AllowUnusedLabels': 'allowUnusedLabels',
'AllowUnreachableCode': 'allowUnreachableCode',
'EmitBOM': 'emitBom',

@@ -149,2 +154,3 @@ 'EmitDecoratorMetadata': 'emitDecoratorMetadata',

'ExperimentalDecorators': 'experimentalDecorators',
'ForceConsistentCasingInFileNames': 'forceConsistentCasingInFileNames',
'GeneratesDeclarations': 'declaration',

@@ -161,9 +167,14 @@ 'InlineSourceMap': 'inlineSourceMap',

'NoEmitHelpers': 'NoEmitHelpers',
'NoFallthroughCasesInSwitch': 'noFallthroughCasesInSwitch',
'NoImplicitAny': 'noImplicitAny',
'NoImplicitReturns': 'noImplicitReturns',
'noImplicitUseStrict': 'NoImplicitUseStrict',
'NoLib': 'noLib',
'NoResolve': 'noResolve',
// OutFile and OutDir are resolved elsewhere
// OutFile (both out and outFile) and OutDir are resolved elsewhere
'PreserveConstEnums': 'preserveConstEnums',
'ReactNamespace': 'reactNamespace',
'RemoveComments': 'removeComments',
'RootDir': 'rootDir',
'SkipDefaultLibCheck': 'skipDefaultLibCheck',
'SourceMap': 'sourceMap',

@@ -170,0 +181,0 @@ 'SourceRoot': 'sourceRoot',

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

if (options.html) {
var html2tsOptions = {
var html2tsOptions_1 = {
moduleFunction: _.template(options.htmlModuleTemplate),

@@ -261,3 +261,3 @@ varFunction: _.template(options.htmlVarTemplate),

var htmlFiles = grunt.file.expand(options.html);
generatedFiles = _.map(htmlFiles, function (filename) { return html2tsModule.compileHTML(filename, html2tsOptions); });
generatedFiles = _.map(htmlFiles, function (filename) { return html2tsModule.compileHTML(filename, html2tsOptions_1); });
generatedFiles.forEach(function (fileName) {

@@ -264,0 +264,0 @@ if (filesToCompile.indexOf(fileName) === -1 &&

Sorry, the diff of this file is too big to display

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

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

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