Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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) {