@vivliostyle/cli 9.9.0 → 10.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 +74 -30
- package/dist/{chunk-WELNNHOB.js → chunk-CKAJY2BE.js} +415 -384
- package/dist/chunk-CKAJY2BE.js.map +1 -0
- package/dist/{chunk-UYKCTF6F.js → chunk-CKXFRCPH.js} +445 -228
- package/dist/chunk-CKXFRCPH.js.map +1 -0
- package/dist/{chunk-3O3N2V7D.js → chunk-IOFOZNLZ.js} +6 -7
- package/dist/chunk-IOFOZNLZ.js.map +1 -0
- package/dist/{chunk-OZ4XTSAH.js → chunk-LVS2NLYC.js} +2 -2
- package/dist/chunk-LVS2NLYC.js.map +1 -0
- package/dist/{chunk-6UU7DEUR.js → chunk-RJO22WHX.js} +32 -33
- package/dist/chunk-RJO22WHX.js.map +1 -0
- package/dist/chunk-RKU7H2GS.js +1076 -0
- package/dist/chunk-RKU7H2GS.js.map +1 -0
- package/dist/{chunk-QWX5MAON.js → chunk-SPTG2DFV.js} +16 -17
- package/dist/chunk-SPTG2DFV.js.map +1 -0
- package/dist/{chunk-G3GROLBN.js → chunk-T2VWLU2I.js} +397 -88
- package/dist/chunk-T2VWLU2I.js.map +1 -0
- package/dist/chunk-ZEBXHUJX.js +334 -0
- package/dist/chunk-ZEBXHUJX.js.map +1 -0
- package/dist/{chunk-FXUEYQRY.js → chunk-ZIK6DINS.js} +3 -3
- package/dist/chunk-ZIK6DINS.js.map +1 -0
- package/dist/cli.js +7 -8
- package/dist/cli.js.map +1 -1
- package/dist/commands/build.js +29 -17
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/create.d.ts +2 -0
- package/dist/commands/create.js +64 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/init.js +23 -14
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/preview.js +26 -20
- package/dist/commands/preview.js.map +1 -1
- package/dist/config/schema.d.ts +8370 -4567
- package/dist/config/schema.js +16 -4
- package/dist/index.d.ts +46 -7
- package/dist/index.js +24 -16
- package/dist/index.js.map +1 -1
- package/dist/node-modules.d.ts +5 -5
- package/dist/node-modules.js +1 -1
- package/dist/vite-adapter.d.ts +1 -0
- package/dist/vite-adapter.js +6 -6
- package/package.json +37 -26
- package/dist/chunk-3O3N2V7D.js.map +0 -1
- package/dist/chunk-4IIM6RSG.js +0 -71
- package/dist/chunk-4IIM6RSG.js.map +0 -1
- package/dist/chunk-6KEOMYDZ.js +0 -89
- package/dist/chunk-6KEOMYDZ.js.map +0 -1
- package/dist/chunk-6UU7DEUR.js.map +0 -1
- package/dist/chunk-FXUEYQRY.js.map +0 -1
- package/dist/chunk-G3GROLBN.js.map +0 -1
- package/dist/chunk-OZ4XTSAH.js.map +0 -1
- package/dist/chunk-QWX5MAON.js.map +0 -1
- package/dist/chunk-UYKCTF6F.js.map +0 -1
- package/dist/chunk-WELNNHOB.js.map +0 -1
- package/types/playwright.d.ts +0 -49
package/dist/config/schema.js
CHANGED
|
@@ -12,8 +12,10 @@ import {
|
|
|
12
12
|
LogLevel,
|
|
13
13
|
OutputConfig,
|
|
14
14
|
OutputFormat,
|
|
15
|
+
PromptOption,
|
|
15
16
|
ReadingProgression,
|
|
16
17
|
RenderMode,
|
|
18
|
+
SelectPromptOption,
|
|
17
19
|
ServerConfig,
|
|
18
20
|
StructuredDocument,
|
|
19
21
|
StructuredDocumentSection,
|
|
@@ -23,9 +25,13 @@ import {
|
|
|
23
25
|
ValidString,
|
|
24
26
|
VfmReplaceRule,
|
|
25
27
|
VivliostyleConfigSchema,
|
|
26
|
-
VivliostyleInlineConfig
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
VivliostyleInlineConfig,
|
|
29
|
+
VivliostyleInlineConfigWithoutChecks,
|
|
30
|
+
VivliostylePackageMetadata,
|
|
31
|
+
VivliostyleTemplateMetadata,
|
|
32
|
+
VivliostyleThemeMetadata
|
|
33
|
+
} from "../chunk-CKXFRCPH.js";
|
|
34
|
+
import "../chunk-ZEBXHUJX.js";
|
|
29
35
|
import "../chunk-I7BWSAN6.js";
|
|
30
36
|
export {
|
|
31
37
|
ArticleEntryConfig,
|
|
@@ -41,8 +47,10 @@ export {
|
|
|
41
47
|
LogLevel,
|
|
42
48
|
OutputConfig,
|
|
43
49
|
OutputFormat,
|
|
50
|
+
PromptOption,
|
|
44
51
|
ReadingProgression,
|
|
45
52
|
RenderMode,
|
|
53
|
+
SelectPromptOption,
|
|
46
54
|
ServerConfig,
|
|
47
55
|
StructuredDocument,
|
|
48
56
|
StructuredDocumentSection,
|
|
@@ -52,6 +60,10 @@ export {
|
|
|
52
60
|
ValidString,
|
|
53
61
|
VfmReplaceRule,
|
|
54
62
|
VivliostyleConfigSchema,
|
|
55
|
-
VivliostyleInlineConfig
|
|
63
|
+
VivliostyleInlineConfig,
|
|
64
|
+
VivliostyleInlineConfigWithoutChecks,
|
|
65
|
+
VivliostylePackageMetadata,
|
|
66
|
+
VivliostyleTemplateMetadata,
|
|
67
|
+
VivliostyleThemeMetadata
|
|
56
68
|
};
|
|
57
69
|
//# sourceMappingURL=schema.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as vite from 'vite';
|
|
2
|
-
import { VivliostyleInlineConfig } from './config/schema.js';
|
|
3
|
-
export { StructuredDocument, StructuredDocumentSection
|
|
2
|
+
import { VivliostyleConfigSchema, ParsedVivliostyleInlineConfig, ThemeSpecifier, VivliostylePackageMetadata, VivliostyleInlineConfig } from './config/schema.js';
|
|
3
|
+
export { StructuredDocument, StructuredDocumentSection } from './config/schema.js';
|
|
4
4
|
export { createVitePlugin } from './vite-adapter.js';
|
|
5
|
+
import 'stream';
|
|
5
6
|
import '@vivliostyle/vfm';
|
|
6
7
|
import 'unified';
|
|
7
8
|
import 'valibot';
|
|
@@ -110,6 +111,44 @@ interface PublicationLinks {
|
|
|
110
111
|
[k: string]: unknown;
|
|
111
112
|
}
|
|
112
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Define the configuration for Vivliostyle CLI.
|
|
116
|
+
*/
|
|
117
|
+
declare function defineConfig(config: VivliostyleConfigSchema): VivliostyleConfigSchema;
|
|
118
|
+
|
|
119
|
+
interface PackageJson {
|
|
120
|
+
name: string;
|
|
121
|
+
version: string;
|
|
122
|
+
description?: string;
|
|
123
|
+
dependencies?: Record<string, string>;
|
|
124
|
+
dist?: {
|
|
125
|
+
fileCount: number;
|
|
126
|
+
integrity: string;
|
|
127
|
+
shasum: string;
|
|
128
|
+
signatures: {
|
|
129
|
+
keyid: string;
|
|
130
|
+
sig: string;
|
|
131
|
+
}[];
|
|
132
|
+
tarball: string;
|
|
133
|
+
unpackedSize: number;
|
|
134
|
+
};
|
|
135
|
+
vivliostyle?: unknown;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
type VivliostylePackageJson = Pick<PackageJson, 'name' | 'version'> & {
|
|
139
|
+
vivliostyle?: VivliostylePackageMetadata;
|
|
140
|
+
};
|
|
141
|
+
interface TemplateVariable extends Omit<ParsedVivliostyleInlineConfig, 'theme'> {
|
|
142
|
+
projectPath: string;
|
|
143
|
+
title: string;
|
|
144
|
+
author: string;
|
|
145
|
+
language: string;
|
|
146
|
+
theme?: ThemeSpecifier;
|
|
147
|
+
themePackage?: VivliostylePackageJson;
|
|
148
|
+
cliVersion: string;
|
|
149
|
+
coreVersion: string;
|
|
150
|
+
}
|
|
151
|
+
|
|
113
152
|
/** @hidden */
|
|
114
153
|
type PublicationManifest = PublicationManifest$1;
|
|
115
154
|
/**
|
|
@@ -128,18 +167,18 @@ type PublicationManifest = PublicationManifest$1;
|
|
|
128
167
|
*/
|
|
129
168
|
declare function build(options: VivliostyleInlineConfig): Promise<void>;
|
|
130
169
|
/**
|
|
131
|
-
*
|
|
170
|
+
* Open a browser for previewing the publication.
|
|
132
171
|
*
|
|
133
172
|
* @param options
|
|
134
173
|
* @returns
|
|
135
174
|
*/
|
|
136
|
-
declare function
|
|
175
|
+
declare function preview(options: VivliostyleInlineConfig): Promise<vite.ViteDevServer>;
|
|
137
176
|
/**
|
|
138
|
-
*
|
|
177
|
+
* Scaffold a new Vivliostyle project.
|
|
139
178
|
*
|
|
140
179
|
* @param options
|
|
141
180
|
* @returns
|
|
142
181
|
*/
|
|
143
|
-
declare function
|
|
182
|
+
declare function create(options: VivliostyleInlineConfig): Promise<void>;
|
|
144
183
|
|
|
145
|
-
export { type PublicationManifest, build,
|
|
184
|
+
export { type PublicationManifest, type TemplateVariable, VivliostyleConfigSchema, VivliostylePackageMetadata, build, create, defineConfig, preview };
|
package/dist/index.js
CHANGED
|
@@ -1,43 +1,51 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createVitePlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SPTG2DFV.js";
|
|
4
4
|
import {
|
|
5
5
|
build
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RJO22WHX.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
create
|
|
9
|
+
} from "./chunk-RKU7H2GS.js";
|
|
10
10
|
import {
|
|
11
11
|
preview
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-G3GROLBN.js";
|
|
12
|
+
} from "./chunk-IOFOZNLZ.js";
|
|
13
|
+
import "./chunk-LVS2NLYC.js";
|
|
14
|
+
import "./chunk-CKAJY2BE.js";
|
|
15
|
+
import "./chunk-T2VWLU2I.js";
|
|
17
16
|
import {
|
|
18
17
|
VivliostyleInlineConfig
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-CKXFRCPH.js";
|
|
19
|
+
import "./chunk-ZEBXHUJX.js";
|
|
20
|
+
import "./chunk-ZIK6DINS.js";
|
|
21
21
|
import "./chunk-I7BWSAN6.js";
|
|
22
22
|
|
|
23
23
|
// src/index.ts
|
|
24
24
|
import * as v from "valibot";
|
|
25
|
+
|
|
26
|
+
// src/config/define.ts
|
|
27
|
+
function defineConfig(config) {
|
|
28
|
+
return config;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// src/index.ts
|
|
25
32
|
async function build2(options) {
|
|
26
33
|
const parsed = v.parse(VivliostyleInlineConfig, options);
|
|
27
34
|
return await build(parsed);
|
|
28
35
|
}
|
|
29
|
-
async function init2(options) {
|
|
30
|
-
const parsed = v.parse(VivliostyleInlineConfig, options);
|
|
31
|
-
return await init(parsed);
|
|
32
|
-
}
|
|
33
36
|
async function preview2(options) {
|
|
34
37
|
const parsed = v.parse(VivliostyleInlineConfig, options);
|
|
35
38
|
return await preview(parsed);
|
|
36
39
|
}
|
|
40
|
+
async function create2(options) {
|
|
41
|
+
const parsed = v.parse(VivliostyleInlineConfig, options);
|
|
42
|
+
return await create(parsed);
|
|
43
|
+
}
|
|
37
44
|
export {
|
|
38
45
|
build2 as build,
|
|
46
|
+
create2 as create,
|
|
39
47
|
createVitePlugin,
|
|
40
|
-
|
|
48
|
+
defineConfig,
|
|
41
49
|
preview2 as preview
|
|
42
50
|
};
|
|
43
51
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import * as v from 'valibot';\nimport { VivliostyleInlineConfig } from './config/schema.js';\nimport { build as _build } from './core/build.js';\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/config/define.ts"],"sourcesContent":["import * as v from 'valibot';\nimport { VivliostyleInlineConfig } from './config/schema.js';\nimport { build as _build } from './core/build.js';\nimport { create as _create } from './core/create.js';\nimport { preview as _preview } from './core/preview.js';\nimport type { PublicationManifest as _PublicationManifest } from './schema/publication.schema.js';\n\nexport { defineConfig } from './config/define.js';\nexport type {\n StructuredDocument,\n StructuredDocumentSection,\n VivliostyleConfigSchema,\n VivliostylePackageMetadata,\n} from './config/schema.js';\nexport type { TemplateVariable } from './create-template.js';\nexport { createVitePlugin } from './vite-adapter.js';\n/** @hidden */\nexport type PublicationManifest = _PublicationManifest;\n\n/**\n * Build publication file(s) from the given configuration.\n *\n * ```ts\n * import { build } from '@vivliostyle/cli';\n * build({\n * configPath: './vivliostyle.config.js',\n * logLevel: 'silent',\n * });\n * ```\n *\n * @param options\n * @returns\n */\nexport async function build(options: VivliostyleInlineConfig) {\n const parsed = v.parse(VivliostyleInlineConfig, options);\n return await _build(parsed);\n}\n\n/**\n * Open a browser for previewing the publication.\n *\n * @param options\n * @returns\n */\nexport async function preview(options: VivliostyleInlineConfig) {\n const parsed = v.parse(VivliostyleInlineConfig, options);\n return await _preview(parsed);\n}\n\n/**\n * Scaffold a new Vivliostyle project.\n *\n * @param options\n * @returns\n */\nexport async function create(options: VivliostyleInlineConfig) {\n const parsed = v.parse(VivliostyleInlineConfig, options);\n return await _create(parsed);\n}\n","import { VivliostyleConfigSchema } from './schema.js';\n\n/**\n * Define the configuration for Vivliostyle CLI.\n */\nexport function defineConfig(\n config: VivliostyleConfigSchema,\n): VivliostyleConfigSchema {\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAY,OAAO;;;ACKZ,SAAS,aACd,QACyB;AACzB,SAAO;AACT;;;ADwBA,eAAsBA,OAAM,SAAkC;AAC5D,QAAM,SAAW,QAAM,yBAAyB,OAAO;AACvD,SAAO,MAAM,MAAO,MAAM;AAC5B;AAQA,eAAsBC,SAAQ,SAAkC;AAC9D,QAAM,SAAW,QAAM,yBAAyB,OAAO;AACvD,SAAO,MAAM,QAAS,MAAM;AAC9B;AAQA,eAAsBC,QAAO,SAAkC;AAC7D,QAAM,SAAW,QAAM,yBAAyB,OAAO;AACvD,SAAO,MAAM,OAAQ,MAAM;AAC7B;","names":["build","preview","create"]}
|
package/dist/node-modules.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as playwright_core from 'playwright-core';
|
|
1
|
+
import * as puppeteer_core from 'puppeteer-core';
|
|
3
2
|
import * as pdf_lib from 'pdf-lib';
|
|
4
3
|
import * as press_ready from 'press-ready';
|
|
5
4
|
import * as execa from 'execa';
|
|
6
5
|
import * as command_exists from 'command-exists';
|
|
6
|
+
import * as _puppeteer_browsers from '@puppeteer/browsers';
|
|
7
7
|
import * as _napi_rs_canvas from '@napi-rs/canvas';
|
|
8
8
|
|
|
9
|
-
declare const nodeExternalModules: readonly ["@napi-rs/canvas", "command-exists", "execa", "press-ready", "pdf-lib", "
|
|
9
|
+
declare const nodeExternalModules: readonly ["@napi-rs/canvas", "@puppeteer/browsers", "command-exists", "execa", "press-ready", "pdf-lib", "puppeteer-core"];
|
|
10
10
|
type NodeExternalModules = {
|
|
11
11
|
'@napi-rs/canvas': typeof _napi_rs_canvas;
|
|
12
|
+
'@puppeteer/browsers': typeof _puppeteer_browsers;
|
|
12
13
|
'command-exists': typeof command_exists;
|
|
13
14
|
execa: typeof execa;
|
|
14
15
|
'press-ready': typeof press_ready;
|
|
15
16
|
'pdf-lib': typeof pdf_lib;
|
|
16
|
-
'
|
|
17
|
-
'playwright-core/lib/server': typeof playwright_core_lib_server;
|
|
17
|
+
'puppeteer-core': typeof puppeteer_core;
|
|
18
18
|
};
|
|
19
19
|
declare const importNodeModule: <T extends (typeof nodeExternalModules)[number]>(name: T) => Promise<NodeExternalModules[T]>;
|
|
20
20
|
|
package/dist/node-modules.js
CHANGED
package/dist/vite-adapter.d.ts
CHANGED
package/dist/vite-adapter.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createVitePlugin
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-SPTG2DFV.js";
|
|
4
|
+
import "./chunk-CKAJY2BE.js";
|
|
5
|
+
import "./chunk-T2VWLU2I.js";
|
|
6
|
+
import "./chunk-CKXFRCPH.js";
|
|
7
|
+
import "./chunk-ZEBXHUJX.js";
|
|
8
|
+
import "./chunk-ZIK6DINS.js";
|
|
9
9
|
import "./chunk-I7BWSAN6.js";
|
|
10
10
|
export {
|
|
11
11
|
createVitePlugin
|
package/package.json
CHANGED
|
@@ -1,31 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vivliostyle/cli",
|
|
3
3
|
"description": "Save the pdf file via headless browser and Vivliostyle.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "10.0.1",
|
|
5
5
|
"author": "spring_raining <harusamex.com@gmail.com>",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "run-s build:*",
|
|
9
|
-
"build:cli": "tsup && shx chmod +x dist/cli.js",
|
|
10
|
-
"build:typecheck": "tsc --noEmit",
|
|
11
|
-
"build:docs": "tsx scripts/update-docs.ts",
|
|
12
|
-
"generate:schema": "json2ts -i schemas/pub-manifest/publication.schema.json -o src/schema/publication.schema.ts --cwd schemas/pub-manifest",
|
|
13
|
-
"clean": "shx rm -rf dist tmp",
|
|
14
|
-
"dev": "tsup --watch src",
|
|
15
|
-
"pretest": "playwright-core install chromium --no-shell",
|
|
16
|
-
"release": "release-it",
|
|
17
|
-
"release:pre": "release-it --preRelease --npm.tag=next",
|
|
18
|
-
"test": "vitest run --coverage",
|
|
19
|
-
"prepare": "husky"
|
|
20
|
-
},
|
|
21
7
|
"peerDependencies": {
|
|
22
8
|
"vite": ">=6"
|
|
23
9
|
},
|
|
24
10
|
"dependencies": {
|
|
25
11
|
"@babel/code-frame": "7.26.2",
|
|
12
|
+
"@bluwy/giget-core": "0.1.3",
|
|
13
|
+
"@clack/core": "1.0.0-alpha.6",
|
|
14
|
+
"@clack/prompts": "1.0.0-alpha.6",
|
|
26
15
|
"@humanwhocodes/momoa": "3.3.8",
|
|
27
16
|
"@napi-rs/canvas": "0.1.69",
|
|
28
|
-
"@npmcli/arborist": "
|
|
17
|
+
"@npmcli/arborist": "9.1.7",
|
|
18
|
+
"@puppeteer/browsers": "2.10.5",
|
|
29
19
|
"@vivliostyle/jsdom": "25.0.1-vivliostyle-cli.1",
|
|
30
20
|
"@vivliostyle/vfm": "2.4.0",
|
|
31
21
|
"@vivliostyle/viewer": "2.37.0",
|
|
@@ -33,6 +23,7 @@
|
|
|
33
23
|
"ajv-formats": "3.0.1",
|
|
34
24
|
"archiver": "7.0.1",
|
|
35
25
|
"bcp-47-match": "2.0.3",
|
|
26
|
+
"change-case": "5.4.4",
|
|
36
27
|
"command-exists": "1.2.9",
|
|
37
28
|
"commander": "13.1.0",
|
|
38
29
|
"debug": "4.4.0",
|
|
@@ -40,27 +31,34 @@
|
|
|
40
31
|
"dompurify": "3.2.5",
|
|
41
32
|
"escape-string-regexp": "5.0.0",
|
|
42
33
|
"execa": "9.5.2",
|
|
34
|
+
"fast-wrap-ansi": "0.1.3",
|
|
43
35
|
"fast-xml-parser": "5.2.1",
|
|
44
36
|
"fs-extra": "11.2.0",
|
|
45
37
|
"github-slugger": "2.0.0",
|
|
38
|
+
"handlebars": "4.7.8",
|
|
46
39
|
"hast-util-to-html": "9.0.5",
|
|
47
40
|
"hastscript": "9.0.1",
|
|
41
|
+
"lcid": "5.0.0",
|
|
48
42
|
"mime-types": "3.0.1",
|
|
43
|
+
"node-fetch-native": "1.6.7",
|
|
49
44
|
"node-stream-zip": "1.15.0",
|
|
50
45
|
"npm-package-arg": "12.0.2",
|
|
46
|
+
"os-locale": "6.0.2",
|
|
51
47
|
"pdf-lib": "1.17.1",
|
|
52
48
|
"picomatch": "4.0.2",
|
|
53
|
-
"playwright-core": "1.56.1",
|
|
54
49
|
"press-ready": "4.0.3",
|
|
50
|
+
"puppeteer-core": "24.27.0",
|
|
55
51
|
"resolve-pkg": "2.0.0",
|
|
56
52
|
"semver": "7.7.1",
|
|
57
53
|
"sirv": "3.0.1",
|
|
54
|
+
"sisteransi": "1.0.5",
|
|
58
55
|
"terminal-link": "4.0.0",
|
|
59
56
|
"tinyglobby": "0.2.13",
|
|
57
|
+
"title-case": "4.3.2",
|
|
60
58
|
"tmp": "0.2.4",
|
|
61
59
|
"upath": "2.0.1",
|
|
62
60
|
"uuid": "11.1.0",
|
|
63
|
-
"valibot": "1.
|
|
61
|
+
"valibot": "1.2.0",
|
|
64
62
|
"vfile": "4.2.1",
|
|
65
63
|
"vite": "^6.3.5",
|
|
66
64
|
"w3c-xmlserializer": "5.0.0",
|
|
@@ -69,7 +67,8 @@
|
|
|
69
67
|
"yoctocolors": "2.1.1"
|
|
70
68
|
},
|
|
71
69
|
"devDependencies": {
|
|
72
|
-
"@
|
|
70
|
+
"@changesets/cli": "2.29.8",
|
|
71
|
+
"@svitejs/changesets-changelog-github-compact": "1.2.0",
|
|
73
72
|
"@types/adm-zip": "0.5.7",
|
|
74
73
|
"@types/archiver": "6.0.3",
|
|
75
74
|
"@types/babel__code-frame": "7.0.6",
|
|
@@ -96,16 +95,13 @@
|
|
|
96
95
|
"husky": "9.1.7",
|
|
97
96
|
"json-schema-to-typescript": "15.0.4",
|
|
98
97
|
"memfs": "4.17.0",
|
|
99
|
-
"
|
|
100
|
-
"pnpm": "10.9.0",
|
|
98
|
+
"pnpm": "10.25.0",
|
|
101
99
|
"prettier": "3.5.3",
|
|
102
100
|
"prettier-plugin-astro": "0.14.1",
|
|
103
101
|
"pretty-quick": "4.1.1",
|
|
104
|
-
"release-it": "17.11.0",
|
|
105
102
|
"shx": "0.4.0",
|
|
106
103
|
"supertest": "7.1.0",
|
|
107
104
|
"tsup": "8.4.0",
|
|
108
|
-
"tsx": "4.19.3",
|
|
109
105
|
"typedoc": "^0.28.3",
|
|
110
106
|
"typedoc-plugin-markdown": "4.6.3",
|
|
111
107
|
"typescript": "5.8.3",
|
|
@@ -124,6 +120,10 @@
|
|
|
124
120
|
"types": "./dist/cli.d.ts",
|
|
125
121
|
"import": "./dist/cli.js"
|
|
126
122
|
},
|
|
123
|
+
"./commands/*": {
|
|
124
|
+
"types": "./dist/commands/*.d.ts",
|
|
125
|
+
"import": "./dist/commands/*.js"
|
|
126
|
+
},
|
|
127
127
|
"./node-modules": {
|
|
128
128
|
"types": "./dist/node-modules.d.ts",
|
|
129
129
|
"import": "./dist/node-modules.js"
|
|
@@ -158,7 +158,18 @@
|
|
|
158
158
|
],
|
|
159
159
|
"license": "AGPL-3.0",
|
|
160
160
|
"engines": {
|
|
161
|
-
"node": ">=
|
|
161
|
+
"node": "^20.0.0 || >=22.0.0"
|
|
162
162
|
},
|
|
163
|
-
"
|
|
164
|
-
|
|
163
|
+
"scripts": {
|
|
164
|
+
"build": "pnpm run --sequential \"/^build:.*/\"",
|
|
165
|
+
"build:cli": "tsup",
|
|
166
|
+
"build:typecheck": "tsc --noEmit",
|
|
167
|
+
"build:create-book": "pnpm run --filter create-book build",
|
|
168
|
+
"build:docs": "node scripts/update-docs.ts",
|
|
169
|
+
"generate:schema": "json2ts -i schemas/pub-manifest/publication.schema.json -o src/schema/publication.schema.ts --cwd schemas/pub-manifest",
|
|
170
|
+
"generate:browser-versions": "node scripts/update-default-browser-versions.ts",
|
|
171
|
+
"clean": "shx rm -rf dist tmp",
|
|
172
|
+
"dev": "tsup --watch src",
|
|
173
|
+
"test": "vitest run --coverage"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/preview.ts"],"sourcesContent":["import terminalLink from 'terminal-link';\nimport { ViteDevServer } from 'vite';\nimport { blueBright, cyan, dim } from 'yoctocolors';\nimport { setupConfigFromFlags } from '../commands/cli-flags.js';\nimport { loadVivliostyleConfig, warnDeprecatedConfig } from '../config/load.js';\nimport { mergeConfig, mergeInlineConfig } from '../config/merge.js';\nimport { resolveTaskConfig } from '../config/resolve.js';\nimport { ParsedVivliostyleInlineConfig } from '../config/schema.js';\nimport { resolveViteConfig } from '../config/vite.js';\nimport { cliVersion } from '../const.js';\nimport { isUnicodeSupported, Logger, randomBookSymbol } from '../logger.js';\nimport { createViteServer, getViewerFullUrl } from '../server.js';\n\nexport async function preview(inlineConfig: ParsedVivliostyleInlineConfig) {\n Logger.setLogLevel(inlineConfig.logLevel);\n Logger.setCustomLogger(inlineConfig.logger);\n Logger.debug('preview > inlineConfig %O', inlineConfig);\n\n let vivliostyleConfig =\n (await loadVivliostyleConfig(inlineConfig)) ??\n setupConfigFromFlags(inlineConfig);\n warnDeprecatedConfig(vivliostyleConfig);\n vivliostyleConfig = mergeInlineConfig(vivliostyleConfig, inlineConfig);\n const { tasks, inlineOptions } = vivliostyleConfig;\n Logger.debug('preview > vivliostyleConfig %O', vivliostyleConfig);\n\n // Only show preview of first entry\n let config = resolveTaskConfig(tasks[0], inlineOptions);\n Logger.debug('preview > config %O', config);\n\n let server: ViteDevServer;\n let url: string;\n {\n using _ = Logger.startLogging('Start preview');\n const viteConfig = await resolveViteConfig({\n ...config,\n mode: 'preview',\n });\n server = await createViteServer({\n config,\n viteConfig,\n inlineConfig,\n mode: 'preview',\n });\n if (server.httpServer) {\n await server.listen();\n vivliostyleConfig = mergeConfig(vivliostyleConfig, {\n temporaryFilePrefix: config.temporaryFilePrefix,\n server: server.config.server,\n });\n config = resolveTaskConfig(\n vivliostyleConfig.tasks[0],\n vivliostyleConfig.inlineOptions,\n );\n }\n url = await getViewerFullUrl(config);\n }\n\n if (server.httpServer) {\n Logger.log(`\n${cyan(`Vivliostyle CLI v${cliVersion}`)}\n${blueBright('║')} ${isUnicodeSupported ? `${randomBookSymbol} ` : ''}Up and running (press Ctrl+C to quit)\n${blueBright('╙─')} ${dim(`Preview URL: ${terminalLink(url, url, { fallback: () => url })}`)}\n`);\n }\n return server;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,kBAAkB;AAEzB,SAAS,YAAY,MAAM,WAAW;AAWtC,eAAsB,QAAQ,cAA6C;AACzE,SAAO,YAAY,aAAa,QAAQ;AACxC,SAAO,gBAAgB,aAAa,MAAM;AAC1C,SAAO,MAAM,6BAA6B,YAAY;AAEtD,MAAI,oBACD,MAAM,sBAAsB,YAAY,KACzC,qBAAqB,YAAY;AACnC,uBAAqB,iBAAiB;AACtC,sBAAoB,kBAAkB,mBAAmB,YAAY;AACrE,QAAM,EAAE,OAAO,cAAc,IAAI;AACjC,SAAO,MAAM,kCAAkC,iBAAiB;AAGhE,MAAI,SAAS,kBAAkB,MAAM,CAAC,GAAG,aAAa;AACtD,SAAO,MAAM,uBAAuB,MAAM;AAE1C,MAAI;AACJ,MAAI;AACJ;AACE;AAAA;AAAA,YAAMA,KAAI,uBAAO,aAAa,eAAe;AAC7C,YAAM,aAAa,MAAM,kBAAkB;AAAA,QACzC,GAAG;AAAA,QACH,MAAM;AAAA,MACR,CAAC;AACD,eAAS,MAAM,iBAAiB;AAAA,QAC9B;AAAA,QACA;AAAA,QACA;AAAA,QACA,MAAM;AAAA,MACR,CAAC;AACD,UAAI,OAAO,YAAY;AACrB,cAAM,OAAO,OAAO;AACpB,4BAAoB,YAAY,mBAAmB;AAAA,UACjD,qBAAqB,OAAO;AAAA,UAC5B,QAAQ,OAAO,OAAO;AAAA,QACxB,CAAC;AACD,iBAAS;AAAA,UACP,kBAAkB,MAAM,CAAC;AAAA,UACzB,kBAAkB;AAAA,QACpB;AAAA,MACF;AACA,YAAM,MAAM,iBAAiB,MAAM;AAAA,aAtBnC;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBF;AAEA,MAAI,OAAO,YAAY;AACrB,WAAO,IAAI;AAAA,EACb,KAAK,oBAAoB,UAAU,EAAE,CAAC;AAAA,EACtC,WAAW,QAAG,CAAC,IAAI,qBAAqB,GAAG,gBAAgB,MAAM,EAAE;AAAA,EACnE,WAAW,cAAI,CAAC,IAAI,IAAI,gBAAgB,aAAa,KAAK,KAAK,EAAE,UAAU,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC;AAAA,CAC3F;AAAA,EACC;AACA,SAAO;AACT;","names":["_"]}
|
package/dist/chunk-4IIM6RSG.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// src/const.ts
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import resolvePkg from "resolve-pkg";
|
|
5
|
-
import upath from "upath";
|
|
6
|
-
var MANIFEST_FILENAME = "publication.json";
|
|
7
|
-
var TOC_FILENAME = "index.html";
|
|
8
|
-
var TOC_TITLE = "Table of Contents";
|
|
9
|
-
var COVER_HTML_FILENAME = "cover.html";
|
|
10
|
-
var COVER_HTML_IMAGE_ALT = "Cover image";
|
|
11
|
-
var XML_DECLARATION = '<?xml version="1.0" encoding="UTF-8"?>';
|
|
12
|
-
var EPUB_OUTPUT_VERSION = "3.0";
|
|
13
|
-
var EPUB_NS = "http://www.idpf.org/2007/ops";
|
|
14
|
-
var EPUB_CONTAINER_XML = `${XML_DECLARATION}
|
|
15
|
-
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
|
|
16
|
-
<rootfiles>
|
|
17
|
-
<rootfile full-path="EPUB/content.opf" media-type="application/oebps-package+xml" />
|
|
18
|
-
</rootfiles>
|
|
19
|
-
</container>`;
|
|
20
|
-
var EPUB_LANDMARKS_TITLE = "Landmarks";
|
|
21
|
-
var EPUB_LANDMARKS_TOC_ENTRY = TOC_TITLE;
|
|
22
|
-
var EPUB_LANDMARKS_COVER_ENTRY = "Cover Page";
|
|
23
|
-
var EMPTY_DATA_URI = "data:,";
|
|
24
|
-
var VIEWER_ROOT_PATH = "/__vivliostyle-viewer";
|
|
25
|
-
var CONTAINER_URL = "ghcr.io/vivliostyle/cli";
|
|
26
|
-
var CONTAINER_ROOT_DIR = "/data";
|
|
27
|
-
var CONTAINER_LOCAL_HOSTNAME = "host.docker.internal";
|
|
28
|
-
var cliRoot = upath.join(fileURLToPath(import.meta.url), "../..");
|
|
29
|
-
var cliVersion = (() => {
|
|
30
|
-
if (import.meta.env?.VITEST) {
|
|
31
|
-
return "0.0.1";
|
|
32
|
-
}
|
|
33
|
-
const pkg = JSON.parse(
|
|
34
|
-
fs.readFileSync(upath.join(cliRoot, "package.json"), "utf8")
|
|
35
|
-
);
|
|
36
|
-
return pkg.version;
|
|
37
|
-
})();
|
|
38
|
-
var viewerRoot = resolvePkg("@vivliostyle/viewer", { cwd: cliRoot });
|
|
39
|
-
var coreVersion = (() => {
|
|
40
|
-
if (import.meta.env?.VITEST) {
|
|
41
|
-
return "0.0.1";
|
|
42
|
-
}
|
|
43
|
-
const pkg = JSON.parse(
|
|
44
|
-
fs.readFileSync(upath.join(viewerRoot, "package.json"), "utf8")
|
|
45
|
-
);
|
|
46
|
-
return pkg.version;
|
|
47
|
-
})();
|
|
48
|
-
|
|
49
|
-
export {
|
|
50
|
-
MANIFEST_FILENAME,
|
|
51
|
-
TOC_FILENAME,
|
|
52
|
-
TOC_TITLE,
|
|
53
|
-
COVER_HTML_FILENAME,
|
|
54
|
-
COVER_HTML_IMAGE_ALT,
|
|
55
|
-
XML_DECLARATION,
|
|
56
|
-
EPUB_OUTPUT_VERSION,
|
|
57
|
-
EPUB_NS,
|
|
58
|
-
EPUB_CONTAINER_XML,
|
|
59
|
-
EPUB_LANDMARKS_TITLE,
|
|
60
|
-
EPUB_LANDMARKS_TOC_ENTRY,
|
|
61
|
-
EPUB_LANDMARKS_COVER_ENTRY,
|
|
62
|
-
EMPTY_DATA_URI,
|
|
63
|
-
VIEWER_ROOT_PATH,
|
|
64
|
-
CONTAINER_URL,
|
|
65
|
-
CONTAINER_ROOT_DIR,
|
|
66
|
-
CONTAINER_LOCAL_HOSTNAME,
|
|
67
|
-
cliVersion,
|
|
68
|
-
viewerRoot,
|
|
69
|
-
coreVersion
|
|
70
|
-
};
|
|
71
|
-
//# sourceMappingURL=chunk-4IIM6RSG.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/const.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport resolvePkg from 'resolve-pkg';\nimport upath from 'upath';\n\nexport const MANIFEST_FILENAME = 'publication.json';\nexport const TOC_FILENAME = 'index.html';\nexport const TOC_TITLE = 'Table of Contents';\nexport const COVER_HTML_FILENAME = 'cover.html';\nexport const COVER_HTML_IMAGE_ALT = 'Cover image';\n\nexport const XML_DECLARATION = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>';\nexport const EPUB_OUTPUT_VERSION = '3.0';\nexport const EPUB_MIMETYPE = 'application/epub+zip';\nexport const EPUB_NS = 'http://www.idpf.org/2007/ops';\nexport const EPUB_CONTAINER_XML = `${XML_DECLARATION}\n<container version=\"1.0\" xmlns=\"urn:oasis:names:tc:opendocument:xmlns:container\">\n <rootfiles>\n <rootfile full-path=\"EPUB/content.opf\" media-type=\"application/oebps-package+xml\" />\n </rootfiles>\n</container>`;\nexport const EPUB_LANDMARKS_TITLE = 'Landmarks';\nexport const EPUB_LANDMARKS_TOC_ENTRY = TOC_TITLE;\nexport const EPUB_LANDMARKS_COVER_ENTRY = 'Cover Page';\n\nexport const EMPTY_DATA_URI = 'data:,';\nexport const VIEWER_ROOT_PATH = '/__vivliostyle-viewer';\n\nexport const CONTAINER_URL = 'ghcr.io/vivliostyle/cli';\nexport const CONTAINER_ROOT_DIR = '/data';\n// Special hostname to access host machine from container\n// https://docs.docker.com/desktop/features/networking/#use-cases-and-workarounds\nexport const CONTAINER_LOCAL_HOSTNAME = 'host.docker.internal';\n\nexport const cliRoot = upath.join(fileURLToPath(import.meta.url), '../..');\nexport const cliVersion = (() => {\n if (import.meta.env?.VITEST) {\n return '0.0.1';\n }\n const pkg = JSON.parse(\n fs.readFileSync(upath.join(cliRoot, 'package.json'), 'utf8'),\n );\n return pkg.version;\n})();\n\nexport const viewerRoot = resolvePkg('@vivliostyle/viewer', { cwd: cliRoot })!;\nexport const coreVersion = (() => {\n if (import.meta.env?.VITEST) {\n return '0.0.1';\n }\n const pkg = JSON.parse(\n fs.readFileSync(upath.join(viewerRoot, 'package.json'), 'utf8'),\n );\n return pkg.version;\n})();\n"],"mappings":";AAAA,OAAO,QAAQ;AACf,SAAS,qBAAqB;AAC9B,OAAO,gBAAgB;AACvB,OAAO,WAAW;AAEX,IAAM,oBAAoB;AAC1B,IAAM,eAAe;AACrB,IAAM,YAAY;AAClB,IAAM,sBAAsB;AAC5B,IAAM,uBAAuB;AAE7B,IAAM,kBAAkB;AACxB,IAAM,sBAAsB;AAE5B,IAAM,UAAU;AAChB,IAAM,qBAAqB,GAAG,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAM7C,IAAM,uBAAuB;AAC7B,IAAM,2BAA2B;AACjC,IAAM,6BAA6B;AAEnC,IAAM,iBAAiB;AACvB,IAAM,mBAAmB;AAEzB,IAAM,gBAAgB;AACtB,IAAM,qBAAqB;AAG3B,IAAM,2BAA2B;AAEjC,IAAM,UAAU,MAAM,KAAK,cAAc,YAAY,GAAG,GAAG,OAAO;AAClE,IAAM,cAAc,MAAM;AAC/B,MAAI,YAAY,KAAK,QAAQ;AAC3B,WAAO;AAAA,EACT;AACA,QAAM,MAAM,KAAK;AAAA,IACf,GAAG,aAAa,MAAM,KAAK,SAAS,cAAc,GAAG,MAAM;AAAA,EAC7D;AACA,SAAO,IAAI;AACb,GAAG;AAEI,IAAM,aAAa,WAAW,uBAAuB,EAAE,KAAK,QAAQ,CAAC;AACrE,IAAM,eAAe,MAAM;AAChC,MAAI,YAAY,KAAK,QAAQ;AAC3B,WAAO;AAAA,EACT;AACA,QAAM,MAAM,KAAK;AAAA,IACf,GAAG,aAAa,MAAM,KAAK,YAAY,cAAc,GAAG,MAAM;AAAA,EAChE;AACA,SAAO,IAAI;AACb,GAAG;","names":[]}
|
package/dist/chunk-6KEOMYDZ.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Logger,
|
|
3
|
-
cwd,
|
|
4
|
-
runExitHandlers
|
|
5
|
-
} from "./chunk-G3GROLBN.js";
|
|
6
|
-
import {
|
|
7
|
-
CONTAINER_URL,
|
|
8
|
-
cliVersion
|
|
9
|
-
} from "./chunk-4IIM6RSG.js";
|
|
10
|
-
|
|
11
|
-
// src/core/init.ts
|
|
12
|
-
import fs from "node:fs";
|
|
13
|
-
import upath from "upath";
|
|
14
|
-
import { cyan, yellow } from "yoctocolors";
|
|
15
|
-
async function init(inlineConfig) {
|
|
16
|
-
Logger.setLogLevel(inlineConfig.logLevel);
|
|
17
|
-
Logger.setCustomLogger(inlineConfig.logger);
|
|
18
|
-
const vivliostyleConfigPath = upath.join(
|
|
19
|
-
inlineConfig.cwd ?? cwd,
|
|
20
|
-
"vivliostyle.config.js"
|
|
21
|
-
);
|
|
22
|
-
if (fs.existsSync(vivliostyleConfigPath)) {
|
|
23
|
-
runExitHandlers();
|
|
24
|
-
return Logger.log(
|
|
25
|
-
`${yellow("vivliostyle.config.js already exists. aborting.")}`
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
const vivliostyleConfig = `// @ts-check
|
|
29
|
-
/** @type {import('@vivliostyle/cli').VivliostyleConfigSchema} */
|
|
30
|
-
const vivliostyleConfig = {
|
|
31
|
-
title: '${inlineConfig.title || "Principia"}', // populated into 'publication.json', default to 'title' of the first entry or 'name' in 'package.json'.
|
|
32
|
-
author: '${inlineConfig.author || "Isaac Newton"}', // default to 'author' in 'package.json' or undefined
|
|
33
|
-
${inlineConfig.language ? "" : "// "}language: '${inlineConfig.language || "la"}',
|
|
34
|
-
// readingProgression: 'rtl', // reading progression direction, 'ltr' or 'rtl'.
|
|
35
|
-
${inlineConfig.size ? "" : "// "}size: '${inlineConfig.size || "A4"}',
|
|
36
|
-
${inlineConfig.theme ? "" : "// "}theme: '${inlineConfig.theme?.[0].specifier || ""}', // .css or local dir or npm package. default to undefined
|
|
37
|
-
image: '${CONTAINER_URL}:${cliVersion}',
|
|
38
|
-
entry: [ // **required field**
|
|
39
|
-
// 'introduction.md', // 'title' is automatically guessed from the file (frontmatter > first heading)
|
|
40
|
-
// {
|
|
41
|
-
// path: 'epigraph.md',
|
|
42
|
-
// title: '\u304A\u308F\u308A\u306B', // title can be overwritten (entry > file),
|
|
43
|
-
// theme: '@vivliostyle/theme-whatever' // theme can be set individually. default to root 'theme'
|
|
44
|
-
// },
|
|
45
|
-
// 'glossary.html' // html is also acceptable
|
|
46
|
-
], // 'entry' can be 'string' or 'object' if there's only single markdown file
|
|
47
|
-
// entryContext: './manuscripts', // default to '.' (relative to 'vivliostyle.config.js')
|
|
48
|
-
// output: [ // path to generate draft file(s). default to '{title}.pdf'
|
|
49
|
-
// './output.pdf', // the output format will be inferred from the name.
|
|
50
|
-
// {
|
|
51
|
-
// path: './book',
|
|
52
|
-
// format: 'webpub',
|
|
53
|
-
// },
|
|
54
|
-
// ],
|
|
55
|
-
// workspaceDir: '.vivliostyle', // directory which is saved intermediate files.
|
|
56
|
-
// toc: {
|
|
57
|
-
// title: 'Table of Contents',
|
|
58
|
-
// htmlPath: 'index.html',
|
|
59
|
-
// sectionDepth: 3,
|
|
60
|
-
// },
|
|
61
|
-
// cover: './cover.png', // cover image. default to undefined.
|
|
62
|
-
// vfm: { // options of VFM processor
|
|
63
|
-
// replace: [ // specify replace handlers to modify HTML outputs
|
|
64
|
-
// {
|
|
65
|
-
// // This handler replaces {current_time} to a current local time tag.
|
|
66
|
-
// test: /{current_time}/,
|
|
67
|
-
// match: (_, h) => {
|
|
68
|
-
// const currentTime = new Date().toLocaleString();
|
|
69
|
-
// return h('time', { datetime: currentTime }, currentTime);
|
|
70
|
-
// },
|
|
71
|
-
// },
|
|
72
|
-
// ],
|
|
73
|
-
// hardLineBreaks: true, // converts line breaks of VFM to <br> tags. default to 'false'.
|
|
74
|
-
// disableFormatHtml: true, // disables HTML formatting. default to 'false'.
|
|
75
|
-
// },
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
module.exports = vivliostyleConfig;
|
|
79
|
-
`;
|
|
80
|
-
fs.mkdirSync(upath.dirname(vivliostyleConfigPath), { recursive: true });
|
|
81
|
-
fs.writeFileSync(vivliostyleConfigPath, vivliostyleConfig);
|
|
82
|
-
runExitHandlers();
|
|
83
|
-
Logger.log(`Successfully created ${cyan("vivliostyle.config.js")}`);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export {
|
|
87
|
-
init
|
|
88
|
-
};
|
|
89
|
-
//# sourceMappingURL=chunk-6KEOMYDZ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/init.ts"],"sourcesContent":["import fs from 'node:fs';\nimport upath from 'upath';\nimport { cyan, yellow } from 'yoctocolors';\nimport { ParsedVivliostyleInlineConfig } from '../config/schema.js';\nimport { cliVersion, CONTAINER_URL } from '../const.js';\nimport { Logger } from '../logger.js';\nimport { cwd, runExitHandlers } from '../util.js';\n\nexport async function init(inlineConfig: ParsedVivliostyleInlineConfig) {\n Logger.setLogLevel(inlineConfig.logLevel);\n Logger.setCustomLogger(inlineConfig.logger);\n\n const vivliostyleConfigPath = upath.join(\n inlineConfig.cwd ?? cwd,\n 'vivliostyle.config.js',\n );\n\n if (fs.existsSync(vivliostyleConfigPath)) {\n runExitHandlers();\n return Logger.log(\n `${yellow('vivliostyle.config.js already exists. aborting.')}`,\n );\n }\n\n // prettier-ignore\n const vivliostyleConfig = `// @ts-check\n/** @type {import('@vivliostyle/cli').VivliostyleConfigSchema} */\nconst vivliostyleConfig = {\n title: '${ inlineConfig.title || 'Principia'}', // populated into 'publication.json', default to 'title' of the first entry or 'name' in 'package.json'.\n author: '${inlineConfig.author || 'Isaac Newton'}', // default to 'author' in 'package.json' or undefined\n ${inlineConfig.language ? '' : '// '}language: '${inlineConfig.language || 'la'}',\n // readingProgression: 'rtl', // reading progression direction, 'ltr' or 'rtl'.\n ${inlineConfig.size ? '' : '// '}size: '${inlineConfig.size || 'A4'}',\n ${inlineConfig.theme ? '' : '// '}theme: '${inlineConfig.theme?.[0].specifier || ''}', // .css or local dir or npm package. default to undefined\n image: '${CONTAINER_URL}:${cliVersion}',\n entry: [ // **required field**\n // 'introduction.md', // 'title' is automatically guessed from the file (frontmatter > first heading)\n // {\n // path: 'epigraph.md',\n // title: 'おわりに', // title can be overwritten (entry > file),\n // theme: '@vivliostyle/theme-whatever' // theme can be set individually. default to root 'theme'\n // },\n // 'glossary.html' // html is also acceptable\n ], // 'entry' can be 'string' or 'object' if there's only single markdown file\n // entryContext: './manuscripts', // default to '.' (relative to 'vivliostyle.config.js')\n // output: [ // path to generate draft file(s). default to '{title}.pdf'\n // './output.pdf', // the output format will be inferred from the name.\n // {\n // path: './book',\n // format: 'webpub',\n // },\n // ],\n // workspaceDir: '.vivliostyle', // directory which is saved intermediate files.\n // toc: {\n // title: 'Table of Contents',\n // htmlPath: 'index.html',\n // sectionDepth: 3,\n // },\n // cover: './cover.png', // cover image. default to undefined.\n // vfm: { // options of VFM processor\n // replace: [ // specify replace handlers to modify HTML outputs\n // {\n // // This handler replaces {current_time} to a current local time tag.\n // test: /{current_time}/,\n // match: (_, h) => {\n // const currentTime = new Date().toLocaleString();\n // return h('time', { datetime: currentTime }, currentTime);\n // },\n // },\n // ],\n // hardLineBreaks: true, // converts line breaks of VFM to <br> tags. default to 'false'.\n // disableFormatHtml: true, // disables HTML formatting. default to 'false'.\n // },\n};\n\nmodule.exports = vivliostyleConfig;\n`;\n\n fs.mkdirSync(upath.dirname(vivliostyleConfigPath), { recursive: true });\n fs.writeFileSync(vivliostyleConfigPath, vivliostyleConfig);\n\n runExitHandlers();\n Logger.log(`Successfully created ${cyan('vivliostyle.config.js')}`);\n}\n"],"mappings":";;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,WAAW;AAClB,SAAS,MAAM,cAAc;AAM7B,eAAsB,KAAK,cAA6C;AACtE,SAAO,YAAY,aAAa,QAAQ;AACxC,SAAO,gBAAgB,aAAa,MAAM;AAE1C,QAAM,wBAAwB,MAAM;AAAA,IAClC,aAAa,OAAO;AAAA,IACpB;AAAA,EACF;AAEA,MAAI,GAAG,WAAW,qBAAqB,GAAG;AACxC,oBAAgB;AAChB,WAAO,OAAO;AAAA,MACZ,GAAG,OAAO,iDAAiD,CAAC;AAAA,IAC9D;AAAA,EACF;AAGA,QAAM,oBAAoB;AAAA;AAAA;AAAA,YAGf,aAAa,SAAS,WAAW;AAAA,aACjC,aAAa,UAAU,cAAc;AAAA,IAC9C,aAAa,WAAW,KAAK,KAAK,cAAc,aAAa,YAAY,IAAI;AAAA;AAAA,IAE7E,aAAa,OAAO,KAAK,KAAK,UAAU,aAAa,QAAQ,IAAI;AAAA,IACjE,aAAa,QAAQ,KAAK,KAAK,WAAW,aAAa,QAAQ,CAAC,EAAE,aAAa,EAAE;AAAA,YACzE,aAAa,IAAI,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4CrC,KAAG,UAAU,MAAM,QAAQ,qBAAqB,GAAG,EAAE,WAAW,KAAK,CAAC;AACtE,KAAG,cAAc,uBAAuB,iBAAiB;AAEzD,kBAAgB;AAChB,SAAO,IAAI,wBAAwB,KAAK,uBAAuB,CAAC,EAAE;AACpE;","names":[]}
|