@file-services/utils
Advanced tools
Comparing version 1.0.1 to 1.0.2
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const types_1 = require("@file-services/types"); | ||
const posixPath = __importStar(require("@file-services/posix-path")); | ||
const create_extended_api_1 = require("./create-extended-api"); | ||
@@ -15,4 +22,3 @@ /** | ||
const { join, relative, sep } = fs.path; | ||
const posixPath = fs.path.posix || fs.path; | ||
let workingDirectoryPath = types_1.POSIX_ROOT; | ||
let workingDirectoryPath = posixPath.POSIX_ROOT; | ||
function resolveScopedPath(...pathSegments) { | ||
@@ -33,3 +39,3 @@ return posixPath.resolve(workingDirectoryPath, ...pathSegments); | ||
// use posixPath to ensure we give posix-style paths back | ||
path: posixPath.join(types_1.POSIX_ROOT, relativeEventPath) | ||
path: posixPath.join(posixPath.POSIX_ROOT, relativeEventPath.replace(/\\/g, '/')) | ||
}); | ||
@@ -68,3 +74,3 @@ } | ||
const scopedBaseFs = { | ||
path: Object.assign({}, fs.path, { resolve: resolveScopedPath }), | ||
path: Object.assign({}, posixPath, { resolve: resolveScopedPath }), | ||
caseSensitive: fs.caseSensitive, | ||
@@ -71,0 +77,0 @@ watchService: scopedWatchService, |
@@ -1,2 +0,2 @@ | ||
import { POSIX_ROOT } from '@file-services/types'; | ||
import * as posixPath from '@file-services/posix-path'; | ||
import { createFileSystem } from './create-extended-api'; | ||
@@ -13,4 +13,3 @@ /** | ||
const { join, relative, sep } = fs.path; | ||
const posixPath = fs.path.posix || fs.path; | ||
let workingDirectoryPath = POSIX_ROOT; | ||
let workingDirectoryPath = posixPath.POSIX_ROOT; | ||
function resolveScopedPath(...pathSegments) { | ||
@@ -31,3 +30,3 @@ return posixPath.resolve(workingDirectoryPath, ...pathSegments); | ||
// use posixPath to ensure we give posix-style paths back | ||
path: posixPath.join(POSIX_ROOT, relativeEventPath) | ||
path: posixPath.join(posixPath.POSIX_ROOT, relativeEventPath.replace(/\\/g, '/')) | ||
}); | ||
@@ -66,3 +65,3 @@ } | ||
const scopedBaseFs = { | ||
path: Object.assign({}, fs.path, { resolve: resolveScopedPath }), | ||
path: Object.assign({}, posixPath, { resolve: resolveScopedPath }), | ||
caseSensitive: fs.caseSensitive, | ||
@@ -69,0 +68,0 @@ watchService: scopedWatchService, |
{ | ||
"name": "@file-services/utils", | ||
"description": "Common file system utility functions.", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"main": "cjs/index.js", | ||
@@ -15,3 +15,4 @@ "module": "esm/index.js", | ||
"dependencies": { | ||
"@file-services/types": "^1.0.1" | ||
"@file-services/posix-path": "^1.0.1", | ||
"@file-services/types": "^1.0.2" | ||
}, | ||
@@ -31,3 +32,3 @@ "files": [ | ||
"sideEffects": false, | ||
"gitHead": "81f93fdc7b06ba209ae43cfd5dc34d87c33c6638" | ||
"gitHead": "d06a20f2bd3f48f33513a74e637556f5ecd4ca43" | ||
} |
@@ -6,4 +6,2 @@ import { | ||
IWatchService, | ||
IFileSystemPath, | ||
POSIX_ROOT, | ||
CallbackFn, | ||
@@ -17,2 +15,3 @@ CallbackFnVoid, | ||
} from '@file-services/types'; | ||
import * as posixPath from '@file-services/posix-path'; | ||
import { createFileSystem } from './create-extended-api'; | ||
@@ -30,5 +29,4 @@ | ||
const { join, relative, sep } = fs.path; | ||
const posixPath = ((fs.path as any).posix as IFileSystemPath) || fs.path; | ||
let workingDirectoryPath: string = POSIX_ROOT; | ||
let workingDirectoryPath: string = posixPath.POSIX_ROOT; | ||
@@ -53,3 +51,3 @@ function resolveScopedPath(...pathSegments: string[]): string { | ||
// use posixPath to ensure we give posix-style paths back | ||
path: posixPath.join(POSIX_ROOT, relativeEventPath) | ||
path: posixPath.join(posixPath.POSIX_ROOT, relativeEventPath.replace(/\\/g, '/')) | ||
}); | ||
@@ -91,3 +89,3 @@ } | ||
path: { | ||
...fs.path, | ||
...posixPath, | ||
resolve: resolveScopedPath | ||
@@ -94,0 +92,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
128821
1953
2
+ Added@file-services/posix-path@1.0.3(transitive)
Updated@file-services/types@^1.0.2