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
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FileExtension = exports.TemplateEngine = void 0;
|
|
4
|
-
const sync_1 = require("../commons/io/sync");
|
|
5
|
-
const outlinecss_1 = require("../plugins/outlinecss");
|
|
6
|
-
var TemplateEngine;
|
|
7
|
-
(function (TemplateEngine) {
|
|
8
|
-
TemplateEngine["EJS"] = "ejs";
|
|
9
|
-
})(TemplateEngine || (exports.TemplateEngine = TemplateEngine = {}));
|
|
10
|
-
var FileExtension;
|
|
11
|
-
(function (FileExtension) {
|
|
12
|
-
FileExtension["HTML"] = "html";
|
|
13
|
-
})(FileExtension || (exports.FileExtension = FileExtension = {}));
|
|
14
|
-
const defaults = {
|
|
15
|
-
base: "/",
|
|
16
|
-
renderer: {
|
|
17
|
-
engine: "ejs",
|
|
18
|
-
extension: ".html"
|
|
19
|
-
},
|
|
20
|
-
directories: {
|
|
21
|
-
root: ".",
|
|
22
|
-
output: "./build",
|
|
23
|
-
public: "./source/public",
|
|
24
|
-
pages: "./source/pages",
|
|
25
|
-
styles: "./source/styles",
|
|
26
|
-
partials: "./source/templates/partials",
|
|
27
|
-
layouts: "./source/templates/layouts"
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
var Configuration;
|
|
31
|
-
(function (Configuration) {
|
|
32
|
-
Configuration.from = (configuration) => {
|
|
33
|
-
const renderer = {
|
|
34
|
-
...defaults.renderer,
|
|
35
|
-
...configuration.renderer
|
|
36
|
-
};
|
|
37
|
-
const directories = {
|
|
38
|
-
...defaults.directories,
|
|
39
|
-
...configuration.directories
|
|
40
|
-
};
|
|
41
|
-
return {
|
|
42
|
-
...defaults,
|
|
43
|
-
...configuration,
|
|
44
|
-
renderer: {
|
|
45
|
-
engine: renderer.engine,
|
|
46
|
-
extension: renderer.extension,
|
|
47
|
-
},
|
|
48
|
-
directories: Object.fromEntries(Object.entries(directories)
|
|
49
|
-
.map(([property, value]) => [property, sync_1.path.join(sync_1.path.cwd(), value)])),
|
|
50
|
-
plugins: [
|
|
51
|
-
outlinecss_1.default
|
|
52
|
-
]
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
})(Configuration || (Configuration = {}));
|
|
56
|
-
exports.default = Configuration;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare enum Event {
|
|
2
|
-
END = "end"
|
|
3
|
-
}
|
|
4
|
-
export type EventSubscriber = (...args: unknown[]) => void;
|
|
5
|
-
declare class EventEmitter {
|
|
6
|
-
private readonly events;
|
|
7
|
-
on(event: Event, subscriber: EventSubscriber): void;
|
|
8
|
-
off(event: Event, listener: EventSubscriber): void;
|
|
9
|
-
emit(event: Event, ...args: unknown[]): void;
|
|
10
|
-
once(event: Event, subscriber: EventSubscriber): void;
|
|
11
|
-
removeAllListeners(event?: Event): void;
|
|
12
|
-
}
|
|
13
|
-
export default EventEmitter;
|
|
14
|
-
//# sourceMappingURL=EventEmitter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["EventEmitter.ts"],"names":[],"mappings":"AAAA,oBAAY,KAAK;IACb,GAAG,QAAQ;CACd;AAED,MAAM,MAAM,eAAe,GACvB,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;AAGhC,cAAM,YAAY;IACd,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;IAE3D,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,eAAe,GAAG,IAAI;IAOnD,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,eAAe,GAAG,IAAI;IASlD,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM5C,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,eAAe,GAAG,IAAI;IAQrD,kBAAkB,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;CAOjD;AAGD,eAAe,YAAY,CAAA"}
|
package/lib/core/EventEmitter.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Event = void 0;
|
|
4
|
-
var Event;
|
|
5
|
-
(function (Event) {
|
|
6
|
-
Event["END"] = "end";
|
|
7
|
-
})(Event || (exports.Event = Event = {}));
|
|
8
|
-
class EventEmitter {
|
|
9
|
-
events = new Map();
|
|
10
|
-
on(event, subscriber) {
|
|
11
|
-
if (!this.events.has(event)) {
|
|
12
|
-
this.events.set(event, []);
|
|
13
|
-
}
|
|
14
|
-
this.events.get(event).push(subscriber);
|
|
15
|
-
}
|
|
16
|
-
off(event, listener) {
|
|
17
|
-
if (this.events.has(event)) {
|
|
18
|
-
this.events.set(event, this.events.get(event).filter((l) => l !== listener));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
emit(event, ...args) {
|
|
22
|
-
if (this.events.has(event)) {
|
|
23
|
-
this.events.get(event).forEach((listener) => listener(...args));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
once(event, subscriber) {
|
|
27
|
-
const onceWrapper = (...args) => {
|
|
28
|
-
this.off(event, onceWrapper);
|
|
29
|
-
subscriber(...args);
|
|
30
|
-
};
|
|
31
|
-
this.on(event, onceWrapper);
|
|
32
|
-
}
|
|
33
|
-
removeAllListeners(event) {
|
|
34
|
-
if (event) {
|
|
35
|
-
this.events.delete(event);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
this.events.clear();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.default = EventEmitter;
|
package/lib/core/Page.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Path, PathLike } from "../commons/io/sync/index";
|
|
2
|
-
export default class Page {
|
|
3
|
-
private readonly _path;
|
|
4
|
-
private readonly _content;
|
|
5
|
-
private readonly _layout;
|
|
6
|
-
private readonly _data;
|
|
7
|
-
static from(pathname: PathLike): Page;
|
|
8
|
-
constructor(pathname: PathLike, content: string, layout: string, data: Record<string, unknown>);
|
|
9
|
-
get path(): Path;
|
|
10
|
-
get content(): string;
|
|
11
|
-
get data(): Record<string, unknown>;
|
|
12
|
-
get layout(): string;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=Page.d.ts.map
|
package/lib/core/Page.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["Page.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAY,iCAA+B;AAGlE,MAAM,CAAC,OAAO,OAAO,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAM;IAC5B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;WAEjC,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;gBAMhC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAO9F,IAAW,IAAI,IAAI,IAAI,CAEtB;IAED,IAAW,OAAO,IAAI,MAAM,CAE3B;IAED,IAAW,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzC;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;CACJ"}
|
package/lib/core/Page.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const matter = require("gray-matter");
|
|
4
|
-
const index_1 = require("../commons/io/sync/index");
|
|
5
|
-
class Page {
|
|
6
|
-
_path;
|
|
7
|
-
_content;
|
|
8
|
-
_layout;
|
|
9
|
-
_data;
|
|
10
|
-
static from(pathname) {
|
|
11
|
-
const file = index_1.fs.read(pathname);
|
|
12
|
-
const { content, data: { layout, ...data } } = matter(file.content);
|
|
13
|
-
return new Page(pathname, content, layout, data);
|
|
14
|
-
}
|
|
15
|
-
constructor(pathname, content, layout, data) {
|
|
16
|
-
this._path = index_1.path.join(pathname);
|
|
17
|
-
this._content = content;
|
|
18
|
-
this._layout = layout;
|
|
19
|
-
this._data = data;
|
|
20
|
-
}
|
|
21
|
-
get path() {
|
|
22
|
-
return this._path;
|
|
23
|
-
}
|
|
24
|
-
get content() {
|
|
25
|
-
return this._content;
|
|
26
|
-
}
|
|
27
|
-
get data() {
|
|
28
|
-
return this._data;
|
|
29
|
-
}
|
|
30
|
-
get layout() {
|
|
31
|
-
return this._layout;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.default = Page;
|
package/lib/core/Plugin.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import Configuration from "./Configuration";
|
|
2
|
-
import EventEmitter from "./EventEmitter";
|
|
3
|
-
interface Plugin {
|
|
4
|
-
name: string;
|
|
5
|
-
install(events: EventEmitter, configuration: Configuration): any;
|
|
6
|
-
}
|
|
7
|
-
export declare const Signal: () => {
|
|
8
|
-
signal: Promise<unknown>;
|
|
9
|
-
resolve: (_?: unknown) => void;
|
|
10
|
-
reject: (_?: unknown) => void;
|
|
11
|
-
};
|
|
12
|
-
export default Plugin;
|
|
13
|
-
//# sourceMappingURL=Plugin.d.ts.map
|
package/lib/core/Plugin.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["Plugin.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,wBAA4B;AAChD,OAAO,YAAY,uBAA2B;AAG9C,UAAU,MAAM;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,GAAG,GAAG,CAAA;CACnE;AAED,eAAO,MAAM,MAAM;;kBACI,OAAO,KAAG,IAAI;iBACf,OAAO,KAAG,IAAI;CAMnC,CAAA;AAGD,eAAe,MAAM,CAAA"}
|
package/lib/core/Plugin.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Signal = void 0;
|
|
4
|
-
const Signal = () => {
|
|
5
|
-
let resolve = (_) => void 0, reject = (_) => void 0;
|
|
6
|
-
const signal = new Promise((_resolve, _reject) => {
|
|
7
|
-
resolve = _resolve;
|
|
8
|
-
reject = _reject;
|
|
9
|
-
});
|
|
10
|
-
return { signal, resolve, reject };
|
|
11
|
-
};
|
|
12
|
-
exports.Signal = Signal;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import Configuration from "../Configuration";
|
|
2
|
-
import Page from "../Page";
|
|
3
|
-
export default abstract class Renderer {
|
|
4
|
-
protected readonly _configuration: Configuration;
|
|
5
|
-
constructor(configuration: Configuration);
|
|
6
|
-
abstract render(page: Page): string;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=Renderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["Renderer.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,yBAA4B;AAChD,OAAO,IAAI,gBAAmB;AAG9B,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,QAAQ;IAClC,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAA;gBAEpC,aAAa,EAAE,aAAa;aAIxB,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;CAC7C"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { default as Renderer } from "./Renderer";
|
|
2
|
-
import Configuration from "../Configuration";
|
|
3
|
-
import Renderer from "./Renderer";
|
|
4
|
-
declare namespace RendererFactory {
|
|
5
|
-
const from: (configuration: Configuration) => Renderer;
|
|
6
|
-
}
|
|
7
|
-
export default RendererFactory;
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,aAAa,yBAA4B;AAEhD,OAAO,QAAQ,MAAM,YAAY,CAAA;AAGjC,kBAAU,eAAe,CAAC;IACf,MAAM,IAAI,GAAI,eAAe,aAAa,KAAG,QAOnD,CAAA;CACJ;AAGD,eAAe,eAAe,CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Renderer = void 0;
|
|
4
|
-
var Renderer_1 = require("./Renderer");
|
|
5
|
-
Object.defineProperty(exports, "Renderer", { enumerable: true, get: function () { return Renderer_1.default; } });
|
|
6
|
-
const EJSRenderer_1 = require("../../renderers/EJSRenderer");
|
|
7
|
-
var RendererFactory;
|
|
8
|
-
(function (RendererFactory) {
|
|
9
|
-
RendererFactory.from = (configuration) => {
|
|
10
|
-
const { engine } = configuration.renderer;
|
|
11
|
-
switch (engine) {
|
|
12
|
-
case EJSRenderer_1.default.engine:
|
|
13
|
-
default:
|
|
14
|
-
return new EJSRenderer_1.default(configuration);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
})(RendererFactory || (RendererFactory = {}));
|
|
18
|
-
exports.default = RendererFactory;
|
package/lib/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":""}
|
package/lib/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/lib/main.d.ts
DELETED
package/lib/main.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":"AASA,wBAAsB,IAAI,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBhE"}
|
package/lib/main.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.main = main;
|
|
4
|
-
const Configuration_1 = require("./core/Configuration");
|
|
5
|
-
const build_1 = require("./commands/build");
|
|
6
|
-
const serve_1 = require("./commands/serve");
|
|
7
|
-
const minimist = require("minimist");
|
|
8
|
-
const DEFAULT_OUTPUT = "./website-dist";
|
|
9
|
-
const DEFAULT_ENTRY = "./website";
|
|
10
|
-
async function main(...varargs) {
|
|
11
|
-
const options = minimist(varargs, {
|
|
12
|
-
alias: { o: "output", e: "entry", b: "base" },
|
|
13
|
-
default: { output: DEFAULT_OUTPUT, entry: DEFAULT_ENTRY, base: "/" }
|
|
14
|
-
});
|
|
15
|
-
const [command] = varargs;
|
|
16
|
-
const directories = {
|
|
17
|
-
root: ".",
|
|
18
|
-
output: options.output,
|
|
19
|
-
public: `${options.entry}/public`,
|
|
20
|
-
pages: `${options.entry}/pages`,
|
|
21
|
-
styles: `${options.entry}/styles`,
|
|
22
|
-
partials: `${options.entry}/templates/partials`,
|
|
23
|
-
layouts: `${options.entry}/templates/layouts`
|
|
24
|
-
};
|
|
25
|
-
const configuration = Configuration_1.default.from({ directories, base: options.base });
|
|
26
|
-
switch (command) {
|
|
27
|
-
default:
|
|
28
|
-
case "build":
|
|
29
|
-
return await (0, build_1.default)(configuration);
|
|
30
|
-
case "serve":
|
|
31
|
-
return (0, serve_1.default)(configuration);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
main(...process.argv.slice(2))
|
|
35
|
-
.then(code => console.log(code))
|
|
36
|
-
.catch(error => console.log(error));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"outlinecss.d.ts","sourceRoot":"","sources":["outlinecss.ts"],"names":[],"mappings":"AAAA,OAAO,MAAkB,uBAAqB;AAgB9C,QAAA,MAAM,MAAM,EAAE,MAqBb,CAAA;AAGD,eAAe,MAAM,CAAA"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const Plugin_1 = require("../core/Plugin");
|
|
4
|
-
const EventEmitter_1 = require("../core/EventEmitter");
|
|
5
|
-
const sync_1 = require("../commons/io/sync");
|
|
6
|
-
const requireFromParent = (moduleName) => {
|
|
7
|
-
try {
|
|
8
|
-
const modulePath = require.resolve(moduleName, { paths: [process.cwd()] });
|
|
9
|
-
return require(modulePath);
|
|
10
|
-
}
|
|
11
|
-
catch (err) {
|
|
12
|
-
console.error(`Module "${moduleName}" not found in parent package.`);
|
|
13
|
-
throw err;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
const plugin = {
|
|
17
|
-
name: "outlinecss",
|
|
18
|
-
install(emitter, configuration) {
|
|
19
|
-
const { signal, resolve } = (0, Plugin_1.Signal)();
|
|
20
|
-
emitter.on(EventEmitter_1.Event.END, async () => {
|
|
21
|
-
const { directories } = configuration;
|
|
22
|
-
const outline = requireFromParent("outlinecss");
|
|
23
|
-
if (outline) {
|
|
24
|
-
const entry = sync_1.path.join(directories.styles, "./main.scss").full;
|
|
25
|
-
const output = sync_1.path.join(directories.output, "assets", `${directories.styles.base}.css`).full;
|
|
26
|
-
const tokens = sync_1.path.join(directories.styles, "./tokens").full;
|
|
27
|
-
await outline.build({ entry, output, tokens });
|
|
28
|
-
resolve();
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return signal;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
exports.default = plugin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EJSRenderer.d.ts","sourceRoot":"","sources":["EJSRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,qBAAmB;AAC9B,OAAO,QAAQ,MAAM,2BAA2B,CAAA;AAIhD,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,QAAQ;IAC7C,gBAAuB,MAAM,SAAQ;IAE9B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;CA8BpC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const Renderer_1 = require("../core/Renderer/Renderer");
|
|
4
|
-
const index_1 = require("../commons/io/sync/index");
|
|
5
|
-
class EJSRenderer extends Renderer_1.default {
|
|
6
|
-
static engine = "ejs";
|
|
7
|
-
render(page) {
|
|
8
|
-
const { directories, renderer } = this._configuration;
|
|
9
|
-
const ejs = require(EJSRenderer.engine);
|
|
10
|
-
const [, ext] = page.layout.split(".");
|
|
11
|
-
const layout = index_1.fs.read(index_1.path.join(directories.layouts, page.layout)
|
|
12
|
-
.replace({ ext: ext ?? renderer.extension }));
|
|
13
|
-
const include = (pathname, data) => {
|
|
14
|
-
const [, ext] = pathname.split(".");
|
|
15
|
-
const file = index_1.fs.read(index_1.path.join(directories.partials, pathname)
|
|
16
|
-
.replace({ ext: ext ?? renderer.extension }));
|
|
17
|
-
return ejs.render(file.content, { ...page.data, ...data, include });
|
|
18
|
-
};
|
|
19
|
-
return ejs.render(layout.content, {
|
|
20
|
-
title: page.data.title ?? "",
|
|
21
|
-
body: ejs.render(page.content, { ...page.data, include }, {
|
|
22
|
-
views: [
|
|
23
|
-
String(directories.partials)
|
|
24
|
-
]
|
|
25
|
-
}),
|
|
26
|
-
include
|
|
27
|
-
}, {
|
|
28
|
-
views: [
|
|
29
|
-
String(directories.partials)
|
|
30
|
-
]
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.default = EJSRenderer;
|