GithubHelp home page GithubHelp logo

Comments (17)

danielbayerlein avatar danielbayerlein commented on September 22, 2024 3

@patrickkettner Can we add a support for RegEx?

from confidence.

SimonDegraeve avatar SimonDegraeve commented on September 22, 2024

This is a quick workaround for anybody having the same issue:

var regexp = function(pattern) {
  pattern = new RegExp(pattern);
  this.test = function(str) {
    return pattern.test(str);
  };
};

new regexp('\.scss$') // will not throw an error

from confidence.

kpdecker avatar kpdecker commented on September 22, 2024

An example of the error would be helpful here. Even better would be example code that is failing.

from confidence.

SimonDegraeve avatar SimonDegraeve commented on September 22, 2024

Any value that is a RegExp in the Confidence object will throw the error because of this line. So it is not really a bug but I am wondering why RegExp are not allowed.

from confidence.

kpdecker avatar kpdecker commented on September 22, 2024

I suspect that it's due to JSON not supporting regexs. @hueniverse is this the case?

I agree that this is detrimental for users who are using JS literals or ALCE to parse the confidence file as both of those situations supoprt RegEx literals

from confidence.

hueniverse avatar hueniverse commented on September 22, 2024

I need to see an actual config where you want to use Regex. The referenced line is there to prevent invalid nodes.

from confidence.

patrickkettner avatar patrickkettner commented on September 22, 2024

ping @SimonDegraeve

from confidence.

SimonDegraeve avatar SimonDegraeve commented on September 22, 2024

Hi sorry for the delay. I am not using confidence anymore. Feel free to close the issue. I will be back with a full example when I have a chance to use this library again.

from confidence.

taddei avatar taddei commented on September 22, 2024

ho about something like this?

var store = new Confidence.Store({
    webpack: {
        $filter: 'env',
        production: {
            entry: constants.src.js,
            output:  {
                path:     constants.dest.js.prod,
                filename: '[name].js' // Template based on keys in entry above
            },
            module: {
                loaders: [{
                    test: /\.jsx$/,
                    loader: 'jsx-loader'
                }]
            }
        },
        $default: {
            watch:   true,
            entry:   constants.src.js,
            output:  {
                path:     constants.dest.js.dev,
                filename: '[name].js' // Template based on keys in entry above
            },
            module:  {
                loaders: [{
                    test:   /\.jsx$/,
                    loader: 'jsx-loader'
                },
                {
                    test:   /\.css/,
                    loader: 'css-loader'
                }]
            }
        }
    }
});

from confidence.

prashaantt avatar prashaantt commented on September 22, 2024

I'm also trying to create a Webpack plugin, and need to pass a Webpack config object to it that uses the test RegExp property:


// webpack.config.js

module.exports = {
    module: {
      loaders: [{
        test: /\.jsx?/,
        loaders: ['babel'],
        presets: ['react', 'es2015']
      }]
    }
};
// manifest.js
// using the latest Glue syntax

const manifest = {
    registrations: [
        {
            plugin: {
                register: './my-plugin',
                options: {
                    config: require('./webpack.config.js')
                }
            }
        }
    ]
};

Confidence 1.4.2 throws me this error:

Error: Invalid node object type
    at error (/Users/user/project/node_modules/confidence/lib/store.js:211:22)

from confidence.

danielbayerlein avatar danielbayerlein commented on September 22, 2024

@patrickkettner I have the same problem as @prashaantt. Any idea?

from confidence.

patrickkettner avatar patrickkettner commented on September 22, 2024

@danielbayerlein have you tried the above workaround?

from confidence.

danielbayerlein avatar danielbayerlein commented on September 22, 2024

@patrickkettner The workaround does not work well with webpack v2.1.0-beta because the webpack default configuration used RegEx. See https://github.com/webpack/webpack/blob/6b0c20a53ad7b04d4282a8a5c334ea0982fd364c/lib/WebpackOptionsDefaulter.js#L25

from confidence.

patrickkettner avatar patrickkettner commented on September 22, 2024

@hueniverse do you recall the original reason for marking regexp as an invalid type?

from confidence.

hueniverse avatar hueniverse commented on September 22, 2024

No idea.

from confidence.

damusix avatar damusix commented on September 22, 2024

Any fix for this? still getting it

from confidence.

orditeck avatar orditeck commented on September 22, 2024

I have the same issue.

{
    plugin: 'hapi-pagination',
    options: {
        meta: {
            location: 'body'
        },
        reply: {
            paginate: 'hapiPaginate'
        },
        routes: {
            exclude: [
                new RegExp('/documentation*'), // or /\/documentation*/,
                new RegExp('/swaggerui*') // or /\/swaggerui*/,
            ]
        }
    }
}

from confidence.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.