@cosmology/utils
Advanced tools
Comparing version 1.8.1 to 1.8.2
@@ -29,5 +29,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.convertPackageNameToNestedJSONPath = exports.getTypeNameByEnumObj = exports.getEnumValues = exports.duplicateImportPathsWithExt = exports.restoreExtension = exports.getServiceImplement = exports.buildImports = exports.getPluginValue = exports.swapKeyValue = void 0; | ||
exports.toPosixPath = exports.crossGlob = exports.convertPackageNameToNestedJSONPath = exports.getTypeNameByEnumObj = exports.getEnumValues = exports.duplicateImportPathsWithExt = exports.restoreExtension = exports.getServiceImplement = exports.buildImports = exports.getPluginValue = exports.swapKeyValue = void 0; | ||
const minimatch_1 = __importDefault(require("minimatch")); | ||
const dotty = __importStar(require("dotty")); | ||
const glob_1 = require("glob"); | ||
const posixPath = require('path').posix; | ||
/** | ||
@@ -230,1 +232,20 @@ * swap the key and value of the input object | ||
exports.convertPackageNameToNestedJSONPath = convertPackageNameToNestedJSONPath; | ||
/** | ||
* Replace all \\ to / for windows support purpose | ||
* @param input | ||
* @param options | ||
* @returns | ||
*/ | ||
const crossGlob = (input, options) => { | ||
return (0, glob_1.sync)((0, exports.toPosixPath)(input), options); | ||
}; | ||
exports.crossGlob = crossGlob; | ||
/** | ||
* Unify all the path to posixPath for windows support purpose | ||
* @param mixedPath | ||
* @returns | ||
*/ | ||
const toPosixPath = (mixedPath) => { | ||
return mixedPath.replace(/\\/g, posixPath.sep); | ||
}; | ||
exports.toPosixPath = toPosixPath; |
import minimatch from "minimatch"; | ||
import * as dotty from "dotty"; | ||
import { sync as globSync } from 'glob'; | ||
const posixPath = require('path').posix; | ||
/** | ||
@@ -191,1 +193,18 @@ * swap the key and value of the input object | ||
} | ||
/** | ||
* Replace all \\ to / for windows support purpose | ||
* @param input | ||
* @param options | ||
* @returns | ||
*/ | ||
export const crossGlob = (input, options) => { | ||
return globSync(toPosixPath(input), options); | ||
}; | ||
/** | ||
* Unify all the path to posixPath for windows support purpose | ||
* @param mixedPath | ||
* @returns | ||
*/ | ||
export const toPosixPath = (mixedPath) => { | ||
return mixedPath.replace(/\\/g, posixPath.sep); | ||
}; |
{ | ||
"name": "@cosmology/utils", | ||
"version": "1.8.1", | ||
"version": "1.8.2", | ||
"description": "Telescope utils", | ||
@@ -77,6 +77,6 @@ "author": "Dan Lynch <pyramation@gmail.com>", | ||
"dependencies": { | ||
"@cosmology/types": "^1.8.1", | ||
"@cosmology/types": "^1.8.2", | ||
"dotty": "0.1.2" | ||
}, | ||
"gitHead": "0c1bd988982b0f3207d3be70231661d5228c4dbb" | ||
"gitHead": "e8ed8695a55fd68b4f1cf32916cdde819bebab70" | ||
} |
@@ -11,3 +11,6 @@ import minimatch from "minimatch"; | ||
import * as dotty from "dotty"; | ||
import { sync as globSync } from 'glob'; | ||
const posixPath = require('path').posix; | ||
/** | ||
@@ -246,3 +249,3 @@ * swap the key and value of the input object | ||
* each package level is further nested within its parent. | ||
* | ||
* | ||
* Example output for "cosmwasm.wasm.v1": | ||
@@ -265,1 +268,21 @@ * - "/root/nested/cosmwasm/nested/wasm/nested/v1" | ||
} | ||
/** | ||
* Replace all \\ to / for windows support purpose | ||
* @param input | ||
* @param options | ||
* @returns | ||
*/ | ||
export const crossGlob = (input:string, options?:object) => { | ||
return globSync(toPosixPath(input), options); | ||
} | ||
/** | ||
* Unify all the path to posixPath for windows support purpose | ||
* @param mixedPath | ||
* @returns | ||
*/ | ||
export const toPosixPath = (mixedPath): string => { | ||
return mixedPath.replace(/\\/g, posixPath.sep); | ||
} | ||
@@ -87,1 +87,14 @@ import { TelescopeOptions, TelescopeOption, ImportUsage, ProtoEnum } from "@cosmology/types"; | ||
export declare function convertPackageNameToNestedJSONPath(packageName: string): string; | ||
/** | ||
* Replace all \\ to / for windows support purpose | ||
* @param input | ||
* @param options | ||
* @returns | ||
*/ | ||
export declare const crossGlob: (input: string, options?: object) => string[]; | ||
/** | ||
* Unify all the path to posixPath for windows support purpose | ||
* @param mixedPath | ||
* @returns | ||
*/ | ||
export declare const toPosixPath: (mixedPath: any) => string; |
90996
2439
Updated@cosmology/types@^1.8.2