Closed krzysztofpniak closed 7 months ago
There is no way to load babel config, anyways everything works good for me https://putout.cloudcmd.io/#/gist/aa57aef60816b5d7875536b9271a701b/73337bbf9ac4cf9df51460ceaa9415ce742a7f19
What version of πPutout are you using?
I'm using the latest.
This is not working for me: https://putout.cloudcmd.io/#/gist/790e78f476c01dfe478cf1b8adae54e8/41e70353c72502710d7de340d001ae8cfa142031
export const report = () => `Use 'if condition' instead of 'pipeline operator'`;
export const replace = () => ({
'__a |> __b |> __c': 'if (__a) __b; else __c;'
});
Yes, this construction isβn supported now in Replacer (good idea for PR to @putout/engine-parser
), you can use Traverser instead. What result do you want to achieve: please provide input and output, and I try to help you.
It is easy to enable parsing of pipelineOperator, but what kind of topic to set?
It is also stage-2 so lots things can be changed and it is not supported by any runtime as I know. Are you using pipelineOperator
in production and want to get rid of it?
It is also easy to transform such code since this is just BinaryExpression
:
Exactly, I'm using pipeline in production for 3 years and I want to get rid of it.
I would like to transform:
expr1 |> expr2 |> expr_n
to:
wrap(expr1).pipe(expr2).pipe(expr_n).value
What kind of topics have you used?
Right now I have an error:
I don't mind to help you converting your codebase, but I need to seed your babel config, and I think is better to add hack
:
Also if this is one-time transformation you can update babel parser plugins inside @putout/engine-parser
to enable anything you need.
I'm using
[
'@babel/plugin-proposal-pipeline-operator',
{proposal: 'minimal'},
],
Do you need any additional help for this?
Yes, I tried Traverser and it gave me the same error.
export const report = () => `replace pipelines`;
export const traverse = ({push}) => ({
BinaryExpression: path => console.log('path', path),
});
Did you update babel plugins?
Yes, this construction isβn supported now in Replacer (good idea for PR to
@putout/engine-parser
), you can use Traverser instead. What result do you want to achieve: please provide input and output, and I try to help you.
You mentioned that it will work in Traverser. However, it seems that manual changes are required in the plugins within the node_modules directory each time, and on every machine I need to use it. Do you have any better ideas on how I can achieve this?
https://www.npmjs.com/package/patch-package can help with this, but why don't you want to run transform once and commit to git repository. Do you need to run it every time you write code?
patch-packages + change in @putout/engine-parser solves all my issues. Thanks for your help.
How can I load
babel.config.js
? I have a code:I got
This experimental syntax requires enabling the parser plugin: "pipelineOperator". (1:2)