webpipe-js 2.0.41 → 2.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1867,10 +1867,16 @@ function formatPipelineStep(step, indent = " ") {
1867
1867
  } else if (step.kind === "Dispatch") {
1868
1868
  const lines = [`${indent}|> dispatch`];
1869
1869
  step.branches.forEach((branch) => {
1870
- lines.push(`${indent} case ${formatTagExpr(branch.condition)}:`);
1871
- branch.pipeline.steps.forEach((branchStep) => {
1872
- lines.push(formatPipelineStep(branchStep, indent + " "));
1873
- });
1870
+ if (branch.pipeline.steps.length === 1) {
1871
+ const inlineStep = formatPipelineStep(branch.pipeline.steps[0], indent + " ");
1872
+ const stepContent = inlineStep.substring((indent + " ").length);
1873
+ lines.push(`${indent} case ${formatTagExpr(branch.condition)}: ${stepContent}`);
1874
+ } else {
1875
+ lines.push(`${indent} case ${formatTagExpr(branch.condition)}:`);
1876
+ branch.pipeline.steps.forEach((branchStep) => {
1877
+ lines.push(formatPipelineStep(branchStep, indent + " "));
1878
+ });
1879
+ }
1874
1880
  });
1875
1881
  if (step.default) {
1876
1882
  lines.push(`${indent} default:`);
package/dist/index.mjs CHANGED
@@ -1814,10 +1814,16 @@ function formatPipelineStep(step, indent = " ") {
1814
1814
  } else if (step.kind === "Dispatch") {
1815
1815
  const lines = [`${indent}|> dispatch`];
1816
1816
  step.branches.forEach((branch) => {
1817
- lines.push(`${indent} case ${formatTagExpr(branch.condition)}:`);
1818
- branch.pipeline.steps.forEach((branchStep) => {
1819
- lines.push(formatPipelineStep(branchStep, indent + " "));
1820
- });
1817
+ if (branch.pipeline.steps.length === 1) {
1818
+ const inlineStep = formatPipelineStep(branch.pipeline.steps[0], indent + " ");
1819
+ const stepContent = inlineStep.substring((indent + " ").length);
1820
+ lines.push(`${indent} case ${formatTagExpr(branch.condition)}: ${stepContent}`);
1821
+ } else {
1822
+ lines.push(`${indent} case ${formatTagExpr(branch.condition)}:`);
1823
+ branch.pipeline.steps.forEach((branchStep) => {
1824
+ lines.push(formatPipelineStep(branchStep, indent + " "));
1825
+ });
1826
+ }
1821
1827
  });
1822
1828
  if (step.default) {
1823
1829
  lines.push(`${indent} default:`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpipe-js",
3
- "version": "2.0.41",
3
+ "version": "2.0.42",
4
4
  "description": "Web Pipe parser",
5
5
  "license": "ISC",
6
6
  "author": "William Cotton",