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

rollup-plugin-typescript2

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-typescript2 - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

50

dist/rollup-plugin-typescript2.cjs.js

@@ -222,6 +222,3 @@ /* eslint-disable */

return;
if (this.rolled)
fs.writeJsonSync(this.oldCacheRoot + "/" + name, data);
else
fs.writeJsonSync(this.newCacheRoot + "/" + name, data);
fs.writeJsonSync(this.newCacheRoot + "/" + name, data);
};

@@ -262,8 +259,9 @@ RollingCache.prototype.touch = function (name) {

var TsCache = (function () {
function TsCache(host, cache, options, rootFilenames, context) {
function TsCache(host, cache, options, rollupConfig, rootFilenames, context) {
var _this = this;
this.host = host;
this.options = options;
this.rollupConfig = rollupConfig;
this.context = context;
this.cacheVersion = "4";
this.cacheVersion = "5";
this.ambientTypesDirty = false;

@@ -274,6 +272,7 @@ this.cacheDir = cache + "/" + hash.sha1({

options: this.options,
rollupConfig: this.rollupConfig,
tsVersion: ts.version,
});
this.dependencyTree = new graph.Graph({ directed: true });
this.dependencyTree.setDefaultNodeLabel(function (_node) { return { dirty: false }; });
this.dependencyTree.setDefaultNodeLabel(function (_node) { return ({ dirty: false }); });
var automaticTypes = _.map(ts.getAutomaticTypeDirectiveNames(options, ts.sys), function (entry) { return ts.resolveTypeReferenceDirective(entry, undefined, options, ts.sys); })

@@ -284,3 +283,3 @@ .filter(function (entry) { return entry.resolvedTypeReferenceDirective && entry.resolvedTypeReferenceDirective.resolvedFileName; })

.concat(automaticTypes)
.map(function (id) { return { id: id, snapshot: _this.host.getScriptSnapshot(id) }; });
.map(function (id) { return ({ id: id, snapshot: _this.host.getScriptSnapshot(id) }); });
this.init();

@@ -470,3 +469,2 @@ this.checkAmbientTypes();

}
function typescript(options) {

@@ -484,2 +482,3 @@ options = __assign({}, options);

});
var rollupConfig;
var watchMode = false;

@@ -495,6 +494,9 @@ var round = 0;

var service = ts.createLanguageService(servicesHost, ts.createDocumentRegistry());
var cache = new TsCache(servicesHost, options.cacheRoot, parsedConfig.options, parsedConfig.fileNames, context);
var _cache;
var cache = function () {
if (!_cache)
_cache = new TsCache(servicesHost, options.cacheRoot, parsedConfig.options, rollupConfig, parsedConfig.fileNames, context);
return _cache;
};
var noErrors = true;
if (options.clean)
cache.clean();
// printing compiler option errors

@@ -504,2 +506,8 @@ if (options.check)

return {
options: function (config) {
rollupConfig = config;
context.debug("rollupConfig: " + JSON.stringify(rollupConfig, undefined, 4));
if (options.clean)
cache().clean();
},
resolveId: function (importee, importer) {

@@ -515,3 +523,3 @@ if (importee === TSLIB)

if (filter$$1(result.resolvedModule.resolvedFileName))
cache.setDependency(result.resolvedModule.resolvedFileName, importer);
cache().setDependency(result.resolvedModule.resolvedFileName, importer);
if (_.endsWith(result.resolvedModule.resolvedFileName, ".d.ts"))

@@ -540,3 +548,3 @@ return null;

// getting compiled file from cache or from ts
var result = cache.getCompiled(id, snapshot, function () {
var result = cache().getCompiled(id, snapshot, function () {
var output = service.getEmitOutput(id);

@@ -546,5 +554,5 @@ if (output.emitSkipped) {

// always checking on fatal errors, even if options.check is set to false
var diagnostics = _.concat(cache.getSyntacticDiagnostics(id, snapshot, function () {
var diagnostics = _.concat(cache().getSyntacticDiagnostics(id, snapshot, function () {
return service.getSyntacticDiagnostics(id);
}), cache.getSemanticDiagnostics(id, snapshot, function () {
}), cache().getSemanticDiagnostics(id, snapshot, function () {
return service.getSemanticDiagnostics(id);

@@ -554,3 +562,3 @@ }));

// since no output was generated, aborting compilation
cache.done();
cache().done();
if (_.isFunction(_this.error))

@@ -567,5 +575,5 @@ _this.error(colors.red("failed to transpile '" + id + "'"));

if (options.check) {
var diagnostics = _.concat(cache.getSyntacticDiagnostics(id, snapshot, function () {
var diagnostics = _.concat(cache().getSyntacticDiagnostics(id, snapshot, function () {
return service.getSyntacticDiagnostics(id);
}), cache.getSemanticDiagnostics(id, snapshot, function () {
}), cache().getSemanticDiagnostics(id, snapshot, function () {
return service.getSemanticDiagnostics(id);

@@ -588,3 +596,3 @@ }));

context.debug("running in watch mode");
cache.walkTree(function (id) {
cache().walkTree(function (id) {
var diagnostics = _.concat(convertDiagnostic("syntax", service.getSyntacticDiagnostics(id)), convertDiagnostic("semantic", service.getSemanticDiagnostics(id)));

@@ -596,3 +604,3 @@ printDiagnostics(context, diagnostics);

context.info(colors.yellow("there were errors or warnings above."));
cache.done();
cache().done();
round++;

@@ -599,0 +607,0 @@ },

@@ -228,6 +228,3 @@ /* eslint-disable */

return;
if (this.rolled)
writeJsonSync(this.oldCacheRoot + "/" + name, data);
else
writeJsonSync(this.newCacheRoot + "/" + name, data);
writeJsonSync(this.newCacheRoot + "/" + name, data);
};

@@ -268,8 +265,9 @@ RollingCache.prototype.touch = function (name) {

var TsCache = (function () {
function TsCache(host, cache, options, rootFilenames, context) {
function TsCache(host, cache, options, rollupConfig, rootFilenames, context) {
var _this = this;
this.host = host;
this.options = options;
this.rollupConfig = rollupConfig;
this.context = context;
this.cacheVersion = "4";
this.cacheVersion = "5";
this.ambientTypesDirty = false;

@@ -280,6 +278,7 @@ this.cacheDir = cache + "/" + sha1({

options: this.options,
rollupConfig: this.rollupConfig,
tsVersion: version,
});
this.dependencyTree = new Graph({ directed: true });
this.dependencyTree.setDefaultNodeLabel(function (_node) { return { dirty: false }; });
this.dependencyTree.setDefaultNodeLabel(function (_node) { return ({ dirty: false }); });
var automaticTypes = map(getAutomaticTypeDirectiveNames(options, sys), function (entry) { return resolveTypeReferenceDirective(entry, undefined, options, sys); })

@@ -290,3 +289,3 @@ .filter(function (entry) { return entry.resolvedTypeReferenceDirective && entry.resolvedTypeReferenceDirective.resolvedFileName; })

.concat(automaticTypes)
.map(function (id) { return { id: id, snapshot: _this.host.getScriptSnapshot(id) }; });
.map(function (id) { return ({ id: id, snapshot: _this.host.getScriptSnapshot(id) }); });
this.init();

@@ -476,3 +475,2 @@ this.checkAmbientTypes();

}
function typescript(options) {

@@ -490,2 +488,3 @@ options = __assign({}, options);

});
var rollupConfig;
var watchMode = false;

@@ -501,6 +500,9 @@ var round = 0;

var service = createLanguageService(servicesHost, createDocumentRegistry());
var cache = new TsCache(servicesHost, options.cacheRoot, parsedConfig.options, parsedConfig.fileNames, context);
var _cache;
var cache = function () {
if (!_cache)
_cache = new TsCache(servicesHost, options.cacheRoot, parsedConfig.options, rollupConfig, parsedConfig.fileNames, context);
return _cache;
};
var noErrors = true;
if (options.clean)
cache.clean();
// printing compiler option errors

@@ -510,2 +512,8 @@ if (options.check)

return {
options: function (config) {
rollupConfig = config;
context.debug("rollupConfig: " + JSON.stringify(rollupConfig, undefined, 4));
if (options.clean)
cache().clean();
},
resolveId: function (importee, importer) {

@@ -521,3 +529,3 @@ if (importee === TSLIB)

if (filter$$1(result.resolvedModule.resolvedFileName))
cache.setDependency(result.resolvedModule.resolvedFileName, importer);
cache().setDependency(result.resolvedModule.resolvedFileName, importer);
if (endsWith(result.resolvedModule.resolvedFileName, ".d.ts"))

@@ -546,3 +554,3 @@ return null;

// getting compiled file from cache or from ts
var result = cache.getCompiled(id, snapshot, function () {
var result = cache().getCompiled(id, snapshot, function () {
var output = service.getEmitOutput(id);

@@ -552,5 +560,5 @@ if (output.emitSkipped) {

// always checking on fatal errors, even if options.check is set to false
var diagnostics = concat(cache.getSyntacticDiagnostics(id, snapshot, function () {
var diagnostics = concat(cache().getSyntacticDiagnostics(id, snapshot, function () {
return service.getSyntacticDiagnostics(id);
}), cache.getSemanticDiagnostics(id, snapshot, function () {
}), cache().getSemanticDiagnostics(id, snapshot, function () {
return service.getSemanticDiagnostics(id);

@@ -560,3 +568,3 @@ }));

// since no output was generated, aborting compilation
cache.done();
cache().done();
if (isFunction(_this.error))

@@ -573,5 +581,5 @@ _this.error(red("failed to transpile '" + id + "'"));

if (options.check) {
var diagnostics = concat(cache.getSyntacticDiagnostics(id, snapshot, function () {
var diagnostics = concat(cache().getSyntacticDiagnostics(id, snapshot, function () {
return service.getSyntacticDiagnostics(id);
}), cache.getSemanticDiagnostics(id, snapshot, function () {
}), cache().getSemanticDiagnostics(id, snapshot, function () {
return service.getSemanticDiagnostics(id);

@@ -594,3 +602,3 @@ }));

context.debug("running in watch mode");
cache.walkTree(function (id) {
cache().walkTree(function (id) {
var diagnostics = concat(convertDiagnostic("syntax", service.getSyntacticDiagnostics(id)), convertDiagnostic("semantic", service.getSemanticDiagnostics(id)));

@@ -602,3 +610,3 @@ printDiagnostics(context, diagnostics);

context.info(yellow("there were errors or warnings above."));
cache.done();
cache().done();
round++;

@@ -605,0 +613,0 @@ },

{
"name": "rollup-plugin-typescript2",
"version": "0.4.0",
"version": "0.4.1",
"description": "Seamless integration between Rollup and TypeScript. Now with errors.",

@@ -30,3 +30,3 @@ "main": "dist/rollup-plugin-typescript2.cjs.js",

"lodash": "^4.17.4",
"object-hash": "^1.1.5",
"object-hash": "^1.1.8",
"rollup-pluginutils": "^2.0.1"

@@ -40,17 +40,17 @@ },

"devDependencies": {
"@types/colors": "^1.1.1",
"@types/fs-extra": "0.0.37",
"@types/graphlib": "^2.1.3",
"@types/lodash": "^4.14.52",
"@types/colors": "^1.1.3",
"@types/fs-extra": "2.1.0",
"@types/graphlib": "^2.1.4",
"@types/lodash": "^4.14.62",
"@types/node": "^6.0.53",
"@types/object-hash": "^0.5.28",
"@types/resolve": "0.0.4",
"resolve": "^1.1.7",
"rimraf": "^2.5.4",
"rollup": "^0.41.4",
"rollup-plugin-typescript2": "^0.3.0",
"resolve": "^1.3.3",
"rimraf": "^2.6.1",
"rollup": "^0.41.6",
"rollup-plugin-typescript2": "^0.4.0",
"rollup-watch": "^3.2.2",
"tslib": "^1.6.0",
"tslint": "^4.5.1",
"typescript": "^2.2.1"
"tslib": "^1.6.1",
"tslint": "^5.1.0",
"typescript": "^2.2.2"
},

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

@@ -28,3 +28,3 @@ # rollup-plugin-typescript2

The plugin depends on existence of `tsconfig.json` file. All compiler options and file lists are loaded from that.
The plugin depends on existence of `tsconfig.json` file. All compiler options and file lists are loaded from that.

@@ -37,2 +37,4 @@ Following compiler options are forced though:

You will need to set `"moduleResolution": "node"` in `tsconfig.json` if typescript complains about missing `tslib`. See [#12](https://github.com/ezolenko/rollup-plugin-typescript2/issues/12) and [#14](https://github.com/ezolenko/rollup-plugin-typescript2/issues/14).
Plugin takes following options:

@@ -39,0 +41,0 @@

@@ -25,3 +25,3 @@ import * as fs from "fs-extra";

let snapshot = ts.ScriptSnapshot.fromString(data);
const snapshot = ts.ScriptSnapshot.fromString(data);
this.snapshots[fileName] = snapshot;

@@ -57,3 +57,3 @@ this.versions[fileName] = (this.versions[fileName] || 0) + 1;

fileName = this.normalize(fileName);
return (this.versions[fileName] || 0).toString();

@@ -60,0 +60,0 @@ }

@@ -16,2 +16,2 @@ export interface ICache <DataType>

roll(): void;
};
}

@@ -95,3 +95,3 @@ import { RollupContext } from "./rollupcontext";

});
};
}

@@ -110,3 +110,3 @@ interface IOptions

export default function typescript (options: IOptions)
export default function typescript(options: IOptions)
{

@@ -127,2 +127,4 @@ options = { ... options };

let rollupConfig: any;
let watchMode = false;

@@ -141,13 +143,17 @@ let round = 0;

let servicesHost = new LanguageServiceHost(parsedConfig);
const servicesHost = new LanguageServiceHost(parsedConfig);
let service = ts.createLanguageService(servicesHost, ts.createDocumentRegistry());
const service = ts.createLanguageService(servicesHost, ts.createDocumentRegistry());
const cache = new TsCache(servicesHost, options.cacheRoot, parsedConfig.options, parsedConfig.fileNames, context);
let _cache: TsCache;
const cache = (): TsCache =>
{
if (!_cache)
_cache = new TsCache(servicesHost, options.cacheRoot, parsedConfig.options, rollupConfig, parsedConfig.fileNames, context);
return _cache;
};
let noErrors = true;
if (options.clean)
cache.clean();
// printing compiler option errors

@@ -159,2 +165,12 @@ if (options.check)

options(config: any)
{
rollupConfig = config;
context.debug(`rollupConfig: ${JSON.stringify(rollupConfig, undefined, 4)}`);
if (options.clean)
cache().clean();
},
resolveId(importee: string, importer: string)

@@ -176,3 +192,3 @@ {

if (filter(result.resolvedModule.resolvedFileName))
cache.setDependency(result.resolvedModule.resolvedFileName, importer);
cache().setDependency(result.resolvedModule.resolvedFileName, importer);

@@ -213,3 +229,3 @@ if (_.endsWith(result.resolvedModule.resolvedFileName, ".d.ts"))

// getting compiled file from cache or from ts
const result = cache.getCompiled(id, snapshot, () =>
const result = cache().getCompiled(id, snapshot, () =>
{

@@ -224,7 +240,7 @@ const output = service.getEmitOutput(id);

const diagnostics = _.concat(
cache.getSyntacticDiagnostics(id, snapshot, () =>
cache().getSyntacticDiagnostics(id, snapshot, () =>
{
return service.getSyntacticDiagnostics(id);
}),
cache.getSemanticDiagnostics(id, snapshot, () =>
cache().getSemanticDiagnostics(id, snapshot, () =>
{

@@ -237,3 +253,3 @@ return service.getSemanticDiagnostics(id);

// since no output was generated, aborting compilation
cache.done();
cache().done();
if (_.isFunction(this.error))

@@ -255,7 +271,7 @@ this.error(colors.red(`failed to transpile '${id}'`));

const diagnostics = _.concat(
cache.getSyntacticDiagnostics(id, snapshot, () =>
cache().getSyntacticDiagnostics(id, snapshot, () =>
{
return service.getSyntacticDiagnostics(id);
}),
cache.getSemanticDiagnostics(id, snapshot, () =>
cache().getSemanticDiagnostics(id, snapshot, () =>
{

@@ -290,3 +306,3 @@ return service.getSemanticDiagnostics(id);

cache.walkTree((id) =>
cache().walkTree((id) =>
{

@@ -305,3 +321,3 @@ const diagnostics = _.concat(

cache.done();
cache().done();

@@ -308,0 +324,0 @@ round++;

@@ -80,6 +80,3 @@ import { ICache } from "./icache";

if (this.rolled)
fs.writeJsonSync(`${this.oldCacheRoot}/${name}`, data);
else
fs.writeJsonSync(`${this.newCacheRoot}/${name}`, data);
fs.writeJsonSync(`${this.newCacheRoot}/${name}`, data);
}

@@ -86,0 +83,0 @@

@@ -61,3 +61,3 @@ import { IContext } from "./context";

{
private cacheVersion = "4";
private cacheVersion = "5";
private dependencyTree: graph.Graph;

@@ -72,3 +72,3 @@ private ambientTypes: ITypeSnapshot[];

constructor(private host: ts.LanguageServiceHost, cache: string, private options: ts.CompilerOptions, rootFilenames: string[], private context: IContext)
constructor(private host: ts.LanguageServiceHost, cache: string, private options: ts.CompilerOptions, private rollupConfig: any, rootFilenames: string[], private context: IContext)
{

@@ -79,2 +79,3 @@ this.cacheDir = `${cache}/${hash.sha1({

options: this.options,
rollupConfig: this.rollupConfig,
tsVersion : ts.version,

@@ -84,3 +85,3 @@ })}`;

this.dependencyTree = new graph.Graph({ directed: true });
this.dependencyTree.setDefaultNodeLabel((_node: string) => { return { dirty: false }; });
this.dependencyTree.setDefaultNodeLabel((_node: string) => ({ dirty: false }) );

@@ -95,3 +96,3 @@ const automaticTypes = _

.concat(automaticTypes)
.map((id) => { return { id, snapshot: this.host.getScriptSnapshot(id) }; });
.map((id) => ({ id, snapshot: this.host.getScriptSnapshot(id) }));

@@ -98,0 +99,0 @@ this.init();

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