@moku-labs/web 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +9 -5
- package/dist/index.d.cts +10 -2
- package/dist/index.d.mts +10 -2
- package/dist/index.mjs +9 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3339,14 +3339,15 @@ function resolveJsEntrypoints(ctx) {
|
|
|
3339
3339
|
* @param runner - The bundler runner to invoke.
|
|
3340
3340
|
* @param kind - The asset kind label (`"css"` / `"js"`) — used as the cache key.
|
|
3341
3341
|
* @param entrypoints - Resolved entry files (skipped when empty).
|
|
3342
|
-
* @param
|
|
3342
|
+
* @param outDir - The publish root; stored asset paths are made relative to it.
|
|
3343
|
+
* @param outdir - The bundler output directory (`<outDir>/assets`).
|
|
3343
3344
|
* @param minify - Whether to minify.
|
|
3344
3345
|
* @example
|
|
3345
3346
|
* ```ts
|
|
3346
3347
|
* await runOne(ctx, runner, "css", ["a.css"], "dist", true);
|
|
3347
3348
|
* ```
|
|
3348
3349
|
*/
|
|
3349
|
-
async function runOne(ctx, runner, kind, entrypoints, outdir, minify) {
|
|
3350
|
+
async function runOne(ctx, runner, kind, entrypoints, outDir, outdir, minify) {
|
|
3350
3351
|
if (entrypoints.length === 0) return;
|
|
3351
3352
|
const result = await runner({
|
|
3352
3353
|
entrypoints,
|
|
@@ -3355,7 +3356,10 @@ async function runOne(ctx, runner, kind, entrypoints, outdir, minify) {
|
|
|
3355
3356
|
});
|
|
3356
3357
|
if (!result.success) throw new Error(`[web] build.bundle ${kind} build failed`);
|
|
3357
3358
|
const hashed = {};
|
|
3358
|
-
for (const output of result.outputs)
|
|
3359
|
+
for (const output of result.outputs) {
|
|
3360
|
+
const webPath = node_path$1.default.relative(node_path$1.default.resolve(outDir), node_path$1.default.resolve(output.path)).split(node_path$1.default.sep).join("/");
|
|
3361
|
+
hashed[node_path$1.default.basename(output.path)] = webPath;
|
|
3362
|
+
}
|
|
3359
3363
|
ctx.state.buildCache.set(kind, hashed);
|
|
3360
3364
|
ctx.log.debug("build:bundle", {
|
|
3361
3365
|
kind,
|
|
@@ -3380,8 +3384,8 @@ async function bundle(ctx, options = {}) {
|
|
|
3380
3384
|
const { minify, outDir } = ctx.config;
|
|
3381
3385
|
const cssEntrypoints = options.cssEntrypoints ?? resolveEntrypoints(CSS_ENTRY_CANDIDATES);
|
|
3382
3386
|
const jsEntrypoints = options.jsEntrypoints ?? resolveJsEntrypoints(ctx);
|
|
3383
|
-
await runOne(ctx, runner, "css", cssEntrypoints, node_path$1.default.join(outDir, "assets"), minify);
|
|
3384
|
-
await runOne(ctx, runner, "js", jsEntrypoints, node_path$1.default.join(outDir, "assets"), minify);
|
|
3387
|
+
await runOne(ctx, runner, "css", cssEntrypoints, outDir, node_path$1.default.join(outDir, "assets"), minify);
|
|
3388
|
+
await runOne(ctx, runner, "js", jsEntrypoints, outDir, node_path$1.default.join(outDir, "assets"), minify);
|
|
3385
3389
|
}
|
|
3386
3390
|
//#endregion
|
|
3387
3391
|
//#region src/plugins/build/phases/content.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentChildren, VNode } from "preact";
|
|
2
2
|
import { EmitFn } from "@moku-labs/core";
|
|
3
|
+
import { BundledTheme, ThemeRegistrationAny } from "shiki";
|
|
3
4
|
import { Pluggable, Processor } from "unified";
|
|
4
5
|
|
|
5
6
|
//#region \0rolldown/runtime.js
|
|
@@ -1680,8 +1681,15 @@ type Config$1 = {
|
|
|
1680
1681
|
*/
|
|
1681
1682
|
trustedContent: boolean; /** Additional remark plugins, concatenated AFTER framework defaults. Defaults to []. */
|
|
1682
1683
|
extraRemarkPlugins?: readonly Pluggable[]; /** Additional rehype plugins, concatenated after custom transforms, before Shiki + sanitize. Defaults to []. */
|
|
1683
|
-
extraRehypePlugins?: readonly Pluggable[];
|
|
1684
|
-
|
|
1684
|
+
extraRehypePlugins?: readonly Pluggable[];
|
|
1685
|
+
/**
|
|
1686
|
+
* Shiki theme for syntax highlighting: a bundled theme NAME — typed as Shiki's
|
|
1687
|
+
* `BundledTheme` union so editors autocomplete the ~60 built-ins (default
|
|
1688
|
+
* "github-dark") — or a custom `ThemeRegistration` object. Passed straight through
|
|
1689
|
+
* to `@shikijs/rehype`'s `theme`. (Like Shiki's own theme type, an arbitrary string
|
|
1690
|
+
* still compiles via the object arm, so this is autocomplete, not typo-rejection.)
|
|
1691
|
+
*/
|
|
1692
|
+
shikiTheme?: BundledTheme | ThemeRegistrationAny; /** Author applied to articles whose frontmatter omits author. Defaults to undefined. */
|
|
1685
1693
|
defaultAuthor?: string;
|
|
1686
1694
|
};
|
|
1687
1695
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EmitFn } from "@moku-labs/core";
|
|
2
2
|
import { Pluggable, Processor } from "unified";
|
|
3
3
|
import { ComponentChildren, VNode } from "preact";
|
|
4
|
+
import { BundledTheme, ThemeRegistrationAny } from "shiki";
|
|
4
5
|
|
|
5
6
|
//#region src/plugins/log/types.d.ts
|
|
6
7
|
declare namespace types_d_exports$6 {
|
|
@@ -1680,8 +1681,15 @@ type Config$1 = {
|
|
|
1680
1681
|
*/
|
|
1681
1682
|
trustedContent: boolean; /** Additional remark plugins, concatenated AFTER framework defaults. Defaults to []. */
|
|
1682
1683
|
extraRemarkPlugins?: readonly Pluggable[]; /** Additional rehype plugins, concatenated after custom transforms, before Shiki + sanitize. Defaults to []. */
|
|
1683
|
-
extraRehypePlugins?: readonly Pluggable[];
|
|
1684
|
-
|
|
1684
|
+
extraRehypePlugins?: readonly Pluggable[];
|
|
1685
|
+
/**
|
|
1686
|
+
* Shiki theme for syntax highlighting: a bundled theme NAME — typed as Shiki's
|
|
1687
|
+
* `BundledTheme` union so editors autocomplete the ~60 built-ins (default
|
|
1688
|
+
* "github-dark") — or a custom `ThemeRegistration` object. Passed straight through
|
|
1689
|
+
* to `@shikijs/rehype`'s `theme`. (Like Shiki's own theme type, an arbitrary string
|
|
1690
|
+
* still compiles via the object arm, so this is autocomplete, not typo-rejection.)
|
|
1691
|
+
*/
|
|
1692
|
+
shikiTheme?: BundledTheme | ThemeRegistrationAny; /** Author applied to articles whose frontmatter omits author. Defaults to undefined. */
|
|
1685
1693
|
defaultAuthor?: string;
|
|
1686
1694
|
};
|
|
1687
1695
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -3326,14 +3326,15 @@ function resolveJsEntrypoints(ctx) {
|
|
|
3326
3326
|
* @param runner - The bundler runner to invoke.
|
|
3327
3327
|
* @param kind - The asset kind label (`"css"` / `"js"`) — used as the cache key.
|
|
3328
3328
|
* @param entrypoints - Resolved entry files (skipped when empty).
|
|
3329
|
-
* @param
|
|
3329
|
+
* @param outDir - The publish root; stored asset paths are made relative to it.
|
|
3330
|
+
* @param outdir - The bundler output directory (`<outDir>/assets`).
|
|
3330
3331
|
* @param minify - Whether to minify.
|
|
3331
3332
|
* @example
|
|
3332
3333
|
* ```ts
|
|
3333
3334
|
* await runOne(ctx, runner, "css", ["a.css"], "dist", true);
|
|
3334
3335
|
* ```
|
|
3335
3336
|
*/
|
|
3336
|
-
async function runOne(ctx, runner, kind, entrypoints, outdir, minify) {
|
|
3337
|
+
async function runOne(ctx, runner, kind, entrypoints, outDir, outdir, minify) {
|
|
3337
3338
|
if (entrypoints.length === 0) return;
|
|
3338
3339
|
const result = await runner({
|
|
3339
3340
|
entrypoints,
|
|
@@ -3342,7 +3343,10 @@ async function runOne(ctx, runner, kind, entrypoints, outdir, minify) {
|
|
|
3342
3343
|
});
|
|
3343
3344
|
if (!result.success) throw new Error(`[web] build.bundle ${kind} build failed`);
|
|
3344
3345
|
const hashed = {};
|
|
3345
|
-
for (const output of result.outputs)
|
|
3346
|
+
for (const output of result.outputs) {
|
|
3347
|
+
const webPath = path.relative(path.resolve(outDir), path.resolve(output.path)).split(path.sep).join("/");
|
|
3348
|
+
hashed[path.basename(output.path)] = webPath;
|
|
3349
|
+
}
|
|
3346
3350
|
ctx.state.buildCache.set(kind, hashed);
|
|
3347
3351
|
ctx.log.debug("build:bundle", {
|
|
3348
3352
|
kind,
|
|
@@ -3367,8 +3371,8 @@ async function bundle(ctx, options = {}) {
|
|
|
3367
3371
|
const { minify, outDir } = ctx.config;
|
|
3368
3372
|
const cssEntrypoints = options.cssEntrypoints ?? resolveEntrypoints(CSS_ENTRY_CANDIDATES);
|
|
3369
3373
|
const jsEntrypoints = options.jsEntrypoints ?? resolveJsEntrypoints(ctx);
|
|
3370
|
-
await runOne(ctx, runner, "css", cssEntrypoints, path.join(outDir, "assets"), minify);
|
|
3371
|
-
await runOne(ctx, runner, "js", jsEntrypoints, path.join(outDir, "assets"), minify);
|
|
3374
|
+
await runOne(ctx, runner, "css", cssEntrypoints, outDir, path.join(outDir, "assets"), minify);
|
|
3375
|
+
await runOne(ctx, runner, "js", jsEntrypoints, outDir, path.join(outDir, "assets"), minify);
|
|
3372
3376
|
}
|
|
3373
3377
|
//#endregion
|
|
3374
3378
|
//#region src/plugins/build/phases/content.ts
|
package/package.json
CHANGED