plggmatic 0.0.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/README.md +89 -0
- package/dist/App/model/AppError.d.ts +31 -0
- package/dist/App/model/AppError.d.ts.map +1 -0
- package/dist/App/model/AppOptions.d.ts +31 -0
- package/dist/App/model/AppOptions.d.ts.map +1 -0
- package/dist/Build/usecase/build.d.ts +48 -0
- package/dist/Build/usecase/build.d.ts.map +1 -0
- package/dist/Cli/usecase/resolveOptions.d.ts +27 -0
- package/dist/Cli/usecase/resolveOptions.d.ts.map +1 -0
- package/dist/Cli/usecase/runApp.d.ts +39 -0
- package/dist/Cli/usecase/runApp.d.ts.map +1 -0
- package/dist/Config/usecase/fixtures/invalid.config.d.ts +5 -0
- package/dist/Config/usecase/fixtures/invalid.config.d.ts.map +1 -0
- package/dist/Config/usecase/fixtures/named-only.config.d.ts +2 -0
- package/dist/Config/usecase/fixtures/named-only.config.d.ts.map +1 -0
- package/dist/Config/usecase/fixtures/throws.config.d.ts +2 -0
- package/dist/Config/usecase/fixtures/throws.config.d.ts.map +1 -0
- package/dist/Config/usecase/fixtures/valid.config.d.ts +5 -0
- package/dist/Config/usecase/fixtures/valid.config.d.ts.map +1 -0
- package/dist/Config/usecase/loadConfig.d.ts +15 -0
- package/dist/Config/usecase/loadConfig.d.ts.map +1 -0
- package/dist/Routing/usecase/buildRouter.d.ts +17 -0
- package/dist/Routing/usecase/buildRouter.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +465 -0
- package/dist/ssg.d.ts +2 -0
- package/dist/ssg.d.ts.map +1 -0
- package/dist/ssg.es.js +54 -0
- package/dist/style.d.ts +2 -0
- package/dist/style.d.ts.map +1 -0
- package/dist/style.es.js +98 -0
- package/package.json +60 -0
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# plggmatic
|
|
2
|
+
|
|
3
|
+
> **UNSTABLE** - Experimental study work. Part of the [plgg monorepo](../../README.md).
|
|
4
|
+
|
|
5
|
+
A **pre-organized, composable full-stack web-application
|
|
6
|
+
framework**, built on the plgg family. It supplies the
|
|
7
|
+
framework-generic parts — config loading, a router builder,
|
|
8
|
+
static-build orchestration, and a pre-organized CLI — and
|
|
9
|
+
wraps the mid-library surfaces, so an app supplies only its
|
|
10
|
+
own content and render specifics and depends on plggmatic
|
|
11
|
+
(plus the [`plgg`](../plgg/) foundation) alone.
|
|
12
|
+
|
|
13
|
+
## Why this package exists
|
|
14
|
+
|
|
15
|
+
A site generator like [`plggpress`](../plggpress/) and a
|
|
16
|
+
bespoke app share the same skeleton: load a config, build a
|
|
17
|
+
router, run a static build or serve. plggmatic extracts that
|
|
18
|
+
skeleton so each app writes only what makes it distinct:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
plgg ─┬─ plgg-http ─ plgg-server ─┐
|
|
22
|
+
├─ plgg-view ───────────────┤
|
|
23
|
+
├─ plgg-md ─────────────────┼─ plggmatic ── plggpress
|
|
24
|
+
├─ plgg-highlight ──────────┤
|
|
25
|
+
└─ plgg-cli ────────────────┘
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Dev / hot-reload is deliberately **not** here — that is a
|
|
29
|
+
toolchain concern owned by [`plgg-bundle`](../plgg-bundle/)'s
|
|
30
|
+
`dev` server.
|
|
31
|
+
|
|
32
|
+
## The facade boundary (amended)
|
|
33
|
+
|
|
34
|
+
plggmatic originally drew a thinner line — "the framework
|
|
35
|
+
never renders" — and depended only on
|
|
36
|
+
[`plgg-http`](../plgg-http/) / [`plgg-server`](../plgg-server/)
|
|
37
|
+
/ [`plgg-cli`](../plgg-cli/). That boundary was deliberately
|
|
38
|
+
amended: the framework now also wraps
|
|
39
|
+
[`plgg-view`](../plgg-view/), [`plgg-md`](../plgg-md/), and
|
|
40
|
+
[`plgg-highlight`](../plgg-highlight/), re-exporting their
|
|
41
|
+
full surfaces so a consumer imports the whole stack's
|
|
42
|
+
vocabulary from one place and its dependency list collapses
|
|
43
|
+
to `{plgg, plggmatic}`. The wrap is a **pure re-export** — no
|
|
44
|
+
behavior accretes in the facade, so each mid-library stays
|
|
45
|
+
independently rebuildable behind it.
|
|
46
|
+
|
|
47
|
+
Two subpath vocabularies mirror the wrapped packages'
|
|
48
|
+
own entries:
|
|
49
|
+
|
|
50
|
+
- `plggmatic/ssg` — [`plgg-server/ssg`](../plgg-server/), the
|
|
51
|
+
node-only static-site seam (kept off the runtime-neutral
|
|
52
|
+
root barrel).
|
|
53
|
+
- `plggmatic/style` — [`plgg-view/style`](../plgg-view/), the
|
|
54
|
+
inline-style utilities whose Tailwind-style names (`p`,
|
|
55
|
+
`text`, …) would collide with the Html element builders.
|
|
56
|
+
|
|
57
|
+
Nine names exist in two wrapped libraries with different
|
|
58
|
+
meanings; the root barrel resolves them to the
|
|
59
|
+
**page-authoring (plgg-view) variant**: `head`, `header`,
|
|
60
|
+
`on`, `link`, `strong`, `table`, `text$`, `ListItem`,
|
|
61
|
+
`TableRow`. The shadowed variants (plgg-server's HEAD-route
|
|
62
|
+
`head`, context `header`, route-matcher `on`; plgg-md's AST
|
|
63
|
+
constructors and node types) remain reachable from their own
|
|
64
|
+
packages.
|
|
65
|
+
|
|
66
|
+
## How it's organized
|
|
67
|
+
|
|
68
|
+
- **Config** — `loadConfig` reads and validates an app's
|
|
69
|
+
config across the untrusted boundary.
|
|
70
|
+
- **Routing** — `buildRouter` assembles a
|
|
71
|
+
[`plgg-server`](../plgg-server/) router from the app's page
|
|
72
|
+
set.
|
|
73
|
+
- **Build** — `build` runs a `BuildSpec` to emit the static
|
|
74
|
+
site, returning a `BuildReport`.
|
|
75
|
+
- **App** — `AppOptions` / `BuildReport` and the
|
|
76
|
+
`ConfigLoadError` vocabulary.
|
|
77
|
+
- **Cli** — `runApp` + `resolveOptions` are the pre-organized
|
|
78
|
+
`argv` → build/serve entrypoint, built on
|
|
79
|
+
[`plgg-cli`](../plgg-cli/).
|
|
80
|
+
|
|
81
|
+
plggmatic is ESM-only (no CJS entry).
|
|
82
|
+
|
|
83
|
+
## Conventions
|
|
84
|
+
|
|
85
|
+
- `as` / `any` / `ts-ignore` are prohibited (see root
|
|
86
|
+
`CLAUDE.md`); config crosses into the typed core through one
|
|
87
|
+
validating boundary.
|
|
88
|
+
- After editing a `file:`-linked dependency's source, rebuild
|
|
89
|
+
its `dist` or this package won't see new exports.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Box, type SoftStr, type Option, type InvalidError } from "plgg";
|
|
2
|
+
/**
|
|
3
|
+
* A failure while loading the consumer app's config
|
|
4
|
+
* module: the file was missing, threw on import, or its
|
|
5
|
+
* default export did not validate through the app-supplied
|
|
6
|
+
* caster. `cause` carries the underlying {@link
|
|
7
|
+
* InvalidError} when the failure was a validation miss.
|
|
8
|
+
* Result-style, so config loading never throws.
|
|
9
|
+
*/
|
|
10
|
+
export type ConfigLoadError = Box<"ConfigLoadError", {
|
|
11
|
+
message: SoftStr;
|
|
12
|
+
cause: Option<InvalidError>;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Constructs a {@link ConfigLoadError}. `cause` is the
|
|
16
|
+
* validation error when present.
|
|
17
|
+
*/
|
|
18
|
+
export declare const configLoadError: ({ message, cause, }: {
|
|
19
|
+
message: SoftStr;
|
|
20
|
+
cause?: InvalidError;
|
|
21
|
+
}) => ConfigLoadError;
|
|
22
|
+
/**
|
|
23
|
+
* Pattern matcher for folding a {@link ConfigLoadError}
|
|
24
|
+
* with `match` by tag.
|
|
25
|
+
*/
|
|
26
|
+
export declare const configLoadError$: () => {
|
|
27
|
+
__tag: "ConfigLoadError";
|
|
28
|
+
type: "tag";
|
|
29
|
+
body: undefined;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=AppError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppError.d.ts","sourceRoot":"","sources":["../../../src/App/model/AppError.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,YAAY,EAIlB,MAAM,MAAM,CAAC;AAEd;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,GAAG,CAC/B,iBAAiB,EACjB;IACE,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;CAC7B,CACF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,qBAG7B;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB,KAAG,eAIA,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;CACC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type SoftStr } from "plgg";
|
|
2
|
+
/**
|
|
3
|
+
* The resolved inputs a single framework `build`/`dev` run
|
|
4
|
+
* operates on — the framework-generic generalization of an
|
|
5
|
+
* app's run-input contract. The pre-organized CLI fills
|
|
6
|
+
* these from cwd defaults + flags; the programmatic API
|
|
7
|
+
* takes them directly. Pure data, and deliberately free of
|
|
8
|
+
* any app-specific config type: the app closes its own
|
|
9
|
+
* validated config over the router factory it hands the
|
|
10
|
+
* framework, so {@link AppOptions} stays generic.
|
|
11
|
+
*
|
|
12
|
+
* - `contentDir` — root of the authored content corpus.
|
|
13
|
+
* - `outDir` — where the built site is written.
|
|
14
|
+
* - `assetsDir` — static files copied verbatim.
|
|
15
|
+
* - `base` — the deploy base path (e.g. `/plgg/`).
|
|
16
|
+
*/
|
|
17
|
+
export type AppOptions = Readonly<{
|
|
18
|
+
contentDir: SoftStr;
|
|
19
|
+
outDir: SoftStr;
|
|
20
|
+
assetsDir: SoftStr;
|
|
21
|
+
base: SoftStr;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* The outcome of a successful `build`: where it wrote and
|
|
25
|
+
* the output paths it emitted.
|
|
26
|
+
*/
|
|
27
|
+
export type BuildReport = Readonly<{
|
|
28
|
+
outDir: SoftStr;
|
|
29
|
+
pages: ReadonlyArray<SoftStr>;
|
|
30
|
+
}>;
|
|
31
|
+
//# sourceMappingURL=AppOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppOptions.d.ts","sourceRoot":"","sources":["../../../src/App/model/AppOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CAC/B,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type SoftStr, type PromisedResult, type Defect, type Option } from "plgg";
|
|
2
|
+
import { type Web } from "plgg-server";
|
|
3
|
+
import { type SsgError } from "plgg-server/ssg";
|
|
4
|
+
import { type AppOptions, type BuildReport } from "../../App/model/AppOptions";
|
|
5
|
+
/**
|
|
6
|
+
* The app-supplied pieces a static build needs from its
|
|
7
|
+
* consumer:
|
|
8
|
+
*
|
|
9
|
+
* - `router` — a factory turning the discovered route set
|
|
10
|
+
* into a plgg-server {@link Web} app (the app's
|
|
11
|
+
* content→render→layout specifics, assembled via
|
|
12
|
+
* {@link buildRouter}).
|
|
13
|
+
* - `notFoundHtml` — the already-rendered 404 body written
|
|
14
|
+
* as `outDir/404.html` (the framework never renders — the
|
|
15
|
+
* app owns its theme).
|
|
16
|
+
* - `linkCheck` — an OPTIONAL policy run after discovery
|
|
17
|
+
* and BEFORE anything is written, so a broken link fails
|
|
18
|
+
* the build as data; `none()` skips it.
|
|
19
|
+
*/
|
|
20
|
+
export type BuildSpec<E> = Readonly<{
|
|
21
|
+
router: (paths: ReadonlyArray<SoftStr>) => Web;
|
|
22
|
+
notFoundHtml: SoftStr;
|
|
23
|
+
linkCheck: Option<(paths: ReadonlyArray<SoftStr>) => PromisedResult<unknown, E>>;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Build the static site from a content corpus into
|
|
27
|
+
* `opts.outDir`, as one typed transform pipeline that
|
|
28
|
+
* never throws:
|
|
29
|
+
*
|
|
30
|
+
* 1. {@link discoverPaths} crawls the corpus for route
|
|
31
|
+
* paths;
|
|
32
|
+
* 1b. the optional `spec.linkCheck` validates the routes
|
|
33
|
+
* BEFORE anything is written — an `Err` (an app-typed
|
|
34
|
+
* `E`) fails the build;
|
|
35
|
+
* 2. {@link generateStatic} renders every path through the
|
|
36
|
+
* app's `spec.router` and writes each to
|
|
37
|
+
* `outDir/<path>/index.html`;
|
|
38
|
+
* 3. {@link copyAssets} mirrors `assetsDir` verbatim;
|
|
39
|
+
* 4. {@link write404} persists `spec.notFoundHtml` as
|
|
40
|
+
* `outDir/404.html`.
|
|
41
|
+
*
|
|
42
|
+
* The framework owns the orchestration; the app supplies
|
|
43
|
+
* the router factory, the 404 body, and any link-check
|
|
44
|
+
* policy. The error channel folds to
|
|
45
|
+
* `SsgError | Defect | E` at the edge.
|
|
46
|
+
*/
|
|
47
|
+
export declare const build: <E>(opts: AppOptions, spec: BuildSpec<E>) => PromisedResult<BuildReport, SsgError | Defect | E>;
|
|
48
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/Build/usecase/build.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAEZ,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,MAAM,EAKZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,KAAK,QAAQ,EAKd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,gCAAgC,CAAC;AAExC;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,QAAQ,CAAC;IAClC,MAAM,EAAE,CACN,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAC1B,GAAG,CAAC;IACT,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,MAAM,CACf,CACE,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAC1B,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAChC,CAAC;CACH,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EACrB,MAAM,UAAU,EAChB,MAAM,SAAS,CAAC,CAAC,CAAC,KACjB,cAAc,CACf,WAAW,EACX,QAAQ,GAAG,MAAM,GAAG,CAAC,CAkFpB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type SoftStr } from "plgg";
|
|
2
|
+
import { type Invocation } from "plgg-cli";
|
|
3
|
+
import { type AppOptions } from "../../App/model/AppOptions";
|
|
4
|
+
/**
|
|
5
|
+
* The app-specific bit the framework cannot derive from
|
|
6
|
+
* cwd + flags: the deploy `base`, read from the app's
|
|
7
|
+
* validated config. The framework fills every other
|
|
8
|
+
* {@link AppOptions} field.
|
|
9
|
+
*/
|
|
10
|
+
export type AppRunContext = Readonly<{
|
|
11
|
+
base: SoftStr;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* The config path for this run: `--config <path>` or the
|
|
15
|
+
* cwd default `configFile` (the app names its own default,
|
|
16
|
+
* e.g. `site.config.ts`).
|
|
17
|
+
*/
|
|
18
|
+
export declare const configPathOf: (invocation: Invocation, configFile: SoftStr) => SoftStr;
|
|
19
|
+
/**
|
|
20
|
+
* Resolve {@link AppOptions} from cwd defaults, the parsed
|
|
21
|
+
* invocation flags, and the app's {@link AppRunContext}.
|
|
22
|
+
* `contentDir` defaults to cwd, `outDir` to `<cwd>/dist`,
|
|
23
|
+
* `assetsDir` to `<contentDir>/public`; `base` and
|
|
24
|
+
* `allowedHosts` come from the app config via `ctx`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const resolveOptions: (invocation: Invocation, ctx: AppRunContext) => AppOptions;
|
|
27
|
+
//# sourceMappingURL=resolveOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveOptions.d.ts","sourceRoot":"","sources":["../../../src/Cli/usecase/resolveOptions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EAGb,MAAM,MAAM,CAAC;AACd,OAAO,EACL,KAAK,UAAU,EAEhB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;IACnC,IAAI,EAAE,OAAO,CAAC;CACf,CAAC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY,GACvB,YAAY,UAAU,EACtB,YAAY,OAAO,KAClB,OAIA,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GACzB,YAAY,UAAU,EACtB,KAAK,aAAa,KACjB,UAeF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type SoftStr, type Defect, type PromisedResult } from "plgg";
|
|
2
|
+
import { type SsgError } from "plgg-server/ssg";
|
|
3
|
+
import { type AppOptions } from "../../App/model/AppOptions";
|
|
4
|
+
import { type ConfigLoadError } from "../../App/model/AppError";
|
|
5
|
+
import { type BuildSpec } from "../../Build/usecase/build";
|
|
6
|
+
import { type AppRunContext } from "./resolveOptions";
|
|
7
|
+
/**
|
|
8
|
+
* The declaration an app hands the framework to get a
|
|
9
|
+
* pre-organized `build`/`dev` CLI: how to load + validate
|
|
10
|
+
* its config, how to map that config to the app-specific
|
|
11
|
+
* run context (deploy base + dev hosts) and the build/dev
|
|
12
|
+
* specs (router factory, 404 body, link-check), and how to
|
|
13
|
+
* render its error union as a one-line shell message. The
|
|
14
|
+
* framework brings all the wiring — argv parsing, command
|
|
15
|
+
* dispatch, the usage banner, and the `Result`→exit-code
|
|
16
|
+
* fold — so an app's `cli.ts` stays a thin declaration.
|
|
17
|
+
*/
|
|
18
|
+
export type AppDefinition<Config, E> = Readonly<{
|
|
19
|
+
name: SoftStr;
|
|
20
|
+
description: SoftStr;
|
|
21
|
+
/** default config filename (e.g. `site.config.ts`). */
|
|
22
|
+
configFile: SoftStr;
|
|
23
|
+
loadConfig: (path: SoftStr) => PromisedResult<Config, ConfigLoadError>;
|
|
24
|
+
context: (config: Config) => AppRunContext;
|
|
25
|
+
buildSpec: (config: Config, opts: AppOptions) => BuildSpec<E>;
|
|
26
|
+
formatError: (e: SsgError | Defect | E) => SoftStr;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* The pre-organized CLI: wire a plgg-cli `build` program
|
|
30
|
+
* onto the framework build from an {@link AppDefinition},
|
|
31
|
+
* and hand it to plgg-cli's {@link runCli} (which owns argv
|
|
32
|
+
* parsing, dispatch, the usage banner, and the
|
|
33
|
+
* `Result`→exit-code fold). An app's `cli.ts` is then just
|
|
34
|
+
* `await runApp(definition)`. Dev/hot-reload is a toolchain
|
|
35
|
+
* concern (`plgg-bundle dev`), not the framework's, so
|
|
36
|
+
* there is no `dev` command.
|
|
37
|
+
*/
|
|
38
|
+
export declare const runApp: <Config, E>(def: AppDefinition<Config, E>) => Promise<void>;
|
|
39
|
+
//# sourceMappingURL=runApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runApp.d.ts","sourceRoot":"","sources":["../../../src/Cli/usecase/runApp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,MAAM,EAEX,KAAK,cAAc,EAIpB,MAAM,MAAM,CAAC;AASd,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,KAAK,UAAU,EAEhB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EACL,KAAK,SAAS,EAEf,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,sCAAsC,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,aAAa,CAAC,MAAM,EAAE,CAAC,IAAI,QAAQ,CAAC;IAC9C,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,uDAAuD;IACvD,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,CACV,IAAI,EAAE,OAAO,KACV,cAAc,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC7C,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,aAAa,CAAC;IAC3C,SAAS,EAAE,CACT,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,UAAU,KACb,SAAS,CAAC,CAAC,CAAC,CAAC;IAClB,WAAW,EAAE,CACX,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,CAAC,KACrB,OAAO,CAAC;CACd,CAAC,CAAC;AAyEH;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,GAAI,MAAM,EAAE,CAAC,EAC9B,KAAK,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,KAC5B,OAAO,CAAC,IAAI,CAed,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invalid.config.d.ts","sourceRoot":"","sources":["../../../../src/Config/usecase/fixtures/invalid.config.ts"],"names":[],"mappings":";;;AAGA,wBAEE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"named-only.config.d.ts","sourceRoot":"","sources":["../../../../src/Config/usecase/fixtures/named-only.config.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throws.config.d.ts","sourceRoot":"","sources":["../../../../src/Config/usecase/fixtures/throws.config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valid.config.d.ts","sourceRoot":"","sources":["../../../../src/Config/usecase/fixtures/valid.config.ts"],"names":[],"mappings":";;;AAEA,wBAEE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type SoftStr, type PromisedResult, type Result, type InvalidError } from "plgg";
|
|
2
|
+
import { type ConfigLoadError } from "../../App/model/AppError";
|
|
3
|
+
/**
|
|
4
|
+
* Load and validate the consumer app's config module from
|
|
5
|
+
* a path, through the app-supplied boundary `cast`. The TS
|
|
6
|
+
* source is loaded through the dynamic `import` Node strips
|
|
7
|
+
* types on (the same hook the app's bin registers), so no
|
|
8
|
+
* separate transpile step is needed. A missing file or an
|
|
9
|
+
* import-time throw becomes a typed {@link ConfigLoadError}
|
|
10
|
+
* — config loading never throws. The framework owns the
|
|
11
|
+
* import + default-pick + typed-error machinery; the app
|
|
12
|
+
* supplies its own config schema via `cast`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const loadConfig: <T>(path: SoftStr, cast: (value: unknown) => Result<T, InvalidError>) => PromisedResult<T, ConfigLoadError>;
|
|
15
|
+
//# sourceMappingURL=loadConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadConfig.d.ts","sourceRoot":"","sources":["../../../src/Config/usecase/loadConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,YAAY,EAKlB,MAAM,MAAM,CAAC;AACd,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,8BAA8B,CAAC;AA2CtC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,EAC1B,MAAM,OAAO,EACb,MAAM,CACJ,KAAK,EAAE,OAAO,KACX,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,KAC3B,cAAc,CAAC,CAAC,EAAE,eAAe,CAgBjC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type SoftStr } from "plgg";
|
|
2
|
+
import { type Web, type Handler } from "plgg-server";
|
|
3
|
+
/**
|
|
4
|
+
* The framework-generic ROUTER BUILDER: fold a discovered
|
|
5
|
+
* route set into a plgg-server {@link Web} app, binding
|
|
6
|
+
* ONE GET route per path to the single app-supplied
|
|
7
|
+
* {@link Handler}. Because the handler reads the request
|
|
8
|
+
* path from its {@link Context}, one handler serves every
|
|
9
|
+
* registered route — the app supplies its own
|
|
10
|
+
* content-source + renderer + layout inside that handler;
|
|
11
|
+
* the framework owns only the assembly. Built data-last
|
|
12
|
+
* over the paths through `web()`/`get()`, so feeding the
|
|
13
|
+
* same `paths` to `generateStatic` renders exactly the
|
|
14
|
+
* routes registered here.
|
|
15
|
+
*/
|
|
16
|
+
export declare const buildRouter: (paths: ReadonlyArray<SoftStr>, handler: Handler) => Web;
|
|
17
|
+
//# sourceMappingURL=buildRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildRouter.d.ts","sourceRoot":"","sources":["../../../src/Routing/usecase/buildRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EAGb,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,GACtB,OAAO,aAAa,CAAC,OAAO,CAAC,EAC7B,SAAS,OAAO,KACf,GAKA,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { type AppOptions, type BuildReport, } from "./App/model/AppOptions";
|
|
2
|
+
export { type ConfigLoadError, configLoadError, configLoadError$, } from "./App/model/AppError";
|
|
3
|
+
export { loadConfig } from "./Config/usecase/loadConfig";
|
|
4
|
+
export { buildRouter } from "./Routing/usecase/buildRouter";
|
|
5
|
+
export { type BuildSpec, build, } from "./Build/usecase/build";
|
|
6
|
+
export { type AppRunContext, configPathOf, resolveOptions, } from "./Cli/usecase/resolveOptions";
|
|
7
|
+
export { type AppDefinition, runApp, } from "./Cli/usecase/runApp";
|
|
8
|
+
export * from "plgg-view";
|
|
9
|
+
export * from "plgg-server";
|
|
10
|
+
export * from "plgg-http";
|
|
11
|
+
export * from "plgg-md";
|
|
12
|
+
export * from "plgg-highlight";
|
|
13
|
+
export { head, header, on, link, strong, table, text$, type ListItem, type TableRow, } from "plgg-view";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,KAAK,eAAe,EACpB,eAAe,EACf,gBAAgB,GACjB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEpE,OAAO,EACL,KAAK,SAAS,EACd,KAAK,GACN,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,KAAK,aAAa,EAClB,YAAY,EACZ,cAAc,GACf,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,KAAK,aAAa,EAClB,MAAM,GACP,MAAM,8BAA8B,CAAC;AAMtC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAW/B,OAAO,EACL,IAAI,EACJ,MAAM,EACN,EAAE,EACF,IAAI,EACJ,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAK,QAAQ,EACb,KAAK,QAAQ,GACd,MAAM,WAAW,CAAC"}
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
import * as __ext0 from "node:path";
|
|
2
|
+
import * as __ext1 from "node:url";
|
|
3
|
+
import * as __ext2 from "plgg";
|
|
4
|
+
import * as __ext3 from "plgg-cli";
|
|
5
|
+
import * as __ext4 from "plgg-highlight";
|
|
6
|
+
import * as __ext5 from "plgg-http";
|
|
7
|
+
import * as __ext6 from "plgg-md";
|
|
8
|
+
import * as __ext7 from "plgg-server";
|
|
9
|
+
import * as __ext8 from "plgg-server/ssg";
|
|
10
|
+
import * as __ext9 from "plgg-view";
|
|
11
|
+
const __externals = {
|
|
12
|
+
"node:path": __ext0,
|
|
13
|
+
"node:url": __ext1,
|
|
14
|
+
"plgg": __ext2,
|
|
15
|
+
"plgg-cli": __ext3,
|
|
16
|
+
"plgg-highlight": __ext4,
|
|
17
|
+
"plgg-http": __ext5,
|
|
18
|
+
"plgg-md": __ext6,
|
|
19
|
+
"plgg-server": __ext7,
|
|
20
|
+
"plgg-server/ssg": __ext8,
|
|
21
|
+
"plgg-view": __ext9
|
|
22
|
+
};
|
|
23
|
+
const __modules = {
|
|
24
|
+
"src/index.ts": function (module, exports, require) {
|
|
25
|
+
"use strict";
|
|
26
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27
|
+
if (k2 === undefined) k2 = k;
|
|
28
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
29
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
30
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(o, k2, desc);
|
|
33
|
+
}) : (function(o, m, k, k2) {
|
|
34
|
+
if (k2 === undefined) k2 = k;
|
|
35
|
+
o[k2] = m[k];
|
|
36
|
+
}));
|
|
37
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
38
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.text$ = exports.table = exports.strong = exports.link = exports.on = exports.header = exports.head = exports.runApp = exports.resolveOptions = exports.configPathOf = exports.build = exports.buildRouter = exports.loadConfig = exports.configLoadError$ = exports.configLoadError = void 0;
|
|
42
|
+
var AppError_1 = require("src/App/model/AppError.ts");
|
|
43
|
+
Object.defineProperty(exports, "configLoadError", { enumerable: true, get: function () { return AppError_1.configLoadError; } });
|
|
44
|
+
Object.defineProperty(exports, "configLoadError$", { enumerable: true, get: function () { return AppError_1.configLoadError$; } });
|
|
45
|
+
var loadConfig_1 = require("src/Config/usecase/loadConfig.ts");
|
|
46
|
+
Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return loadConfig_1.loadConfig; } });
|
|
47
|
+
var buildRouter_1 = require("src/Routing/usecase/buildRouter.ts");
|
|
48
|
+
Object.defineProperty(exports, "buildRouter", { enumerable: true, get: function () { return buildRouter_1.buildRouter; } });
|
|
49
|
+
var build_1 = require("src/Build/usecase/build.ts");
|
|
50
|
+
Object.defineProperty(exports, "build", { enumerable: true, get: function () { return build_1.build; } });
|
|
51
|
+
var resolveOptions_1 = require("src/Cli/usecase/resolveOptions.ts");
|
|
52
|
+
Object.defineProperty(exports, "configPathOf", { enumerable: true, get: function () { return resolveOptions_1.configPathOf; } });
|
|
53
|
+
Object.defineProperty(exports, "resolveOptions", { enumerable: true, get: function () { return resolveOptions_1.resolveOptions; } });
|
|
54
|
+
var runApp_1 = require("src/Cli/usecase/runApp.ts");
|
|
55
|
+
Object.defineProperty(exports, "runApp", { enumerable: true, get: function () { return runApp_1.runApp; } });
|
|
56
|
+
__exportStar(require("plgg-view"), exports);
|
|
57
|
+
__exportStar(require("plgg-server"), exports);
|
|
58
|
+
__exportStar(require("plgg-http"), exports);
|
|
59
|
+
__exportStar(require("plgg-md"), exports);
|
|
60
|
+
__exportStar(require("plgg-highlight"), exports);
|
|
61
|
+
var plgg_view_1 = require("plgg-view");
|
|
62
|
+
Object.defineProperty(exports, "head", { enumerable: true, get: function () { return plgg_view_1.head; } });
|
|
63
|
+
Object.defineProperty(exports, "header", { enumerable: true, get: function () { return plgg_view_1.header; } });
|
|
64
|
+
Object.defineProperty(exports, "on", { enumerable: true, get: function () { return plgg_view_1.on; } });
|
|
65
|
+
Object.defineProperty(exports, "link", { enumerable: true, get: function () { return plgg_view_1.link; } });
|
|
66
|
+
Object.defineProperty(exports, "strong", { enumerable: true, get: function () { return plgg_view_1.strong; } });
|
|
67
|
+
Object.defineProperty(exports, "table", { enumerable: true, get: function () { return plgg_view_1.table; } });
|
|
68
|
+
Object.defineProperty(exports, "text$", { enumerable: true, get: function () { return plgg_view_1.text$; } });
|
|
69
|
+
|
|
70
|
+
},
|
|
71
|
+
"src/App/model/AppError.ts": function (module, exports, require) {
|
|
72
|
+
"use strict";
|
|
73
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
74
|
+
exports.configLoadError$ = exports.configLoadError = void 0;
|
|
75
|
+
const plgg_1 = require("plgg");
|
|
76
|
+
const configLoadError = ({ message, cause, }) => (0, plgg_1.box)("ConfigLoadError")({
|
|
77
|
+
message,
|
|
78
|
+
cause: (0, plgg_1.fromNullable)(cause),
|
|
79
|
+
});
|
|
80
|
+
exports.configLoadError = configLoadError;
|
|
81
|
+
const configLoadError$ = () => (0, plgg_1.pattern)("ConfigLoadError")();
|
|
82
|
+
exports.configLoadError$ = configLoadError$;
|
|
83
|
+
|
|
84
|
+
},
|
|
85
|
+
"src/Config/usecase/loadConfig.ts": function (module, exports, require) {
|
|
86
|
+
"use strict";
|
|
87
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88
|
+
exports.loadConfig = void 0;
|
|
89
|
+
const node_path_1 = require("node:path");
|
|
90
|
+
const node_url_1 = require("node:url");
|
|
91
|
+
const plgg_1 = require("plgg");
|
|
92
|
+
const AppError_1 = require("src/App/model/AppError.ts");
|
|
93
|
+
const pickDefault = (mod) => typeof mod === "object" &&
|
|
94
|
+
mod !== null &&
|
|
95
|
+
"default" in mod
|
|
96
|
+
? mod.default
|
|
97
|
+
: mod;
|
|
98
|
+
const validate = (path, cast, value) => (0, plgg_1.pipe)(cast(value), (0, plgg_1.matchResult)((e) => (0, plgg_1.err)((0, AppError_1.configLoadError)({
|
|
99
|
+
message: `invalid config at ${path}: ${e.content.message}`,
|
|
100
|
+
cause: e,
|
|
101
|
+
})), (cfg) => (0, plgg_1.ok)(cfg)));
|
|
102
|
+
const loadConfig = (path, cast) => Promise.resolve(`${(0, node_url_1.pathToFileURL)((0, node_path_1.resolve)(path)).href}`).then(s => require(s)).then((mod) => validate(path, cast, pickDefault(mod)), (reason) => (0, plgg_1.err)((0, AppError_1.configLoadError)({
|
|
103
|
+
message: `failed to load config at ${path}: ${reason instanceof Error
|
|
104
|
+
? reason.message
|
|
105
|
+
: String(reason)}`,
|
|
106
|
+
})));
|
|
107
|
+
exports.loadConfig = loadConfig;
|
|
108
|
+
|
|
109
|
+
},
|
|
110
|
+
"src/Routing/usecase/buildRouter.ts": function (module, exports, require) {
|
|
111
|
+
"use strict";
|
|
112
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
113
|
+
exports.buildRouter = void 0;
|
|
114
|
+
const plgg_server_1 = require("plgg-server");
|
|
115
|
+
const buildRouter = (paths, handler) => paths.reduce((app, path) => (0, plgg_server_1.get)(path, handler)(app), (0, plgg_server_1.web)());
|
|
116
|
+
exports.buildRouter = buildRouter;
|
|
117
|
+
|
|
118
|
+
},
|
|
119
|
+
"src/Build/usecase/build.ts": function (module, exports, require) {
|
|
120
|
+
"use strict";
|
|
121
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
122
|
+
exports.build = void 0;
|
|
123
|
+
const plgg_1 = require("plgg");
|
|
124
|
+
const ssg_1 = require("plgg-server/ssg");
|
|
125
|
+
const build = (opts, spec) => (0, plgg_1.proc)((0, ssg_1.discoverPaths)(opts.contentDir), (paths) => (0, plgg_1.matchOption)(() => Promise.resolve((0, plgg_1.ok)(paths)), (check) => check(paths).then((0, plgg_1.mapResult)(() => paths)))(spec.linkCheck), (paths) => (0, ssg_1.generateStatic)(spec.router(paths))({
|
|
126
|
+
paths,
|
|
127
|
+
outDir: opts.outDir,
|
|
128
|
+
}), (pages) => (0, ssg_1.copyAssets)(opts.assetsDir)(opts.outDir).then((0, plgg_1.mapResult)((assets) => [
|
|
129
|
+
...pages,
|
|
130
|
+
...assets,
|
|
131
|
+
])), (files) => (0, ssg_1.write404)(opts.outDir)(spec.notFoundHtml).then((0, plgg_1.mapResult)((file) => [
|
|
132
|
+
...files,
|
|
133
|
+
file,
|
|
134
|
+
])), (files) => (0, plgg_1.ok)({
|
|
135
|
+
outDir: opts.outDir,
|
|
136
|
+
pages: files,
|
|
137
|
+
}));
|
|
138
|
+
exports.build = build;
|
|
139
|
+
|
|
140
|
+
},
|
|
141
|
+
"src/Cli/usecase/resolveOptions.ts": function (module, exports, require) {
|
|
142
|
+
"use strict";
|
|
143
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
144
|
+
exports.resolveOptions = exports.configPathOf = void 0;
|
|
145
|
+
const node_path_1 = require("node:path");
|
|
146
|
+
const plgg_1 = require("plgg");
|
|
147
|
+
const plgg_cli_1 = require("plgg-cli");
|
|
148
|
+
const configPathOf = (invocation, configFile) => (0, plgg_1.pipe)((0, plgg_cli_1.optionOf)("config")(invocation), (0, plgg_1.getOr)((0, node_path_1.resolve)(process.cwd(), configFile)));
|
|
149
|
+
exports.configPathOf = configPathOf;
|
|
150
|
+
const resolveOptions = (invocation, ctx) => {
|
|
151
|
+
const cwd = process.cwd();
|
|
152
|
+
const contentDir = (0, plgg_1.pipe)((0, plgg_cli_1.optionOf)("contentDir")(invocation), (0, plgg_1.getOr)(cwd));
|
|
153
|
+
return {
|
|
154
|
+
contentDir,
|
|
155
|
+
outDir: (0, plgg_1.pipe)((0, plgg_cli_1.optionOf)("outDir")(invocation), (0, plgg_1.getOr)((0, node_path_1.resolve)(cwd, "dist"))),
|
|
156
|
+
assetsDir: (0, node_path_1.resolve)(contentDir, "public"),
|
|
157
|
+
base: ctx.base,
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
exports.resolveOptions = resolveOptions;
|
|
161
|
+
|
|
162
|
+
},
|
|
163
|
+
"src/Cli/usecase/runApp.ts": function (module, exports, require) {
|
|
164
|
+
"use strict";
|
|
165
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
166
|
+
exports.runApp = void 0;
|
|
167
|
+
const plgg_1 = require("plgg");
|
|
168
|
+
const plgg_cli_1 = require("plgg-cli");
|
|
169
|
+
const build_1 = require("src/Build/usecase/build.ts");
|
|
170
|
+
const resolveOptions_1 = require("src/Cli/usecase/resolveOptions.ts");
|
|
171
|
+
const configOptions = [
|
|
172
|
+
(0, plgg_cli_1.option)("config", "path", "path to the app config file"),
|
|
173
|
+
(0, plgg_cli_1.option)("contentDir", "path", "content source directory"),
|
|
174
|
+
(0, plgg_cli_1.option)("outDir", "path", "output directory"),
|
|
175
|
+
];
|
|
176
|
+
const runBuild = (def) => (invocation) => def
|
|
177
|
+
.loadConfig((0, resolveOptions_1.configPathOf)(invocation, def.configFile))
|
|
178
|
+
.then((0, plgg_1.matchResult)((e) => Promise.resolve((0, plgg_1.err)(e.content.message)), (config) => {
|
|
179
|
+
const opts = (0, resolveOptions_1.resolveOptions)(invocation, def.context(config));
|
|
180
|
+
return (0, build_1.build)(opts, def.buildSpec(config, opts)).then((0, plgg_1.matchResult)((be) => (0, plgg_1.err)(def.formatError(be)), (r) => (0, plgg_1.ok)(`built ${r.pages.length} page(s) to ${r.outDir}`)));
|
|
181
|
+
}));
|
|
182
|
+
const runApp = (def) => {
|
|
183
|
+
const app = (0, plgg_cli_1.program)(def.name, def.description, [
|
|
184
|
+
(0, plgg_cli_1.command)("build", "build the site into static files", configOptions),
|
|
185
|
+
]);
|
|
186
|
+
return (0, plgg_cli_1.runCli)(app, {
|
|
187
|
+
build: runBuild(def),
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
exports.runApp = runApp;
|
|
191
|
+
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
const __cache = {};
|
|
195
|
+
function __require(id) {
|
|
196
|
+
if (id in __cache) return __cache[id].exports;
|
|
197
|
+
const fn = __modules[id];
|
|
198
|
+
if (!fn) { if (id in __externals) return __externals[id]; return import(id); }
|
|
199
|
+
const module = { exports: {} };
|
|
200
|
+
__cache[id] = module;
|
|
201
|
+
fn(module, module.exports, __require);
|
|
202
|
+
return module.exports;
|
|
203
|
+
}
|
|
204
|
+
const __entry = __require("src/index.ts");
|
|
205
|
+
export default __entry;
|
|
206
|
+
export const {
|
|
207
|
+
METHODS,
|
|
208
|
+
TOKEN_LANG_ALIAS,
|
|
209
|
+
a,
|
|
210
|
+
anim$,
|
|
211
|
+
asHeadingLevel,
|
|
212
|
+
asHighlighter,
|
|
213
|
+
asHttpStatus,
|
|
214
|
+
asMethod,
|
|
215
|
+
attr,
|
|
216
|
+
attr$,
|
|
217
|
+
badRequest,
|
|
218
|
+
badRequest$,
|
|
219
|
+
blockToHtml,
|
|
220
|
+
blockquote,
|
|
221
|
+
body,
|
|
222
|
+
br,
|
|
223
|
+
build,
|
|
224
|
+
buildRouter,
|
|
225
|
+
button,
|
|
226
|
+
bytesBody,
|
|
227
|
+
bytesResponse,
|
|
228
|
+
callout,
|
|
229
|
+
callout$,
|
|
230
|
+
class_,
|
|
231
|
+
code,
|
|
232
|
+
code$,
|
|
233
|
+
codeFence,
|
|
234
|
+
codeFence$,
|
|
235
|
+
collectCss,
|
|
236
|
+
collectCssRules,
|
|
237
|
+
comment,
|
|
238
|
+
comment$,
|
|
239
|
+
compilePattern,
|
|
240
|
+
compileRoutes,
|
|
241
|
+
configLoadError,
|
|
242
|
+
configLoadError$,
|
|
243
|
+
configPathOf,
|
|
244
|
+
css$,
|
|
245
|
+
del,
|
|
246
|
+
details,
|
|
247
|
+
dispatch,
|
|
248
|
+
div,
|
|
249
|
+
easeIn,
|
|
250
|
+
easeInOut,
|
|
251
|
+
easeOut,
|
|
252
|
+
el,
|
|
253
|
+
element$,
|
|
254
|
+
em,
|
|
255
|
+
emph,
|
|
256
|
+
emph$,
|
|
257
|
+
escapeAttr,
|
|
258
|
+
escapeCss,
|
|
259
|
+
escapeText,
|
|
260
|
+
fadeIn,
|
|
261
|
+
fadeOut,
|
|
262
|
+
foldHtml,
|
|
263
|
+
forbidden,
|
|
264
|
+
forbidden$,
|
|
265
|
+
form,
|
|
266
|
+
frontmatter,
|
|
267
|
+
get,
|
|
268
|
+
getBytes,
|
|
269
|
+
getHeader,
|
|
270
|
+
getParam,
|
|
271
|
+
getQuery,
|
|
272
|
+
getRequest,
|
|
273
|
+
getState,
|
|
274
|
+
h1,
|
|
275
|
+
h2,
|
|
276
|
+
h3,
|
|
277
|
+
h4,
|
|
278
|
+
h5,
|
|
279
|
+
h6,
|
|
280
|
+
handle,
|
|
281
|
+
handler$,
|
|
282
|
+
head,
|
|
283
|
+
header,
|
|
284
|
+
heading,
|
|
285
|
+
heading$,
|
|
286
|
+
highlightPlain,
|
|
287
|
+
highlightTs,
|
|
288
|
+
hr,
|
|
289
|
+
href,
|
|
290
|
+
html,
|
|
291
|
+
htmlDocument,
|
|
292
|
+
htmlResponse,
|
|
293
|
+
httpErrorToResponse,
|
|
294
|
+
identifier,
|
|
295
|
+
identifier$,
|
|
296
|
+
identityResolver,
|
|
297
|
+
image,
|
|
298
|
+
image$,
|
|
299
|
+
img,
|
|
300
|
+
inlineCode,
|
|
301
|
+
inlineText,
|
|
302
|
+
input,
|
|
303
|
+
internalError,
|
|
304
|
+
internalError$,
|
|
305
|
+
isCallout,
|
|
306
|
+
isCode,
|
|
307
|
+
isCodeFence,
|
|
308
|
+
isEmph,
|
|
309
|
+
isHeading,
|
|
310
|
+
isHeadingLevel,
|
|
311
|
+
isHttpStatus,
|
|
312
|
+
isImage,
|
|
313
|
+
isLineBreak,
|
|
314
|
+
isLink,
|
|
315
|
+
isList,
|
|
316
|
+
isMethod,
|
|
317
|
+
isPara,
|
|
318
|
+
isQuote,
|
|
319
|
+
isSafeAttrName,
|
|
320
|
+
isSafeTag,
|
|
321
|
+
isStrong,
|
|
322
|
+
isTable,
|
|
323
|
+
isText,
|
|
324
|
+
isThematicBreak,
|
|
325
|
+
javascriptResponse,
|
|
326
|
+
jsonResponse,
|
|
327
|
+
key,
|
|
328
|
+
key$,
|
|
329
|
+
keyword,
|
|
330
|
+
keyword$,
|
|
331
|
+
label,
|
|
332
|
+
li,
|
|
333
|
+
lineBreak,
|
|
334
|
+
lineBreak$,
|
|
335
|
+
link,
|
|
336
|
+
link$,
|
|
337
|
+
list,
|
|
338
|
+
list$,
|
|
339
|
+
loadConfig,
|
|
340
|
+
lookupRoute,
|
|
341
|
+
main_,
|
|
342
|
+
makeContext,
|
|
343
|
+
makeRoute,
|
|
344
|
+
makeSluggers,
|
|
345
|
+
mapHtml,
|
|
346
|
+
matchSegments,
|
|
347
|
+
mdToHtml,
|
|
348
|
+
meta,
|
|
349
|
+
methodNotAllowed,
|
|
350
|
+
methodNotAllowed$,
|
|
351
|
+
name_,
|
|
352
|
+
nav,
|
|
353
|
+
nonHtmlBody,
|
|
354
|
+
nonHtmlBody$,
|
|
355
|
+
nonOkStatus,
|
|
356
|
+
nonOkStatus$,
|
|
357
|
+
normalizeLang,
|
|
358
|
+
notFound,
|
|
359
|
+
notFound$,
|
|
360
|
+
numberKind,
|
|
361
|
+
numberKind$,
|
|
362
|
+
ol,
|
|
363
|
+
on,
|
|
364
|
+
onChange,
|
|
365
|
+
onClick,
|
|
366
|
+
onInput,
|
|
367
|
+
onSubmit,
|
|
368
|
+
options,
|
|
369
|
+
p,
|
|
370
|
+
pageResponse,
|
|
371
|
+
para,
|
|
372
|
+
para$,
|
|
373
|
+
param,
|
|
374
|
+
paramSegment,
|
|
375
|
+
parseBlocks,
|
|
376
|
+
parseFrontmatter,
|
|
377
|
+
patch,
|
|
378
|
+
path,
|
|
379
|
+
plain,
|
|
380
|
+
plain$,
|
|
381
|
+
plainHighlighter,
|
|
382
|
+
plainText,
|
|
383
|
+
post,
|
|
384
|
+
pre,
|
|
385
|
+
punctuation,
|
|
386
|
+
punctuation$,
|
|
387
|
+
put,
|
|
388
|
+
query,
|
|
389
|
+
quote,
|
|
390
|
+
quote$,
|
|
391
|
+
redirectResponse,
|
|
392
|
+
regex,
|
|
393
|
+
regex$,
|
|
394
|
+
renderCssRule,
|
|
395
|
+
renderFailed,
|
|
396
|
+
renderFailed$,
|
|
397
|
+
renderInline,
|
|
398
|
+
renderMarkdown,
|
|
399
|
+
renderMarkdownWith,
|
|
400
|
+
renderPath,
|
|
401
|
+
renderRoutes,
|
|
402
|
+
renderToString,
|
|
403
|
+
resolveOptions,
|
|
404
|
+
route,
|
|
405
|
+
runApp,
|
|
406
|
+
safeAttrValue,
|
|
407
|
+
safeUrl,
|
|
408
|
+
section,
|
|
409
|
+
setState,
|
|
410
|
+
slideIn,
|
|
411
|
+
slot,
|
|
412
|
+
slugify,
|
|
413
|
+
span,
|
|
414
|
+
splitPath,
|
|
415
|
+
ssgPage,
|
|
416
|
+
staticSegment,
|
|
417
|
+
statusError,
|
|
418
|
+
statusError$,
|
|
419
|
+
statusOf,
|
|
420
|
+
streamBody,
|
|
421
|
+
streamResponse,
|
|
422
|
+
stringKind,
|
|
423
|
+
stringKind$,
|
|
424
|
+
strong,
|
|
425
|
+
strong$,
|
|
426
|
+
style,
|
|
427
|
+
summary,
|
|
428
|
+
svg,
|
|
429
|
+
table,
|
|
430
|
+
table$,
|
|
431
|
+
tbody,
|
|
432
|
+
td,
|
|
433
|
+
template,
|
|
434
|
+
template$,
|
|
435
|
+
text,
|
|
436
|
+
text$,
|
|
437
|
+
textResponse,
|
|
438
|
+
th,
|
|
439
|
+
thead,
|
|
440
|
+
thematicBreak,
|
|
441
|
+
thematicBreak$,
|
|
442
|
+
title,
|
|
443
|
+
toFetch,
|
|
444
|
+
toHttpRequest,
|
|
445
|
+
toNativeResponse,
|
|
446
|
+
toPage,
|
|
447
|
+
token,
|
|
448
|
+
tokenize,
|
|
449
|
+
tr,
|
|
450
|
+
transition,
|
|
451
|
+
type_,
|
|
452
|
+
ul,
|
|
453
|
+
unauthorized,
|
|
454
|
+
unauthorized$,
|
|
455
|
+
unsupported,
|
|
456
|
+
unsupported$,
|
|
457
|
+
use,
|
|
458
|
+
value_,
|
|
459
|
+
viewResponse,
|
|
460
|
+
web,
|
|
461
|
+
wildcardSegment,
|
|
462
|
+
withParams,
|
|
463
|
+
writeFailed,
|
|
464
|
+
writeFailed$
|
|
465
|
+
} = __entry;
|
package/dist/ssg.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssg.d.ts","sourceRoot":"","sources":["../src/ssg.ts"],"names":[],"mappings":"AAMA,cAAc,iBAAiB,CAAC"}
|
package/dist/ssg.es.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as __ext0 from "plgg-server/ssg";
|
|
2
|
+
const __externals = {
|
|
3
|
+
"plgg-server/ssg": __ext0
|
|
4
|
+
};
|
|
5
|
+
const __modules = {
|
|
6
|
+
"src/ssg.ts": function (module, exports, require) {
|
|
7
|
+
"use strict";
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
__exportStar(require("plgg-server/ssg"), exports);
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const __cache = {};
|
|
28
|
+
function __require(id) {
|
|
29
|
+
if (id in __cache) return __cache[id].exports;
|
|
30
|
+
const fn = __modules[id];
|
|
31
|
+
if (!fn) { if (id in __externals) return __externals[id]; return import(id); }
|
|
32
|
+
const module = { exports: {} };
|
|
33
|
+
__cache[id] = module;
|
|
34
|
+
fn(module, module.exports, __require);
|
|
35
|
+
return module.exports;
|
|
36
|
+
}
|
|
37
|
+
const __entry = __require("src/ssg.ts");
|
|
38
|
+
export default __entry;
|
|
39
|
+
export const {
|
|
40
|
+
copyAssets,
|
|
41
|
+
discoverPaths,
|
|
42
|
+
generateStatic,
|
|
43
|
+
nonHtmlBody,
|
|
44
|
+
nonHtmlBody$,
|
|
45
|
+
nonOkStatus,
|
|
46
|
+
nonOkStatus$,
|
|
47
|
+
renderFailed,
|
|
48
|
+
renderFailed$,
|
|
49
|
+
ssgPage,
|
|
50
|
+
write404,
|
|
51
|
+
writeFailed,
|
|
52
|
+
writeFailed$,
|
|
53
|
+
writeStatic
|
|
54
|
+
} = __entry;
|
package/dist/style.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAMA,cAAc,iBAAiB,CAAC"}
|
package/dist/style.es.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as __ext0 from "plgg-view/style";
|
|
2
|
+
const __externals = {
|
|
3
|
+
"plgg-view/style": __ext0
|
|
4
|
+
};
|
|
5
|
+
const __modules = {
|
|
6
|
+
"src/style.ts": function (module, exports, require) {
|
|
7
|
+
"use strict";
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
__exportStar(require("plgg-view/style"), exports);
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const __cache = {};
|
|
28
|
+
function __require(id) {
|
|
29
|
+
if (id in __cache) return __cache[id].exports;
|
|
30
|
+
const fn = __modules[id];
|
|
31
|
+
if (!fn) { if (id in __externals) return __externals[id]; return import(id); }
|
|
32
|
+
const module = { exports: {} };
|
|
33
|
+
__cache[id] = module;
|
|
34
|
+
fn(module, module.exports, __require);
|
|
35
|
+
return module.exports;
|
|
36
|
+
}
|
|
37
|
+
const __entry = __require("src/style.ts");
|
|
38
|
+
export default __entry;
|
|
39
|
+
export const {
|
|
40
|
+
active,
|
|
41
|
+
alignValue,
|
|
42
|
+
bg,
|
|
43
|
+
block,
|
|
44
|
+
border,
|
|
45
|
+
borderColor,
|
|
46
|
+
center,
|
|
47
|
+
color,
|
|
48
|
+
colorValue,
|
|
49
|
+
decl,
|
|
50
|
+
flex,
|
|
51
|
+
flexCol,
|
|
52
|
+
focus,
|
|
53
|
+
fontSizeValue,
|
|
54
|
+
gap,
|
|
55
|
+
grid,
|
|
56
|
+
grow,
|
|
57
|
+
h,
|
|
58
|
+
hFull,
|
|
59
|
+
hashClass,
|
|
60
|
+
hover,
|
|
61
|
+
inlineFlex,
|
|
62
|
+
items,
|
|
63
|
+
justify,
|
|
64
|
+
justifyValue,
|
|
65
|
+
left,
|
|
66
|
+
listNone,
|
|
67
|
+
m,
|
|
68
|
+
maxW,
|
|
69
|
+
mb,
|
|
70
|
+
minW,
|
|
71
|
+
ml,
|
|
72
|
+
mr,
|
|
73
|
+
mt,
|
|
74
|
+
mx,
|
|
75
|
+
my,
|
|
76
|
+
opacity,
|
|
77
|
+
outline,
|
|
78
|
+
p,
|
|
79
|
+
pb,
|
|
80
|
+
pl,
|
|
81
|
+
pointer,
|
|
82
|
+
pr,
|
|
83
|
+
pt,
|
|
84
|
+
px,
|
|
85
|
+
py,
|
|
86
|
+
radiusValue,
|
|
87
|
+
right,
|
|
88
|
+
rounded,
|
|
89
|
+
shadow,
|
|
90
|
+
shadowValue,
|
|
91
|
+
spacing,
|
|
92
|
+
style_,
|
|
93
|
+
text,
|
|
94
|
+
w,
|
|
95
|
+
wFull,
|
|
96
|
+
weight,
|
|
97
|
+
wrap
|
|
98
|
+
} = __entry;
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "plggmatic",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A pre-organized, lightweight, composable full-stack web application framework built on the plgg family: config loading, a router builder, static-build + dev-server orchestration, and a pre-organized CLI — the framework-generic seam an app supplies its content/render specifics to.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"main": "dist/index.es.js",
|
|
10
|
+
"module": "dist/index.es.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.es.js"
|
|
15
|
+
},
|
|
16
|
+
"./ssg": {
|
|
17
|
+
"types": "./dist/ssg.d.ts",
|
|
18
|
+
"default": "./dist/ssg.es.js"
|
|
19
|
+
},
|
|
20
|
+
"./style": {
|
|
21
|
+
"types": "./dist/style.d.ts",
|
|
22
|
+
"default": "./dist/style.es.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"types": "dist/index.d.ts",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "plgg-bundle",
|
|
28
|
+
"test": "tsc --noEmit && plgg-test src",
|
|
29
|
+
"tsc": "tsc --noEmit",
|
|
30
|
+
"tsc:watch": "tsc --noEmit --watch",
|
|
31
|
+
"test:watch": "plgg-test src --watch",
|
|
32
|
+
"coverage": "tsc --noEmit && plgg-test src --coverage",
|
|
33
|
+
"coverage:watch": "plgg-test src --coverage --watch"
|
|
34
|
+
},
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/qmu/plgg.git"
|
|
38
|
+
},
|
|
39
|
+
"author": "qmu",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/qmu/plgg/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/qmu/plgg#readme",
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"plgg": "^0.0.27",
|
|
47
|
+
"plgg-http": "^0.0.1",
|
|
48
|
+
"plgg-server": "^0.0.2",
|
|
49
|
+
"plgg-view": "^0.0.1",
|
|
50
|
+
"plgg-md": "^0.0.1",
|
|
51
|
+
"plgg-highlight": "^0.0.1",
|
|
52
|
+
"plgg-cli": "^0.0.1"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/node": "^25.6.0",
|
|
56
|
+
"plgg-bundle": "^0.0.2",
|
|
57
|
+
"plgg-test": "^0.0.2",
|
|
58
|
+
"typescript": "^6.0.3"
|
|
59
|
+
}
|
|
60
|
+
}
|