Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

Filters always ignore dot-files #9

Description

@IvanSanchez

Scenario: GobbleJS workflow with merge nodes, and a rollup transform with some rollup plugins, like:

var code = gobble([txt, js])
.transform('rollup', {
    entry: 'main.js',
    dest: 'dist/main.js',
    format: 'cjs',
    sourceMap: true,
    plugins: [
        require('rollup-plugin-string')({ include: '**/*.txt' }),
        require('rollup-plugin-buble')({ exclude: '**/*.txt'}),
        require('rollup-plugin-commonjs')(),
        require('rollup-plugin-node-resolve')()
    ]
});

Due to Gobble's merge nodes, the files are in a path containing the hidden subdirectory name .gobble, like:

/home/ivan/devel/project/.gobble/03-merge/1/src/submodule/messages.txt

This was throwing errors in the buble transform, as apparently the *.txt files were being processed by rollup-plugin-buble, where I wanted them to be processed just by rollup-plugin-string.

Fortunately, I've been able to track down the problem to createFilter in the rollup-pluginutils module.

See, createFilter uses minimatch, and looking at its documentation I found this bit:

All options are false by default.
[…]
dot
Allow patterns to match filenames starting with a period, even if the pattern does not explicitly have a period in that spot.
Note that by default, a/**/b will not match a/.d/b, unless dot is set.

This means that all filters for all rollup plugins are broken when rollup is used within gobble (not sure about whether other build tools use paths with dot-files for temp/hidden files).

I think I can work around the issue by specifying minimatch patterns with an explicit .gobble/**/ for every rollup plugin, but this is totally counter-intuitive.

So:

  • What would be a sane default for the dot setting of minimatch?
  • Should createFilter accept an extra set of minimach options?
  • How can we make gobble-rollup force dot=true in the rollup plugin filters?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions