Skip to content

Commit 861a03d

Browse files
author
Petr Leonov
committed
add a global variable to break the circular transpilation
This is a dirty workaround, but I have no time now to make it proper. The proper solution, btw, would be to make Jest understand query params in imports jestjs/jest#6282
1 parent 1315ce0 commit 861a03d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

babel-plugin.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,15 @@ const STANDARD_BUILTINS = [
8888
'_asyncToGenerator',
8989
];
9090

91+
let hackyCount = undefined
92+
9193
const mergeIntoOptions = (options, opts) => {
94+
if (opts.hackyCount !== undefined) {
95+
if (hackyCount === undefined) {
96+
hackyCount = opts.hackyCount
97+
}
98+
}
99+
92100
opts = Object.assign({}, opts);
93101
const ignore = opts.ignore;
94102
if (ignore) {
@@ -104,6 +112,9 @@ const mergeIntoOptions = (options, opts) => {
104112
Object.assign(options, opts);
105113
};
106114

115+
let howDeepIsYourLove = 0
116+
let howDeepYourLoveMustBe = undefined
117+
107118
function processProgram({ types: t }, programPath, programOpts) {
108119
const options = {
109120
enable: isInASTExploler(),
@@ -398,6 +409,11 @@ function processProgram({ types: t }, programPath, programOpts) {
398409
return false;
399410
}
400411

412+
howDeepIsYourLove++
413+
if (howDeepIsYourLove > hackyCount) {
414+
return false;
415+
}
416+
401417
const globalIds = toPairs(path.scope.globals)
402418
.filter(([name, _]) => !options.ignore.has(name))
403419
.map(([_, identifier]) => identifier);

0 commit comments

Comments
 (0)