How to use the upath.toUnix 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 ryanelian / instapack / src / CompilerResolver.ts View on Github external
async function tryGetProjectPackageVersion(resolver: EnhancedResolver, projectBasePath: string, packageName: string): Promise {
    try {
        let jsonPath = await resolveAsync(resolver, projectBasePath, packageName + '/package.json');
        jsonPath = upath.toUnix(jsonPath);
        if (jsonPath.startsWith(projectBasePath) === false) {
            // explicitly prevent resolution in parent folder...
            return undefined;
        }
        const json = await fse.readJson(jsonPath);
        const version = json['version'];
        return version;
    } catch (error) {
        return undefined;
    }
}
github ryanelian / instapack / src / CompilerResolver.ts View on Github external
async function tryGetProjectPackage(resolver: EnhancedResolver, projectBasePath: string, packageName: string): Promise {
    try {
        let modulePath = await resolveAsync(resolver, projectBasePath, packageName);
        modulePath = upath.toUnix(modulePath);
        if (modulePath.startsWith(projectBasePath) === false) {
            // explicitly prevent resolution in parent folder...
            return undefined;
        }
        return require(modulePath);
    } catch (error) {
        return undefined;
    }
}
github liximomo / vscode-sftp / src / modules / remotePath.ts View on Github external
export function normalize(path) {
  return upath.toUnix(path);
}
github ryanelian / instapack / src / TypeScriptSourceStore.ts View on Github external
removeFile(filePath: string): boolean {
        filePath = upath.toUnix(filePath);
        let sourcePath = filePath;

        if (filePath.endsWith('.vue')) {
            sourcePath = upath.addExt(filePath, '.ts');
        }

        return this.sources.delete(sourcePath);
    }
}
github ryanelian / instapack / src / variables-factory / ReadProjectSettings.ts View on Github external
export async function readProjectSettingsFrom(folder: string): Promise {
    const settings: ProjectSettings = {
        root: upath.toUnix(folder),
        input: 'client',
        output: 'wwwroot',
        jsOut: 'ipack.js',
        cssOut: 'ipack.css',

        alias: {},
        externals: {},
        copy: [],
        namespace: undefined,
        port1: 0,
    };

    const ajv = new Ajv();
    const settingsJsonSchema = await fse.readJson(settingsJsonSchemaPath);
    const validate = ajv.compile(settingsJsonSchema);
github lukasz-wronski / vscode-ftp-sync / modules / download-command.js View on Github external
var downloadNextFile = function() {
							if(list.files.length == 0) {
								downloadingStatus.dispose();
								vscode.window.setStatusBarMessage("Ftp-sync: download complete", STATUS_TIMEOUT);
							}
							else
							{
								var file = list.files[0];
								list.files.splice(0, 1);
								var remoteFilePath = upath.toUnix(path.join(remotePath, file.id));
								var localFilePath = path.join(localPath, file.id);
								mkdirp(path.dirname(localFilePath), function(err) { 
									ftp.get(remoteFilePath, localFilePath, function(err) {
										if(err)
											vscode.window.showErrorMessage("Ftp-sync: error while downloading file: " + err);
										downloadingStatus.dispose();
										downloadingStatus = vscode.window.setStatusBarMessage("Ftp-sync: downloaded " + (totalFiles - list.files.length) + " of " + totalFiles + " files...");	
										downloadNextFile();
									});
								});
							}
						}

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