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

gulp-tsb

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-tsb - npm Package Compare versions

Comparing version 1.10.3 to 1.10.4

46

lib/builder.js

@@ -23,4 +23,4 @@ 'use strict';

}
function createTypeScriptBuilder(config) {
var compilerOptions = createCompilerOptions(config), host = new LanguageServiceHost(compilerOptions, config.noFilesystemLookup || false), service = ts.createLanguageService(host, ts.createDocumentRegistry()), lastBuildVersion = Object.create(null), lastDtsHash = Object.create(null), userWantsDeclarations = compilerOptions.declaration, oldErrors = Object.create(null), headUsed = process.memoryUsage().heapUsed, emitSourceMapsInStream = true;
function createTypeScriptBuilder(config, compilerOptions) {
var host = new LanguageServiceHost(compilerOptions, config.noFilesystemLookup || false), service = ts.createLanguageService(host, ts.createDocumentRegistry()), lastBuildVersion = Object.create(null), lastDtsHash = Object.create(null), userWantsDeclarations = compilerOptions.declaration, oldErrors = Object.create(null), headUsed = process.memoryUsage().heapUsed, emitSourceMapsInStream = true;
// always emit declaraction files

@@ -297,34 +297,2 @@ host.getCompilationSettings().declaration = true;

exports.createTypeScriptBuilder = createTypeScriptBuilder;
function createCompilerOptions(config) {
function map(key, map, defaultValue) {
var s = String(key).toLowerCase();
if (map.hasOwnProperty(s)) {
return map[s];
}
return defaultValue;
}
// language version
config['target'] = map(config['target'], {
es3: 0 /* ES3 */,
es5: 1 /* ES5 */,
es6: 2 /* ES6 */,
es2015: 2 /* ES2015 */,
latest: 2 /* Latest */
}, 0 /* ES3 */);
// module generation
config['module'] = map(config['module'], {
commonjs: 1 /* CommonJS */,
amd: 2 /* AMD */,
system: 4 /* System */,
umd: 3 /* UMD */,
es6: 5 /* ES6 */,
es2015: 5 /* ES2015 */
}, 0 /* None */);
// jsx handling
config['jsx'] = map(config['jsx'], {
preserve: 1 /* Preserve */,
react: 2 /* React */
}, 0 /* None */);
return config;
}
var ScriptSnapshot = (function () {

@@ -348,3 +316,3 @@ function ScriptSnapshot(text, mtime) {

return ScriptSnapshot;
})();
}());
var VinylScriptSnapshot = (function (_super) {

@@ -360,3 +328,3 @@ __extends(VinylScriptSnapshot, _super);

return VinylScriptSnapshot;
})(ScriptSnapshot);
}(ScriptSnapshot));
var LanguageServiceHost = (function () {

@@ -433,3 +401,3 @@ function LanguageServiceHost(settings, noFilesystemLookup) {

LanguageServiceHost._declareModule.lastIndex = 0;
var match;
var match = void 0;
while ((match = LanguageServiceHost._declareModule.exec(snapshot.getText(0, snapshot.getLength())))) {

@@ -468,3 +436,3 @@ var declaredModules = this._fileNameToDeclaredModule[filename];

LanguageServiceHost.prototype.getDefaultLibFileName = function (options) {
var libFile = options.target < 2 /* ES6 */ ? 'lib.d.ts' : 'lib.es6.d.ts';
var libFile = options.target < ts.ScriptTarget.ES6 ? 'lib.d.ts' : 'lib.es6.d.ts';
return require.resolve("typescript/lib/" + libFile);

@@ -521,2 +489,2 @@ };

return LanguageServiceHost;
})();
}());

27

lib/index.js
/// <reference path="../node_modules/typescript/lib/lib.es6.d.ts"/>
'use strict';
var through = require('through');
var clone = require('clone');
var builder = require('./builder');
var typescript_1 = require('typescript');
var ts = require('typescript');
var fs_1 = require('fs');
var _parseConfigHost = {
readFile: function (fileName) {
return fs_1.readFileSync(fileName, 'utf-8');
},
readDirectory: function (rootDir, extension, exclude) {
return []; // don't want to find files!
},
};
function create(configOrName, verbose, json, onError) {
var config;
var options = ts.getDefaultCompilerOptions();
var config = { json: json, verbose: verbose, noFilesystemLookup: false };
if (typeof configOrName === 'string') {
var parsed = typescript_1.readConfigFile(configOrName, function (path) { return fs_1.readFileSync(path, 'utf-8'); });
var parsed = ts.readConfigFile(configOrName, _parseConfigHost.readFile);
options = ts.parseJsonConfigFileContent(parsed.config, _parseConfigHost, __dirname).options;
if (parsed.error) {

@@ -16,15 +25,11 @@ console.error(parsed.error);

}
config = parsed.config.compilerOptions;
}
else {
// clone the configuration
config = clone(configOrName);
options = ts.parseJsonConfigFileContent({ compilerOptions: configOrName }, _parseConfigHost, __dirname).options;
Object.assign(config, configOrName);
}
// add those
config.verbose = config.verbose || verbose;
config.json = config.json || json;
if (!onError) {
onError = function (err) { return console.log(JSON.stringify(err, null, 4)); };
}
var _builder = builder.createTypeScriptBuilder(config);
var _builder = builder.createTypeScriptBuilder(config, options);
function createStream(token) {

@@ -31,0 +36,0 @@ return through(function (file) {

@@ -13,4 +13,4 @@ 'use strict';

index.create(config);
assert.equal(Object.keys(config).length, 2);
assert.equal(Object.keys(config).length, 3);
});
});

@@ -0,0 +0,0 @@ 'use strict';

@@ -120,4 +120,4 @@ 'use strict';

return Graph;
})();
}());
graph.Graph = Graph;
})(graph = exports.graph || (exports.graph = {}));
{
"name": "gulp-tsb",
"version": "1.10.3",
"version": "1.10.4",
"author": "Johannes Rieken <johannes.rieken@gmail.com>",

@@ -9,3 +9,4 @@ "description": "A gulp plugin for very fast TypeScript compilation.",

"scripts": {
"test": "mocha lib/tests"
"test": "mocha lib/tests",
"prepublish": "tsc && mocha lib/tests"
},

@@ -23,3 +24,2 @@ "repository": {

"dependencies": {
"clone": "^0.2.0",
"gulp-util": "^3.0.1",

@@ -26,0 +26,0 @@ "through": "^2.3.6",

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