Skip to content

Commit f6db596

Browse files
authored
fix: don't resolve filtered files (#428)
* fix: don't resolve `filter`ed files - if they're `exclude`d / not `include`d, then we shouldn't be processing them - we're already not transforming them, so this just applies the same exclusion to resolving - this is _partly_ a regression from b0e3922, as that removed the `allImportedFiles` Set that previously filtered out files not in the `tsconfig` `include` - but that _itself_ was a regression that was removed -- files that didn't pass `filter` should have _never_ been resolved - basically, the `allImportedFiles` regression was covering up this long-standing bug - also move `.d.ts` check to above the `filter` check - we shouldn't be adding declarations to the `cache`, in particular as we don't process declarations, so they'll never be marked as dirty - having this check above the `filter` should be slighltly more efficient as well (as would not having these files in the cache graph) types: be more specific with `filter`'s type - no need for this to be `any` * build - patch release has been waiting for a few weeks * pub: release v0.34.1 - patch bump with the past few fixes - bump internal rpt2 version to 0.34.0
1 parent 3ef3289 commit f6db596

8 files changed

+30
-26
lines changed

dist/index.d.ts.map

+1-1
Original file line numberDiff line numberDiff line change

dist/rollup-plugin-typescript2.cjs.js

+5-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rollup-plugin-typescript2.cjs.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rollup-plugin-typescript2.es.js

+5-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rollup-plugin-typescript2.es.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rollup-plugin-typescript2",
3-
"version": "0.34.0",
3+
"version": "0.34.1",
44
"description": "Seamless integration between Rollup and TypeScript. Now with errors.",
55
"main": "dist/rollup-plugin-typescript2.cjs.js",
66
"module": "dist/rollup-plugin-typescript2.es.js",
@@ -62,7 +62,7 @@
6262
"rimraf": "3.0.2",
6363
"rollup": "^2.70.2",
6464
"rollup-plugin-re": "1.0.7",
65-
"rollup-plugin-typescript2": "0.33.0",
65+
"rollup-plugin-typescript2": "0.34.0",
6666
"ts-jest": "^28.0.0",
6767
"tslint": "6.1.3",
6868
"typescript": "^4.6.3"

src/index.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
3232
let generateRound = 0;
3333
let rollupOptions: InputOptions;
3434
let context: RollupContext;
35-
let filter: any;
35+
let filter: ReturnType<typeof createFilter>;
3636
let parsedConfig: tsTypes.ParsedCommandLine;
3737
let tsConfigPath: string | undefined;
3838
let servicesHost: LanguageServiceHost;
@@ -204,12 +204,14 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
204204
if (!resolved)
205205
return;
206206

207-
if (filter(resolved))
208-
cache.setDependency(resolved, importer);
209-
210207
if (resolved.endsWith(".d.ts"))
211208
return;
212209

210+
if (!filter(resolved))
211+
return;
212+
213+
cache.setDependency(resolved, importer);
214+
213215
context.debug(() => `${blue("resolving")} '${importee}' imported by '${importer}'`);
214216
context.debug(() => ` to '${resolved}'`);
215217

0 commit comments

Comments
 (0)