mirror of https://github.com/curbengh/hexo-yam
				
				
				
			feat: disable basename globbing when pattern contains slash
This commit is contained in:
		
							parent
							
								
									43a316d149
								
							
						
					
					
						commit
						a6f59a9704
					
				| 
						 | 
				
			
			@ -26,6 +26,10 @@ function logicHtml (str, data) {
 | 
			
		|||
  const exclude = options.exclude
 | 
			
		||||
  const globOptions = options.globOptions
 | 
			
		||||
 | 
			
		||||
  let excludeString = exclude
 | 
			
		||||
  if (Array.isArray(exclude)) excludeString = exclude.join('')
 | 
			
		||||
  if (excludeString.includes('/')) globOptions.basename = false
 | 
			
		||||
 | 
			
		||||
  // Return if a path matches exclusion pattern
 | 
			
		||||
  if (isMatch(path, exclude, globOptions)) return str
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -47,6 +51,10 @@ function logicCss (str, data) {
 | 
			
		|||
  const exclude = options.exclude
 | 
			
		||||
  const globOptions = options.globOptions
 | 
			
		||||
 | 
			
		||||
  let excludeString = exclude
 | 
			
		||||
  if (exclude && Array.isArray(exclude)) excludeString = exclude.join('')
 | 
			
		||||
  if (excludeString && excludeString.includes('/')) globOptions.basename = false
 | 
			
		||||
 | 
			
		||||
  if (isMatch(path, exclude, globOptions)) return str
 | 
			
		||||
 | 
			
		||||
  return new Promise((resolve, reject) => {
 | 
			
		||||
| 
						 | 
				
			
			@ -71,6 +79,10 @@ function logicJs (str, data) {
 | 
			
		|||
  const exclude = options.exclude
 | 
			
		||||
  const globOptions = options.globOptions
 | 
			
		||||
 | 
			
		||||
  let excludeString = exclude
 | 
			
		||||
  if (exclude && Array.isArray(exclude)) excludeString = exclude.join('')
 | 
			
		||||
  if (excludeString && excludeString.includes('/')) globOptions.basename = false
 | 
			
		||||
 | 
			
		||||
  if (isMatch(path, exclude, globOptions)) return str
 | 
			
		||||
 | 
			
		||||
  // Terser doesn't like unsupported options
 | 
			
		||||
| 
						 | 
				
			
			@ -100,6 +112,10 @@ function logicSvg () {
 | 
			
		|||
  let include = options.include
 | 
			
		||||
  const globOptions = options.globOptions
 | 
			
		||||
 | 
			
		||||
  let includeString = include
 | 
			
		||||
  if (include && Array.isArray(include)) includeString = include.join('')
 | 
			
		||||
  if (includeString && includeString.includes('/')) globOptions.basename = false
 | 
			
		||||
 | 
			
		||||
  return Promise.all((micromatch(routeList, include, globOptions)).map(path => {
 | 
			
		||||
    return new Promise((resolve, reject) => {
 | 
			
		||||
      // Grab all assets using hexo router
 | 
			
		||||
| 
						 | 
				
			
			@ -138,6 +154,10 @@ function logicGzip () {
 | 
			
		|||
  let include = options.include
 | 
			
		||||
  const globOptions = options.globOptions
 | 
			
		||||
 | 
			
		||||
  let includeString = include
 | 
			
		||||
  if (include && Array.isArray(include)) includeString = include.join('')
 | 
			
		||||
  if (includeString && includeString.includes('/')) globOptions.basename = false
 | 
			
		||||
 | 
			
		||||
  return Promise.all((micromatch(routeList, include, globOptions)).map(path => {
 | 
			
		||||
    return new Promise((resolve, reject) => {
 | 
			
		||||
      // Grab all assets using hexo router
 | 
			
		||||
| 
						 | 
				
			
			@ -180,6 +200,10 @@ function logicBrotli () {
 | 
			
		|||
  let include = options.include
 | 
			
		||||
  const globOptions = options.globOptions
 | 
			
		||||
 | 
			
		||||
  let includeString = include
 | 
			
		||||
  if (include && Array.isArray(include)) includeString = include.join('')
 | 
			
		||||
  if (includeString && includeString.includes('/')) globOptions.basename = false
 | 
			
		||||
 | 
			
		||||
  return Promise.all((micromatch(routeList, include, globOptions)).map(path => {
 | 
			
		||||
    return new Promise((resolve, reject) => {
 | 
			
		||||
      // Grab all assets using hexo router
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue