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

Add option to exclude files #390

Open
m1ga opened this issue Jun 27, 2024 · 2 comments
Open

Add option to exclude files #390

m1ga opened this issue Jun 27, 2024 · 2 comments
Assignees

Comments

@m1ga
Copy link
Contributor

m1ga commented Jun 27, 2024

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. inspect-js/has-symbols#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

  • create an app
  • include hyperloop
  • inside app/lib run npm i has-symbols
  • build the app
  • it should fail with "'return' outside of function"
@hansemannn
Copy link
Contributor

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

@m1ga
Copy link
Contributor Author

m1ga commented Sep 9, 2024

👍 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 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants