@h3ravel/filesystem 0.2.0 → 0.2.1
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/dist/index.cjs +0 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -14
- package/dist/index.d.ts +1 -14
- package/dist/index.js +1 -42
- package/dist/index.js.map +1 -1
- package/package.json +4 -5
package/dist/index.cjs
CHANGED
|
@@ -23,12 +23,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
//#endregion
|
|
24
24
|
let __h3ravel_core = require("@h3ravel/core");
|
|
25
25
|
__h3ravel_core = __toESM(__h3ravel_core);
|
|
26
|
-
let fs_promises = require("fs/promises");
|
|
27
|
-
fs_promises = __toESM(fs_promises);
|
|
28
|
-
let escalade_sync = require("escalade/sync");
|
|
29
|
-
escalade_sync = __toESM(escalade_sync);
|
|
30
|
-
let path = require("path");
|
|
31
|
-
path = __toESM(path);
|
|
32
26
|
|
|
33
27
|
//#region src/Providers/FilesystemProvider.ts
|
|
34
28
|
/**
|
|
@@ -40,45 +34,6 @@ var FilesystemProvider = class extends __h3ravel_core.ServiceProvider {
|
|
|
40
34
|
register() {}
|
|
41
35
|
};
|
|
42
36
|
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/Utils/Helpers.ts
|
|
45
|
-
var Helpers = class {
|
|
46
|
-
static findModulePkg(moduleId, cwd) {
|
|
47
|
-
const parts = moduleId.replace(/\\/g, "/").split("/");
|
|
48
|
-
let packageName = "";
|
|
49
|
-
if (parts.length > 0 && parts[0][0] === "@") packageName += parts.shift() + "/";
|
|
50
|
-
packageName += parts.shift();
|
|
51
|
-
const packageJson = path.default.join(cwd ?? process.cwd(), "node_modules", packageName);
|
|
52
|
-
const resolved = this.findUpConfig(packageJson, "package", ["json"]);
|
|
53
|
-
if (!resolved) return;
|
|
54
|
-
return path.default.join(path.default.dirname(resolved), parts.join("/"));
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Check if file exists
|
|
58
|
-
*
|
|
59
|
-
* @param path
|
|
60
|
-
* @returns
|
|
61
|
-
*/
|
|
62
|
-
static async fileExists(path$2) {
|
|
63
|
-
try {
|
|
64
|
-
await (0, fs_promises.access)(path$2);
|
|
65
|
-
return true;
|
|
66
|
-
} catch {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
static findUpConfig(cwd, name, extensions) {
|
|
71
|
-
return (0, escalade_sync.default)(cwd, (_dir, names) => {
|
|
72
|
-
for (const ext of extensions) {
|
|
73
|
-
const filename = `${name}.${ext}`;
|
|
74
|
-
if (names.includes(filename)) return filename;
|
|
75
|
-
}
|
|
76
|
-
return false;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
37
|
//#endregion
|
|
82
38
|
exports.FilesystemProvider = FilesystemProvider;
|
|
83
|
-
exports.Helpers = Helpers;
|
|
84
39
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["ServiceProvider"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["ServiceProvider"],"sources":["../src/Providers/FilesystemProvider.ts"],"sourcesContent":["import { ServiceProvider } from '@h3ravel/core'\n\n/**\n * Sets up Filesystem management and lifecycle.\n * \n */\nexport class FilesystemProvider extends ServiceProvider {\n public static priority = 997\n\n register () {\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAa,qBAAb,cAAwCA,+BAAgB;CACpD,OAAc,WAAW;CAEzB,WAAY"}
|
package/dist/index.d.cts
CHANGED
|
@@ -11,18 +11,5 @@ declare class FilesystemProvider extends ServiceProvider {
|
|
|
11
11
|
register(): void;
|
|
12
12
|
}
|
|
13
13
|
//#endregion
|
|
14
|
-
|
|
15
|
-
declare class Helpers {
|
|
16
|
-
static findModulePkg(moduleId: string, cwd?: string): string | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Check if file exists
|
|
19
|
-
*
|
|
20
|
-
* @param path
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
|
-
static fileExists(path: string): Promise<boolean>;
|
|
24
|
-
static findUpConfig(cwd: string, name: string, extensions: string[]): string | void;
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
export { FilesystemProvider, Helpers };
|
|
14
|
+
export { FilesystemProvider };
|
|
28
15
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -11,18 +11,5 @@ declare class FilesystemProvider extends ServiceProvider {
|
|
|
11
11
|
register(): void;
|
|
12
12
|
}
|
|
13
13
|
//#endregion
|
|
14
|
-
|
|
15
|
-
declare class Helpers {
|
|
16
|
-
static findModulePkg(moduleId: string, cwd?: string): string | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Check if file exists
|
|
19
|
-
*
|
|
20
|
-
* @param path
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
|
-
static fileExists(path: string): Promise<boolean>;
|
|
24
|
-
static findUpConfig(cwd: string, name: string, extensions: string[]): string | void;
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
export { FilesystemProvider, Helpers };
|
|
14
|
+
export { FilesystemProvider };
|
|
28
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { ServiceProvider } from "@h3ravel/core";
|
|
2
|
-
import { access } from "fs/promises";
|
|
3
|
-
import escalade from "escalade/sync";
|
|
4
|
-
import path from "path";
|
|
5
2
|
|
|
6
3
|
//#region src/Providers/FilesystemProvider.ts
|
|
7
4
|
/**
|
|
@@ -14,43 +11,5 @@ var FilesystemProvider = class extends ServiceProvider {
|
|
|
14
11
|
};
|
|
15
12
|
|
|
16
13
|
//#endregion
|
|
17
|
-
|
|
18
|
-
var Helpers = class {
|
|
19
|
-
static findModulePkg(moduleId, cwd) {
|
|
20
|
-
const parts = moduleId.replace(/\\/g, "/").split("/");
|
|
21
|
-
let packageName = "";
|
|
22
|
-
if (parts.length > 0 && parts[0][0] === "@") packageName += parts.shift() + "/";
|
|
23
|
-
packageName += parts.shift();
|
|
24
|
-
const packageJson = path.join(cwd ?? process.cwd(), "node_modules", packageName);
|
|
25
|
-
const resolved = this.findUpConfig(packageJson, "package", ["json"]);
|
|
26
|
-
if (!resolved) return;
|
|
27
|
-
return path.join(path.dirname(resolved), parts.join("/"));
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Check if file exists
|
|
31
|
-
*
|
|
32
|
-
* @param path
|
|
33
|
-
* @returns
|
|
34
|
-
*/
|
|
35
|
-
static async fileExists(path$1) {
|
|
36
|
-
try {
|
|
37
|
-
await access(path$1);
|
|
38
|
-
return true;
|
|
39
|
-
} catch {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
static findUpConfig(cwd, name, extensions) {
|
|
44
|
-
return escalade(cwd, (_dir, names) => {
|
|
45
|
-
for (const ext of extensions) {
|
|
46
|
-
const filename = `${name}.${ext}`;
|
|
47
|
-
if (names.includes(filename)) return filename;
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
//#endregion
|
|
55
|
-
export { FilesystemProvider, Helpers };
|
|
14
|
+
export { FilesystemProvider };
|
|
56
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/Providers/FilesystemProvider.ts"],"sourcesContent":["import { ServiceProvider } from '@h3ravel/core'\n\n/**\n * Sets up Filesystem management and lifecycle.\n * \n */\nexport class FilesystemProvider extends ServiceProvider {\n public static priority = 997\n\n register () {\n }\n}\n"],"mappings":";;;;;;;AAMA,IAAa,qBAAb,cAAwC,gBAAgB;CACpD,OAAc,WAAW;CAEzB,WAAY"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/filesystem",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Filesystem manager for H3ravel.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,12 +37,11 @@
|
|
|
37
37
|
"filesystem"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"
|
|
41
|
-
"@h3ravel/support": "^0.10.0"
|
|
42
|
-
"@h3ravel/shared": "^0.19.0"
|
|
40
|
+
"@h3ravel/shared": "^0.20.0",
|
|
41
|
+
"@h3ravel/support": "^0.10.0"
|
|
43
42
|
},
|
|
44
43
|
"peerDependencies": {
|
|
45
|
-
"@h3ravel/core": "^1.9.
|
|
44
|
+
"@h3ravel/core": "^1.9.1"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
47
|
"typescript": "^5.4.0"
|