Skip to content
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

Only the first vfile is processed #57

Closed
4 tasks done
remcohaszing opened this issue Dec 20, 2021 · 3 comments
Closed
4 tasks done

Only the first vfile is processed #57

remcohaszing opened this issue Dec 20, 2021 · 3 comments
Labels
💪 phase/solved Post is done

Comments

@remcohaszing
Copy link
Member

Initial checklist

Affected packages and versions

unified-engine@9.0.4

Link to runnable example

No response

Steps to reproduce

Run the following script:

#!/usr/bin/env node
import {unified} from 'unified'
import {engine} from 'unified-engine'
import {VFile} from 'vfile'

function plugin() {
  this.Parser = () => ({type: 'root'})
  this.Compiler = () => ''

  return (ast, file) => {
    file.message('Oh noez!')
  }
}

const files = [
  new VFile({path: new URL('file:///a.txt'), value: 'a'}),
  new VFile({path: new URL('file:///b.txt'), value: 'b'})
]

engine(
  {
    files,
    processor: unified().use(plugin)
  },
  (error, code, context) => {
    console.dir(context.files, {depth: 3})
  }
)

Expected behavior

For all given files the unified plugins are ran.

Actual behavior

Unified plugins are only run for the first vfile given.

If file paths are given as strings instead of vfiles, all given paths are processed.

If a combination of vfiles and string paths is given, all string paths are processed up to the first vfile.

Runtime

Node v16

Package manager

npm v6

OS

Linux

Build and bundle tools

Other (please specify in steps to reproduce)

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Dec 20, 2021
@wooorm
Copy link
Member

wooorm commented Dec 20, 2021

Running with debugging on probably provides more insight.
My hunch would be somewhere here: https://github.com/unifiedjs/unified-engine/blob/main/lib/file-pipeline/queue.js.

@wooorm wooorm added the 🙆 yes/confirmed This is confirmed and ready to be worked on label Dec 20, 2021
@github-actions github-actions bot added 👍 phase/yes Post is accepted and can be worked on and removed 🤞 phase/open Post is being triaged manually labels Dec 20, 2021
@github-actions

This comment has been minimized.

@wooorm wooorm closed this as completed in 2387aa9 Dec 20, 2021
@wooorm wooorm added the 💪 phase/solved Post is done label Dec 20, 2021
@github-actions github-actions bot removed 👍 phase/yes Post is accepted and can be worked on 🙆 yes/confirmed This is confirmed and ready to be worked on labels Dec 20, 2021
@wooorm
Copy link
Member

wooorm commented Dec 20, 2021

released!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 phase/solved Post is done
Development

No branches or pull requests

2 participants