How to use the upath.normalizeSafe function in upath

To help you get started, we’ve selected a few upath 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 jaywcjlove / rdoc / src / conf / webpack.config.js View on Github external
const define = { FOOTER: null };
if (paths.rdocConf && paths.rdocConf.footer && typeof paths.rdocConf.footer === 'string') {
  define.FOOTER = JSON.stringify(paths.rdocConf.footer);
}

module.exports = {
  entry: {},
  output: {
    path: paths.appBuildDist,
    publicPath: paths.publicPath,
    filename: 'js/[name].[hash:8].js',
    chunkFilename: 'js/[name].[hash:8].js',
  },
  resolve: {
    alias: {
      'rdoc-theme': UPATH.normalizeSafe(paths.appThemePath),
    },
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx|mjs)$/,
        exclude: [/node_modules/, /\.(cache)/, /rdoc-theme-(.*)/],
        enforce: 'pre',
        use: [
          // TODO:禁用require.ensure也不是一种标准的语言特征。
          // 我们等待https://github.com/facebookincubator/create-react-app/issues/2176。
          // { parser: { requireEnsure: false } },
          {
            // 首先运行linter。
            // 在Babel处理js之前做这一点很重要。
            options: {
github aurelia / webpack-plugin / src / index.js View on Github external
constructor(options = {}) {
    options.root = options.root ? path.normalizeSafe(options.root) : path.dirname(module.parent.filename);
    options.src = options.src ? path.normalizeSafe(options.src) : path.resolve(options.root, 'src');
    options.nameExternalModules = options.nameExternalModules == undefined || options.nameExternalModules == true;
    options.nameLocalModules = options.nameLocalModules == undefined || options.nameLocalModules == true;
    options.resourceRegExp = options.resourceRegExp || /aurelia-loader-context/;
    options.customViewLoaders = Object.assign({
      '.css': ['css-loader'],
      '.scss': ['css-loader', 'sass-loader'],
      '.sass': ['css-loader', 'sass-loader'],
      '.less': ['css-loader', 'less-loader'],
      '.styl': ['css-loader', 'stylus-loader'],
    }, options.customViewLoaders || {});

    if (options.includeSubModules || options.contextMap) {
      console.error('WARNING: You are passing a depracated option "includeSubModules" / "contextMap" to aurelia-webpack-plugin.');
      console.error('         Please migrate your config to use aurelia.build.resources inside of your package.json.');
      console.error('         For more information see: https://github.com/aurelia/skeleton-navigation/blob/master/skeleton-typescript-webpack/README.md#resource-and-bundling-configuration');
github joelday / papyrus-lang / packages / papyrus-lang / src / projects / AmbientProjectLoader.ts View on Github external
private getPathRelativeToInstallPath(
        normalizedInstallPath: string,
        maybeRelativePath: string
    ) {
        const normalizedRelativePath = path.normalizeSafe(maybeRelativePath);

        if (path.isAbsolute(normalizedRelativePath)) {
            return normalizedRelativePath;
        }

        return path.resolve(
            path.join(normalizedInstallPath, maybeRelativePath)
        );
    }
github nuxt / nuxt.js / packages / builder / src / builder.js View on Github external
    patterns = patterns.map((path, ...args) => upath.normalizeSafe(this.globPathWithExtensions(path), ...args))
github joelday / papyrus-lang / packages / papyrus-lang / src / host / NodeFileSystem.ts View on Github external
public findFilesAsUris(globPattern: string): string[] {
        return new GlobSync(normalize(globPattern)).found.map((f) =>
            URI.file(f).toString()
        );
    }
github serkanyersen / sync / src / classes / InitConfig.ts View on Github external
}).then(answer => {
            if (answer) {
                newConfig.localPath = upath.normalizeSafe(answer);
            } else {
                newConfig.localPath = upath.normalizeSafe(process.cwd());
            }
            return this.cli.read(this.getPrompt("Remote Path", { required: true }));
        }).then(answer => {
            if (answer) {
github serkanyersen / sync / src / classes / Uploader.ts View on Github external
getRemotePath(path: string): string {
        let normalPath = upath.normalizeSafe(path);
        let normalLocalPath = upath.normalizeSafe(this.config.localPath);
        let remotePath = normalPath.replace(normalLocalPath, this.config.remotePath);
        return upath.normalizeSafe(remotePath);
    }
github joelday / papyrus-lang / packages / papyrus-lang / src / projects / XmlProjectLoader.ts View on Github external
projectConfig.imports = projectConfig.imports
            .map((importPath) => path.normalizeSafe(importPath))
            .map(
                (importPath) =>
                    path.isAbsolute(importPath)
                        ? importPath
                        : path.resolve(base, importPath)
            )
            .map((importPath) => URI.file(importPath).toString());

        projectConfig.filePath = URI.file(filePath).toString();

        if (projectConfig.output) {
            projectConfig.output = URI.file(
                path.normalizeSafe(projectConfig.output)
            ).toString();
        }

        return projectConfig;
    }
}
github serkanyersen / sync / src / classes / Uploader.ts View on Github external
getRemotePath(path: string): string {
        let normalPath = upath.normalizeSafe(path);
        let normalLocalPath = upath.normalizeSafe(this.config.localPath);
        let remotePath = normalPath.replace(normalLocalPath, this.config.remotePath);
        return upath.normalizeSafe(remotePath);
    }

upath

A proxy to `path`, replacing `\` with `/` for all results (supports UNC paths) & new methods to normalize & join keeping leading `./` and add, change, default, trim file extensions.

MIT
Latest version published 4 years ago

Package Health Score

67 / 100
Full package analysis