Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't resolve filtered files #428

Merged
merged 3 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions dist/rollup-plugin-typescript2.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -27932,7 +27932,7 @@ catch (e) {
// these use globals during testing and are substituted by rollup-plugin-re during builds
const TS_VERSION_RANGE = (global === null || global === void 0 ? void 0 : global.rpt2__TS_VERSION_RANGE) || ">=2.4.0";
const ROLLUP_VERSION_RANGE = (global === null || global === void 0 ? void 0 : global.rpt2__ROLLUP_VERSION_RANGE) || ">=1.26.3";
const RPT2_VERSION = (global === null || global === void 0 ? void 0 : global.rpt2__ROLLUP_VERSION_RANGE) || "0.34.0";
const RPT2_VERSION = (global === null || global === void 0 ? void 0 : global.rpt2__ROLLUP_VERSION_RANGE) || "0.34.1";
const typescript = (options) => {
let watchMode = false;
let supportsThisLoad = false;
Expand Down Expand Up @@ -27978,7 +27978,7 @@ const typescript = (options) => {
const buildDone = () => {
if (!watchMode && !noErrors)
context.info(safe.exports.yellow("there were errors or warnings."));
cache.done();
cache === null || cache === void 0 ? void 0 : cache.done(); // if there's an initialization error in `buildStart`, such as a `tsconfig` error, the cache may not exist yet
};
const pluginOptions = Object.assign({}, {
check: true,
Expand Down Expand Up @@ -28065,10 +28065,11 @@ const typescript = (options) => {
const resolved = (_a = result.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName;
if (!resolved)
return;
if (filter(resolved))
cache.setDependency(resolved, importer);
if (resolved.endsWith(".d.ts"))
return;
if (!filter(resolved))
return;
cache.setDependency(resolved, importer);
context.debug(() => `${safe.exports.blue("resolving")} '${importee}' imported by '${importer}'`);
context.debug(() => ` to '${resolved}'`);
return require$$0$1.normalize(resolved); // use host OS separators to fix Windows issue: https://github.com/ezolenko/rollup-plugin-typescript2/pull/251
Expand Down
2 changes: 1 addition & 1 deletion dist/rollup-plugin-typescript2.cjs.js.map

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions dist/rollup-plugin-typescript2.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -27903,7 +27903,7 @@ catch (e) {
// these use globals during testing and are substituted by rollup-plugin-re during builds
const TS_VERSION_RANGE = (global === null || global === void 0 ? void 0 : global.rpt2__TS_VERSION_RANGE) || ">=2.4.0";
const ROLLUP_VERSION_RANGE = (global === null || global === void 0 ? void 0 : global.rpt2__ROLLUP_VERSION_RANGE) || ">=1.26.3";
const RPT2_VERSION = (global === null || global === void 0 ? void 0 : global.rpt2__ROLLUP_VERSION_RANGE) || "0.34.0";
const RPT2_VERSION = (global === null || global === void 0 ? void 0 : global.rpt2__ROLLUP_VERSION_RANGE) || "0.34.1";
const typescript = (options) => {
let watchMode = false;
let supportsThisLoad = false;
Expand Down Expand Up @@ -27949,7 +27949,7 @@ const typescript = (options) => {
const buildDone = () => {
if (!watchMode && !noErrors)
context.info(safe.exports.yellow("there were errors or warnings."));
cache.done();
cache === null || cache === void 0 ? void 0 : cache.done(); // if there's an initialization error in `buildStart`, such as a `tsconfig` error, the cache may not exist yet
};
const pluginOptions = Object.assign({}, {
check: true,
Expand Down Expand Up @@ -28036,10 +28036,11 @@ const typescript = (options) => {
const resolved = (_a = result.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName;
if (!resolved)
return;
if (filter(resolved))
cache.setDependency(resolved, importer);
if (resolved.endsWith(".d.ts"))
return;
if (!filter(resolved))
return;
cache.setDependency(resolved, importer);
context.debug(() => `${safe.exports.blue("resolving")} '${importee}' imported by '${importer}'`);
context.debug(() => ` to '${resolved}'`);
return normalize(resolved); // use host OS separators to fix Windows issue: https://github.com/ezolenko/rollup-plugin-typescript2/pull/251
Expand Down
2 changes: 1 addition & 1 deletion dist/rollup-plugin-typescript2.es.js.map

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rollup-plugin-typescript2",
"version": "0.34.0",
"version": "0.34.1",
"description": "Seamless integration between Rollup and TypeScript. Now with errors.",
"main": "dist/rollup-plugin-typescript2.cjs.js",
"module": "dist/rollup-plugin-typescript2.es.js",
Expand Down Expand Up @@ -62,7 +62,7 @@
"rimraf": "3.0.2",
"rollup": "^2.70.2",
"rollup-plugin-re": "1.0.7",
"rollup-plugin-typescript2": "0.33.0",
"rollup-plugin-typescript2": "0.34.0",
"ts-jest": "^28.0.0",
"tslint": "6.1.3",
"typescript": "^4.6.3"
Expand Down
10 changes: 6 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
let generateRound = 0;
let rollupOptions: InputOptions;
let context: RollupContext;
let filter: any;
let filter: ReturnType<typeof createFilter>;
let parsedConfig: tsTypes.ParsedCommandLine;
let tsConfigPath: string | undefined;
let servicesHost: LanguageServiceHost;
Expand Down Expand Up @@ -204,12 +204,14 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
if (!resolved)
return;

if (filter(resolved))
cache.setDependency(resolved, importer);

if (resolved.endsWith(".d.ts"))
return;

if (!filter(resolved))
return;

cache.setDependency(resolved, importer);

context.debug(() => `${blue("resolving")} '${importee}' imported by '${importer}'`);
context.debug(() => ` to '${resolved}'`);

Expand Down