How to use the parcel/src/utils/glob.glob.sync function in parcel

To help you get started, we’ve selected a few parcel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zeit / next.js / packages / next-build / index.js View on Github external
function getPageFiles({dir, config, isClient, entrypoint}) {
  let result = []
  if(entrypoint) {
    if(isClient) {
      result = glob.sync(`pages(_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })      
    } else {
      result = glob.sync(`pages(_document|_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })            
    }
    result = [...result, ...glob.sync(entrypoint, { cwd: dir, absolute: true })]
  } else {
    result = glob.sync(`pages/**/${isClient ? '!(_document)' : ''}*.+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
  }
  const appPath = path.join(dir, 'pages', '_app.js')
  if(!result.some((item) => item === appPath)) {
    result.push(require.resolve('next/dist/pages/_app.js'))
  }

  const errorPath = path.join(dir, 'pages', '_error.js')
  if(!result.some((item) => item === errorPath)) {
    result.push(require.resolve('next/dist/pages/_error.js'))
  }
github zeit / next.js / packages / next-build / index.js View on Github external
function getPageFiles({dir, config, isClient, entrypoint}) {
  let result = []
  if(entrypoint) {
    if(isClient) {
      result = glob.sync(`pages(_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })      
    } else {
      result = glob.sync(`pages(_document|_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })            
    }
    result = [...result, ...glob.sync(entrypoint, { cwd: dir, absolute: true })]
  } else {
    result = glob.sync(`pages/**/${isClient ? '!(_document)' : ''}*.+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
  }
  const appPath = path.join(dir, 'pages', '_app.js')
  if(!result.some((item) => item === appPath)) {
    result.push(require.resolve('next/dist/pages/_app.js'))
  }

  const errorPath = path.join(dir, 'pages', '_error.js')
  if(!result.some((item) => item === errorPath)) {
    result.push(require.resolve('next/dist/pages/_error.js'))
  }

  if(!isClient) {
    const documentPath = path.join(dir, 'pages', '_document.js')
    if(!result.some((item) => item === documentPath)) {
github zeit / next.js / packages / next-build / index.js View on Github external
function getPageFiles({dir, config, isClient, entrypoint}) {
  let result = []
  if(entrypoint) {
    if(isClient) {
      result = glob.sync(`pages(_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })      
    } else {
      result = glob.sync(`pages(_document|_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })            
    }
    result = [...result, ...glob.sync(entrypoint, { cwd: dir, absolute: true })]
  } else {
    result = glob.sync(`pages/**/${isClient ? '!(_document)' : ''}*.+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
  }
  const appPath = path.join(dir, 'pages', '_app.js')
  if(!result.some((item) => item === appPath)) {
    result.push(require.resolve('next/dist/pages/_app.js'))
  }

  const errorPath = path.join(dir, 'pages', '_error.js')
  if(!result.some((item) => item === errorPath)) {
    result.push(require.resolve('next/dist/pages/_error.js'))
  }

  if(!isClient) {
github zeit / next.js / packages / next-build / index.js View on Github external
function getPageFiles({dir, config, isClient, entrypoint}) {
  let result = []
  if(entrypoint) {
    if(isClient) {
      result = glob.sync(`pages(_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })      
    } else {
      result = glob.sync(`pages(_document|_app|_error).+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })            
    }
    result = [...result, ...glob.sync(entrypoint, { cwd: dir, absolute: true })]
  } else {
    result = glob.sync(`pages/**/${isClient ? '!(_document)' : ''}*.+(${config.pageExtensions.join('|')})`, { cwd: dir, absolute: true })
  }
  const appPath = path.join(dir, 'pages', '_app.js')
  if(!result.some((item) => item === appPath)) {
    result.push(require.resolve('next/dist/pages/_app.js'))
  }

  const errorPath = path.join(dir, 'pages', '_error.js')
  if(!result.some((item) => item === errorPath)) {
    result.push(require.resolve('next/dist/pages/_error.js'))
  }

  if(!isClient) {
    const documentPath = path.join(dir, 'pages', '_document.js')
    if(!result.some((item) => item === documentPath)) {
      result.push(require.resolve('next/dist/pages/_document.js'))
    }

parcel

Blazing fast, zero configuration web application bundler

MIT
Latest version published 8 months ago

Package Health Score

87 / 100
Full package analysis