feat: estructura base OpenSpec + Skills + arquitectura limpia Capacitor+Dextie
This commit is contained in:
318
node_modules/@ionic/utils-fs/CHANGELOG.md
generated
vendored
Normal file
318
node_modules/@ionic/utils-fs/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,318 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [3.1.7](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.6...@ionic/utils-fs@3.1.7) (2023-03-29)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.1.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.5...@ionic/utils-fs@3.1.6) (2022-06-16)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.1.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.4...@ionic/utils-fs@3.1.5) (2020-08-28)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.1.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.3...@ionic/utils-fs@3.1.4) (2020-08-25)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.1.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.2...@ionic/utils-fs@3.1.3) (2020-05-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* pin tslib to avoid "Cannot set property pathExists" error ([689e1f0](https://github.com/ionic-team/ionic-cli/commit/689e1f038b907356ef855a067a76d4822e7072a8))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.1.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.1...@ionic/utils-fs@3.1.2) (2020-05-06)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.1.0...@ionic/utils-fs@3.1.1) (2020-03-03)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 3.1.0 (2020-02-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **start:** add new list starter option ([#4315](https://github.com/ionic-team/ionic-cli/issues/4315)) ([1df44c1](https://github.com/ionic-team/ionic-cli/commit/1df44c1591f37b89f2b672857740edd6cb2aea67))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.0.1...@ionic/utils-fs@3.0.2) (2020-02-10)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [3.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@3.0.0...@ionic/utils-fs@3.0.1) (2020-02-03)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [3.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.9...@ionic/utils-fs@3.0.0) (2020-01-25)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* require Node 10 ([5a47874](https://github.com/ionic-team/ionic-cli/commit/5a478746c074207b6dc96aa8771f04a606deb1ef))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* A minimum of Node.js 10.3.0 is required.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.0.9](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.8...@ionic/utils-fs@2.0.9) (2019-12-05)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.0.8](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.7...@ionic/utils-fs@2.0.8) (2019-10-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **fileToString:** handle ENOTDIR errors ([fab07d8](https://github.com/ionic-team/ionic-cli/commit/fab07d8c6e3d6756d633ada4c81165d11c70eb8f))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.0.7](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.6...@ionic/utils-fs@2.0.7) (2019-09-18)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.0.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.5...@ionic/utils-fs@2.0.6) (2019-08-23)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.4...@ionic/utils-fs@2.0.5) (2019-08-14)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.0.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.3...@ionic/utils-fs@2.0.4) (2019-08-07)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.0.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.2...@ionic/utils-fs@2.0.3) (2019-06-28)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.1...@ionic/utils-fs@2.0.2) (2019-06-10)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.0.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@2.0.0...@ionic/utils-fs@2.0.1) (2019-06-05)
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@1.2.0...@ionic/utils-fs@2.0.0) (2019-05-29)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* require Node 8 ([5670e68](https://github.com/ionic-team/ionic-cli/commit/5670e68))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* A minimum of Node.js 8.9.4 is required.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.2.0"></a>
|
||||
# [1.2.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@1.1.1...@ionic/utils-fs@1.2.0) (2019-03-06)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **fs:** add `isExecutableFile` utility ([53d9626](https://github.com/ionic-team/ionic-cli/commit/53d9626))
|
||||
* **fs:** add `pathReadable`, `pathWritable`, and `pathExecutable` ([5412791](https://github.com/ionic-team/ionic-cli/commit/5412791))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.1.1"></a>
|
||||
## [1.1.1](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@1.1.0...@ionic/utils-fs@1.1.1) (2019-02-27)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
<a name="1.1.0"></a>
|
||||
# [1.1.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@1.0.0...@ionic/utils-fs@1.1.0) (2019-02-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **walk:** stat symlinks themselves while walking ([92f2cee](https://github.com/ionic-team/ionic-cli/commit/92f2cee))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **fs:** `onError` option for `readdirp` and `getFileTree` ([90bcfcd](https://github.com/ionic-team/ionic-cli/commit/90bcfcd))
|
||||
* **fs:** `onFileNode` and `onDirectoryNode` options for `getFileTree` ([1858e96](https://github.com/ionic-team/ionic-cli/commit/1858e96))
|
||||
* **fs:** add `getFileTree` for creating file tree object structures ([c14b46b](https://github.com/ionic-team/ionic-cli/commit/c14b46b))
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="1.0.0"></a>
|
||||
# [1.0.0](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.7...@ionic/utils-fs@1.0.0) (2019-01-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* rimraf is a full dependency ([962ad94](https://github.com/ionic-team/ionic-cli/commit/962ad94))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* switch to fs-extra ([c17d8d8](https://github.com/ionic-team/ionic-cli/commit/c17d8d8))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* `readDir`, `readDirp`, `readDirSafe` were renamed to be
|
||||
consistent with fs and fs-extra. `readJsonFile` and `writeJsonFile` have
|
||||
been renamed to `readJson` and `writeJson` and use the fs-extra version
|
||||
directly. `isDir` was removed (use stat). `copyFile` and `copyDirectory`
|
||||
were removed (use `copy`). `removeDirectory` was removed (use `remove`).
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="0.0.7"></a>
|
||||
## [0.0.7](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.6...@ionic/utils-fs@0.0.7) (2019-01-07)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
<a name="0.0.6"></a>
|
||||
## [0.0.6](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.5...@ionic/utils-fs@0.0.6) (2018-12-19)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
<a name="0.0.5"></a>
|
||||
## [0.0.5](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.4...@ionic/utils-fs@0.0.5) (2018-11-20)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
<a name="0.0.4"></a>
|
||||
## [0.0.4](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.3...@ionic/utils-fs@0.0.4) (2018-10-31)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
<a name="0.0.3"></a>
|
||||
## [0.0.3](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.2...@ionic/utils-fs@0.0.3) (2018-10-05)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
<a name="0.0.2"></a>
|
||||
## [0.0.2](https://github.com/ionic-team/ionic-cli/compare/@ionic/utils-fs@0.0.1...@ionic/utils-fs@0.0.2) (2018-10-03)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
<a name="0.0.1"></a>
|
||||
## 0.0.1 (2018-09-05)
|
||||
|
||||
|
||||
|
||||
|
||||
**Note:** Version bump only for package @ionic/utils-fs
|
||||
|
||||
# Change Log
|
||||
21
node_modules/@ionic/utils-fs/LICENSE
generated
vendored
Normal file
21
node_modules/@ionic/utils-fs/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Drifty Co
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
1
node_modules/@ionic/utils-fs/README.md
generated
vendored
Normal file
1
node_modules/@ionic/utils-fs/README.md
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# @ionic/utils-fs
|
||||
148
node_modules/@ionic/utils-fs/dist/index.d.ts
generated
vendored
Normal file
148
node_modules/@ionic/utils-fs/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import * as fs from 'fs-extra';
|
||||
import * as stream from 'stream';
|
||||
export * from 'fs-extra';
|
||||
export { stat as statSafe, readdir as readdirSafe } from './safe';
|
||||
export interface ReaddirPOptions {
|
||||
/**
|
||||
* Filter out items from the walk process from the final result.
|
||||
*
|
||||
* @return `true` to keep, otherwise the item is filtered out
|
||||
*/
|
||||
readonly filter?: (item: WalkerItem) => boolean;
|
||||
/**
|
||||
* Called whenever an error occurs during the walk process.
|
||||
*
|
||||
* If excluded, the function will throw an error when first encountered.
|
||||
*/
|
||||
readonly onError?: (err: Error) => void;
|
||||
readonly walkerOptions?: WalkerOptions;
|
||||
}
|
||||
export declare function readdirp(dir: string, { filter, onError, walkerOptions }?: ReaddirPOptions): Promise<string[]>;
|
||||
export declare const enum FileType {
|
||||
FILE = "file",
|
||||
DIRECTORY = "directory"
|
||||
}
|
||||
export interface RegularFileNode {
|
||||
path: string;
|
||||
type: FileType.FILE;
|
||||
parent: FileNode;
|
||||
}
|
||||
export interface DirectoryNode {
|
||||
path: string;
|
||||
type: FileType.DIRECTORY;
|
||||
parent?: FileNode;
|
||||
children: FileNode[];
|
||||
}
|
||||
export declare type FileNode = RegularFileNode | DirectoryNode;
|
||||
export interface GetFileTreeOptions<RE = {}, DE = {}> {
|
||||
/**
|
||||
* Called whenever an error occurs during the walk process.
|
||||
*
|
||||
* If excluded, the function will throw an error when first encountered.
|
||||
*/
|
||||
readonly onError?: (err: Error) => void;
|
||||
/**
|
||||
* Called whenever a file node is added to the tree.
|
||||
*
|
||||
* File nodes can be supplemented by returning a new object from this
|
||||
* function.
|
||||
*/
|
||||
readonly onFileNode?: (node: RegularFileNode) => RegularFileNode & RE;
|
||||
/**
|
||||
* Called whenever a directory node is added to the tree.
|
||||
*
|
||||
* Directory nodes can be supplemented by returning a new object from this
|
||||
* function.
|
||||
*/
|
||||
readonly onDirectoryNode?: (node: DirectoryNode) => DirectoryNode & DE;
|
||||
readonly walkerOptions?: WalkerOptions;
|
||||
}
|
||||
/**
|
||||
* Compile and return a file tree structure.
|
||||
*
|
||||
* This function walks a directory structure recursively, building a nested
|
||||
* object structure in memory that represents it. When finished, the root
|
||||
* directory node is returned.
|
||||
*
|
||||
* @param dir The root directory from which to compile the file tree
|
||||
*/
|
||||
export declare function getFileTree<RE = {}, DE = {}>(dir: string, { onError, onFileNode, onDirectoryNode, walkerOptions }?: GetFileTreeOptions<RE, DE>): Promise<RegularFileNode & RE | DirectoryNode & DE>;
|
||||
export declare function fileToString(filePath: string): Promise<string>;
|
||||
export declare function getFileChecksum(filePath: string): Promise<string>;
|
||||
/**
|
||||
* Return true and cached checksums for a file by its path.
|
||||
*
|
||||
* Cached checksums are stored as `.md5` files next to the original file. If
|
||||
* the cache file is missing, the cached checksum is undefined.
|
||||
*
|
||||
* @param p The file path
|
||||
* @return Promise<[true checksum, cached checksum or undefined if cache file missing]>
|
||||
*/
|
||||
export declare function getFileChecksums(p: string): Promise<[string, string | undefined]>;
|
||||
/**
|
||||
* Store a cache file containing the source file's md5 checksum hash.
|
||||
*
|
||||
* @param p The file path
|
||||
* @param checksum The checksum. If excluded, the checksum is computed
|
||||
*/
|
||||
export declare function cacheFileChecksum(p: string, checksum?: string): Promise<void>;
|
||||
export declare function writeStreamToFile(stream: NodeJS.ReadableStream, destination: string): Promise<any>;
|
||||
export declare function pathAccessible(filePath: string, mode: number): Promise<boolean>;
|
||||
export declare function pathExists(filePath: string): Promise<boolean>;
|
||||
export declare function pathReadable(filePath: string): Promise<boolean>;
|
||||
export declare function pathWritable(filePath: string): Promise<boolean>;
|
||||
export declare function pathExecutable(filePath: string): Promise<boolean>;
|
||||
export declare function isExecutableFile(filePath: string): Promise<boolean>;
|
||||
/**
|
||||
* Find the base directory based on the path given and a marker file to look for.
|
||||
*/
|
||||
export declare function findBaseDirectory(dir: string, file: string): Promise<string | undefined>;
|
||||
/**
|
||||
* Generate a random file path within the computer's temporary directory.
|
||||
*
|
||||
* @param prefix Optionally provide a filename prefix.
|
||||
*/
|
||||
export declare function tmpfilepath(prefix?: string): string;
|
||||
/**
|
||||
* Given an absolute system path, compile an array of paths working backwards
|
||||
* one directory at a time, always ending in the root directory.
|
||||
*
|
||||
* For example, `'/some/dir'` => `['/some/dir', '/some', '/']`
|
||||
*
|
||||
* @param filePath Absolute system base path.
|
||||
*/
|
||||
export declare function compilePaths(filePath: string): string[];
|
||||
export interface WalkerItem {
|
||||
path: string;
|
||||
stats: fs.Stats;
|
||||
}
|
||||
export interface WalkerOptions {
|
||||
/**
|
||||
* Filter out file paths during walk.
|
||||
*
|
||||
* As the file tree is walked, this function can be used to exclude files and
|
||||
* directories from the final result.
|
||||
*
|
||||
* It can also be used to tune performance. If a subdirectory is excluded, it
|
||||
* is not walked.
|
||||
*
|
||||
* @param p The file path.
|
||||
* @return `true` to include file path, otherwise it is excluded
|
||||
*/
|
||||
readonly pathFilter?: (p: string) => boolean;
|
||||
}
|
||||
export interface Walker extends stream.Readable {
|
||||
on(event: 'data', callback: (item: WalkerItem) => void): this;
|
||||
on(event: string, callback: (...args: any[]) => any): this;
|
||||
}
|
||||
export declare class Walker extends stream.Readable {
|
||||
readonly p: string;
|
||||
readonly options: WalkerOptions;
|
||||
readonly paths: string[];
|
||||
constructor(p: string, options?: WalkerOptions);
|
||||
_read(): void;
|
||||
}
|
||||
export declare function walk(p: string, options?: WalkerOptions): Walker;
|
||||
286
node_modules/@ionic/utils-fs/dist/index.js
generated
vendored
Normal file
286
node_modules/@ionic/utils-fs/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,286 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.walk = exports.Walker = exports.compilePaths = exports.tmpfilepath = exports.findBaseDirectory = exports.isExecutableFile = exports.pathExecutable = exports.pathWritable = exports.pathReadable = exports.pathExists = exports.pathAccessible = exports.writeStreamToFile = exports.cacheFileChecksum = exports.getFileChecksums = exports.getFileChecksum = exports.fileToString = exports.getFileTree = exports.readdirp = exports.readdirSafe = exports.statSafe = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const fs = require("fs-extra");
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const stream = require("stream");
|
||||
const safe = require("./safe");
|
||||
tslib_1.__exportStar(require("fs-extra"), exports);
|
||||
var safe_1 = require("./safe");
|
||||
Object.defineProperty(exports, "statSafe", { enumerable: true, get: function () { return safe_1.stat; } });
|
||||
Object.defineProperty(exports, "readdirSafe", { enumerable: true, get: function () { return safe_1.readdir; } });
|
||||
async function readdirp(dir, { filter, onError, walkerOptions } = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const items = [];
|
||||
let rs = walk(dir, walkerOptions);
|
||||
if (filter) {
|
||||
rs = rs.pipe(new stream.Transform({
|
||||
objectMode: true,
|
||||
transform(obj, enc, cb) {
|
||||
if (!filter || filter(obj)) {
|
||||
this.push(obj);
|
||||
}
|
||||
cb();
|
||||
},
|
||||
}));
|
||||
}
|
||||
rs
|
||||
.on('error', (err) => onError ? onError(err) : reject(err))
|
||||
.on('data', (item) => items.push(item.path))
|
||||
.on('end', () => resolve(items));
|
||||
});
|
||||
}
|
||||
exports.readdirp = readdirp;
|
||||
/**
|
||||
* Compile and return a file tree structure.
|
||||
*
|
||||
* This function walks a directory structure recursively, building a nested
|
||||
* object structure in memory that represents it. When finished, the root
|
||||
* directory node is returned.
|
||||
*
|
||||
* @param dir The root directory from which to compile the file tree
|
||||
*/
|
||||
async function getFileTree(dir, { onError, onFileNode = n => n, onDirectoryNode = n => n, walkerOptions } = {}) {
|
||||
const fileMap = new Map([]);
|
||||
const getOrCreateParent = (item) => {
|
||||
const parentPath = path.dirname(item.path);
|
||||
const parent = fileMap.get(parentPath);
|
||||
if (parent && parent.type === "directory" /* FileType.DIRECTORY */) {
|
||||
return parent;
|
||||
}
|
||||
return onDirectoryNode({ path: parentPath, type: "directory" /* FileType.DIRECTORY */, children: [] });
|
||||
};
|
||||
const createFileNode = (item, parent) => {
|
||||
const node = { path: item.path, parent };
|
||||
return item.stats.isDirectory() ?
|
||||
onDirectoryNode({ ...node, type: "directory" /* FileType.DIRECTORY */, children: [] }) :
|
||||
onFileNode({ ...node, type: "file" /* FileType.FILE */ });
|
||||
};
|
||||
return new Promise((resolve, reject) => {
|
||||
dir = path.resolve(dir);
|
||||
const rs = walk(dir, walkerOptions);
|
||||
rs
|
||||
.on('error', err => onError ? onError(err) : reject(err))
|
||||
.on('data', item => {
|
||||
const parent = getOrCreateParent(item);
|
||||
const node = createFileNode(item, parent);
|
||||
parent.children.push(node);
|
||||
fileMap.set(item.path, node);
|
||||
fileMap.set(parent.path, parent);
|
||||
})
|
||||
.on('end', () => {
|
||||
const root = fileMap.get(dir);
|
||||
if (!root) {
|
||||
return reject(new Error('No root node found after walking directory structure.'));
|
||||
}
|
||||
delete root.parent;
|
||||
resolve(root);
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.getFileTree = getFileTree;
|
||||
async function fileToString(filePath) {
|
||||
try {
|
||||
return await fs.readFile(filePath, { encoding: 'utf8' });
|
||||
}
|
||||
catch (e) {
|
||||
if (e.code === 'ENOENT' || e.code === 'ENOTDIR') {
|
||||
return '';
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
exports.fileToString = fileToString;
|
||||
async function getFileChecksum(filePath) {
|
||||
const crypto = await Promise.resolve().then(() => require('crypto'));
|
||||
return new Promise((resolve, reject) => {
|
||||
const hash = crypto.createHash('md5');
|
||||
const input = fs.createReadStream(filePath);
|
||||
input.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
hash.once('readable', () => {
|
||||
const fullChecksum = hash.read().toString('hex');
|
||||
resolve(fullChecksum);
|
||||
});
|
||||
input.pipe(hash);
|
||||
});
|
||||
}
|
||||
exports.getFileChecksum = getFileChecksum;
|
||||
/**
|
||||
* Return true and cached checksums for a file by its path.
|
||||
*
|
||||
* Cached checksums are stored as `.md5` files next to the original file. If
|
||||
* the cache file is missing, the cached checksum is undefined.
|
||||
*
|
||||
* @param p The file path
|
||||
* @return Promise<[true checksum, cached checksum or undefined if cache file missing]>
|
||||
*/
|
||||
async function getFileChecksums(p) {
|
||||
return Promise.all([
|
||||
getFileChecksum(p),
|
||||
(async () => {
|
||||
try {
|
||||
const md5 = await fs.readFile(`${p}.md5`, { encoding: 'utf8' });
|
||||
return md5.trim();
|
||||
}
|
||||
catch (e) {
|
||||
if (e.code !== 'ENOENT') {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
})(),
|
||||
]);
|
||||
}
|
||||
exports.getFileChecksums = getFileChecksums;
|
||||
/**
|
||||
* Store a cache file containing the source file's md5 checksum hash.
|
||||
*
|
||||
* @param p The file path
|
||||
* @param checksum The checksum. If excluded, the checksum is computed
|
||||
*/
|
||||
async function cacheFileChecksum(p, checksum) {
|
||||
const md5 = await getFileChecksum(p);
|
||||
await fs.writeFile(`${p}.md5`, md5, { encoding: 'utf8' });
|
||||
}
|
||||
exports.cacheFileChecksum = cacheFileChecksum;
|
||||
function writeStreamToFile(stream, destination) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const dest = fs.createWriteStream(destination);
|
||||
stream.pipe(dest);
|
||||
dest.on('error', reject);
|
||||
dest.on('finish', resolve);
|
||||
});
|
||||
}
|
||||
exports.writeStreamToFile = writeStreamToFile;
|
||||
async function pathAccessible(filePath, mode) {
|
||||
try {
|
||||
await fs.access(filePath, mode);
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
exports.pathAccessible = pathAccessible;
|
||||
async function pathExists(filePath) {
|
||||
return pathAccessible(filePath, fs.constants.F_OK);
|
||||
}
|
||||
exports.pathExists = pathExists;
|
||||
async function pathReadable(filePath) {
|
||||
return pathAccessible(filePath, fs.constants.R_OK);
|
||||
}
|
||||
exports.pathReadable = pathReadable;
|
||||
async function pathWritable(filePath) {
|
||||
return pathAccessible(filePath, fs.constants.W_OK);
|
||||
}
|
||||
exports.pathWritable = pathWritable;
|
||||
async function pathExecutable(filePath) {
|
||||
return pathAccessible(filePath, fs.constants.X_OK);
|
||||
}
|
||||
exports.pathExecutable = pathExecutable;
|
||||
async function isExecutableFile(filePath) {
|
||||
const [stats, executable] = await (Promise.all([
|
||||
safe.stat(filePath),
|
||||
pathExecutable(filePath),
|
||||
]));
|
||||
return !!stats && (stats.isFile() || stats.isSymbolicLink()) && executable;
|
||||
}
|
||||
exports.isExecutableFile = isExecutableFile;
|
||||
/**
|
||||
* Find the base directory based on the path given and a marker file to look for.
|
||||
*/
|
||||
async function findBaseDirectory(dir, file) {
|
||||
if (!dir || !file) {
|
||||
return;
|
||||
}
|
||||
for (const d of compilePaths(dir)) {
|
||||
const results = await safe.readdir(d);
|
||||
if (results.includes(file)) {
|
||||
return d;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.findBaseDirectory = findBaseDirectory;
|
||||
/**
|
||||
* Generate a random file path within the computer's temporary directory.
|
||||
*
|
||||
* @param prefix Optionally provide a filename prefix.
|
||||
*/
|
||||
function tmpfilepath(prefix) {
|
||||
const rn = Math.random().toString(16).substring(2, 8);
|
||||
const p = path.resolve(os.tmpdir(), prefix ? `${prefix}-${rn}` : rn);
|
||||
return p;
|
||||
}
|
||||
exports.tmpfilepath = tmpfilepath;
|
||||
/**
|
||||
* Given an absolute system path, compile an array of paths working backwards
|
||||
* one directory at a time, always ending in the root directory.
|
||||
*
|
||||
* For example, `'/some/dir'` => `['/some/dir', '/some', '/']`
|
||||
*
|
||||
* @param filePath Absolute system base path.
|
||||
*/
|
||||
function compilePaths(filePath) {
|
||||
filePath = path.normalize(filePath);
|
||||
if (!path.isAbsolute(filePath)) {
|
||||
throw new Error(`${filePath} is not an absolute path`);
|
||||
}
|
||||
const parsed = path.parse(filePath);
|
||||
if (filePath === parsed.root) {
|
||||
return [filePath];
|
||||
}
|
||||
return filePath
|
||||
.slice(parsed.root.length)
|
||||
.split(path.sep)
|
||||
.map((segment, i, array) => parsed.root + path.join(...array.slice(0, array.length - i)))
|
||||
.concat(parsed.root);
|
||||
}
|
||||
exports.compilePaths = compilePaths;
|
||||
class Walker extends stream.Readable {
|
||||
constructor(p, options = {}) {
|
||||
super({ objectMode: true });
|
||||
this.p = p;
|
||||
this.options = options;
|
||||
this.paths = [this.p];
|
||||
}
|
||||
_read() {
|
||||
const p = this.paths.shift();
|
||||
const { pathFilter } = this.options;
|
||||
if (!p) {
|
||||
this.push(null);
|
||||
return;
|
||||
}
|
||||
fs.lstat(p, (err, stats) => {
|
||||
if (err) {
|
||||
this.emit('error', err);
|
||||
return;
|
||||
}
|
||||
const item = { path: p, stats };
|
||||
if (stats.isDirectory()) {
|
||||
fs.readdir(p, (err, contents) => {
|
||||
if (err) {
|
||||
this.emit('error', err);
|
||||
return;
|
||||
}
|
||||
let paths = contents.map(file => path.join(p, file));
|
||||
if (pathFilter) {
|
||||
paths = paths.filter(p => pathFilter(p.substring(this.p.length + 1)));
|
||||
}
|
||||
this.paths.push(...paths);
|
||||
this.push(item);
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.push(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Walker = Walker;
|
||||
function walk(p, options = {}) {
|
||||
return new Walker(p, options);
|
||||
}
|
||||
exports.walk = walk;
|
||||
4
node_modules/@ionic/utils-fs/dist/safe.d.ts
generated
vendored
Normal file
4
node_modules/@ionic/utils-fs/dist/safe.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/// <reference types="node" />
|
||||
import * as fs from 'fs-extra';
|
||||
export declare function stat(p: string): Promise<fs.Stats | undefined>;
|
||||
export declare function readdir(dir: string): Promise<string[]>;
|
||||
22
node_modules/@ionic/utils-fs/dist/safe.js
generated
vendored
Normal file
22
node_modules/@ionic/utils-fs/dist/safe.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.readdir = exports.stat = void 0;
|
||||
const fs = require("fs-extra");
|
||||
async function stat(p) {
|
||||
try {
|
||||
return await fs.stat(p);
|
||||
}
|
||||
catch (e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
exports.stat = stat;
|
||||
async function readdir(dir) {
|
||||
try {
|
||||
return await fs.readdir(dir);
|
||||
}
|
||||
catch (e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
exports.readdir = readdir;
|
||||
51
node_modules/@ionic/utils-fs/package.json
generated
vendored
Normal file
51
node_modules/@ionic/utils-fs/package.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "@ionic/utils-fs",
|
||||
"version": "3.1.7",
|
||||
"description": "Filesystem utils for Node",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"homepage": "https://ionicframework.com/",
|
||||
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
},
|
||||
"files": [
|
||||
"dist/",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ionic-team/ionic-cli.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ionic-team/ionic-cli/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"lint": "true",
|
||||
"build": "npm run clean && tsc",
|
||||
"watch": "tsc -w --preserveWatchOutput",
|
||||
"test": "jest --maxWorkers=4",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/fs-extra": "^8.0.0",
|
||||
"debug": "^4.0.0",
|
||||
"fs-extra": "^9.0.0",
|
||||
"tslib": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/debug": "^4.1.1",
|
||||
"@types/jest": "^26.0.10",
|
||||
"@types/node": "~16.0.0",
|
||||
"jest": "^26.4.2",
|
||||
"jest-cli": "^26.0.1",
|
||||
"lint-staged": "^10.0.2",
|
||||
"rimraf": "^3.0.0",
|
||||
"ts-jest": "~26.3.0",
|
||||
"typescript": "~4.8.0"
|
||||
},
|
||||
"gitHead": "15ef6e7da4eace4fd55d16fd9508d156a4bc8203"
|
||||
}
|
||||
Reference in New Issue
Block a user