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

ts-loader

Package Overview
Dependencies
Maintainers
1
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-loader - npm Package Compare versions

Comparing version 0.4.5 to 0.4.6

7

CHANGELOG.md
# Changelog
## v0.4.6
- Improve error reporting related to tsconfig.json
- Fix bug that reported the wrong errors
- Errors are now reported as webpack errors instead of logged to console
- Add support for latest TypeScript nightly (#24)
## v0.4.5

@@ -4,0 +11,0 @@

64

index.js

@@ -25,2 +25,5 @@ ///<reference path="node_modules/typescript/bin/typescript.d.ts" />

}
else if (diagnostic.fileName) {
outputFn(" " + diagnostic.fileName.blue + ": " + messageText.red, messageText, null);
}
else {

@@ -68,3 +71,3 @@ outputFn(" " + "unknown file".blue + ": " + messageText.red, messageText, null);

if (Object.prototype.hasOwnProperty.call(instances, options.instance)) {
return instances[options.instance];
return { instance: instances[options.instance] };
}

@@ -80,11 +83,49 @@ var compilerOptions = {

var configFile = compiler.readConfigFile(configFilePath);
// TODO: when 1.5 stable comes out, this will never be undefined. Instead it will
// have an 'error' property
// 1.5.0-beta only
if (!configFile) {
throw new Error('tsconfig.json file found but not parsable');
return { error: {
file: configFilePath,
module: loader._module,
message: 'tsconfig.json file found but not parsable'.red,
rawMessage: 'tsconfig.json file found but not parsable'
} };
}
var configParseResult = compiler.parseConfigFile(configFile, path.dirname(configFilePath));
// 1.5.3+
if (configFile.config || configFile.error) {
if (configFile.error) {
var configFileError;
configFile.error.fileName = configFilePath;
handleErrors([configFile.error], compiler, function (message, rawMessage, location) {
configFileError = {
file: configFilePath,
module: loader._module,
message: message,
rawMessage: rawMessage,
location: location
};
});
return { error: configFileError };
}
var configParseResult = compiler.parseConfigFile(configFile.config, compiler.sys, path.dirname(configFilePath));
}
else {
var configParseResult = compiler.parseConfigFile(configFile, path.dirname(configFilePath));
}
if (configParseResult.errors.length) {
handleErrors(languageService.getCompilerOptionsDiagnostics(), compiler, consoleError);
throw new Error('error while parsing tsconfig.json');
configParseResult.errors.forEach(function (error) { return error.fileName = configFilePath; });
handleErrors(configParseResult.errors, compiler, function (message, rawMessage, location) {
loader._module.errors.push({
file: configFilePath,
module: loader._module,
message: message,
rawMessage: rawMessage,
location: location
});
});
return { error: {
file: configFilePath,
module: loader._module,
message: 'error while parsing tsconfig.json'.red,
rawMessage: 'error while parsing tsconfig.json'
} };
}

@@ -180,3 +221,3 @@ objectAssign(compilerOptions, configParseResult.options);

});
return instance;
return { instance: instance };
}

@@ -195,3 +236,8 @@ function loader(contents) {

}, options);
var instance = ensureTypeScriptInstance(options, this), file = instance.files[filePath], langService = instance.languageService;
var _a = ensureTypeScriptInstance(options, this), instance = _a.instance, error = _a.error;
if (error) {
callback(error);
return;
}
var file = instance.files[filePath], langService = instance.languageService;
// Update TypeScript with the new file contents

@@ -198,0 +244,0 @@ if (!file) {

3

package.json
{
"name": "ts-loader",
"version": "0.4.5",
"version": "0.4.6",
"description": "TypeScript loader for webpack",

@@ -36,3 +36,2 @@ "main": "index.js",

"devDependencies": {
"jsx-typescript": "^1.5.0-alpha.4",
"mocha": "^2.1.0",

@@ -39,0 +38,0 @@ "webpack": "^1.9.11"

@@ -93,2 +93,5 @@ # TypeScript loader for webpack

If you like living on the edge, the nightly version of TypeScript supports JSX natively. See
the [JSX test](test/jsx) for an example.
## Building from source

@@ -95,0 +98,0 @@

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