webanvil 0.0.6 → 0.0.7
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/LICENSE +21 -21
- package/README.md +490 -38
- package/bin/webanvil +6 -0
- package/bin/webanvil.cmd +2 -0
- package/dist/_chunks/commands.mjs +1867 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +30 -0
- package/dist/index.d.mts +646 -0
- package/dist/index.mjs +5 -0
- package/package.json +96 -60
- package/bin/run +0 -3
- package/bin/run.cmd +0 -3
- package/lib/commands/build.d.ts +0 -3
- package/lib/commands/build.d.ts.map +0 -1
- package/lib/commands/build.js +0 -34
- package/lib/commands/serve.d.ts +0 -3
- package/lib/commands/serve.d.ts.map +0 -1
- package/lib/commands/serve.js +0 -44
- package/lib/commons/io/core/File.d.ts +0 -11
- package/lib/commons/io/core/File.d.ts.map +0 -1
- package/lib/commons/io/core/File.js +0 -23
- package/lib/commons/io/core/Path.d.ts +0 -30
- package/lib/commons/io/core/Path.d.ts.map +0 -1
- package/lib/commons/io/core/Path.js +0 -122
- package/lib/commons/io/sync/fs.d.ts +0 -11
- package/lib/commons/io/sync/fs.d.ts.map +0 -1
- package/lib/commons/io/sync/fs.js +0 -46
- package/lib/commons/io/sync/index.d.ts +0 -5
- package/lib/commons/io/sync/index.d.ts.map +0 -1
- package/lib/commons/io/sync/index.js +0 -9
- package/lib/commons/io/sync/path.d.ts +0 -4
- package/lib/commons/io/sync/path.d.ts.map +0 -1
- package/lib/commons/io/sync/path.js +0 -13
- package/lib/core/Configuration.d.ts +0 -37
- package/lib/core/Configuration.d.ts.map +0 -1
- package/lib/core/Configuration.js +0 -56
- package/lib/core/EventEmitter.d.ts +0 -14
- package/lib/core/EventEmitter.d.ts.map +0 -1
- package/lib/core/EventEmitter.js +0 -42
- package/lib/core/Page.d.ts +0 -14
- package/lib/core/Page.d.ts.map +0 -1
- package/lib/core/Page.js +0 -34
- package/lib/core/Plugin.d.ts +0 -13
- package/lib/core/Plugin.d.ts.map +0 -1
- package/lib/core/Plugin.js +0 -12
- package/lib/core/Renderer/Renderer.d.ts +0 -8
- package/lib/core/Renderer/Renderer.d.ts.map +0 -1
- package/lib/core/Renderer/Renderer.js +0 -9
- package/lib/core/Renderer/index.d.ts +0 -8
- package/lib/core/Renderer/index.d.ts.map +0 -1
- package/lib/core/Renderer/index.js +0 -18
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -1
- package/lib/main.d.ts +0 -2
- package/lib/main.d.ts.map +0 -1
- package/lib/main.js +0 -36
- package/lib/plugins/outlinecss.d.ts +0 -4
- package/lib/plugins/outlinecss.d.ts.map +0 -1
- package/lib/plugins/outlinecss.js +0 -34
- package/lib/renderers/EJSRenderer.d.ts +0 -7
- package/lib/renderers/EJSRenderer.d.ts.map +0 -1
- package/lib/renderers/EJSRenderer.js +0 -34
package/package.json
CHANGED
|
@@ -1,60 +1,96 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "webanvil",
|
|
3
|
+
"version": "0.0.7",
|
|
4
|
+
"description": "A unified CLI for building, testing, linting, formatting, and type-checking JavaScript and TypeScript projects.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"build-tool",
|
|
7
|
+
"cli",
|
|
8
|
+
"javascript",
|
|
9
|
+
"rolldown",
|
|
10
|
+
"typescript",
|
|
11
|
+
"vite",
|
|
12
|
+
"vitest"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://mzpkdev.github.io/webanvil/",
|
|
15
|
+
"bugs": "https://github.com/mzpkdev/webanvil/issues",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": {
|
|
18
|
+
"name": "Mateusz Pietrzak",
|
|
19
|
+
"email": "mateusz@mzpk.dev",
|
|
20
|
+
"url": "https://github.com/mzpkdev"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/mzpkdev/webanvil.git"
|
|
25
|
+
},
|
|
26
|
+
"bin": {
|
|
27
|
+
"wa": "bin/webanvil",
|
|
28
|
+
"webanvil": "bin/webanvil"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"bin",
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
35
|
+
"type": "module",
|
|
36
|
+
"main": "./dist/index.mjs",
|
|
37
|
+
"types": "./dist/index.d.mts",
|
|
38
|
+
"exports": {
|
|
39
|
+
".": {
|
|
40
|
+
"types": "./dist/index.d.mts",
|
|
41
|
+
"import": "./dist/index.mjs",
|
|
42
|
+
"default": "./dist/index.mjs"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public",
|
|
47
|
+
"registry": "https://registry.npmjs.org/"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "obuild",
|
|
51
|
+
"prepack": "npm run build",
|
|
52
|
+
"pretest": "npm run build",
|
|
53
|
+
"test": "vitest run --passWithNoTests --config vitest.repo.config.ts",
|
|
54
|
+
"test:watch": "vitest",
|
|
55
|
+
"typecheck": "npm run build && node bin/webanvil typecheck",
|
|
56
|
+
"lint": "npm run build && node bin/webanvil lint",
|
|
57
|
+
"lint:fix": "npm run build && node bin/webanvil lint --fix",
|
|
58
|
+
"format": "npm run build && node bin/webanvil format",
|
|
59
|
+
"format:check": "npm run build && node bin/webanvil format --check",
|
|
60
|
+
"check": "npm run typecheck && npm run lint && npm run format:check && npm test"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"@types/node": "^26.1.1",
|
|
64
|
+
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
65
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
66
|
+
"@vitest/ui": "^4.1.10",
|
|
67
|
+
"c12": "^4.0.0-beta.5",
|
|
68
|
+
"cmdore": "^0.4.1",
|
|
69
|
+
"consola": "^3.4.2",
|
|
70
|
+
"defu": "^6.1.7",
|
|
71
|
+
"execa": "^9.6.1",
|
|
72
|
+
"get-tsconfig": "5.0.0-beta.5",
|
|
73
|
+
"jsdom": "^29.1.1",
|
|
74
|
+
"mlly": "^1.8.2",
|
|
75
|
+
"oxfmt": "0.60.0",
|
|
76
|
+
"oxlint": "1.75.0",
|
|
77
|
+
"pathe": "^2.0.3",
|
|
78
|
+
"pkg-types": "^2.3.1",
|
|
79
|
+
"rolldown": "1.2.0",
|
|
80
|
+
"rolldown-plugin-dts": "0.27.13",
|
|
81
|
+
"semver": "7.8.5",
|
|
82
|
+
"tinyglobby": "^0.2.15",
|
|
83
|
+
"typescript": "6.0.3",
|
|
84
|
+
"vite": "8.1.5",
|
|
85
|
+
"vitest": "4.1.10",
|
|
86
|
+
"yaml": "^2.9.0",
|
|
87
|
+
"zod": "^4.4.3"
|
|
88
|
+
},
|
|
89
|
+
"devDependencies": {
|
|
90
|
+
"obuild": "^0.4.38",
|
|
91
|
+
"unplugin": "^3.3.0"
|
|
92
|
+
},
|
|
93
|
+
"engines": {
|
|
94
|
+
"node": "^22.18.0 || >=24.11.0"
|
|
95
|
+
}
|
|
96
|
+
}
|
package/bin/run
DELETED
package/bin/run.cmd
DELETED
package/lib/commands/build.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["build.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,8BAA4B;AAMhD,wBAA8B,KAAK,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BjF"}
|
package/lib/commands/build.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = build;
|
|
4
|
-
const sync_1 = require("../commons/io/sync");
|
|
5
|
-
const Renderer_1 = require("../core/Renderer");
|
|
6
|
-
const Page_1 = require("../core/Page");
|
|
7
|
-
const EventEmitter_1 = require("../core/EventEmitter");
|
|
8
|
-
async function build(configuration) {
|
|
9
|
-
const pages = sync_1.fs.deepdir(configuration.directories.pages)
|
|
10
|
-
.filter(pathname => pathname.base.includes(configuration.renderer.extension))
|
|
11
|
-
.map(pathname => Page_1.default.from(pathname));
|
|
12
|
-
const renderer = Renderer_1.default.from(configuration);
|
|
13
|
-
const emitter = new EventEmitter_1.default();
|
|
14
|
-
const signals = [];
|
|
15
|
-
for (const plugin of configuration.plugins) {
|
|
16
|
-
signals.push(plugin.install(emitter, configuration));
|
|
17
|
-
}
|
|
18
|
-
sync_1.fs.rm(configuration.directories.output);
|
|
19
|
-
for (const page of pages) {
|
|
20
|
-
const html = renderer.render(page);
|
|
21
|
-
const output = page.path
|
|
22
|
-
.replace(configuration.directories.pages, "");
|
|
23
|
-
if (output.base === "index.html") {
|
|
24
|
-
sync_1.fs.write(sync_1.path.join(configuration.directories.output, output), html);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
sync_1.fs.write(sync_1.path.join(configuration.directories.output, output.dir, output.name, "index.html"), html);
|
|
28
|
-
}
|
|
29
|
-
sync_1.fs.cp(configuration.directories.public, configuration.directories.output);
|
|
30
|
-
}
|
|
31
|
-
emitter.emit(EventEmitter_1.Event.END);
|
|
32
|
-
await Promise.all(signals);
|
|
33
|
-
return 0;
|
|
34
|
-
}
|
package/lib/commands/serve.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["serve.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,8BAA4B;AAIhD,wBAA8B,KAAK,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAiCjF"}
|
package/lib/commands/serve.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = serve;
|
|
4
|
-
const bs = require("browser-sync");
|
|
5
|
-
const index_1 = require("../commons/io/sync/index");
|
|
6
|
-
const build_1 = require("./build");
|
|
7
|
-
async function serve(configuration) {
|
|
8
|
-
await (0, build_1.default)(configuration);
|
|
9
|
-
const browser = bs.create();
|
|
10
|
-
const rebuild = async () => {
|
|
11
|
-
return (0, build_1.default)(configuration);
|
|
12
|
-
};
|
|
13
|
-
const reload = async () => {
|
|
14
|
-
browser.reload();
|
|
15
|
-
};
|
|
16
|
-
browser.watch(index_1.path.join(configuration.directories.public, `**/*`).full)
|
|
17
|
-
.on("change", run(reload));
|
|
18
|
-
browser.watch(index_1.path.join(configuration.directories.pages, `**/*`).full)
|
|
19
|
-
.on("change", run(rebuild, reload));
|
|
20
|
-
browser.watch(index_1.path.join(configuration.directories.partials, `**/*`).full)
|
|
21
|
-
.on("change", run(rebuild, reload));
|
|
22
|
-
browser.watch(index_1.path.join(configuration.directories.layouts, `**/*`).full)
|
|
23
|
-
.on("change", run(rebuild, reload));
|
|
24
|
-
browser.watch(index_1.path.join(configuration.directories.styles, `**/*`).full)
|
|
25
|
-
.on("change", run(rebuild, reload));
|
|
26
|
-
browser.init({
|
|
27
|
-
server: {
|
|
28
|
-
baseDir: configuration.directories.output.full,
|
|
29
|
-
routes: {
|
|
30
|
-
[configuration.base]: configuration.directories.output.full
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
startPath: configuration.base,
|
|
34
|
-
open: false
|
|
35
|
-
});
|
|
36
|
-
return new Promise(() => void 0);
|
|
37
|
-
}
|
|
38
|
-
const run = (...jobs) => {
|
|
39
|
-
return (...varargs) => {
|
|
40
|
-
return jobs.reduce((accumulator, job) => {
|
|
41
|
-
return accumulator.then(job);
|
|
42
|
-
}, Promise.resolve(varargs[0]));
|
|
43
|
-
};
|
|
44
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import Path from "./Path";
|
|
2
|
-
export default class File {
|
|
3
|
-
private readonly _path;
|
|
4
|
-
private readonly _content;
|
|
5
|
-
constructor(path: Path, content: string);
|
|
6
|
-
get path(): Path;
|
|
7
|
-
get content(): string;
|
|
8
|
-
toString(): string;
|
|
9
|
-
valueOf(): string;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=File.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"File.d.ts","sourceRoot":"","sources":["File.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAA;AAGzB,MAAM,CAAC,OAAO,OAAO,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAM;IAC5B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;gBAErB,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM;IAKvC,IAAW,IAAI,IAAI,IAAI,CAEtB;IAED,IAAW,OAAO,IAAI,MAAM,CAE3B;IAEM,QAAQ;IAIR,OAAO,IAAI,MAAM;CAG3B"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class File {
|
|
4
|
-
_path;
|
|
5
|
-
_content;
|
|
6
|
-
constructor(path, content) {
|
|
7
|
-
this._path = path;
|
|
8
|
-
this._content = content;
|
|
9
|
-
}
|
|
10
|
-
get path() {
|
|
11
|
-
return this._path;
|
|
12
|
-
}
|
|
13
|
-
get content() {
|
|
14
|
-
return this._content;
|
|
15
|
-
}
|
|
16
|
-
toString() {
|
|
17
|
-
return this.content;
|
|
18
|
-
}
|
|
19
|
-
valueOf() {
|
|
20
|
-
return this.toString();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.default = File;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as nodeutil from "util";
|
|
2
|
-
export type PathStruct = {
|
|
3
|
-
dir?: string;
|
|
4
|
-
name?: string;
|
|
5
|
-
ext?: string;
|
|
6
|
-
};
|
|
7
|
-
export type PathLike = Path | string;
|
|
8
|
-
export default class Path {
|
|
9
|
-
private readonly _dir;
|
|
10
|
-
private readonly _name;
|
|
11
|
-
private readonly _ext;
|
|
12
|
-
static from(path: PathLike | PathStruct, ...segments: PathLike[]): Path;
|
|
13
|
-
constructor(pathname: string);
|
|
14
|
-
replace(path: PathLike | PathStruct, replaceValue?: string): Path;
|
|
15
|
-
join(...segments: PathLike[]): Path;
|
|
16
|
-
from(to: PathLike): Path;
|
|
17
|
-
to(from: PathLike): Path;
|
|
18
|
-
get full(): string;
|
|
19
|
-
get base(): string;
|
|
20
|
-
get name(): string;
|
|
21
|
-
set name(value: string);
|
|
22
|
-
get ext(): string;
|
|
23
|
-
set ext(value: string);
|
|
24
|
-
get dir(): string;
|
|
25
|
-
set dir(value: string);
|
|
26
|
-
toString(): string;
|
|
27
|
-
valueOf(): string;
|
|
28
|
-
[nodeutil.inspect.custom](): string;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=Path.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Path.d.ts","sourceRoot":"","sources":["Path.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,MAAM,CAAA;AAGhC,MAAM,MAAM,UAAU,GAClB;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEjD,MAAM,MAAM,QAAQ,GAChB,IAAI,GAAG,MAAM,CAAA;AAEjB,MAAM,CAAC,OAAO,OAAO,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAQ;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAQ;WAEf,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI;gBAelE,QAAQ,EAAE,MAAM;IAOrB,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI;IAiBjE,IAAI,CAAC,GAAG,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI;IAInC,IAAI,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI;IAIxB,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAI/B,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,IAAI,CAAC,KAAK,EAAE,MAAM,EAE5B;IAED,IAAW,GAAG,IAAI,MAAM,CAEvB;IAED,IAAW,GAAG,CAAC,KAAK,EAAE,MAAM,EAE3B;IAED,IAAW,GAAG,IAAI,MAAM,CAEvB;IAED,IAAW,GAAG,CAAC,KAAK,EAAE,MAAM,EAE3B;IAwCM,QAAQ;IAIR,OAAO,IAAI,MAAM;IAIjB,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM;CAG7C"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const nodepath = require("path");
|
|
4
|
-
const nodeutil = require("util");
|
|
5
|
-
class Path {
|
|
6
|
-
_dir;
|
|
7
|
-
_name;
|
|
8
|
-
_ext;
|
|
9
|
-
static from(path, ...segments) {
|
|
10
|
-
if (path instanceof Path) {
|
|
11
|
-
return segments.reduce((pathname, segment) => pathname.join(segment), path);
|
|
12
|
-
}
|
|
13
|
-
else if (typeof path === "string") {
|
|
14
|
-
return new Path(nodepath.join(path, ...segments.map(String)));
|
|
15
|
-
}
|
|
16
|
-
else if (typeof path === "object") {
|
|
17
|
-
return new Path(nodepath.join(path.dir ?? "", `${path.name ?? ""}${path.ext ?? ""}`));
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
throw new TypeError("[TODO] Invalid pathname");
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
constructor(pathname) {
|
|
24
|
-
const { dir, name, ext } = nodepath.parse(pathname);
|
|
25
|
-
this._dir = dir;
|
|
26
|
-
this._name = name;
|
|
27
|
-
this._ext = ext;
|
|
28
|
-
}
|
|
29
|
-
replace(path, replaceValue) {
|
|
30
|
-
if (path instanceof Path || typeof path === "string") {
|
|
31
|
-
return new Path(String(this.full)
|
|
32
|
-
.replace(String(path), replaceValue ?? ""));
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
let { dir, name, ext } = path;
|
|
36
|
-
if (ext?.charAt(0) === ".") {
|
|
37
|
-
ext = ext.slice(1);
|
|
38
|
-
}
|
|
39
|
-
return new Path(nodepath.join(dir ?? this._dir, `${name ?? this._name}.${ext ?? this._ext}`));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
join(...segments) {
|
|
43
|
-
return new Path(nodepath.join(this.full, ...segments.map(String)));
|
|
44
|
-
}
|
|
45
|
-
from(to) {
|
|
46
|
-
return new Path(nodepath.relative(String(this), String(to)));
|
|
47
|
-
}
|
|
48
|
-
to(from) {
|
|
49
|
-
return new Path(nodepath.relative(String(from), String(this)));
|
|
50
|
-
}
|
|
51
|
-
get full() {
|
|
52
|
-
return nodepath.join(this._dir, this.base);
|
|
53
|
-
}
|
|
54
|
-
get base() {
|
|
55
|
-
return `${this._name}${this._ext}`;
|
|
56
|
-
}
|
|
57
|
-
get name() {
|
|
58
|
-
return this._name;
|
|
59
|
-
}
|
|
60
|
-
set name(value) {
|
|
61
|
-
this.replace({ name: value });
|
|
62
|
-
}
|
|
63
|
-
get ext() {
|
|
64
|
-
return this._ext;
|
|
65
|
-
}
|
|
66
|
-
set ext(value) {
|
|
67
|
-
this.replace({ ext: value });
|
|
68
|
-
}
|
|
69
|
-
get dir() {
|
|
70
|
-
return this._dir;
|
|
71
|
-
}
|
|
72
|
-
set dir(value) {
|
|
73
|
-
this.replace({ dir: value });
|
|
74
|
-
}
|
|
75
|
-
// public path(): string {
|
|
76
|
-
// return nodepath.join(this._dir, this.base())
|
|
77
|
-
// }
|
|
78
|
-
//
|
|
79
|
-
// public base(): string {
|
|
80
|
-
// return `${this._name}${this._ext}`
|
|
81
|
-
// }
|
|
82
|
-
//
|
|
83
|
-
// public name(): string
|
|
84
|
-
// public name(value: string): Path
|
|
85
|
-
// public name(value?: string): PathLike {
|
|
86
|
-
// if (value) {
|
|
87
|
-
// return this.replace({ name: value })
|
|
88
|
-
// } else {
|
|
89
|
-
// return this._name
|
|
90
|
-
// }
|
|
91
|
-
// }
|
|
92
|
-
//
|
|
93
|
-
// public ext(): string
|
|
94
|
-
// public ext(value: string): Path
|
|
95
|
-
// public ext(value?: string): PathLike {
|
|
96
|
-
// if (value) {
|
|
97
|
-
// return this.replace({ ext: value })
|
|
98
|
-
// } else {
|
|
99
|
-
// return this._ext
|
|
100
|
-
// }
|
|
101
|
-
// }
|
|
102
|
-
//
|
|
103
|
-
// public dir(): string
|
|
104
|
-
// public dir(value: string): Path
|
|
105
|
-
// public dir(value?: string): PathLike {
|
|
106
|
-
// if (value) {
|
|
107
|
-
// return this.replace({ dir: value })
|
|
108
|
-
// } else {
|
|
109
|
-
// return this._dir
|
|
110
|
-
// }
|
|
111
|
-
// }
|
|
112
|
-
toString() {
|
|
113
|
-
return this.full;
|
|
114
|
-
}
|
|
115
|
-
valueOf() {
|
|
116
|
-
return this.toString();
|
|
117
|
-
}
|
|
118
|
-
[nodeutil.inspect.custom]() {
|
|
119
|
-
return this.valueOf();
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
exports.default = Path;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import Path, { PathLike } from "../core/Path";
|
|
2
|
-
import File from "../core/File";
|
|
3
|
-
export declare const dir: (path: PathLike) => Path[];
|
|
4
|
-
export declare const deepdir: (path: PathLike) => Path[];
|
|
5
|
-
export declare const mkdir: (path: PathLike) => void;
|
|
6
|
-
export declare const exists: (path: PathLike) => boolean;
|
|
7
|
-
export declare const read: (path: PathLike) => File;
|
|
8
|
-
export declare const write: (path: PathLike, content: string) => void;
|
|
9
|
-
export declare const rm: (path: PathLike) => void;
|
|
10
|
-
export declare const cp: (source: PathLike, destination: PathLike) => void;
|
|
11
|
-
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["fs.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,IAAI,MAAM,cAAc,CAAA;AAG/B,eAAO,MAAM,GAAG,GAAI,MAAM,QAAQ,KAAG,IAAI,EAGxC,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,MAAM,QAAQ,KAAG,IAAI,EAG5C,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,MAAM,QAAQ,KAAG,IAEtC,CAAA;AAED,eAAO,MAAM,MAAM,GAAI,MAAM,QAAQ,KAAG,OAEvC,CAAA;AAED,eAAO,MAAM,IAAI,GAAI,MAAM,QAAQ,KAAG,IAGrC,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,MAAM,QAAQ,EAAE,SAAS,MAAM,KAAG,IAGvD,CAAA;AAED,eAAO,MAAM,EAAE,GAAI,MAAM,QAAQ,KAAG,IAInC,CAAA;AAED,eAAO,MAAM,EAAE,GAAI,QAAQ,QAAQ,EAAE,aAAa,QAAQ,SAIzD,CAAA"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cp = exports.rm = exports.write = exports.read = exports.exists = exports.mkdir = exports.deepdir = exports.dir = void 0;
|
|
4
|
-
const nodefs = require("fs");
|
|
5
|
-
const Path_1 = require("../core/Path");
|
|
6
|
-
const File_1 = require("../core/File");
|
|
7
|
-
const dir = (path) => {
|
|
8
|
-
const dirents = nodefs.readdirSync(String(path), { encoding: "utf-8" });
|
|
9
|
-
return dirents.map(dirent => Path_1.default.from(path, dirent));
|
|
10
|
-
};
|
|
11
|
-
exports.dir = dir;
|
|
12
|
-
const deepdir = (path) => {
|
|
13
|
-
const dirents = nodefs.readdirSync(String(path), { encoding: "utf-8", recursive: true });
|
|
14
|
-
return dirents.map(dirent => Path_1.default.from(path, dirent));
|
|
15
|
-
};
|
|
16
|
-
exports.deepdir = deepdir;
|
|
17
|
-
const mkdir = (path) => {
|
|
18
|
-
nodefs.mkdirSync(String(path), { recursive: true });
|
|
19
|
-
};
|
|
20
|
-
exports.mkdir = mkdir;
|
|
21
|
-
const exists = (path) => {
|
|
22
|
-
return nodefs.existsSync(String(path));
|
|
23
|
-
};
|
|
24
|
-
exports.exists = exists;
|
|
25
|
-
const read = (path) => {
|
|
26
|
-
const content = nodefs.readFileSync(String(path), "utf-8");
|
|
27
|
-
return new File_1.default(Path_1.default.from(path), content);
|
|
28
|
-
};
|
|
29
|
-
exports.read = read;
|
|
30
|
-
const write = (path, content) => {
|
|
31
|
-
(0, exports.mkdir)(Path_1.default.from(path).dir);
|
|
32
|
-
nodefs.writeFileSync(String(path), content, "utf-8");
|
|
33
|
-
};
|
|
34
|
-
exports.write = write;
|
|
35
|
-
const rm = (path) => {
|
|
36
|
-
if ((0, exports.exists)(path)) {
|
|
37
|
-
nodefs.rmSync(String(path), { recursive: true });
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
exports.rm = rm;
|
|
41
|
-
const cp = (source, destination) => {
|
|
42
|
-
if ((0, exports.exists)(source)) {
|
|
43
|
-
nodefs.cpSync(String(source), String(destination), { recursive: true });
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
exports.cp = cp;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAExD,OAAO,KAAK,EAAE,MAAM,MAAM,CAAA;AAC1B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.path = exports.fs = exports.Path = exports.File = void 0;
|
|
4
|
-
var File_1 = require("../core/File");
|
|
5
|
-
Object.defineProperty(exports, "File", { enumerable: true, get: function () { return File_1.default; } });
|
|
6
|
-
var Path_1 = require("../core/Path");
|
|
7
|
-
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return Path_1.default; } });
|
|
8
|
-
exports.fs = require("./fs");
|
|
9
|
-
exports.path = require("./path");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["path.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAG7C,eAAO,MAAM,GAAG,YAEf,CAAA;AAED,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,QAAQ,EAAE,SAEvC,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.join = exports.cwd = void 0;
|
|
4
|
-
const nodepath = require("path");
|
|
5
|
-
const Path_1 = require("../core/Path");
|
|
6
|
-
const cwd = () => {
|
|
7
|
-
return new Path_1.default(process.cwd());
|
|
8
|
-
};
|
|
9
|
-
exports.cwd = cwd;
|
|
10
|
-
const join = (...path) => {
|
|
11
|
-
return new Path_1.default(nodepath.join(...path.map(String)));
|
|
12
|
-
};
|
|
13
|
-
exports.join = join;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Path } from "../commons/io/sync";
|
|
2
|
-
import Plugin from "./Plugin";
|
|
3
|
-
export declare enum TemplateEngine {
|
|
4
|
-
EJS = "ejs"
|
|
5
|
-
}
|
|
6
|
-
export declare enum FileExtension {
|
|
7
|
-
HTML = "html"
|
|
8
|
-
}
|
|
9
|
-
export type RendererConfiguration = {
|
|
10
|
-
engine: TemplateEngine;
|
|
11
|
-
extension: FileExtension;
|
|
12
|
-
};
|
|
13
|
-
export type DirectoriesConfiguration = {
|
|
14
|
-
root: Path;
|
|
15
|
-
output: Path;
|
|
16
|
-
public: Path;
|
|
17
|
-
pages: Path;
|
|
18
|
-
styles: Path;
|
|
19
|
-
partials: Path;
|
|
20
|
-
layouts: Path;
|
|
21
|
-
};
|
|
22
|
-
type Configuration = {
|
|
23
|
-
renderer: RendererConfiguration;
|
|
24
|
-
directories: DirectoriesConfiguration;
|
|
25
|
-
plugins: Plugin[];
|
|
26
|
-
base: string;
|
|
27
|
-
};
|
|
28
|
-
export type PlainConfiguration = {
|
|
29
|
-
base: string;
|
|
30
|
-
renderer: Record<keyof RendererConfiguration, string>;
|
|
31
|
-
directories: Record<keyof DirectoriesConfiguration, string>;
|
|
32
|
-
};
|
|
33
|
-
declare namespace Configuration {
|
|
34
|
-
const from: (configuration: Partial<PlainConfiguration>) => Configuration;
|
|
35
|
-
}
|
|
36
|
-
export default Configuration;
|
|
37
|
-
//# sourceMappingURL=Configuration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Configuration.d.ts","sourceRoot":"","sources":["Configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,IAAI,EAAE,2BAAyB;AAC9C,OAAO,MAAM,iBAAqB;AAIlC,oBAAY,cAAc;IACtB,GAAG,QAAQ;CACd;AAED,oBAAY,aAAa;IACrB,IAAI,SAAS;CAChB;AAED,MAAM,MAAM,qBAAqB,GAAG;IAChC,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,aAAa,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACnC,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,EAAE,IAAI,CAAA;IACZ,MAAM,EAAE,IAAI,CAAA;IACZ,KAAK,EAAE,IAAI,CAAA;IACX,MAAM,EAAE,IAAI,CAAA;IACZ,QAAQ,EAAE,IAAI,CAAA;IACd,OAAO,EAAE,IAAI,CAAA;CAChB,CAAA;AAED,KAAK,aAAa,GAAG;IACjB,QAAQ,EAAE,qBAAqB,CAAA;IAC/B,WAAW,EAAE,wBAAwB,CAAA;IACrC,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAC,MAAM,qBAAqB,EAAE,MAAM,CAAC,CAAA;IACrD,WAAW,EAAE,MAAM,CAAC,MAAM,wBAAwB,EAAE,MAAM,CAAC,CAAA;CAC9D,CAAA;AAmBD,kBAAU,aAAa,CAAC;IACb,MAAM,IAAI,GAAI,eAAe,OAAO,CAAC,kBAAkB,CAAC,KAAG,aAuBjE,CAAA;CACJ;AAGD,eAAe,aAAa,CAAA"}
|