How to use the @sanity/util.getSanityVersions function in @sanity/util

To help you get started, we’ve selected a few @sanity/util 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 sanity-io / sanity / packages / @sanity / webpack-loader / src / partLoader.js View on Github external
const path = require('path')
const loaderUtils = require('loader-utils')
const sanityUtil = require('@sanity/util')
const multiImplementationHandler = require('./multiImplementationHandler')
const reduceConfig = sanityUtil.reduceConfig
const getSanityVersions = sanityUtil.getSanityVersions

/* eslint-disable no-process-env */
const sanityEnv = process.env.SANITY_INTERNAL_ENV
const env = typeof sanityEnv === 'undefined' ? process.env.NODE_ENV : sanityEnv
/* eslint-enable no-process-env */

function sanityPartLoader(input) {
  this.cacheable()

  let buildEnv = sanityEnv
  if (!buildEnv) {
    buildEnv = this.options.devtool ? env : 'production'
  }

  const qs = this.resourceQuery.substring(this.resourceQuery.indexOf('?'))
  const request = (loaderUtils.parseQuery(qs) || {}).sanityPart
github sanity-io / sanity / packages / @sanity / plugin-loader / loader.js View on Github external
const path = require('path')
const Module = require('module')
const interopRequire = require('interop-require')
const cssHook = require('css-modules-require-hook')
const resolver = require('@sanity/resolver')
const util = require('@sanity/util')

const reduceConfig = util.reduceConfig
const getSanityVersions = util.getSanityVersions

/* eslint-disable no-process-env */
const sanityEnv = process.env.SANITY_INTERNAL_ENV
const env = typeof sanityEnv === 'undefined' ? process.env.NODE_ENV : sanityEnv
/* eslint-enable no-process-env */

const configMatcher = /^config:(@?[A-Za-z0-9_-]+\/[A-Za-z0-9_-]+|[A-Za-z0-9_-]+)$/
const resolveParts = resolver.resolveParts
const defaultResult = {
  definitions: {},
  implementations: {},
  plugins: []
}

function registerLoader(options) {
  if (!options) {