How to use the resolve-runtime/lib/common/utils/validate-path function in resolve-runtime

To help you get started, we’ve selected a few resolve-runtime 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 reimagined / resolve / packages / core / resolve-scripts / src / alias / $resolve.staticPath.js View on Github external
export default ({ resolveConfig, isClient }) => {
  let staticPath = resolveConfig.staticPath
  const exports = []

  if (!checkRuntimeEnv(staticPath)) {
    if (!validatePath(staticPath, { allowAbsolutePath: true })) {
      throw new Error(
        `Incorrect options.staticPath = "${staticPath}"\nValue must be part of the URL or the absolute URL, which is the application's static subdirectory`
      )
    }
    staticPath = encodeURI(staticPath)

    exports.push(
      `const staticPath = ${JSON.stringify(staticPath)}`,
      ``,
      `export default staticPath`
    )
  } else {
    if (!isClient) {
      exports.push(
        `import validatePath from 'resolve-runtime/lib/common/utils/validate-path'`
      )
github reimagined / resolve / packages / core / resolve-scripts / src / alias / $resolve.rootPath.js View on Github external
export default ({ resolveConfig, isClient }) => {
  let rootPath = resolveConfig.rootPath
  const exports = []

  if (!checkRuntimeEnv(rootPath)) {
    if (!validatePath(rootPath, { allowEmptyPath: true })) {
      throw new Error(
        `Incorrect options.rootPath = "${rootPath}"\nValue must be part of the URL, which is the application's subdirectory`
      )
    }
    rootPath = encodeURI(rootPath)

    exports.push(
      `const rootPath = ${JSON.stringify(rootPath)}`,
      ``,
      `export default rootPath`
    )
  } else {
    if (!isClient) {
      exports.push(
        `import validatePath from 'resolve-runtime/lib/common/utils/validate-path'`
      )

resolve-runtime

The reSolve framework's backend server.

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis