-
-
Notifications
You must be signed in to change notification settings - Fork 65
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: support non-file transpiler srcs #236
Conversation
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.
Could you add the documentation change as well, anywhere that the transpiler function signature is referenced? (the transpiler attribute and the separate transpiler.md file)
will help to understand if it's the right shape based on how we explain to users.
i wonder how would this work when the build is; filegroup(name = "filegroup", srcs = ["1.ts", "2.ts"])
ts_project(
srcs = [":filegroup"]
) |
17a80d5
to
c9b9449
Compare
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.
Nice, I think you made a good case for this and the changes look right to me.
d489fd7
to
f50e781
Compare
f50e781
to
6458179
Compare
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.
looks good but we may need more tests. It would be great to have a test with filegroup
select
, and target with multiple files
in it.
The js_outs and map_outs attributes have been removed and all sources are passed including non .ts files. Transpilers should produce .js files for each inputted .ts file. Additional features such as generation of source maps (.js.map) may be implemented and should respect the the ts_project(source_map) attribute. Transpilers may optionally pre-declare output files similar to ts_project(). Fixes aspect-build#219
6458179
to
eb7f4b8
Compare
Good to merge then? |
The current transpiler which takes 3 arrays with aligning indexes is a bad API, and to fix #219 one of those arrays will no longer align with the other 2 making it unusable.
Proposed solution in this PR: #219 (comment)
This change makes the transpiler API simply
transpiler(srcs)
. Any additional information required should be added viapartial.make
such asout_dir
,source_map
etc. Often these extra params will be required in order to align with thets_project
attributes. A macro will almost always be ideal to configure the transpiler including things like aligning these attributes.swc change to do its own output declarations: aspect-build/rules_swc@f716962
ts/test/mock_transpiler.bzl is an example implementing a full rule including support for non-file srcs and predeclaring the .js and .js.map outputs.
examples/transpiler/babel.bzl is an example of a macro keeping the same functionality as today where it only supports file inputs. This also predeclares the .js and .js.map outputs as part of the babel invocation.
Alternatives:
changingjs/map_outs
to maps is a lot nicer then 3 arrays where the indexes align, especially since fixing targets (non-files) insrcs
breaks the index-aligning. See 17a80d5