@decohere/core 0.0.1-dev.20261105.97 → 0.0.1-dev.20261106.132
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/package.json +11 -20
- package/commonjs/src/caching/cache-manager.js +0 -98
- package/commonjs/src/caching/cache.decorator.js +0 -69
- package/commonjs/src/caching/cache.js +0 -6
- package/commonjs/src/caching/index.js +0 -23
- package/commonjs/src/caching/invalidate-cache.decorator.js +0 -92
- package/commonjs/src/caching/map-cache.js +0 -39
- package/commonjs/src/caching/memoize.decorator.js +0 -36
- package/commonjs/src/collections/collections.js +0 -21
- package/commonjs/src/collections/find-duplicates.js +0 -35
- package/commonjs/src/collections/index.js +0 -52
- package/commonjs/src/collections/merge-arrays.js +0 -34
- package/commonjs/src/collections/sum.js +0 -63
- package/commonjs/src/collections/unique-objects.js +0 -39
- package/commonjs/src/composition/index.js +0 -4
- package/commonjs/src/configuration/configuration.types.js +0 -11
- package/commonjs/src/configuration/index.js +0 -18
- package/commonjs/src/extensibility/decorator-factory-base.js +0 -22
- package/commonjs/src/extensibility/decorator-factory.js +0 -31
- package/commonjs/src/extensibility/extension.js +0 -37
- package/commonjs/src/extensibility/index.js +0 -23
- package/commonjs/src/extensibility/mixwith.js +0 -36
- package/commonjs/src/extensibility/pipeline.js +0 -56
- package/commonjs/src/extensibility/step.js +0 -18
- package/commonjs/src/io/copy-file.js +0 -25
- package/commonjs/src/io/delete-file.js +0 -21
- package/commonjs/src/io/directory-exists.js +0 -24
- package/commonjs/src/io/file-exists.js +0 -19
- package/commonjs/src/io/index.js +0 -66
- package/commonjs/src/io/io.js +0 -25
- package/commonjs/src/io/read-file.js +0 -39
- package/commonjs/src/io/remove-dir.js +0 -22
- package/commonjs/src/io/types/directory.type.js +0 -4
- package/commonjs/src/io/types/file.js +0 -28
- package/commonjs/src/io/types/index.js +0 -19
- package/commonjs/src/io/url-to-path.js +0 -33
- package/commonjs/src/io/write-file.js +0 -30
- package/commonjs/src/objects/deep-merge.js +0 -67
- package/commonjs/src/objects/index.js +0 -11
- package/commonjs/src/reflection/index.js +0 -20
- package/commonjs/src/reflection/types/index.js +0 -18
- package/commonjs/src/reflection/types/reflection.types.js +0 -25
- package/commonjs/src/reflection/utilities.js +0 -118
- package/commonjs/src/system/camel-case.js +0 -13
- package/commonjs/src/system/debounce.js +0 -19
- package/commonjs/src/system/decorator.js +0 -46
- package/commonjs/src/system/environment.js +0 -23
- package/commonjs/src/system/function.types.js +0 -18
- package/commonjs/src/system/index.js +0 -25
- package/commonjs/src/system/retry.decorator.js +0 -40
- package/commonjs/src/system/sleep.js +0 -13
- package/commonjs/src/system/subject.js +0 -41
- package/commonjs/src/system/type.utils.js +0 -4
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
get uniqueObjectsBy () {
|
|
13
|
-
return uniqueObjectsBy;
|
|
14
|
-
},
|
|
15
|
-
get uniqueObjectsByKey () {
|
|
16
|
-
return uniqueObjectsByKey;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
function uniqueObjectsByKey(objects, key) {
|
|
20
|
-
return uniqueObjects(objects, key);
|
|
21
|
-
}
|
|
22
|
-
function uniqueObjectsBy(objects, key) {
|
|
23
|
-
return uniqueObjects(objects, key);
|
|
24
|
-
}
|
|
25
|
-
function uniqueObjects(objects, key) {
|
|
26
|
-
const getKey = (key, item)=>{
|
|
27
|
-
if (typeof key === "function") {
|
|
28
|
-
return key(item);
|
|
29
|
-
}
|
|
30
|
-
return item != null ? item[key] : null;
|
|
31
|
-
};
|
|
32
|
-
const arrayUniqueByKey = [
|
|
33
|
-
...new Map(objects.map((item)=>[
|
|
34
|
-
getKey(key, item),
|
|
35
|
-
item
|
|
36
|
-
])).values()
|
|
37
|
-
];
|
|
38
|
-
return arrayUniqueByKey;
|
|
39
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "ConfigurationServiceToken", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return ConfigurationServiceToken;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const ConfigurationServiceToken = Symbol("IConfigurationService");
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
_export_star(require("./configuration.types.js"), exports);
|
|
6
|
-
function _export_star(from, to) {
|
|
7
|
-
Object.keys(from).forEach(function(k) {
|
|
8
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
-
Object.defineProperty(to, k, {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function() {
|
|
12
|
-
return from[k];
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
return from;
|
|
18
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "DecoratorFactoryBase", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return DecoratorFactoryBase;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
class DecoratorFactoryBase {
|
|
12
|
-
/**
|
|
13
|
-
* Utility method to check if we're currently in a test environment
|
|
14
|
-
*/ isTestEnvironment() {
|
|
15
|
-
return process.env.TEST === "true";
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Creates a no-op decorator that returns the original function unchanged
|
|
19
|
-
*/ createNoOpDecorator() {
|
|
20
|
-
return (_target, _propertyKey, descriptor)=>descriptor;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decorator factory class that provides decorator methods which can be conditionally
|
|
3
|
-
* disabled during unit testing using the @ignoreInUnitTest decorator.
|
|
4
|
-
*
|
|
5
|
-
* Inspired by: https://jasonharper.blog/2018/03/13/decorate-the-decorator-to-exclude-in-unit-testing/
|
|
6
|
-
*/ /**
|
|
7
|
-
* Decorator that disables the decorated decorator method when TEST environment variable is true.
|
|
8
|
-
* If TEST=true, it returns a no-op decorator that simply returns the original function unchanged.
|
|
9
|
-
*/ "use strict";
|
|
10
|
-
Object.defineProperty(exports, "__esModule", {
|
|
11
|
-
value: true
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "ignoreInUnitTest", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function() {
|
|
16
|
-
return ignoreInUnitTest;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
function ignoreInUnitTest(_target, _propertyKey, descriptor) {
|
|
20
|
-
const originalMethod = descriptor.value;
|
|
21
|
-
descriptor.value = function(...args) {
|
|
22
|
-
// Check if we're in a test environment
|
|
23
|
-
if (process.env.TEST === "true") {
|
|
24
|
-
// Return a no-op decorator that just returns the original function
|
|
25
|
-
return (originalFunction)=>originalFunction;
|
|
26
|
-
}
|
|
27
|
-
// Otherwise, apply the original decorator method
|
|
28
|
-
return originalMethod.apply(this, args);
|
|
29
|
-
};
|
|
30
|
-
return descriptor;
|
|
31
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "extension", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return extension;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
function extension(ctor, options) {
|
|
12
|
-
return (_target, propertyKey, descriptor)=>{
|
|
13
|
-
const originalFunction = descriptor.value;
|
|
14
|
-
ctor.prototype[propertyKey] = function(...args) {
|
|
15
|
-
return originalFunction.apply(this, [
|
|
16
|
-
this,
|
|
17
|
-
...args
|
|
18
|
-
]);
|
|
19
|
-
};
|
|
20
|
-
if (options?.static) {
|
|
21
|
-
Object.defineProperty(ctor, propertyKey, {
|
|
22
|
-
configurable: true,
|
|
23
|
-
writable: true,
|
|
24
|
-
value (...args) {
|
|
25
|
-
const receiver = singletonOf(ctor) ?? this;
|
|
26
|
-
return originalFunction.apply(receiver, [
|
|
27
|
-
receiver,
|
|
28
|
-
...args
|
|
29
|
-
]);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function singletonOf(ctor) {
|
|
36
|
-
return ctor.instance;
|
|
37
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
_export_star(require("./decorator-factory.js"), exports);
|
|
6
|
-
_export_star(require("./decorator-factory-base.js"), exports);
|
|
7
|
-
_export_star(require("./extension.js"), exports);
|
|
8
|
-
_export_star(require("./mixwith.js"), exports);
|
|
9
|
-
_export_star(require("./pipeline.js"), exports);
|
|
10
|
-
_export_star(require("./step.js"), exports);
|
|
11
|
-
function _export_star(from, to) {
|
|
12
|
-
Object.keys(from).forEach(function(k) {
|
|
13
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
14
|
-
Object.defineProperty(to, k, {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function() {
|
|
17
|
-
return from[k];
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return from;
|
|
23
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "mixwith", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return mixwith;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const BLOCKED_PROTOTYPE_KEYS = new Set([
|
|
12
|
-
"constructor",
|
|
13
|
-
"prototype",
|
|
14
|
-
"name",
|
|
15
|
-
"length"
|
|
16
|
-
]);
|
|
17
|
-
function copyPrototypeProperties(target, source) {
|
|
18
|
-
for (const key of Reflect.ownKeys(source)){
|
|
19
|
-
if (typeof key === "string" && BLOCKED_PROTOTYPE_KEYS.has(key)) {
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
const descriptor = Object.getOwnPropertyDescriptor(source, key);
|
|
23
|
-
if (descriptor == null) {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
Object.defineProperty(target, key, descriptor);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function mixwith(...mixins) {
|
|
30
|
-
class Mixed {
|
|
31
|
-
}
|
|
32
|
-
for (const mixin of mixins){
|
|
33
|
-
copyPrototypeProperties(Mixed.prototype, mixin.prototype);
|
|
34
|
-
}
|
|
35
|
-
return Mixed;
|
|
36
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "Pipeline", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return Pipeline;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _scribe = require("@decohere/scribe");
|
|
12
|
-
class Pipeline {
|
|
13
|
-
stack;
|
|
14
|
-
logger = _scribe.scribe.logger(Pipeline.name);
|
|
15
|
-
currentStep;
|
|
16
|
-
constructor(...steps){
|
|
17
|
-
this.stack = steps;
|
|
18
|
-
}
|
|
19
|
-
[Symbol.dispose]() {
|
|
20
|
-
for (const [, step] of this.stack){
|
|
21
|
-
if (Symbol.dispose in step) {
|
|
22
|
-
step[Symbol.dispose]();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
async start(context) {
|
|
27
|
-
const runStep = async (index)=>{
|
|
28
|
-
const [key, middleware, when] = this.stack[index] ?? [];
|
|
29
|
-
if (middleware == null) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (when != null && !when(context)) {
|
|
33
|
-
this.logger.info(`Skipping step ${key}`);
|
|
34
|
-
return await runStep(index + 1);
|
|
35
|
-
}
|
|
36
|
-
this.currentStep = key;
|
|
37
|
-
this.logger.info(`Running step ${key}`);
|
|
38
|
-
await middleware.run(context, async ()=>{
|
|
39
|
-
await runStep(index + 1);
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
try {
|
|
43
|
-
await runStep(0);
|
|
44
|
-
} catch (error) {
|
|
45
|
-
const step = this.currentStep ?? "unknown";
|
|
46
|
-
if (error instanceof Error) {
|
|
47
|
-
throw new Error(`Pipeline step '${step}' failed: ${error.message}`, {
|
|
48
|
-
cause: error
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
throw new Error(`Pipeline step '${step}' failed with non-Error value`, {
|
|
52
|
-
cause: error
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "Step", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return Step;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
class Step {
|
|
12
|
-
type;
|
|
13
|
-
when;
|
|
14
|
-
constructor(type, when){
|
|
15
|
-
this.type = type;
|
|
16
|
-
this.when = when;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "copyFile", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return copyFile;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _promises = /*#__PURE__*/ _interop_require_default(require("node:fs/promises"));
|
|
12
|
-
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
13
|
-
function _interop_require_default(obj) {
|
|
14
|
-
return obj && obj.__esModule ? obj : {
|
|
15
|
-
default: obj
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
async function copyFile(src, dest, options = {}) {
|
|
19
|
-
if (options.mkdir) {
|
|
20
|
-
await _promises.default.mkdir(_nodepath.default.dirname(dest), {
|
|
21
|
-
recursive: true
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
await _promises.default.copyFile(src, dest);
|
|
25
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "deleteFile", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return deleteFile;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _promises = /*#__PURE__*/ _interop_require_default(require("node:fs/promises"));
|
|
12
|
-
function _interop_require_default(obj) {
|
|
13
|
-
return obj && obj.__esModule ? obj : {
|
|
14
|
-
default: obj
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
async function deleteFile(filePath) {
|
|
18
|
-
return _promises.default.rm(filePath, {
|
|
19
|
-
force: true
|
|
20
|
-
});
|
|
21
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "directoryExists", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return directoryExists;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _promises = /*#__PURE__*/ _interop_require_default(require("node:fs/promises"));
|
|
12
|
-
function _interop_require_default(obj) {
|
|
13
|
-
return obj && obj.__esModule ? obj : {
|
|
14
|
-
default: obj
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
async function directoryExists(path) {
|
|
18
|
-
try {
|
|
19
|
-
await _promises.default.access(path);
|
|
20
|
-
return true;
|
|
21
|
-
} catch {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "fileExists", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return fileExists;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _promises = require("node:fs/promises");
|
|
12
|
-
async function fileExists(path) {
|
|
13
|
-
try {
|
|
14
|
-
const stats = await (0, _promises.stat)(path);
|
|
15
|
-
return stats.isFile();
|
|
16
|
-
} catch {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
}
|
package/commonjs/src/io/index.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "io", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _io;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _io = /*#__PURE__*/ _interop_require_wildcard(require("./io.js"));
|
|
12
|
-
_export_star(require("./types/index.js"), exports);
|
|
13
|
-
function _export_star(from, to) {
|
|
14
|
-
Object.keys(from).forEach(function(k) {
|
|
15
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
16
|
-
Object.defineProperty(to, k, {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function() {
|
|
19
|
-
return from[k];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
return from;
|
|
25
|
-
}
|
|
26
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
27
|
-
if (typeof WeakMap !== "function") return null;
|
|
28
|
-
var cacheBabelInterop = new WeakMap();
|
|
29
|
-
var cacheNodeInterop = new WeakMap();
|
|
30
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
31
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
32
|
-
})(nodeInterop);
|
|
33
|
-
}
|
|
34
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
35
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
36
|
-
return obj;
|
|
37
|
-
}
|
|
38
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
39
|
-
return {
|
|
40
|
-
default: obj
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
44
|
-
if (cache && cache.has(obj)) {
|
|
45
|
-
return cache.get(obj);
|
|
46
|
-
}
|
|
47
|
-
var newObj = {
|
|
48
|
-
__proto__: null
|
|
49
|
-
};
|
|
50
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
51
|
-
for(var key in obj){
|
|
52
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
53
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
54
|
-
if (desc && (desc.get || desc.set)) {
|
|
55
|
-
Object.defineProperty(newObj, key, desc);
|
|
56
|
-
} else {
|
|
57
|
-
newObj[key] = obj[key];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
newObj.default = obj;
|
|
62
|
-
if (cache) {
|
|
63
|
-
cache.set(obj, newObj);
|
|
64
|
-
}
|
|
65
|
-
return newObj;
|
|
66
|
-
}
|
package/commonjs/src/io/io.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
_export_star(require("./copy-file.js"), exports);
|
|
6
|
-
_export_star(require("./delete-file.js"), exports);
|
|
7
|
-
_export_star(require("./directory-exists.js"), exports);
|
|
8
|
-
_export_star(require("./file-exists.js"), exports);
|
|
9
|
-
_export_star(require("./read-file.js"), exports);
|
|
10
|
-
_export_star(require("./remove-dir.js"), exports);
|
|
11
|
-
_export_star(require("./url-to-path.js"), exports);
|
|
12
|
-
_export_star(require("./write-file.js"), exports);
|
|
13
|
-
function _export_star(from, to) {
|
|
14
|
-
Object.keys(from).forEach(function(k) {
|
|
15
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
16
|
-
Object.defineProperty(to, k, {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function() {
|
|
19
|
-
return from[k];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
return from;
|
|
25
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
get readFile () {
|
|
13
|
-
return readFile;
|
|
14
|
-
},
|
|
15
|
-
get readFiles () {
|
|
16
|
-
return readFiles;
|
|
17
|
-
},
|
|
18
|
-
get readJsonFile () {
|
|
19
|
-
return readJsonFile;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const _promises = /*#__PURE__*/ _interop_require_default(require("node:fs/promises"));
|
|
23
|
-
function _interop_require_default(obj) {
|
|
24
|
-
return obj && obj.__esModule ? obj : {
|
|
25
|
-
default: obj
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
async function readFiles(filePaths, encoding = "utf8") {
|
|
29
|
-
const data = await Promise.all(filePaths.map((file)=>readFile(file.fullPath, encoding)));
|
|
30
|
-
return data;
|
|
31
|
-
}
|
|
32
|
-
async function readFile(filePath, encoding = "utf8") {
|
|
33
|
-
const data = await _promises.default.readFile(filePath, encoding);
|
|
34
|
-
return data;
|
|
35
|
-
}
|
|
36
|
-
async function readJsonFile(filePath, encoding = "utf8") {
|
|
37
|
-
const data = await readFile(filePath, encoding);
|
|
38
|
-
return JSON.parse(data);
|
|
39
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "removeDir", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return removeDir;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _promises = /*#__PURE__*/ _interop_require_default(require("node:fs/promises"));
|
|
12
|
-
function _interop_require_default(obj) {
|
|
13
|
-
return obj && obj.__esModule ? obj : {
|
|
14
|
-
default: obj
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
async function removeDir(path, options = {
|
|
18
|
-
recursive: false,
|
|
19
|
-
force: false
|
|
20
|
-
}) {
|
|
21
|
-
await _promises.default.rm(path, options);
|
|
22
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "FileEx", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return FileEx;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _readfile = require("../read-file.js");
|
|
12
|
-
class FileEx {
|
|
13
|
-
constructor(data){
|
|
14
|
-
this.fullPath = data.fullPath;
|
|
15
|
-
this.relativePath = data.relativePath ?? data.fullPath;
|
|
16
|
-
this.#content = data.content;
|
|
17
|
-
}
|
|
18
|
-
#content;
|
|
19
|
-
fullPath;
|
|
20
|
-
relativePath;
|
|
21
|
-
toString() {
|
|
22
|
-
return this.relativePath;
|
|
23
|
-
}
|
|
24
|
-
async getContent() {
|
|
25
|
-
if (this.#content != null) return this.#content;
|
|
26
|
-
return (0, _readfile.readFile)(this.fullPath);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
_export_star(require("./directory.type.js"), exports);
|
|
6
|
-
_export_star(require("./file.js"), exports);
|
|
7
|
-
function _export_star(from, to) {
|
|
8
|
-
Object.keys(from).forEach(function(k) {
|
|
9
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
10
|
-
Object.defineProperty(to, k, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function() {
|
|
13
|
-
return from[k];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
return from;
|
|
19
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
get fileUrlToPath () {
|
|
13
|
-
return fileUrlToPath;
|
|
14
|
-
},
|
|
15
|
-
get pathToFileUrl () {
|
|
16
|
-
return pathToFileUrl;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _nodeurl = require("node:url");
|
|
20
|
-
const fileUrlToPath = (url)=>{
|
|
21
|
-
try {
|
|
22
|
-
return (0, _nodeurl.fileURLToPath)(url);
|
|
23
|
-
} catch {
|
|
24
|
-
return url;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
const pathToFileUrl = (path)=>{
|
|
28
|
-
try {
|
|
29
|
-
return (0, _nodeurl.pathToFileURL)(path).toString();
|
|
30
|
-
} catch {
|
|
31
|
-
return path;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "writeFile", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return writeFile;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _promises = /*#__PURE__*/ _interop_require_default(require("node:fs/promises"));
|
|
12
|
-
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
13
|
-
function _interop_require_default(obj) {
|
|
14
|
-
return obj && obj.__esModule ? obj : {
|
|
15
|
-
default: obj
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
async function writeFile(filePath, content, options = {
|
|
19
|
-
encoding: "utf8",
|
|
20
|
-
mkdir: false
|
|
21
|
-
}) {
|
|
22
|
-
const { encoding, mkdir } = options;
|
|
23
|
-
if (mkdir) {
|
|
24
|
-
const directory = _nodepath.default.dirname(filePath);
|
|
25
|
-
await _promises.default.mkdir(directory, {
|
|
26
|
-
recursive: true
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
await _promises.default.writeFile(filePath, content, encoding);
|
|
30
|
-
}
|