-
Notifications
You must be signed in to change notification settings - Fork 69
wip: collect inline require statements and convert them to top level imports #269
Conversation
cfc7b30
to
3e9204e
Compare
@sibelius It seems actions don't run for pushes from fork repos |
how can we enable this? I've gave you access to this org and repo |
I think publishing is automated via travis cc @alloy , we could move it to github actions.
I will check later |
3e9204e
to
21f6bf5
Compare
Agreed that this should normally go into relay, but I’m not against doing it here temporarily 👍 I assume doing it with regexes is faster than using a babel visitor on the JSON, but it might be nice to compare, if you feel like it (don't feel strong on this at all). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as this is the same as flow compiler, we can follow this approach
@sibelius The flow compiler does not address this issue. In case you are referring to https://github.com/facebook/relay/pull/2841/files#diff-8258e3677c0534bd73d878b16093be514b2227f8972766d881bf903ff5f0e0d9R15-R27 - that was only a WIP pr that got superseded by facebook/relay#2781 which never addressed this issue (maybe because the |
Anything that is needed here @n1ru4l to fix this for the moment? (We use snowpack/webpack pipeline and the current require command even hardcodes the whole filename (foo.graphql.ts) which breaks our pipeline.) |
@theseyi You wanna write some tests for this? |
* Update CHANGELOG.md [skip ci] * Bump version to: 13.0.3 [skip ci] * chore: bump typescript from 4.1.4 to 4.1.5 (relay-tools#268) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.1.4 to 4.1.5. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](microsoft/TypeScript@v4.1.4...v4.1.5) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> * Update CHANGELOG.md [skip ci] * Bump version to: 13.0.4 [skip ci] * chore: bump @types/node from 14.14.25 to 14.14.28 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.14.25 to 14.14.28. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * fix: revert breaking changes introduced in 13.0.3 (relay-tools#274) * Revert "refactor: use factory functions instead of deprecated functions" This reverts commit 812d17e. * Revert "refactor: remove deprecated typescript function calls in favor of the factory; replace @ts-ignores with proper code (microsoft/TypeScript#40263 (comment))" This reverts commit 55c58be. * Revert "refactor: some of the statements are redundant. It is not necessary to write to write only properties." This reverts commit 2cbd1de. * Revert "refactor: address all the typescript deprecations by using the factory" This reverts commit 72e0b4a. * chore: run CI github action on pull request * fix: typo * Update CHANGELOG.md [skip ci] * Bump version to: 13.0.5 [skip ci] * Update CHANGELOG.md [skip ci] * Bump version to: 13.0.6 [skip ci] * feat: include .d.ts types in release (relay-tools#309) * feat: drop typescript 3 and Node.js 10 support (relay-tools#275) * refactor: address all the typescript deprecations by using the factory * refactor: some of the statements are redundant. It is not necessary to write to write only properties. * refactor: remove deprecated typescript function calls in favor of the factory; replace @ts-ignores with proper code (microsoft/TypeScript#40263 (comment)) * refactor: use factory functions instead of deprecated functions * feat: bump peerDependencies version * dps: upgrade to latest typescript version * chore: replace rm with rimraf for cross platform support * chore: replace fixture tests with inline snapshot tests * docs: add notice about minimum TypeScript version. * chore: drop node 10 support * Update CHANGELOG.md [skip ci] * Bump version to: 13.0.7 [skip ci] * Update CHANGELOG.md [skip ci] * Bump version to: 13.0.8 [skip ci] * feat: replace require calls by static (top level) or dynamic imports based on ts compiler options * feat: add tests for require call replacement logic * chore: add comment * fix: parse contents of tsconfig file into compiler options Converts strings to enum values etc. * fix: remove support for dynamic imports * fix: import default Co-authored-by: Eloy Durn <eloy.de.enige@gmail.com> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Laurin Quast <laurinquast@googlemail.com> Co-authored-by: Sibelius Seraphini <sibeliusseraphini@gmail.com> Co-authored-by: Tim Griesser <tgriesser10@gmail.com> Co-authored-by: Erik Müller <e.mueller@detelling.com>
@asterikx Do you mind-altering the README to include a section on how to properly configure typescript and relay config in order to produce esm imports? After that is done I will merge this! Thank you so much for adding the tests |
517f584
to
54934ce
Compare
🚀 PR was released in |
It might be possible that this should be better off within relay. however, this works great for my use-cases as a quick fix.
Example output: