@@ -97,6 +97,54 @@ const decoratorsLegacy = useOptions(
97
97
}
98
98
},
99
99
)
100
+
101
+ const pipelineOperator = useOptions (
102
+ (opt : ParserOptions ) =>
103
+ opt .plugins ?.some ((n ) => Array .isArray (n ) && n [0 ] === ' pipelineOperator' ),
104
+ (value , opt ) => {
105
+ if (! Array .isArray (opt .plugins )) opt .plugins = []
106
+ if (value ) {
107
+ opt .plugins .push ([
108
+ ' pipelineOperator' ,
109
+ { proposal: ' hack' , topicToken: ' #' },
110
+ ])
111
+ } else {
112
+ opt .plugins = opt .plugins .filter (
113
+ (n ) => ! Array .isArray (n ) || n [0 ] !== ' pipelineOperator' ,
114
+ )
115
+ }
116
+ },
117
+ )
118
+
119
+ function findPipelineOperator(optPlugins : ParserOptions [' plugins' ]) {
120
+ return optPlugins ?.find (
121
+ (n ) => Array .isArray (n ) && n [0 ] === ' pipelineOperator' ,
122
+ )
123
+ }
124
+
125
+ const pipelineOperatorProposal = useOptions (
126
+ (opt : ParserOptions ) => findPipelineOperator (opt .plugins )?.[1 ].proposal ,
127
+ (value , opt ) => {
128
+ const pipelineOperator = findPipelineOperator (opt .plugins )
129
+ if (! pipelineOperator ) return
130
+ if (value === ' fsharp' ) {
131
+ pipelineOperator [1 ].proposal = value
132
+ delete pipelineOperator [1 ].topicToken
133
+ } else if (value === ' hack' ) {
134
+ pipelineOperator [1 ].proposal = value
135
+ pipelineOperator [1 ].topicToken = ' #'
136
+ }
137
+ },
138
+ )
139
+ const pipelineOperatorTopicToken = useOptions (
140
+ (opt : ParserOptions ) => findPipelineOperator (opt .plugins )?.[1 ].topicToken ,
141
+ (value , opt ) => {
142
+ const pipelineOperator = findPipelineOperator (opt .plugins )
143
+ if (! pipelineOperator ) return
144
+ pipelineOperator [1 ].topicToken = value
145
+ },
146
+ )
147
+
100
148
const decoratorAutoAccessors = usePlugin (' decoratorAutoAccessors' , [decorators ])
101
149
const decimal = usePlugin (' decimal' )
102
150
const deferredImportEvaluation = usePlugin (' deferredImportEvaluation' )
@@ -110,7 +158,6 @@ const importReflection = usePlugin('importReflection')
110
158
const moduleBlocks = usePlugin (' moduleBlocks' )
111
159
const optionalChainingAssign = usePlugin (' optionalChainingAssign' )
112
160
const partialApplication = usePlugin (' partialApplication' )
113
- const pipelineOperator = usePlugin (' pipelineOperator' )
114
161
const recordAndTuple = usePlugin (' recordAndTuple' )
115
162
const sourcePhaseImports = usePlugin (' sourcePhaseImports' )
116
163
const throwExpressions = usePlugin (' throwExpressions' )
@@ -271,6 +318,28 @@ const throwExpressions = usePlugin('throwExpressions')
271
318
<span >pipelineOperator</span >
272
319
</label >
273
320
321
+ <label ml6 >
322
+ <span >proposal</span >
323
+ <select v-model =" pipelineOperatorProposal" :disabled =" !pipelineOperator" >
324
+ <option value =" hack" >hack</option >
325
+ <option value =" fsharp" >fsharp</option >
326
+ </select >
327
+ </label >
328
+
329
+ <label ml6 >
330
+ <span >topicToken</span >
331
+ <select
332
+ v-model =" pipelineOperatorTopicToken"
333
+ :disabled =" !pipelineOperator || pipelineOperatorProposal !== 'hack'"
334
+ >
335
+ <option value =" %" >%</option >
336
+ <option value =" #" >#</option >
337
+ <option value =" ^" >^</option >
338
+ <option value =" @@" >@@</option >
339
+ <option value =" ^^" >^^</option >
340
+ </select >
341
+ </label >
342
+
274
343
<label >
275
344
<!-- Stage 2 -->
276
345
<input v-model =" functionSent" type =" checkbox" switch />
0 commit comments