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 circular transpilation #26

Merged
merged 3 commits into from
May 31, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 15 additions & 3 deletions babel-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,15 @@ const STANDARD_BUILTINS = [
'_asyncToGenerator',
];

let hackyCount = undefined
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This crap did not work for now.


const mergeIntoOptions = (options, opts) => {
if (opts.hackyCount !== undefined) {
if (hackyCount === undefined) {
hackyCount = opts.hackyCount
}
}

opts = Object.assign({}, opts);
const ignore = opts.ignore;
if (ignore) {
Expand All @@ -104,6 +112,8 @@ const mergeIntoOptions = (options, opts) => {
Object.assign(options, opts);
};

let howDeepIsYourLove = 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol ❤️


function processProgram({ types: t }, programPath, programOpts) {
const options = {
enable: isInASTExploler(),
Expand Down Expand Up @@ -398,6 +408,11 @@ function processProgram({ types: t }, programPath, programOpts) {
return false;
}

howDeepIsYourLove++
if (howDeepIsYourLove > hackyCount) {
return false;
}

const globalIds = toPairs(path.scope.globals)
.filter(([name, _]) => !options.ignore.has(name))
.map(([_, identifier]) => identifier);
Expand Down Expand Up @@ -457,9 +472,6 @@ function processProgram({ types: t }, programPath, programOpts) {
};

function test(path, statepath) {
if (!options.enable) {
return false;
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one worked.

if (options.instrumentImports != 'query') return;

const imports = path.node.body.filter(byType('ImportDeclaration'));
Expand Down