share-pages 0.1.0 → 0.2.0

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.
@@ -5079,9 +5079,7 @@ const limitsSchema = object({
5079
5079
  zipRatio: number$1().positive().default(100),
5080
5080
  storageBytes: number$1().int().positive().default(8 * 1024 ** 3),
5081
5081
  uploadHours: number$1().positive().default(24),
5082
- trashDays: number$1().positive().default(7),
5083
- analyticsMonths: number$1().int().positive().default(24),
5084
- uvDays: number$1().int().min(1).default(3)
5082
+ trashDays: number$1().positive().default(7)
5085
5083
  });
5086
5084
  const defaultLimits = limitsSchema.parse({});
5087
5085
  function validateManifestLimits(manifest, limits) {
@@ -5238,11 +5236,7 @@ const settings = object({
5238
5236
  limits: limitsSchema,
5239
5237
  used_bytes: integer,
5240
5238
  reserved_bytes: integer,
5241
- maintenance: integer,
5242
- analytics_error: nullableText,
5243
- last_aggregate: integer.nullable(),
5244
- analytics_started_at: integer,
5245
- analytics_watermark: nullableText
5239
+ maintenance: integer
5246
5240
  });
5247
5241
  const jobSummary = object({
5248
5242
  id: text,
@@ -5388,27 +5382,43 @@ const metrics = object({
5388
5382
  errors: number,
5389
5383
  denied: number,
5390
5384
  cache_hits: number,
5391
- duration: number,
5392
- sampled: number
5385
+ duration: number
5393
5386
  });
5394
5387
  object({
5388
+ source: _enum(["analytics-engine", "local-memory"]),
5395
5389
  scope: string(),
5396
- timezone: string(),
5390
+ timezone: literal("UTC"),
5397
5391
  from: string(),
5398
5392
  to: string(),
5399
- days: array(metrics.partial().extend({
5393
+ queriedAt: number,
5394
+ cacheStatus: _enum([
5395
+ "live",
5396
+ "fresh-cache",
5397
+ "stale-cache"
5398
+ ]),
5399
+ days: array(metrics.extend({
5400
5400
  day: string(),
5401
- uv: number,
5402
- complete: boolean(),
5403
- state: string(),
5404
- ingestError: boolean(),
5405
- updatedAt: number.nullable()
5401
+ uv: number.nullable(),
5402
+ uvStatus: _enum([
5403
+ "exact",
5404
+ "sampled-estimate",
5405
+ "unavailable"
5406
+ ]),
5407
+ partial: boolean(),
5408
+ sampled: boolean()
5406
5409
  })),
5407
5410
  distributions: array(metrics.extend({
5408
- day: string(),
5409
- scope: string(),
5410
- dimension: string(),
5411
- value: string()
5411
+ dimension: _enum([
5412
+ "country",
5413
+ "device",
5414
+ "browser",
5415
+ "referer",
5416
+ "status",
5417
+ "event",
5418
+ "bot"
5419
+ ]),
5420
+ value: string(),
5421
+ sampled: boolean()
5412
5422
  })),
5413
5423
  popular: array(object({
5414
5424
  scope: string(),
@@ -5420,12 +5430,8 @@ object({
5420
5430
  id: string().optional(),
5421
5431
  number: number.optional()
5422
5432
  })),
5423
- visitorDays: number,
5424
- uvLabel: string(),
5425
- lastAggregate: number.nullable(),
5426
- watermark: string().nullable(),
5427
- mode: string(),
5428
- error: string().nullable()
5433
+ visitorDays: number.nullable(),
5434
+ retentionDays: literal(90)
5429
5435
  });
5430
5436
  async function digest(data) {
5431
5437
  const b = typeof data === "string" ? new TextEncoder().encode(data) : data;
@@ -1,6 +1,6 @@
1
1
  import { t as __commonJSMin } from "./rolldown-runtime-B4iAMlE-.mjs";
2
- import { l as safePath, r as assert } from "./dist-JyXFh6I5.mjs";
3
- import { c as unzipSafe, n as document, o as safeXMLText, r as encoder, s as sanitizeEPUB, t as decodeText } from "./prepare-C56DezIS-DiqwpdkG.mjs";
2
+ import { l as safePath, r as assert } from "./dist-BkIxqYQy.mjs";
3
+ import { c as unzipSafe, n as document, o as safeXMLText, r as encoder, s as sanitizeEPUB, t as decodeText } from "./prepare-C56DezIS-DwhDVRlC.mjs";
4
4
  //#region ../../node_modules/.pnpm/@xmldom+xmldom@0.8.15/node_modules/@xmldom/xmldom/lib/conventions.js
5
5
  var require_conventions = /* @__PURE__ */ __commonJSMin(((exports) => {
6
6
  /**
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as digest, i as defaultLimits, n as CHUNK_SIZE, r as assert, s as formats, t as AppError } from "./dist-JyXFh6I5.mjs";
2
+ import { a as digest, i as defaultLimits, n as CHUNK_SIZE, r as assert, s as formats, t as AppError } from "./dist-BkIxqYQy.mjs";
3
3
  import { Command, CommanderError, Option } from "commander";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { chmod, mkdir, readFile, rename, unlink, writeFile } from "node:fs/promises";
@@ -379,9 +379,12 @@ async function confirm(message, yes, interactive) {
379
379
  }
380
380
  }
381
381
  //#endregion
382
+ //#region package.json
383
+ var version = "0.2.0";
384
+ //#endregion
382
385
  //#region src/shared.ts
383
386
  function createCommand() {
384
- return new Command().name("share-pages").description("个人静态内容发布工具").version("0.1.0").option("--json", "stdout 仅输出 JSON").option("--quiet", "隐藏进度").option("--no-interactive", "禁止交互输入").option("--profile <name>", "实例 profile").option("--server <url>", "覆盖实例地址").exitOverride();
387
+ return new Command().name("share-pages").description("个人静态内容发布工具").version(version).option("--json", "stdout 仅输出 JSON").option("--quiet", "隐藏进度").option("--no-interactive", "禁止交互输入").option("--profile <name>", "实例 profile").option("--server <url>", "覆盖实例地址").exitOverride();
385
388
  }
386
389
  function options(command) {
387
390
  const chain = [];
@@ -499,7 +502,7 @@ function registerPages(cli) {
499
502
  function registerPublish(cli) {
500
503
  cli.command("publish <input>").description("发布文件、ZIP 或目录;使用 - 从 stdin 读取内容").option("--id <id>").option("--update", "更新已有 ID").option("--type <format>").option("--title <title>").option("--entry <path>", "HTML 入口", "index.html").option("--spa", "启用 HTML 导航回退").option("--access <access>", "public / password / admin").option("--indexable", "允许公开页面收录").option("--encoding <encoding>", "文本编码", "utf-8").option("--delimiter <delimiter>", "CSV 分隔符").option("--no-header", "CSV 没有表头").option("--password-file <path>", "从权限受限文件读取页面密码").option("--dry-run", "仅检查转换和 manifest").option("--resume <uploadId>", "继续上传会话").option("--idempotency-key <key>").option("--no-wait", "提交后返回处理中状态").option("--timeout <seconds>", "等待秒数", "120").action(async (input, _local, command) => {
501
504
  const o = options(command);
502
- const { prepareNode, prepareBytes, ensureDOM } = await import("./node-Lh4CQjZ4.mjs");
505
+ const { prepareNode, prepareBytes, ensureDOM } = await import("./node-ZNJuj10Q.mjs");
503
506
  if (o.type && !formats.includes(o.type)) throw new AppError("UNSUPPORTED_FORMAT", `--type 必须是 ${formats.join(", ")}`);
504
507
  if (input === "-" && !o.type) throw new AppError("TYPE_REQUIRED", "stdin 需要显式 --type");
505
508
  let sdk, limits = defaultLimits;
@@ -1,5 +1,5 @@
1
- import { o as escapeHtml, r as assert, t as AppError } from "./dist-JyXFh6I5.mjs";
2
- import { n as document } from "./prepare-C56DezIS-DiqwpdkG.mjs";
1
+ import { o as escapeHtml, r as assert, t as AppError } from "./dist-BkIxqYQy.mjs";
2
+ import { n as document } from "./prepare-C56DezIS-DwhDVRlC.mjs";
3
3
  //#region ../../packages/content/dist/latex-DMo_3IW8.js
4
4
  async function latex(source, title) {
5
5
  assert(!/\\(?:usepackage|RequirePackage|input|include|newcommand|renewcommand|def|bibliography|bibliographystyle|includegraphics|write18|catcode)\b/.test(source), "UNSUPPORTED_LATEX", "不支持任意宏包、宏定义、外部文件、图片或参考文献编译");
@@ -1,6 +1,6 @@
1
1
  import { i as __toESM, n as __exportAll, t as __commonJSMin } from "./rolldown-runtime-B4iAMlE-.mjs";
2
- import { o as escapeHtml, r as assert } from "./dist-JyXFh6I5.mjs";
3
- import { d as parse$4, l as walk, n as document$3 } from "./prepare-C56DezIS-DiqwpdkG.mjs";
2
+ import { o as escapeHtml, r as assert } from "./dist-BkIxqYQy.mjs";
3
+ import { d as parse$4, l as walk, n as document$3 } from "./prepare-C56DezIS-DwhDVRlC.mjs";
4
4
  import minpath from "node:path";
5
5
  import minproc from "node:process";
6
6
  import { fileURLToPath as urlToPath } from "node:url";
@@ -1,5 +1,5 @@
1
- import { i as defaultLimits, l as safePath, r as assert } from "./dist-JyXFh6I5.mjs";
2
- import { a as prepareBytes, i as finalize, u as zipSync } from "./prepare-C56DezIS-DiqwpdkG.mjs";
1
+ import { i as defaultLimits, l as safePath, r as assert } from "./dist-BkIxqYQy.mjs";
2
+ import { a as prepareBytes, i as finalize, u as zipSync } from "./prepare-C56DezIS-DwhDVRlC.mjs";
3
3
  import { lstat, readFile, readdir } from "node:fs/promises";
4
4
  import { basename, join } from "node:path";
5
5
  //#region ../../packages/content/dist/directory-Cz5DdsHB.js
@@ -1,5 +1,5 @@
1
1
  import { i as __toESM } from "./rolldown-runtime-B4iAMlE-.mjs";
2
- import { a as digest, c as manifestSchema, i as defaultLimits, l as safePath, o as escapeHtml, r as assert, t as AppError, u as validateManifestLimits } from "./dist-JyXFh6I5.mjs";
2
+ import { a as digest, c as manifestSchema, i as defaultLimits, l as safePath, o as escapeHtml, r as assert, t as AppError, u as validateManifestLimits } from "./dist-BkIxqYQy.mjs";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { createRequire } from "module";
5
5
  //#region ../../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/common/unicode.js
@@ -8514,7 +8514,7 @@ async function prepareBytes(name, data, options = {}) {
8514
8514
  if (type === "markdown" || type === "latex") {
8515
8515
  assert(data.length <= limits.textBytes, "TEXT_TOO_LARGE", "文本文档超过 5 MiB 限额", 413);
8516
8516
  const source = decodeText(data, options.encoding);
8517
- files.set("index.html", encoder.encode(type === "markdown" ? await (await import("./markdown-BWlCFeLJ-OwSvKM8l.mjs")).markdown(source, title) : await (await import("./latex-DMo_3IW8-B6ogeBvw.mjs")).latex(source, title)));
8517
+ files.set("index.html", encoder.encode(type === "markdown" ? await (await import("./markdown-BWlCFeLJ-D_-ZvWdl.mjs")).markdown(source, title) : await (await import("./latex-DMo_3IW8-D8ylufbk.mjs")).latex(source, title)));
8518
8518
  } else if (type === "csv") {
8519
8519
  assert(data.length <= limits.csvBytes, "CSV_TOO_LARGE", "CSV 超过字节限额", 413);
8520
8520
  const source = decodeText(data, options.encoding);
@@ -8549,7 +8549,7 @@ async function prepareBytes(name, data, options = {}) {
8549
8549
  header,
8550
8550
  maxRows: limits.csvRows
8551
8551
  })));
8552
- } else if (type === "epub") files = await (await import("./epub-BXQPqTFk-CGD2NLS1.mjs")).prepareEPUB(data, title, limits, await digest(data));
8552
+ } else if (type === "epub") files = await (await import("./epub-BXQPqTFk-CSXSpn1h.mjs")).prepareEPUB(data, title, limits, await digest(data));
8553
8553
  for (const [path, bytes] of await loadViewerAssets(type)) files.set(path, bytes);
8554
8554
  }
8555
8555
  return finalize(name, data, files, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "share-pages",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Command-line client for publishing and managing Share Pages content",
5
5
  "keywords": [
6
6
  "share-pages",
@@ -21,15 +21,15 @@
21
21
  ],
22
22
  "scripts": {
23
23
  "build": "pnpm --filter @share-pages/viewers build && tsdown && node scripts/copy-viewer-resources.mjs",
24
- "prepublishOnly": "pnpm build && pnpm typecheck",
24
+ "prepublishOnly": "node scripts/check-publish-manifest.mjs && pnpm build && pnpm typecheck",
25
25
  "typecheck": "tsc --noEmit"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "commander": "catalog:",
32
- "jsdom": "catalog:"
31
+ "commander": "14.0.3",
32
+ "jsdom": "26.1.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@share-pages/content": "workspace:*",