CSSModuleBuilder extends TextModuleBuilder implements  IExtensionInitializer, IExtensionSingleton, IShutdownListener, IConfigListener { protected Pattern toRegexp(String filespec) { Matcher m = escaper.matcher(filespec); StringBuffer sb = new StringBuffer(); while (m.find()) { String matched = m.group(0); if (matched.equals("*")) { m.appendReplacement(sb, "\\[^/]*?"); } else if (matched.equals("?")) { m.appendReplacement(sb, "[^/]"); } else if (matched.equals("$")) { m.appendReplacement(sb, "\\\\\\$"); } else if (matched.equals("\\")) { m.appendReplacement(sb, "\\\\\\\\"); } else { m.appendReplacement(sb, "\\\\" + matched); } } m.appendTail(sb); String patStr = sb.toString(); return Pattern.compile((patStr.startsWith("/") ? BLANK : "(^|/)") + patStr + "$", Pattern.CASE_INSENSITIVE); } CSSModuleBuilder(); protected  CSSModuleBuilder(IAggregator aggregator, ExecutorService es, int scopePoolSize); @Override List<ICacheKeyGenerator> getCacheKeyGenerators(IAggregator aggregator); @Override boolean handles(String mid, IResource resource); @Override void shutdown(IAggregator aggregator); @Override void initialize(IAggregator aggregator,
			IAggregatorExtension extension, IExtensionRegistrar registrar); @Override void configLoaded(IConfig conf, long sequence); String dequote(String in); static final String INLINEIMPORTS_CONFIGPARAM; static final String INCLUDELIST_CONFIGPARAM; static final String EXCLUDELIST_CONFIGPARAM; static final String IMAGETYPES_CONFIGPARAM; static final String SIZETHRESHOLD_CONFIGPARAM; static final String INCLUDEAMDPATHS_CONFIGPARAM; static final String POSTCSSPLUGINS_CONFIGPARAM; static final String SCOPEPOOLSIZE_CONFIGPARAM; static final String POSTCSS_CONFIGPARAM; static final boolean INLINEIMPORTS_DEFAULT_VALUE; static final boolean INCLUDEAMDPATHS_DEFAULT_VALUE; static final int SIZETHRESHOLD_DEFAULT_VALUE; static final String INLINEIMPORTS_REQPARAM_NAME; static final String INLINEIMAGES_REQPARAM_NAME; static final String PREAMBLE; static final String BLANK; static final String UTF8_CHARSET; static final String POSTCSS_RES_NAME; static final String MINIFYER_RES_NAME; static final String POSTCSS; static final String PROCESS; static final String PLUGINS; static final String POSTCSS_INSTANCE; static final String MODULE; static final String EXPORTS; static final String AMD_DEFINE_SHIM_JS; static final String MINIFIER_INITIALIZATION_VAR; static final String MINIFIER_INITIALIZATION_JS; static final Map<String, Boolean> POSTCSS_OPTIONS; static final int INITIALIZER_THREAD_POOL_SIZE; static final int DEFAULT_SCOPE_POOL_SIZE; static final int SCOPE_POOL_TIMEOUT_SECONDS; public int imageSizeThreshold; public boolean inlineImports; public boolean includeAMDPaths; public Collection<Pattern> inlinedImageExcludeList; }
@Test public void testToRegexp() { CSSModuleBuilder builder = new CSSModuleBuilder() { @Override public Pattern toRegexp(String filespec) { return super.toRegexp(filespec); } }; Pattern regexp = builder.toRegexp("test?.*"); Assert.assertEquals("(^|/)test[^/]\\.[^/]*?$", regexp.toString()); Assert.assertTrue(regexp.matcher("test1.abc").find()); Assert.assertFalse(regexp.matcher("test11.abc").find()); Assert.assertTrue(regexp.matcher("/test1.abc").find()); Assert.assertTrue(regexp.matcher("/some/path/test1.abc").find()); regexp = builder.toRegexp("test/*/hello@$!.???"); Assert.assertEquals("(^|/)test/[^/]*?/hello@\\$!\\.[^/][^/][^/]$", regexp.toString()); Assert.assertTrue(regexp.matcher("test/abc/hello@$!.foo").find()); Assert.assertTrue(regexp.matcher("/test/xyz/hello@$!.123").find()); Assert.assertTrue(regexp.matcher("somepath/test/xyz/hello@$!.123").find()); Assert.assertFalse(regexp.matcher("/test/xyz/hello@$!.ab").find()); Assert.assertFalse(regexp.matcher("/test/hello@$!.123").find()); regexp = builder.toRegexp("/a?c"); Assert.assertEquals("/a[^/]c$", regexp.toString()); }