@appium/support 2.55.4 → 2.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/env.d.ts +54 -0
- package/build/lib/env.d.ts.map +1 -0
- package/build/lib/env.js +102 -0
- package/build/lib/fs.d.ts +221 -0
- package/build/lib/fs.d.ts.map +1 -0
- package/build/lib/fs.js +74 -56
- package/build/lib/image-util.d.ts +56 -0
- package/build/lib/image-util.d.ts.map +1 -0
- package/build/lib/image-util.js +3 -6
- package/build/lib/index.d.ts +38 -0
- package/build/lib/index.d.ts.map +1 -0
- package/build/lib/index.js +36 -18
- package/build/lib/log-internal.d.ts +74 -0
- package/build/lib/log-internal.d.ts.map +1 -0
- package/build/lib/log-internal.js +11 -21
- package/build/lib/logger.d.ts +3 -0
- package/build/lib/logger.d.ts.map +1 -0
- package/build/lib/logger.js +2 -4
- package/build/lib/logging.d.ts +45 -0
- package/build/lib/logging.d.ts.map +1 -0
- package/build/lib/logging.js +12 -16
- package/build/lib/mjpeg.d.ts +65 -0
- package/build/lib/mjpeg.d.ts.map +1 -0
- package/build/lib/mjpeg.js +12 -7
- package/build/lib/mkdirp.d.ts +3 -0
- package/build/lib/mkdirp.d.ts.map +1 -0
- package/build/lib/mkdirp.js +7 -11
- package/build/lib/net.d.ts +95 -0
- package/build/lib/net.d.ts.map +1 -0
- package/build/lib/net.js +42 -26
- package/build/lib/node.d.ts +26 -0
- package/build/lib/node.d.ts.map +1 -0
- package/build/lib/node.js +102 -3
- package/build/lib/npm.d.ts +123 -0
- package/build/lib/npm.d.ts.map +1 -0
- package/build/lib/npm.js +217 -0
- package/build/lib/plist.d.ts +43 -0
- package/build/lib/plist.d.ts.map +1 -0
- package/build/lib/plist.js +2 -4
- package/build/lib/process.d.ts +3 -0
- package/build/lib/process.d.ts.map +1 -0
- package/build/lib/process.js +2 -4
- package/build/lib/system.d.ts +7 -0
- package/build/lib/system.d.ts.map +1 -0
- package/build/lib/system.js +2 -4
- package/build/lib/tempdir.d.ts +63 -0
- package/build/lib/tempdir.d.ts.map +1 -0
- package/build/lib/tempdir.js +4 -9
- package/build/lib/timing.d.ts +46 -0
- package/build/lib/timing.d.ts.map +1 -0
- package/build/lib/timing.js +2 -4
- package/build/lib/util.d.ts +183 -0
- package/build/lib/util.d.ts.map +1 -0
- package/build/lib/util.js +9 -15
- package/build/lib/zip.d.ts +180 -0
- package/build/lib/zip.d.ts.map +1 -0
- package/build/lib/zip.js +9 -9
- package/build/tsconfig.tsbuildinfo +1 -0
- package/lib/env.js +162 -0
- package/lib/fs.js +198 -69
- package/lib/image-util.js +23 -7
- package/lib/index.js +6 -6
- package/lib/log-internal.js +31 -38
- package/lib/logging.js +41 -17
- package/lib/mjpeg.js +14 -5
- package/lib/mkdirp.js +3 -6
- package/lib/net.js +116 -60
- package/lib/node.js +107 -4
- package/lib/npm.js +278 -0
- package/lib/plist.js +3 -1
- package/lib/tempdir.js +14 -13
- package/lib/util.js +36 -33
- package/lib/zip.js +31 -21
- package/package.json +31 -13
- package/build/test/assets/sample_binary.plist +0 -0
- package/build/test/assets/sample_text.plist +0 -28
- package/build/test/fs-specs.js +0 -264
- package/build/test/helpers.js +0 -35
- package/build/test/image-util-e2e-specs.js +0 -78
- package/build/test/index-specs.js +0 -49
- package/build/test/log-internals-specs.js +0 -97
- package/build/test/logger/helpers.js +0 -71
- package/build/test/logger/logger-force-specs.js +0 -41
- package/build/test/logger/logger-normal-specs.js +0 -113
- package/build/test/logger/logger-test-specs.js +0 -40
- package/build/test/mjpeg-e2e-specs.js +0 -96
- package/build/test/net-e2e-specs.js +0 -32
- package/build/test/node-e2e-specs.js +0 -22
- package/build/test/plist-specs.js +0 -54
- package/build/test/process-specs.js +0 -104
- package/build/test/system-specs.js +0 -136
- package/build/test/tempdir-specs.js +0 -86
- package/build/test/timing-specs.js +0 -125
- package/build/test/util-e2e-specs.js +0 -136
- package/build/test/util-specs.js +0 -537
- package/build/test/zip-e2e-specs.js +0 -233
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns `true` if appium is installed as a dependency of a local package at `cwd`.
|
|
3
|
+
*
|
|
4
|
+
* The following special cases are considered:
|
|
5
|
+
*
|
|
6
|
+
* - If `resolved` starts with `file:`, then `cwd` likely points to `appium-monorepo`, and (for now) we expect `APPIUM_HOME` to be the default.
|
|
7
|
+
* - If the `version` begins with `0` or `1`, we're looking at an old version of `appium` (not this one!)
|
|
8
|
+
*
|
|
9
|
+
* Note that we are _not_ performing the check "is the currently running Appium the same one as found in the list of dependencies", because I'm not sure it actually matters (assuming the versions are compatible).
|
|
10
|
+
* Regardless we may want to make this more robust in the future, as we hit edge cases.
|
|
11
|
+
*
|
|
12
|
+
* _Also_ note that if `appium` appears as a dependency in `package.json` _but it is not yet installed_ this function will resolve `false`. This may not be exactly what we want.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} cwd
|
|
15
|
+
* @returns {Promise<boolean>}
|
|
16
|
+
*/
|
|
17
|
+
export function hasAppiumDependency(cwd: string): Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Path to the default `APPIUM_HOME` dir (`~/.appium`).
|
|
20
|
+
* @type {string}
|
|
21
|
+
*/
|
|
22
|
+
export const DEFAULT_APPIUM_HOME: string;
|
|
23
|
+
/**
|
|
24
|
+
* Basename of extension manifest file.
|
|
25
|
+
* @type {string}
|
|
26
|
+
*/
|
|
27
|
+
export const MANIFEST_BASENAME: string;
|
|
28
|
+
/**
|
|
29
|
+
* Relative path to extension manifest file from `APPIUM_HOME`.
|
|
30
|
+
* @type {string}
|
|
31
|
+
*/
|
|
32
|
+
export const MANIFEST_RELATIVE_PATH: string;
|
|
33
|
+
/**
|
|
34
|
+
* Read a `package.json` in dir `cwd`. If none found, return `undefined`.
|
|
35
|
+
*/
|
|
36
|
+
export const readPackageInDir: ((cwd: string) => Promise<import('read-pkg').NormalizedPackageJson | undefined>) & _.MemoizedFunction;
|
|
37
|
+
/**
|
|
38
|
+
* Determines location of Appium's "home" dir
|
|
39
|
+
*
|
|
40
|
+
* - If `APPIUM_HOME` is set in the environment, use that
|
|
41
|
+
* - If we have an `extensions.yaml` in {@linkcode DEFAULT_APPIUM_HOME}, then use that.
|
|
42
|
+
* - If we find a `package.json` in or above `cwd` and {@linkcode shouldUseCwdForAppiumHome} returns `true`, then use the directory containing the `package.json`.
|
|
43
|
+
*/
|
|
44
|
+
export const resolveAppiumHome: ((cwd?: string | undefined) => Promise<string>) & _.MemoizedFunction;
|
|
45
|
+
/**
|
|
46
|
+
* Figure out manifest path based on `appiumHome`.
|
|
47
|
+
*
|
|
48
|
+
* The assumption is that, if `appiumHome` has been provided, it was resolved via {@link resolveAppiumHome `resolveAppiumHome()`}! If unsure,
|
|
49
|
+
* don't pass a parameter and let `resolveAppiumHome()` handle it.
|
|
50
|
+
*/
|
|
51
|
+
export const resolveManifestPath: ((appiumHome?: string | undefined) => Promise<string>) & _.MemoizedFunction;
|
|
52
|
+
export type NormalizedPackageJson = import('read-pkg').NormalizedPackageJson;
|
|
53
|
+
import _ from "lodash";
|
|
54
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../lib/env.js"],"names":[],"mappings":"AA+BA;;;;;;;;;;;;;;;GAeG;AACH,yCAHW,MAAM,GACJ,QAAQ,OAAO,CAAC,CAqC5B;AA1ED;;;GAGG;AACH,kCAFU,MAAM,CAEsD;AAEtE;;;GAGG;AACH,gCAFU,MAAM,CAEmC;AAEnD;;;GAGG;AACH,qCAFU,MAAM,CAOd;AAuDF;;GAEG;AACH,sCAGa,MAAM,KACJ,QAAQ,OAAO,UAAU,EAAE,qBAAqB,GAAC,SAAS,CAAC,uBAKxE;AAEF;;;;;;GAMG;AACH,+DAGe,QAAQ,MAAM,CAAC,uBA+B5B;AAEF;;;;;GAKG;AACH,wEAGe,QAAQ,MAAM,CAAC,uBAO5B;oCAGW,OAAO,UAAU,EAAE,qBAAqB"}
|
package/build/lib/env.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.MANIFEST_RELATIVE_PATH = exports.MANIFEST_BASENAME = exports.DEFAULT_APPIUM_HOME = void 0;
|
|
9
|
+
exports.hasAppiumDependency = hasAppiumDependency;
|
|
10
|
+
exports.resolveManifestPath = exports.resolveAppiumHome = exports.readPackageInDir = void 0;
|
|
11
|
+
|
|
12
|
+
require("source-map-support/register");
|
|
13
|
+
|
|
14
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
15
|
+
|
|
16
|
+
var _os = require("os");
|
|
17
|
+
|
|
18
|
+
var _path = _interopRequireDefault(require("path"));
|
|
19
|
+
|
|
20
|
+
var _pkgDir = _interopRequireDefault(require("pkg-dir"));
|
|
21
|
+
|
|
22
|
+
var _readPkg = _interopRequireDefault(require("read-pkg"));
|
|
23
|
+
|
|
24
|
+
var _npm = require("./npm");
|
|
25
|
+
|
|
26
|
+
const DEFAULT_APPIUM_HOME = _path.default.resolve((0, _os.homedir)(), '.appium');
|
|
27
|
+
|
|
28
|
+
exports.DEFAULT_APPIUM_HOME = DEFAULT_APPIUM_HOME;
|
|
29
|
+
const MANIFEST_BASENAME = 'extensions.yaml';
|
|
30
|
+
exports.MANIFEST_BASENAME = MANIFEST_BASENAME;
|
|
31
|
+
|
|
32
|
+
const MANIFEST_RELATIVE_PATH = _path.default.join('node_modules', '.cache', 'appium', MANIFEST_BASENAME);
|
|
33
|
+
|
|
34
|
+
exports.MANIFEST_RELATIVE_PATH = MANIFEST_RELATIVE_PATH;
|
|
35
|
+
|
|
36
|
+
async function hasAppiumDependency(cwd) {
|
|
37
|
+
let listResult;
|
|
38
|
+
let resolved;
|
|
39
|
+
let version;
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
var _listResult$dependenc, _listResult, _listResult$dependenc2, _listResult$dependenc3, _listResult$dependenc4, _listResult2, _listResult2$dependen, _listResult2$dependen2;
|
|
43
|
+
|
|
44
|
+
listResult = await _npm.npm.list(cwd, 'appium');
|
|
45
|
+
resolved = (_listResult$dependenc = (_listResult = listResult) === null || _listResult === void 0 ? void 0 : (_listResult$dependenc2 = _listResult.dependencies) === null || _listResult$dependenc2 === void 0 ? void 0 : (_listResult$dependenc3 = _listResult$dependenc2.appium) === null || _listResult$dependenc3 === void 0 ? void 0 : _listResult$dependenc3.resolved) !== null && _listResult$dependenc !== void 0 ? _listResult$dependenc : '';
|
|
46
|
+
version = (_listResult$dependenc4 = (_listResult2 = listResult) === null || _listResult2 === void 0 ? void 0 : (_listResult2$dependen = _listResult2.dependencies) === null || _listResult2$dependen === void 0 ? void 0 : (_listResult2$dependen2 = _listResult2$dependen.appium) === null || _listResult2$dependen2 === void 0 ? void 0 : _listResult2$dependen2.version) !== null && _listResult$dependenc4 !== void 0 ? _listResult$dependenc4 : '';
|
|
47
|
+
} catch {
|
|
48
|
+
try {
|
|
49
|
+
var _ref, _pkg$dependencies$app, _pkg$dependencies, _pkg$devDependencies, _pkg$optionalDependen;
|
|
50
|
+
|
|
51
|
+
const pkg = await readPackageInDir(cwd);
|
|
52
|
+
version = resolved = (_ref = (_pkg$dependencies$app = pkg === null || pkg === void 0 ? void 0 : (_pkg$dependencies = pkg.dependencies) === null || _pkg$dependencies === void 0 ? void 0 : _pkg$dependencies.appium) !== null && _pkg$dependencies$app !== void 0 ? _pkg$dependencies$app : pkg === null || pkg === void 0 ? void 0 : (_pkg$devDependencies = pkg.devDependencies) === null || _pkg$devDependencies === void 0 ? void 0 : _pkg$devDependencies.appium) !== null && _ref !== void 0 ? _ref : pkg === null || pkg === void 0 ? void 0 : (_pkg$optionalDependen = pkg.optionalDependencies) === null || _pkg$optionalDependen === void 0 ? void 0 : _pkg$optionalDependen.appium;
|
|
53
|
+
} catch {}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return Boolean(version && (!resolved || resolved && !resolved.startsWith('file:')) && !version.startsWith('1') && !version.startsWith('0'));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const readPackageInDir = _lodash.default.memoize(async function _readPackageInDir(cwd) {
|
|
60
|
+
return await (0, _readPkg.default)({
|
|
61
|
+
cwd,
|
|
62
|
+
normalize: true
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
exports.readPackageInDir = readPackageInDir;
|
|
67
|
+
|
|
68
|
+
const resolveAppiumHome = _lodash.default.memoize(async function _resolveAppiumHome(cwd = process.cwd()) {
|
|
69
|
+
if (process.env.APPIUM_HOME) {
|
|
70
|
+
return process.env.APPIUM_HOME;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!_path.default.isAbsolute(cwd)) {
|
|
74
|
+
throw new TypeError('`cwd` parameter must be an absolute path');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let currentPkgDir;
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
currentPkgDir = await (0, _pkgDir.default)(cwd);
|
|
81
|
+
|
|
82
|
+
if (!currentPkgDir) {
|
|
83
|
+
return DEFAULT_APPIUM_HOME;
|
|
84
|
+
}
|
|
85
|
+
} catch {
|
|
86
|
+
return DEFAULT_APPIUM_HOME;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return (await hasAppiumDependency(currentPkgDir)) ? currentPkgDir : DEFAULT_APPIUM_HOME;
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
exports.resolveAppiumHome = resolveAppiumHome;
|
|
93
|
+
|
|
94
|
+
const resolveManifestPath = _lodash.default.memoize(async function _resolveManifestPath(appiumHome) {
|
|
95
|
+
var _appiumHome;
|
|
96
|
+
|
|
97
|
+
appiumHome = (_appiumHome = appiumHome) !== null && _appiumHome !== void 0 ? _appiumHome : await resolveAppiumHome();
|
|
98
|
+
return _path.default.join(appiumHome, MANIFEST_RELATIVE_PATH);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
exports.resolveManifestPath = resolveManifestPath;
|
|
102
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL2xpYi9lbnYuanMiXSwibmFtZXMiOlsiREVGQVVMVF9BUFBJVU1fSE9NRSIsInBhdGgiLCJyZXNvbHZlIiwiTUFOSUZFU1RfQkFTRU5BTUUiLCJNQU5JRkVTVF9SRUxBVElWRV9QQVRIIiwiam9pbiIsImhhc0FwcGl1bURlcGVuZGVuY3kiLCJjd2QiLCJsaXN0UmVzdWx0IiwicmVzb2x2ZWQiLCJ2ZXJzaW9uIiwibnBtIiwibGlzdCIsImRlcGVuZGVuY2llcyIsImFwcGl1bSIsInBrZyIsInJlYWRQYWNrYWdlSW5EaXIiLCJkZXZEZXBlbmRlbmNpZXMiLCJvcHRpb25hbERlcGVuZGVuY2llcyIsIkJvb2xlYW4iLCJzdGFydHNXaXRoIiwiXyIsIm1lbW9pemUiLCJfcmVhZFBhY2thZ2VJbkRpciIsIm5vcm1hbGl6ZSIsInJlc29sdmVBcHBpdW1Ib21lIiwiX3Jlc29sdmVBcHBpdW1Ib21lIiwicHJvY2VzcyIsImVudiIsIkFQUElVTV9IT01FIiwiaXNBYnNvbHV0ZSIsIlR5cGVFcnJvciIsImN1cnJlbnRQa2dEaXIiLCJyZXNvbHZlTWFuaWZlc3RQYXRoIiwiX3Jlc29sdmVNYW5pZmVzdFBhdGgiLCJhcHBpdW1Ib21lIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7O0FBQ0E7O0FBQ0E7O0FBQ0E7O0FBQ0E7O0FBQ0E7O0FBQ0E7O0FBTU8sTUFBTUEsbUJBQW1CLEdBQUdDLGNBQUtDLE9BQUwsQ0FBYSxrQkFBYixFQUF3QixTQUF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R1cm5zIHtQcm9taXNlPHN0cmluZz59XG4gICAqL1xuICBhc3luYyBmdW5jdGlvbiBfcmVzb2x2ZU1hbmlmZXN0UGF0aCAoYXBwaXVtSG9tZSkge1xuICAgIC8vIGNhbiB5b3UgXCJhd2FpdFwiIGluIGEgZGVmYXVsdCBwYXJhbWV0ZXI/IGlzIHRoYXQgYSBnb29kIGlkZWE/XG4gICAgYXBwaXVtSG9tZSA9IGFwcGl1bUhvbWUgPz8gKGF3YWl0IHJlc29sdmVBcHBpdW1Ib21lKCkpO1xuICAgIHJldHVybiBwYXRoLmpvaW4oYXBwaXVtSG9tZSwgTUFOSUZFU1RfUkVMQVRJVkVfUEFUSCk7XG4gIH0sXG4pO1xuXG4vKipcbiAqIEB0eXBlZGVmIHtpbXBvcnQoJ3JlYWQtcGtnJykuTm9ybWFsaXplZFBhY2thZ2VKc29ufSBOb3JtYWxpemVkUGFja2FnZUpzb25cbiAqL1xuIl19
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export default fs;
|
|
3
|
+
/**
|
|
4
|
+
* The callback function which will be called during the directory walking
|
|
5
|
+
*/
|
|
6
|
+
export type WalkDirCallback = (itemPath: string, isDirectory: boolean) => boolean;
|
|
7
|
+
export type glob = typeof glob;
|
|
8
|
+
export type mv = typeof mv;
|
|
9
|
+
export namespace fs {
|
|
10
|
+
/**
|
|
11
|
+
* Resolves `true` if `path` is _readable_, which differs from Node.js' default behavior of "can we see it?"
|
|
12
|
+
* @param {import('fs').PathLike} path
|
|
13
|
+
* @returns {Promise<boolean>}
|
|
14
|
+
*/
|
|
15
|
+
export function hasAccess(path: import("fs").PathLike): Promise<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Resolves `true` if `path` is _readable_, which differs from Node.js' default behavior of "can we see it?"
|
|
18
|
+
* @param {import('fs').PathLike} path
|
|
19
|
+
* @returns {Promise<boolean>}
|
|
20
|
+
*/
|
|
21
|
+
export function hasAccess(path: import("fs").PathLike): Promise<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* Alias for {@linkcode fs.hasAccess}
|
|
24
|
+
* @param {import('fs').PathLike} path
|
|
25
|
+
*/
|
|
26
|
+
export function exists(path: import("fs").PathLike): Promise<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Alias for {@linkcode fs.hasAccess}
|
|
29
|
+
* @param {import('fs').PathLike} path
|
|
30
|
+
*/
|
|
31
|
+
export function exists(path: import("fs").PathLike): Promise<boolean>;
|
|
32
|
+
export function rimraf(dirpath: string, opts?: rimrafIdx.Options | undefined): Promise<void>;
|
|
33
|
+
export const rimrafSync: typeof rimrafIdx.sync;
|
|
34
|
+
/**
|
|
35
|
+
* Like Node.js' `fsPromises.mkdir()`, but will _not_ reject if the directory already exists.
|
|
36
|
+
*
|
|
37
|
+
* @param {string|Buffer|URL} filepath
|
|
38
|
+
* @param {import('fs').MakeDirectoryOptions} [opts]
|
|
39
|
+
* @returns {Promise<string|undefined>}
|
|
40
|
+
* @see https://nodejs.org/api/fs.html#fspromisesmkdirpath-options
|
|
41
|
+
*/
|
|
42
|
+
export function mkdir(filepath: string | Buffer | URL, opts?: import("fs").MakeDirectoryOptions | undefined): Promise<string | undefined>;
|
|
43
|
+
/**
|
|
44
|
+
* Like Node.js' `fsPromises.mkdir()`, but will _not_ reject if the directory already exists.
|
|
45
|
+
*
|
|
46
|
+
* @param {string|Buffer|URL} filepath
|
|
47
|
+
* @param {import('fs').MakeDirectoryOptions} [opts]
|
|
48
|
+
* @returns {Promise<string|undefined>}
|
|
49
|
+
* @see https://nodejs.org/api/fs.html#fspromisesmkdirpath-options
|
|
50
|
+
*/
|
|
51
|
+
export function mkdir(filepath: string | Buffer | URL, opts?: import("fs").MakeDirectoryOptions | undefined): Promise<string | undefined>;
|
|
52
|
+
/**
|
|
53
|
+
* Copies files _and entire directories_
|
|
54
|
+
* @param {string} source - Source to copy
|
|
55
|
+
* @param {string} destination - Destination to copy to
|
|
56
|
+
* @param {ncp.Options} [opts] - Additional arguments to pass to `ncp`
|
|
57
|
+
* @see https://npm.im/ncp
|
|
58
|
+
* @returns {Promise<void>}
|
|
59
|
+
*/
|
|
60
|
+
export function copyFile(source: string, destination: string, opts?: ncp.Options | undefined): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Copies files _and entire directories_
|
|
63
|
+
* @param {string} source - Source to copy
|
|
64
|
+
* @param {string} destination - Destination to copy to
|
|
65
|
+
* @param {ncp.Options} [opts] - Additional arguments to pass to `ncp`
|
|
66
|
+
* @see https://npm.im/ncp
|
|
67
|
+
* @returns {Promise<void>}
|
|
68
|
+
*/
|
|
69
|
+
export function copyFile(source: string, destination: string, opts?: ncp.Options | undefined): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Create an MD5 hash of a file.
|
|
72
|
+
* @param {import('fs').PathLike} filePath
|
|
73
|
+
* @returns {Promise<string>}
|
|
74
|
+
*/
|
|
75
|
+
export function md5(filePath: import("fs").PathLike): Promise<string>;
|
|
76
|
+
/**
|
|
77
|
+
* Create an MD5 hash of a file.
|
|
78
|
+
* @param {import('fs').PathLike} filePath
|
|
79
|
+
* @returns {Promise<string>}
|
|
80
|
+
*/
|
|
81
|
+
export function md5(filePath: import("fs").PathLike): Promise<string>;
|
|
82
|
+
export function mv_1(from: string, to: string, opts?: mv.Options | undefined): B<void>;
|
|
83
|
+
export { mv_1 as mv };
|
|
84
|
+
export { which };
|
|
85
|
+
export function glob_1(pattern: string, opts?: glob.IOptions | undefined): B<string[]>;
|
|
86
|
+
export { glob_1 as glob };
|
|
87
|
+
export { sanitize as sanitizeName };
|
|
88
|
+
/**
|
|
89
|
+
* Create a hex digest of some file at `filePath`
|
|
90
|
+
* @param {import('fs').PathLike} filePath
|
|
91
|
+
* @param {string} [algorithm]
|
|
92
|
+
* @returns {Promise<string>}
|
|
93
|
+
*/
|
|
94
|
+
export function hash(filePath: import("fs").PathLike, algorithm?: string | undefined): Promise<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Create a hex digest of some file at `filePath`
|
|
97
|
+
* @param {import('fs').PathLike} filePath
|
|
98
|
+
* @param {string} [algorithm]
|
|
99
|
+
* @returns {Promise<string>}
|
|
100
|
+
*/
|
|
101
|
+
export function hash(filePath: import("fs").PathLike, algorithm?: string | undefined): Promise<string>;
|
|
102
|
+
/**
|
|
103
|
+
* Returns an `Walker` instance, which is a readable stream (and thusly an async iterator).
|
|
104
|
+
*
|
|
105
|
+
* @param {string} dir - Dir to start walking at
|
|
106
|
+
* @param {import('klaw').Options} [opts]
|
|
107
|
+
* @returns {import('klaw').Walker}
|
|
108
|
+
* @see https://www.npmjs.com/package/klaw
|
|
109
|
+
*/
|
|
110
|
+
export function walk(dir: string, opts?: klaw.Options | undefined): klaw.Walker;
|
|
111
|
+
/**
|
|
112
|
+
* Returns an `Walker` instance, which is a readable stream (and thusly an async iterator).
|
|
113
|
+
*
|
|
114
|
+
* @param {string} dir - Dir to start walking at
|
|
115
|
+
* @param {import('klaw').Options} [opts]
|
|
116
|
+
* @returns {import('klaw').Walker}
|
|
117
|
+
* @see https://www.npmjs.com/package/klaw
|
|
118
|
+
*/
|
|
119
|
+
export function walk(dir: string, opts?: klaw.Options | undefined): klaw.Walker;
|
|
120
|
+
/**
|
|
121
|
+
* Recursively create a directory.
|
|
122
|
+
* @param {import('fs').PathLike} dir
|
|
123
|
+
* @returns {Promise<string|undefined>}
|
|
124
|
+
*/
|
|
125
|
+
export function mkdirp(dir: import("fs").PathLike): Promise<string | undefined>;
|
|
126
|
+
/**
|
|
127
|
+
* Recursively create a directory.
|
|
128
|
+
* @param {import('fs').PathLike} dir
|
|
129
|
+
* @returns {Promise<string|undefined>}
|
|
130
|
+
*/
|
|
131
|
+
export function mkdirp(dir: import("fs").PathLike): Promise<string | undefined>;
|
|
132
|
+
/**
|
|
133
|
+
* Walks a directory given according to the parameters given. The callback will be invoked with a path joined with the dir parameter
|
|
134
|
+
* @param {string} dir Directory path where we will start walking
|
|
135
|
+
* @param {boolean} recursive Set it to true if you want to continue walking sub directories
|
|
136
|
+
* @param {WalkDirCallback} callback The callback to be called when a new path is found
|
|
137
|
+
* @throws {Error} If the `dir` parameter contains a path to an invalid folder
|
|
138
|
+
* @returns {Promise<string?>} returns the found path or null if the item was not found
|
|
139
|
+
*/
|
|
140
|
+
export function walkDir(dir: string, recursive: boolean, callback: WalkDirCallback): Promise<string | null>;
|
|
141
|
+
/**
|
|
142
|
+
* Walks a directory given according to the parameters given. The callback will be invoked with a path joined with the dir parameter
|
|
143
|
+
* @param {string} dir Directory path where we will start walking
|
|
144
|
+
* @param {boolean} recursive Set it to true if you want to continue walking sub directories
|
|
145
|
+
* @param {WalkDirCallback} callback The callback to be called when a new path is found
|
|
146
|
+
* @throws {Error} If the `dir` parameter contains a path to an invalid folder
|
|
147
|
+
* @returns {Promise<string?>} returns the found path or null if the item was not found
|
|
148
|
+
*/
|
|
149
|
+
export function walkDir(dir: string, recursive: boolean, callback: WalkDirCallback): Promise<string | null>;
|
|
150
|
+
/**
|
|
151
|
+
* Reads the closest `package.json` file from absolute path `dir`.
|
|
152
|
+
* @param {string} dir - Directory to search from
|
|
153
|
+
* @param {import('read-pkg').Options} [opts] - Additional options for `read-pkg`
|
|
154
|
+
* @throws {Error} If there were problems finding or reading a `package.json` file
|
|
155
|
+
* @returns {object} A parsed `package.json`
|
|
156
|
+
*/
|
|
157
|
+
export function readPackageJsonFrom(dir: string, opts?: readPkg.Options | undefined): any;
|
|
158
|
+
/**
|
|
159
|
+
* Reads the closest `package.json` file from absolute path `dir`.
|
|
160
|
+
* @param {string} dir - Directory to search from
|
|
161
|
+
* @param {import('read-pkg').Options} [opts] - Additional options for `read-pkg`
|
|
162
|
+
* @throws {Error} If there were problems finding or reading a `package.json` file
|
|
163
|
+
* @returns {object} A parsed `package.json`
|
|
164
|
+
*/
|
|
165
|
+
export function readPackageJsonFrom(dir: string, opts?: readPkg.Options | undefined): any;
|
|
166
|
+
/**
|
|
167
|
+
* Finds the project root directory from `dir`.
|
|
168
|
+
* @param {string} dir - Directory to search from
|
|
169
|
+
* @throws {TypeError} If `dir` is not a nonempty string or relative path
|
|
170
|
+
* @throws {Error} If there were problems finding the project root
|
|
171
|
+
* @returns {string} The closeset parent dir containing `package.json`
|
|
172
|
+
*/
|
|
173
|
+
export function findRoot(dir: string): string;
|
|
174
|
+
/**
|
|
175
|
+
* Finds the project root directory from `dir`.
|
|
176
|
+
* @param {string} dir - Directory to search from
|
|
177
|
+
* @throws {TypeError} If `dir` is not a nonempty string or relative path
|
|
178
|
+
* @throws {Error} If there were problems finding the project root
|
|
179
|
+
* @returns {string} The closeset parent dir containing `package.json`
|
|
180
|
+
*/
|
|
181
|
+
export function findRoot(dir: string): string;
|
|
182
|
+
export const access: typeof fsPromises.access;
|
|
183
|
+
export const appendFile: typeof fsPromises.appendFile;
|
|
184
|
+
export const chmod: typeof fsPromises.chmod;
|
|
185
|
+
export const close: (arg1: number) => B<any>;
|
|
186
|
+
export { constants };
|
|
187
|
+
export { createWriteStream };
|
|
188
|
+
export { createReadStream };
|
|
189
|
+
export const lstat: typeof fsPromises.lstat;
|
|
190
|
+
export const open: (path: import("fs").PathLike, flags: import("fs").OpenMode, mode?: import("fs").Mode | undefined) => Promise<number>;
|
|
191
|
+
export const openFile: typeof fsPromises.open;
|
|
192
|
+
export const readdir: typeof fsPromises.readdir;
|
|
193
|
+
export function read<TBuffer extends NodeJS.ArrayBufferView>(arg1: number, arg2: TBuffer, arg3: number, arg4: number, arg5: import("fs").ReadPosition | null): B<number>;
|
|
194
|
+
export const readFile: typeof fsPromises.readFile;
|
|
195
|
+
export const readlink: typeof fsPromises.readlink;
|
|
196
|
+
export const realpath: typeof fsPromises.realpath;
|
|
197
|
+
export const rename: typeof fsPromises.rename;
|
|
198
|
+
export const stat: typeof fsPromises.stat;
|
|
199
|
+
export const symlink: typeof fsPromises.symlink;
|
|
200
|
+
export const unlink: typeof fsPromises.unlink;
|
|
201
|
+
export const write: (arg1: number, arg2: string) => B<number>;
|
|
202
|
+
export const writeFile: typeof fsPromises.writeFile;
|
|
203
|
+
export const F_OK: number;
|
|
204
|
+
export const R_OK: number;
|
|
205
|
+
export const W_OK: number;
|
|
206
|
+
export const X_OK: number;
|
|
207
|
+
}
|
|
208
|
+
import glob from "glob";
|
|
209
|
+
import mv from "mv";
|
|
210
|
+
import rimrafIdx from "rimraf";
|
|
211
|
+
import ncp from "ncp";
|
|
212
|
+
import B from "bluebird";
|
|
213
|
+
import which from "which";
|
|
214
|
+
import sanitize from "sanitize-filename";
|
|
215
|
+
import klaw from "klaw";
|
|
216
|
+
import readPkg from "read-pkg";
|
|
217
|
+
import { promises as fsPromises } from "fs";
|
|
218
|
+
import { constants } from "fs";
|
|
219
|
+
import { createWriteStream } from "fs";
|
|
220
|
+
import { createReadStream } from "fs";
|
|
221
|
+
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../lib/fs.js"],"names":[],"mappings":";;;;;yCA2UW,MAAM,eACN,OAAO,KACN,OAAO;;;;IArTjB;;;;OAIG;IACH,yEAOC;IAZD;;;;OAIG;IACH,yEAOC;IAED;;;OAGG;IACH,sEAEC;IAND;;;OAGG;IACH,sEAEC;IAMkB,6FAAmE;;IAQtF;;;;;;;OAOG;IACH,0IAQC;IAhBD;;;;;;;OAOG;IACH,0IAQC;IACD;;;;;;;OAOG;IACH,6GAKC;IAbD;;;;;;;OAOG;IACH,6GAKC;IAED;;;;OAIG;IACH,sEAEC;IAPD;;;;OAIG;IACH,sEAEC;IAKc,uFAAwD;;;IAYtD,uFAAsD;;;IAQvE;;;;;OAKG;IACH,uGASC;IAfD;;;;;OAKG;IACH,uGASC;IAED;;;;;;;OAOG;IACH,gFAEC;IAVD;;;;;;;OAOG;IACH,gFAEC;IAED;;;;OAIG;IACH,gFAEC;IAPD;;;;OAIG;IACH,gFAEC;IAED;;;;;;;OAOG;IACH,4GAmEC;IA3ED;;;;;;;OAOG;IACH,4GAmEC;IACD;;;;;;OAMG;IACH,0FAQC;IAfD;;;;;;OAMG;IACH,0FAQC;IACD;;;;;;OAMG;IACH,8CASC;IAhBD;;;;;;OAMG;IACH,8CASC;;;;;;;;;;;;IAwEoqnB,yKAAkE"}
|