tidev / hyperloop.next

Hyperloop Next version (we forgot the version number at this point)
Other
8 stars 5 forks source link

Add option to exclude files #390

Open m1ga opened 4 months ago

m1ga commented 4 months ago

The hooks in: https://github.com/tidev/hyperloop.next/blob/master/android/hooks/tasks/scan-references-task.js#L301 https://github.com/tidev/hyperloop.next/blob/master/iphone/hooks/hyperloop.js#L587 include all files and tries to babel parse them. Depending on your files it will also include node_modules folders that you don't want to have in there (e.g. https://github.com/inspect-js/has-symbols/issues/1 produces an error).

It would be nice to have an option to exclude e.g. node_modules/**/test to be included/parsed. PoC:

        // Now traverse the AST and generate modified source
        if (!file.includes("node_modules/")) {
            const ast = babelParser.parse(originalSource, { sourceFilename: file, sourceType: 'unambiguous' });
            traverse(ast, HyperloopVisitor);
        }

makes it build again. Of course it should be a config option and not just the fixed node_modules folder. We could open .babelrc because that can contain:

{
  "ignore": [
    "**/node_modules/**/test"
  ]
}

check the app folder if the file is there, then read the ignore node and the content.

Test

hansemannn commented 1 month ago

@janvennemann Can you please check that in the end of this sprint? Thanks a lot!

m1ga commented 1 month ago

:+1: thanks. I've added some test instructions.

My current workaround is to remove the test/ folder from that node_module and it will build again. Patching hyperloop works too but I didn't want to do it on all machines :-)