- object-hash hack optional #105

This commit is contained in:
Eugene Zolenko 2018-08-14 11:01:28 -06:00
parent 4d7552206f
commit 3b46e8d599
14 changed files with 41 additions and 32 deletions

View File

@ -54,6 +54,10 @@ Must be before this plugin in the plugin list, especially when `browser: true` o
See explanation for `rollupCommonJSResolveHack` option below.
#### plugins using async/await
See `objectHashIgnoreUnknownHack` below.
### Plugin options
* `tsconfigDefaults`: `{}`
@ -121,6 +125,10 @@ See explanation for `rollupCommonJSResolveHack` option below.
On windows typescript resolver favors POSIX path, while commonjs plugin (and maybe others?) uses native path as module id. This can result in `namedExports` being ignored if rollup happened to use typescript's resolution. Set to true to pass resolved module path through `resolve()` to match up with `rollup-plugin-commonjs`.
* `objectHashIgnoreUnknownHack`: false
The plugin uses rollup config as part of cache key. `object-hash` is used to generate a hash, but it can't hash certain elements at the moment. Setting this option to true will make `object-hash` ignore unknowns, at the cost of not invalidating the cache if ignored elements are changed. Only enable this if you need it (`Error: Unknown object type "asyncfunction"` for example) and make sure to run with `clean: true` once in a while and definitely before a release. (See [#105](https://github.com/ezolenko/rollup-plugin-typescript2/issues/105))
* `useTsconfigDeclarationDir`: false
If true, declaration files will be emitted in the directory given in the tsconfig. If false, the declaration files will be placed inside the destination directory given in the Rollup configuration.

2
dist/index.d.ts.map vendored
View File

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,cAAc,EAAkB,MAAM,WAAW,CAAC;AAE3E,OAAO,EAA8B,WAAW,EAAqB,MAAM,WAAW,CAAC;AAKvF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,MAAM,CAAC,OAAO,qBAAqB,OAAO,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC;;;;;;;;EAwU7D"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,cAAc,EAAkB,MAAM,WAAW,CAAC;AAE3E,OAAO,EAA8B,WAAW,EAAqB,MAAM,WAAW,CAAC;AAKvF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,MAAM,CAAC,OAAO,qBAAqB,OAAO,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC;;;;;;;;EAyU7D"}

1
dist/ioptions.d.ts vendored
View File

@ -21,5 +21,6 @@ export interface IOptions {
transformers: TransformerFactoryCreator[];
tsconfigDefaults: any;
sourceMapCallback: (id: string, map: string) => void;
objectHashIgnoreUnknownHack: boolean;
}
//# sourceMappingURL=ioptions.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"ioptions.d.ts","sourceRoot":"","sources":["src/ioptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,MAAM,WAAW,kBAAkB;IAElC,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxD,KAAK,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;CACvD;AAED,oBAAY,yBAAyB,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,eAAe,KAAK,OAAO,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AAEzH,MAAM,WAAW,QAAQ;IAExB,OAAO,EAAE,MAAM,GAAC,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM,GAAC,MAAM,EAAE,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,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yBAAyB,EAAE,OAAO,CAAC;IACnC,UAAU,EAAE,OAAO,QAAQ,CAAC;IAC5B,gBAAgB,EAAE,GAAG,CAAC;IACtB,YAAY,EAAE,yBAAyB,EAAE,CAAC;IAC1C,gBAAgB,EAAE,GAAG,CAAC;IACtB,iBAAiB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,2BAA2B,EAAE,OAAO,CAAC;CACrC"}

View File

@ -19691,9 +19691,8 @@ function convertDiagnostic(type, data) {
return entry;
});
}
const hashOptions = { algorithm: "sha1", ignoreUnknown: true };
class TsCache {
constructor(noCache, host, cache, options, rollupConfig, rootFilenames, context) {
constructor(noCache, hashIgnoreUnknown, host, cache, options, rollupConfig, rootFilenames, context) {
this.noCache = noCache;
this.host = host;
this.options = options;
@ -19701,13 +19700,15 @@ class TsCache {
this.context = context;
this.cacheVersion = "7";
this.ambientTypesDirty = false;
this.hashOptions = { algorithm: "sha1", ignoreUnknown: false };
this.hashOptions.ignoreUnknown = hashIgnoreUnknown;
this.cacheDir = `${cache}/${objectHash_1({
version: this.cacheVersion,
rootFilenames,
options: this.options,
rollupConfig: this.rollupConfig,
tsVersion: tsModule.version,
}, hashOptions)}`;
}, this.hashOptions)}`;
this.dependencyTree = new graphlib_1({ directed: true });
this.dependencyTree.setDefaultNodeLabel((_node) => ({ dirty: false }));
const automaticTypes = lodash_7(tsModule.getAutomaticTypeDirectiveNames(options, tsModule.sys), (entry) => tsModule.resolveTypeReferenceDirective(entry, undefined, options, tsModule.sys))
@ -19845,7 +19846,7 @@ class TsCache {
}
makeName(id, snapshot) {
const data = snapshot.getText(0, snapshot.getLength());
return objectHash_1({ data, id }, hashOptions);
return objectHash_1({ data, id }, this.hashOptions);
}
}
@ -19991,7 +19992,7 @@ function typescript(options) {
let _cache;
const cache = () => {
if (!_cache)
_cache = new TsCache(pluginOptions.clean, servicesHost, pluginOptions.cacheRoot, parsedConfig.options, rollupOptions, parsedConfig.fileNames, context);
_cache = new TsCache(pluginOptions.clean, pluginOptions.objectHashIgnoreUnknownHack, servicesHost, pluginOptions.cacheRoot, parsedConfig.options, rollupOptions, parsedConfig.fileNames, context);
return _cache;
};
const pluginOptions = Object.assign({}, options);
@ -20010,6 +20011,7 @@ function typescript(options) {
tsconfigOverride: {},
transformers: [],
tsconfigDefaults: {},
objectHashIgnoreUnknownHack: false,
});
setTypescriptModule(pluginOptions.typescript);
return {

File diff suppressed because one or more lines are too long

View File

@ -19687,9 +19687,8 @@ function convertDiagnostic(type, data) {
return entry;
});
}
const hashOptions = { algorithm: "sha1", ignoreUnknown: true };
class TsCache {
constructor(noCache, host, cache, options, rollupConfig, rootFilenames, context) {
constructor(noCache, hashIgnoreUnknown, host, cache, options, rollupConfig, rootFilenames, context) {
this.noCache = noCache;
this.host = host;
this.options = options;
@ -19697,13 +19696,15 @@ class TsCache {
this.context = context;
this.cacheVersion = "7";
this.ambientTypesDirty = false;
this.hashOptions = { algorithm: "sha1", ignoreUnknown: false };
this.hashOptions.ignoreUnknown = hashIgnoreUnknown;
this.cacheDir = `${cache}/${objectHash_1({
version: this.cacheVersion,
rootFilenames,
options: this.options,
rollupConfig: this.rollupConfig,
tsVersion: tsModule.version,
}, hashOptions)}`;
}, this.hashOptions)}`;
this.dependencyTree = new graphlib_1({ directed: true });
this.dependencyTree.setDefaultNodeLabel((_node) => ({ dirty: false }));
const automaticTypes = lodash_7(tsModule.getAutomaticTypeDirectiveNames(options, tsModule.sys), (entry) => tsModule.resolveTypeReferenceDirective(entry, undefined, options, tsModule.sys))
@ -19841,7 +19842,7 @@ class TsCache {
}
makeName(id, snapshot) {
const data = snapshot.getText(0, snapshot.getLength());
return objectHash_1({ data, id }, hashOptions);
return objectHash_1({ data, id }, this.hashOptions);
}
}
@ -19987,7 +19988,7 @@ function typescript(options) {
let _cache;
const cache = () => {
if (!_cache)
_cache = new TsCache(pluginOptions.clean, servicesHost, pluginOptions.cacheRoot, parsedConfig.options, rollupOptions, parsedConfig.fileNames, context);
_cache = new TsCache(pluginOptions.clean, pluginOptions.objectHashIgnoreUnknownHack, servicesHost, pluginOptions.cacheRoot, parsedConfig.options, rollupOptions, parsedConfig.fileNames, context);
return _cache;
};
const pluginOptions = Object.assign({}, options);
@ -20006,6 +20007,7 @@ function typescript(options) {
tsconfigOverride: {},
transformers: [],
tsconfigDefaults: {},
objectHashIgnoreUnknownHack: false,
});
setTypescriptModule(pluginOptions.typescript);
return {

File diff suppressed because one or more lines are too long

3
dist/tscache.d.ts vendored
View File

@ -37,7 +37,8 @@ export declare class TsCache {
private typesCache;
private semanticDiagnosticsCache;
private syntacticDiagnosticsCache;
constructor(noCache: boolean, host: tsTypes.LanguageServiceHost, cache: string, options: tsTypes.CompilerOptions, rollupConfig: any, rootFilenames: string[], context: IContext);
private hashOptions;
constructor(noCache: boolean, hashIgnoreUnknown: boolean, host: tsTypes.LanguageServiceHost, cache: string, options: tsTypes.CompilerOptions, rollupConfig: any, rootFilenames: string[], context: IContext);
clean(): void;
setDependency(importee: string, importer: string): void;
walkTree(cb: (id: string) => void | false): void;

View File

@ -1 +1 @@
{"version":3,"file":"tscache.d.ts","sourceRoot":"","sources":["src/tscache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAOrC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAMtC,MAAM,WAAW,KAAK;IAErB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC;CAC5B;AAED,MAAM,WAAW,WAAW;IAE3B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,GAAG,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1B;AAOD,MAAM,WAAW,YAAY;IAE5B,WAAW,EAAE,M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C,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,eAAe,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC,UAAU,EAAE,GAAG,YAAY,EAAE;IAKzH,sBAAsB,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,eAAe,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC,UAAU,EAAE,GAAG,YAAY,EAAE;IAK/H,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,cAAc;IA4BtB,OAAO,CAAC,IAAI;IAkBZ,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,OAAO;IA8Bf,OAAO,CAAC,QAAQ;CAKhB"}

14
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "rollup-plugin-typescript2",
"version": "0.16.0",
"version": "0.16.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -1278,21 +1278,13 @@
}
},
"rollup-plugin-typescript2": {
"version": "github:ezolenko/rollup-plugin-typescript2#fe0490c80755120e988ade29e94e6f36eb08447e",
"version": "github:ezolenko/rollup-plugin-typescript2#b2cb064766829abcd3889eb1cbde9a768b48d39e",
"dev": true,
"requires": {
"fs-extra": "5.0.0",
"resolve": "1.8.1",
"rollup-pluginutils": "2.3.0",
"tslib": "1.9.2"
},
"dependencies": {
"tslib": {
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.2.tgz",
"integrity": "sha512-AVP5Xol3WivEr7hnssHDsaM+lVrVXWUvd1cfXTRkTj80b//6g2wIFEH6hZG0muGZRnHGrfttpdzRk3YlBkWjKw==",
"dev": true
}
"tslib": "1.9.3"
}
},
"rollup-pluginutils": {

View File

@ -36,7 +36,7 @@ export default function typescript(options?: Partial<IOptions>)
const cache = (): TsCache =>
{
if (!_cache)
_cache = new TsCache(pluginOptions.clean, servicesHost, pluginOptions.cacheRoot, parsedConfig.options, rollupOptions, parsedConfig.fileNames, context);
_cache = new TsCache(pluginOptions.clean, pluginOptions.objectHashIgnoreUnknownHack, servicesHost, pluginOptions.cacheRoot, parsedConfig.options, rollupOptions, parsedConfig.fileNames, context);
return _cache;
};
@ -58,6 +58,7 @@ export default function typescript(options?: Partial<IOptions>)
tsconfigOverride: {},
transformers: [],
tsconfigDefaults: {},
objectHashIgnoreUnknownHack: false,
});
setTypescriptModule(pluginOptions.typescript);

View File

@ -26,4 +26,5 @@ export interface IOptions
transformers: TransformerFactoryCreator[];
tsconfigDefaults: any;
sourceMapCallback: (id: string, map: string) => void;
objectHashIgnoreUnknownHack: boolean;
}

View File

@ -88,7 +88,6 @@ export function convertDiagnostic(type: string, data: tsTypes.Diagnostic[]): IDi
});
}
const hashOptions = { algorithm: "sha1", ignoreUnknown: true };
export class TsCache
{
@ -101,9 +100,11 @@ export class TsCache
private typesCache!: ICache<string>;
private semanticDiagnosticsCache!: ICache<IDiagnostics[]>;
private syntacticDiagnosticsCache!: ICache<IDiagnostics[]>;
private hashOptions = { algorithm: "sha1", ignoreUnknown: false };
constructor(private noCache: boolean, private host: tsTypes.LanguageServiceHost, cache: string, private options: tsTypes.CompilerOptions, private rollupConfig: any, rootFilenames: string[], private context: IContext)
constructor(private noCache: boolean, hashIgnoreUnknown: boolean, private host: tsTypes.LanguageServiceHost, cache: string, private options: tsTypes.CompilerOptions, private rollupConfig: any, rootFilenames: string[], private context: IContext)
{
this.hashOptions.ignoreUnknown = hashIgnoreUnknown;
this.cacheDir = `${cache}/${hash(
{
version: this.cacheVersion,
@ -112,7 +113,7 @@ export class TsCache
rollupConfig: this.rollupConfig,
tsVersion: tsModule.version,
},
hashOptions
this.hashOptions
)}`;
this.dependencyTree = new Graph({ directed: true });
@ -315,6 +316,6 @@ export class TsCache
private makeName(id: string, snapshot: tsTypes.IScriptSnapshot)
{
const data = snapshot.getText(0, snapshot.getLength());
return hash({ data, id }, hashOptions);
return hash({ data, id }, this.hashOptions);
}
}