@vivliostyle/cli 5.8.1 → 6.0.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.
- package/dist/browser.d.ts +1 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +20 -54
- package/dist/browser.js.map +1 -1
- package/dist/build.d.ts +1 -1
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +46 -47
- package/dist/build.js.map +1 -1
- package/dist/builder.d.ts +5 -6
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +124 -103
- package/dist/builder.js.map +1 -1
- package/dist/cli.js +5 -10
- package/dist/cli.js.map +1 -1
- package/dist/commands/build.js +10 -16
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/build.parser.d.ts +3 -3
- package/dist/commands/build.parser.d.ts.map +1 -1
- package/dist/commands/build.parser.js +13 -21
- package/dist/commands/build.parser.js.map +1 -1
- package/dist/commands/init.js +7 -9
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/init.parser.d.ts +2 -2
- package/dist/commands/init.parser.d.ts.map +1 -1
- package/dist/commands/init.parser.js +3 -10
- package/dist/commands/init.parser.js.map +1 -1
- package/dist/commands/preview.js +8 -11
- package/dist/commands/preview.js.map +1 -1
- package/dist/commands/preview.parser.d.ts +2 -2
- package/dist/commands/preview.parser.d.ts.map +1 -1
- package/dist/commands/preview.parser.js +5 -12
- package/dist/commands/preview.parser.js.map +1 -1
- package/dist/config.d.ts +29 -18
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +285 -251
- package/dist/config.js.map +1 -1
- package/dist/const.d.ts +2 -0
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +12 -15
- package/dist/const.js.map +1 -1
- package/dist/container.js +31 -41
- package/dist/container.js.map +1 -1
- package/dist/epub.d.ts.map +1 -1
- package/dist/epub.js +10 -17
- package/dist/epub.js.map +1 -1
- package/dist/html.d.ts +3 -3
- package/dist/html.d.ts.map +1 -1
- package/dist/html.js +21 -30
- package/dist/html.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -9
- package/dist/index.js.map +1 -1
- package/dist/init.js +12 -19
- package/dist/init.js.map +1 -1
- package/dist/input.d.ts +2 -2
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +8 -16
- package/dist/input.js.map +1 -1
- package/dist/markdown.js +9 -17
- package/dist/markdown.js.map +1 -1
- package/dist/output.d.ts +1 -1
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +6 -16
- package/dist/output.js.map +1 -1
- package/dist/pdf.d.ts +3 -3
- package/dist/pdf.d.ts.map +1 -1
- package/dist/pdf.js +66 -79
- package/dist/pdf.js.map +1 -1
- package/dist/postprocess.d.ts +5 -5
- package/dist/postprocess.d.ts.map +1 -1
- package/dist/postprocess.js +54 -81
- package/dist/postprocess.js.map +1 -1
- package/dist/preview.d.ts +1 -1
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +53 -58
- package/dist/preview.js.map +1 -1
- package/dist/schema/pubManifest.d.ts +2 -471
- package/dist/schema/pubManifest.d.ts.map +1 -1
- package/dist/schema/pubManifest.js +41 -42
- package/dist/schema/pubManifest.js.map +1 -1
- package/dist/schema/publication.schema.d.ts +12 -12
- package/dist/schema/publication.schema.d.ts.map +1 -1
- package/dist/schema/publication.schema.js +1 -2
- package/dist/schema/publication.schema.js.map +1 -1
- package/dist/schema/vivliostyle.d.ts +1 -1
- package/dist/schema/vivliostyle.d.ts.map +1 -1
- package/dist/schema/vivliostyle.js +7 -8
- package/dist/schema/vivliostyle.js.map +1 -1
- package/dist/schema/vivliostyleConfig.schema.d.ts +22 -9
- package/dist/schema/vivliostyleConfig.schema.d.ts.map +1 -1
- package/dist/schema/vivliostyleConfig.schema.js +1 -2
- package/dist/schema/vivliostyleConfig.schema.js.map +1 -1
- package/dist/server.d.ts +7 -6
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +26 -38
- package/dist/server.js.map +1 -1
- package/dist/theme.d.ts +6 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +74 -0
- package/dist/theme.js.map +1 -0
- package/dist/util.d.ts +3 -3
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +80 -98
- package/dist/util.js.map +1 -1
- package/dist/webbook.d.ts +1 -1
- package/dist/webbook.d.ts.map +1 -1
- package/dist/webbook.js +40 -44
- package/dist/webbook.js.map +1 -1
- package/package.json +33 -17
- package/schemas/pubManifest/README.md +5 -0
- package/schemas/pubManifest/module/ItemList.schema.json +32 -0
- package/schemas/pubManifest/module/bcp.schema.json +7 -0
- package/schemas/pubManifest/module/context.schema.json +62 -0
- package/schemas/pubManifest/module/contributor-object.schema.json +42 -0
- package/schemas/pubManifest/module/contributor.schema.json +26 -0
- package/schemas/pubManifest/module/date.schema.json +7 -0
- package/schemas/pubManifest/module/duration.schema.json +7 -0
- package/schemas/pubManifest/module/item-lists.schema.json +16 -0
- package/schemas/pubManifest/module/language.schema.json +16 -0
- package/schemas/pubManifest/module/link.schema.json +60 -0
- package/schemas/pubManifest/module/localizable-object.schema.json +15 -0
- package/schemas/pubManifest/module/localizable.schema.json +26 -0
- package/schemas/pubManifest/module/resource.categorization.schema.json +31 -0
- package/schemas/pubManifest/module/strings.schema.json +9 -0
- package/schemas/pubManifest/module/url.schema.json +7 -0
- package/schemas/pubManifest/module/urls.schema.json +18 -0
- package/schemas/pubManifest/publication.schema.json +123 -0
- package/schemas/vivliostyle/vivliostyleConfig.schema.json +348 -0
- package/types/better-ajv-errors.d.ts +28 -0
- package/types/custom.d.ts +9 -0
- package/types/playwright.d.ts +49 -0
- package/dist/schema/pubManifest/module/ItemList.schema.json +0 -32
- package/dist/schema/pubManifest/module/bcp.schema.json +0 -7
- package/dist/schema/pubManifest/module/context.schema.json +0 -62
- package/dist/schema/pubManifest/module/contributor-object.schema.json +0 -42
- package/dist/schema/pubManifest/module/contributor.schema.json +0 -26
- package/dist/schema/pubManifest/module/date.schema.json +0 -7
- package/dist/schema/pubManifest/module/duration.schema.json +0 -7
- package/dist/schema/pubManifest/module/item-lists.schema.json +0 -16
- package/dist/schema/pubManifest/module/language.schema.json +0 -16
- package/dist/schema/pubManifest/module/link.schema.json +0 -60
- package/dist/schema/pubManifest/module/localizable-object.schema.json +0 -15
- package/dist/schema/pubManifest/module/localizable.schema.json +0 -26
- package/dist/schema/pubManifest/module/resource.categorization.schema.json +0 -31
- package/dist/schema/pubManifest/module/strings.schema.json +0 -9
- package/dist/schema/pubManifest/module/url.schema.json +0 -7
- package/dist/schema/pubManifest/module/urls.schema.json +0 -18
- package/dist/schema/pubManifest/publication.schema.json +0 -123
- package/dist/schema/vivliostyle/vivliostyleConfig.schema.json +0 -296
package/dist/config.js
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const output_1 = require("./output");
|
|
23
|
-
const vivliostyle_1 = require("./schema/vivliostyle");
|
|
24
|
-
const util_1 = require("./util");
|
|
1
|
+
import AjvModule from 'ajv';
|
|
2
|
+
import AjvFormatsModule from 'ajv-formats';
|
|
3
|
+
import betterAjvErrors from 'better-ajv-errors';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import cheerio from 'cheerio';
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import path from 'upath';
|
|
8
|
+
import { pathToFileURL } from 'url';
|
|
9
|
+
import { getExecutableBrowserPath } from './browser.js';
|
|
10
|
+
import { MANIFEST_FILENAME, TOC_FILENAME, TOC_TITLE } from './const.js';
|
|
11
|
+
import { CONTAINER_IMAGE } from './container.js';
|
|
12
|
+
import { openEpubToTmpDirectory } from './epub.js';
|
|
13
|
+
import { detectInputFormat, detectManuscriptMediaType, } from './input.js';
|
|
14
|
+
import { readMarkdownMetadata } from './markdown.js';
|
|
15
|
+
import { checkOutputFormat, checkPreflightMode, checkRenderMode, detectOutputFormat, } from './output.js';
|
|
16
|
+
import { vivliostyleConfigSchema } from './schema/vivliostyle.js';
|
|
17
|
+
import { parsePackageName } from './theme.js';
|
|
18
|
+
import { cwd, debug, DetailError, filterRelevantAjvErrors, isUrlString, log, logWarn, readJSON, statFileSync, touchTmpFile, } from './util.js';
|
|
19
|
+
// FIXME: https://github.com/ajv-validator/ajv/issues/2047
|
|
20
|
+
const Ajv = AjvModule.default;
|
|
21
|
+
const addFormats = AjvFormatsModule.default;
|
|
25
22
|
const DEFAULT_TIMEOUT = 2 * 60 * 1000; // 2 minutes
|
|
26
23
|
const DEFAULT_ASSETS = [
|
|
27
24
|
'**/*.png',
|
|
@@ -36,14 +33,12 @@ const DEFAULT_ASSETS = [
|
|
|
36
33
|
'**/*.woff',
|
|
37
34
|
'**/*.woff2',
|
|
38
35
|
];
|
|
39
|
-
function validateTimeoutFlag(val) {
|
|
36
|
+
export function validateTimeoutFlag(val) {
|
|
40
37
|
return Number.isFinite(+val) && +val > 0 ? +val * 1000 : DEFAULT_TIMEOUT;
|
|
41
38
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return loc && upath_1.default.resolve(context, loc);
|
|
39
|
+
export function contextResolve(context, loc) {
|
|
40
|
+
return loc && path.resolve(context, loc);
|
|
45
41
|
}
|
|
46
|
-
exports.contextResolve = contextResolve;
|
|
47
42
|
function normalizeEntry(e) {
|
|
48
43
|
if (typeof e === 'object') {
|
|
49
44
|
return e;
|
|
@@ -51,56 +46,58 @@ function normalizeEntry(e) {
|
|
|
51
46
|
return { path: e };
|
|
52
47
|
}
|
|
53
48
|
// parse theme locator
|
|
54
|
-
function parseTheme(
|
|
55
|
-
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
49
|
+
export function parseTheme({ theme, context, workspaceDir, themesDir, }) {
|
|
50
|
+
const { specifier, import: importPath } = typeof theme === 'string' ? { specifier: theme, import: undefined } : theme;
|
|
58
51
|
// url
|
|
59
|
-
if (
|
|
52
|
+
if (isUrlString(specifier)) {
|
|
60
53
|
return {
|
|
61
54
|
type: 'uri',
|
|
62
|
-
name:
|
|
63
|
-
location:
|
|
55
|
+
name: path.basename(specifier),
|
|
56
|
+
location: specifier,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
// bare .css file
|
|
60
|
+
const stylePath = path.resolve(context, specifier);
|
|
61
|
+
if (fs.existsSync(stylePath) && stylePath.endsWith('.css')) {
|
|
62
|
+
const sourceRelPath = path.relative(context, stylePath);
|
|
63
|
+
return {
|
|
64
|
+
type: 'file',
|
|
65
|
+
name: path.basename(specifier),
|
|
66
|
+
source: stylePath,
|
|
67
|
+
location: path.resolve(workspaceDir, sourceRelPath),
|
|
64
68
|
};
|
|
65
69
|
}
|
|
66
|
-
const stylePath = upath_1.default.resolve(contextDir, locator);
|
|
67
70
|
// node_modules, local pkg
|
|
68
|
-
const
|
|
69
|
-
if (!
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
const parsed = parsePackageName(specifier, context);
|
|
72
|
+
if (!parsed) {
|
|
73
|
+
throw new Error(`Invalid package name: ${specifier}`);
|
|
74
|
+
}
|
|
75
|
+
// To security reason, Vivliostyle CLI disallow other than npm registry or local file as download source
|
|
76
|
+
// TODO: Add option that user can allow an unofficial registry explicitly
|
|
77
|
+
if (!parsed.registry && parsed.type !== 'directory') {
|
|
78
|
+
throw new Error(`This package specifier is not allowed: ${specifier}`);
|
|
79
|
+
}
|
|
80
|
+
let name = parsed.name;
|
|
81
|
+
let resolvedSpecifier = specifier;
|
|
82
|
+
if (parsed.type === 'directory' && parsed.fetchSpec) {
|
|
83
|
+
const pkgJsonPath = path.join(parsed.fetchSpec, 'package.json');
|
|
84
|
+
if (fs.existsSync(pkgJsonPath)) {
|
|
85
|
+
const packageJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
|
|
86
|
+
name = packageJson.name;
|
|
87
|
+
resolvedSpecifier = parsed.fetchSpec;
|
|
79
88
|
}
|
|
80
89
|
}
|
|
81
|
-
|
|
82
|
-
|
|
90
|
+
if (!name) {
|
|
91
|
+
throw new Error(`Could not determine the package name: ${specifier}`);
|
|
92
|
+
}
|
|
83
93
|
return {
|
|
84
|
-
type: '
|
|
85
|
-
name
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
type: 'package',
|
|
95
|
+
name,
|
|
96
|
+
specifier: resolvedSpecifier,
|
|
97
|
+
location: path.join(themesDir, 'packages', name),
|
|
98
|
+
importPath,
|
|
88
99
|
};
|
|
89
100
|
}
|
|
90
|
-
exports.parseTheme = parseTheme;
|
|
91
|
-
function parseStyleLocator(pkgRootDir, locator) {
|
|
92
|
-
var _a, _b, _c, _d;
|
|
93
|
-
const pkgJsonPath = upath_1.default.join(pkgRootDir, 'package.json');
|
|
94
|
-
if (!fs_1.default.existsSync(pkgJsonPath)) {
|
|
95
|
-
return undefined;
|
|
96
|
-
}
|
|
97
|
-
const packageJson = JSON.parse(fs_1.default.readFileSync(pkgJsonPath, 'utf8'));
|
|
98
|
-
const maybeStyle = (_d = (_c = (_b = (_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.vivliostyle) === null || _a === void 0 ? void 0 : _a.theme) === null || _b === void 0 ? void 0 : _b.style) !== null && _c !== void 0 ? _c : packageJson.style) !== null && _d !== void 0 ? _d : packageJson.main;
|
|
99
|
-
if (!maybeStyle) {
|
|
100
|
-
throw new Error(`invalid style file: ${maybeStyle} while parsing ${locator}`);
|
|
101
|
-
}
|
|
102
|
-
return { name: packageJson.name, maybeStyle };
|
|
103
|
-
}
|
|
104
101
|
function parsePageSize(size) {
|
|
105
102
|
const [width, height, ...others] = `${size}`.split(',');
|
|
106
103
|
if (others.length) {
|
|
@@ -114,163 +111,191 @@ function parsePageSize(size) {
|
|
|
114
111
|
}
|
|
115
112
|
else {
|
|
116
113
|
return {
|
|
117
|
-
format: width
|
|
114
|
+
format: width ?? 'Letter',
|
|
118
115
|
};
|
|
119
116
|
}
|
|
120
117
|
}
|
|
121
|
-
function parseFileMetadata(type, sourcePath, workspaceDir) {
|
|
122
|
-
|
|
123
|
-
const sourceDir = upath_1.default.dirname(sourcePath);
|
|
118
|
+
function parseFileMetadata({ type, sourcePath, workspaceDir, themesDir, }) {
|
|
119
|
+
const sourceDir = path.dirname(sourcePath);
|
|
124
120
|
let title;
|
|
125
|
-
let
|
|
121
|
+
let themes;
|
|
126
122
|
if (type === 'text/markdown') {
|
|
127
|
-
const metadata =
|
|
123
|
+
const metadata = readMarkdownMetadata(sourcePath);
|
|
128
124
|
title = metadata.title;
|
|
129
|
-
|
|
125
|
+
if (metadata.vfm?.theme && themesDir) {
|
|
126
|
+
themes = [metadata.vfm.theme]
|
|
127
|
+
.flat()
|
|
128
|
+
.filter((entry) => !!entry && (typeof entry === 'string' || typeof entry === 'object'))
|
|
129
|
+
.map((theme) => parseTheme({
|
|
130
|
+
theme,
|
|
131
|
+
context: sourceDir,
|
|
132
|
+
workspaceDir,
|
|
133
|
+
themesDir,
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
130
136
|
}
|
|
131
137
|
else {
|
|
132
|
-
const $ =
|
|
133
|
-
title =
|
|
138
|
+
const $ = cheerio.load(fs.readFileSync(sourcePath, 'utf8'));
|
|
139
|
+
title = $('title')?.text() ?? undefined;
|
|
134
140
|
}
|
|
135
|
-
return { title,
|
|
141
|
+
return { title, themes };
|
|
136
142
|
}
|
|
137
|
-
function collectVivliostyleConfig(cliFlags) {
|
|
138
|
-
const load = (configPath) => {
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
export async function collectVivliostyleConfig(cliFlags) {
|
|
144
|
+
const load = async (configPath) => {
|
|
145
|
+
let config;
|
|
146
|
+
let jsonRaw;
|
|
147
|
+
try {
|
|
148
|
+
if (path.extname(configPath) === '.json') {
|
|
149
|
+
jsonRaw = fs.readFileSync(configPath, 'utf8');
|
|
150
|
+
config = JSON.parse(jsonRaw);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
config = (await import(configPath)).default;
|
|
154
|
+
}
|
|
141
155
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const
|
|
156
|
+
catch (error) {
|
|
157
|
+
const thrownError = error;
|
|
158
|
+
throw new DetailError(`An error occurred on loading a config file: ${configPath}`, thrownError.stack ?? thrownError.message);
|
|
159
|
+
}
|
|
160
|
+
const ajv = new Ajv({ strict: false });
|
|
161
|
+
addFormats(ajv);
|
|
162
|
+
const validate = ajv.compile(vivliostyleConfigSchema);
|
|
147
163
|
const valid = validate(config);
|
|
148
164
|
if (!valid) {
|
|
149
|
-
let jsonRaw;
|
|
150
|
-
try {
|
|
151
|
-
jsonRaw = fs_1.default.readFileSync(configPath, 'utf8');
|
|
152
|
-
// Check JSON validity
|
|
153
|
-
JSON.parse(jsonRaw);
|
|
154
|
-
}
|
|
155
|
-
catch {
|
|
156
|
-
jsonRaw = undefined;
|
|
157
|
-
}
|
|
158
165
|
const message = `Validation of vivliostyle.config failed. Please check the schema: ${configPath}`;
|
|
159
166
|
const detailMessage = validate.errors &&
|
|
160
|
-
|
|
167
|
+
betterAjvErrors(vivliostyleConfigSchema, config, filterRelevantAjvErrors(validate.errors), typeof jsonRaw === 'string' ? { json: jsonRaw } : { indent: 2 });
|
|
161
168
|
throw detailMessage
|
|
162
|
-
? new
|
|
169
|
+
? new DetailError(message, detailMessage)
|
|
163
170
|
: new Error(message);
|
|
164
171
|
}
|
|
165
172
|
return config;
|
|
166
173
|
};
|
|
167
|
-
let
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
+
let configEntry = {};
|
|
175
|
+
let vivliostyleConfigPath;
|
|
176
|
+
if (cliFlags.configPath) {
|
|
177
|
+
vivliostyleConfigPath = path.resolve(cwd, cliFlags.configPath);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
vivliostyleConfigPath = ['.js', '.mjs', '.cjs']
|
|
181
|
+
.map((ext) => path.join(cwd, `vivliostyle.config${ext}`))
|
|
182
|
+
.find((p) => fs.existsSync(p));
|
|
183
|
+
}
|
|
184
|
+
// let vivliostyleConfig: VivliostyleConfigSchema | undefined;
|
|
185
|
+
if (vivliostyleConfigPath) {
|
|
186
|
+
configEntry = {
|
|
187
|
+
vivliostyleConfigPath,
|
|
188
|
+
vivliostyleConfig: [await load(vivliostyleConfigPath)].flat(),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
else if (cliFlags.input &&
|
|
192
|
+
path.basename(cliFlags.input).startsWith('vivliostyle.config')) {
|
|
174
193
|
// Load an input argument as a Vivliostyle config
|
|
175
194
|
try {
|
|
176
|
-
const inputPath =
|
|
177
|
-
const inputConfig = load(inputPath);
|
|
178
|
-
|
|
179
|
-
cliFlags
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
vivliostyleConfigPath
|
|
184
|
-
vivliostyleConfig
|
|
185
|
-
}
|
|
195
|
+
const inputPath = path.resolve(cwd, cliFlags.input);
|
|
196
|
+
const inputConfig = await load(inputPath);
|
|
197
|
+
cliFlags = {
|
|
198
|
+
...cliFlags,
|
|
199
|
+
input: undefined,
|
|
200
|
+
};
|
|
201
|
+
configEntry = {
|
|
202
|
+
vivliostyleConfigPath: inputPath,
|
|
203
|
+
vivliostyleConfig: [inputConfig].flat(),
|
|
204
|
+
};
|
|
186
205
|
}
|
|
187
206
|
catch (_err) { }
|
|
188
207
|
}
|
|
189
208
|
if (cliFlags.executableChromium) {
|
|
190
|
-
|
|
209
|
+
logWarn(chalk.yellowBright("'--executable-chromium' option was deprecated and will be removed in a future release. Please replace with '--executable-browser' option."));
|
|
191
210
|
cliFlags.executableBrowser = cliFlags.executableChromium;
|
|
192
211
|
}
|
|
193
212
|
return {
|
|
194
213
|
cliFlags,
|
|
195
|
-
|
|
196
|
-
// Config file allows both single input and list of inputs
|
|
197
|
-
(Array.isArray(vivliostyleConfig)
|
|
198
|
-
? vivliostyleConfig
|
|
199
|
-
: [vivliostyleConfig]),
|
|
200
|
-
vivliostyleConfigPath,
|
|
214
|
+
...configEntry,
|
|
201
215
|
};
|
|
202
216
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
util_1.debug('cliFlags', cliFlags);
|
|
208
|
-
util_1.debug('vivliostyle.config.js', config);
|
|
217
|
+
export async function mergeConfig(cliFlags, config, context) {
|
|
218
|
+
debug('context directory', context);
|
|
219
|
+
debug('cliFlags', cliFlags);
|
|
220
|
+
debug('vivliostyle.config.js', config);
|
|
209
221
|
let entryContextDir;
|
|
210
222
|
let workspaceDir;
|
|
211
|
-
if (cliFlags.input &&
|
|
212
|
-
workspaceDir = entryContextDir =
|
|
223
|
+
if (cliFlags.input && isUrlString(cliFlags.input)) {
|
|
224
|
+
workspaceDir = entryContextDir = cwd;
|
|
213
225
|
}
|
|
214
226
|
else {
|
|
215
|
-
entryContextDir =
|
|
216
|
-
?
|
|
217
|
-
:
|
|
227
|
+
entryContextDir = path.resolve(cliFlags.input
|
|
228
|
+
? path.dirname(path.resolve(context, cliFlags.input))
|
|
229
|
+
: contextResolve(context, config?.entryContext) ?? context);
|
|
218
230
|
workspaceDir =
|
|
219
|
-
|
|
231
|
+
contextResolve(context, config?.workspaceDir) ?? entryContextDir;
|
|
220
232
|
}
|
|
221
|
-
const
|
|
233
|
+
const themesDir = path.join(workspaceDir, 'themes');
|
|
234
|
+
const includeAssets = config?.includeAssets
|
|
222
235
|
? Array.isArray(config.includeAssets)
|
|
223
236
|
? config.includeAssets
|
|
224
237
|
: [config.includeAssets]
|
|
225
238
|
: DEFAULT_ASSETS;
|
|
226
|
-
const language =
|
|
227
|
-
const readingProgression =
|
|
228
|
-
const sizeFlag =
|
|
239
|
+
const language = cliFlags.language ?? config?.language ?? null;
|
|
240
|
+
const readingProgression = config?.readingProgression ?? undefined;
|
|
241
|
+
const sizeFlag = cliFlags.size ?? config?.size;
|
|
229
242
|
const size = sizeFlag ? parsePageSize(sizeFlag) : undefined;
|
|
230
|
-
const cropMarks =
|
|
243
|
+
const cropMarks = cliFlags.cropMarks ?? false;
|
|
231
244
|
const bleed = cliFlags.bleed;
|
|
232
245
|
const cropOffset = cliFlags.cropOffset;
|
|
233
246
|
const css = cliFlags.css;
|
|
234
247
|
const customStyle = cliFlags.style &&
|
|
235
|
-
(
|
|
248
|
+
(isUrlString(cliFlags.style)
|
|
236
249
|
? cliFlags.style
|
|
237
|
-
:
|
|
250
|
+
: pathToFileURL(cliFlags.style).href);
|
|
238
251
|
const customUserStyle = cliFlags.userStyle &&
|
|
239
|
-
(
|
|
252
|
+
(isUrlString(cliFlags.userStyle)
|
|
240
253
|
? cliFlags.userStyle
|
|
241
|
-
:
|
|
242
|
-
const singleDoc =
|
|
243
|
-
const quick =
|
|
244
|
-
const cover =
|
|
245
|
-
const pressReady =
|
|
246
|
-
const renderMode =
|
|
247
|
-
const preflight =
|
|
248
|
-
const preflightOption =
|
|
254
|
+
: pathToFileURL(cliFlags.userStyle).href);
|
|
255
|
+
const singleDoc = cliFlags.singleDoc ?? false;
|
|
256
|
+
const quick = cliFlags.quick ?? false;
|
|
257
|
+
const cover = contextResolve(entryContextDir, config?.cover) ?? undefined;
|
|
258
|
+
const pressReady = cliFlags.pressReady ?? config?.pressReady ?? false;
|
|
259
|
+
const renderMode = cliFlags.renderMode ?? 'local';
|
|
260
|
+
const preflight = cliFlags.preflight ?? (pressReady ? 'press-ready' : null);
|
|
261
|
+
const preflightOption = cliFlags.preflightOption ?? [];
|
|
249
262
|
const vfmOptions = {
|
|
250
|
-
...config
|
|
251
|
-
hardLineBreaks:
|
|
252
|
-
disableFormatHtml:
|
|
263
|
+
...config?.vfm,
|
|
264
|
+
hardLineBreaks: config?.vfm?.hardLineBreaks ?? false,
|
|
265
|
+
disableFormatHtml: config?.vfm?.disableFormatHtml ?? false,
|
|
253
266
|
};
|
|
254
|
-
const verbose =
|
|
255
|
-
const timeout =
|
|
256
|
-
const sandbox =
|
|
257
|
-
const browserType =
|
|
258
|
-
const executableBrowser =
|
|
259
|
-
const image =
|
|
260
|
-
const httpServer =
|
|
261
|
-
const viewer =
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
+
const verbose = cliFlags.verbose ?? false;
|
|
268
|
+
const timeout = cliFlags.timeout ?? config?.timeout ?? DEFAULT_TIMEOUT;
|
|
269
|
+
const sandbox = cliFlags.sandbox ?? true;
|
|
270
|
+
const browserType = cliFlags.browser ?? config?.browser ?? 'chromium';
|
|
271
|
+
const executableBrowser = cliFlags.executableBrowser ?? getExecutableBrowserPath(browserType);
|
|
272
|
+
const image = cliFlags.image ?? config?.image ?? CONTAINER_IMAGE;
|
|
273
|
+
const httpServer = cliFlags.http ?? config?.http ?? false;
|
|
274
|
+
const viewer = cliFlags.viewer ?? config?.viewer ?? undefined;
|
|
275
|
+
const rootThemes = cliFlags.theme
|
|
276
|
+
? [
|
|
277
|
+
parseTheme({
|
|
278
|
+
theme: cliFlags.theme,
|
|
279
|
+
context: cwd,
|
|
280
|
+
workspaceDir,
|
|
281
|
+
themesDir,
|
|
282
|
+
}),
|
|
283
|
+
]
|
|
284
|
+
: config?.theme
|
|
285
|
+
? [config.theme].flat().map((theme) => parseTheme({
|
|
286
|
+
theme,
|
|
287
|
+
context,
|
|
288
|
+
workspaceDir,
|
|
289
|
+
themesDir,
|
|
290
|
+
}))
|
|
291
|
+
: [];
|
|
292
|
+
const themeIndexes = new Set(rootThemes);
|
|
267
293
|
const outputs = (() => {
|
|
268
|
-
|
|
269
|
-
if ((_a = cliFlags.targets) === null || _a === void 0 ? void 0 : _a.length) {
|
|
294
|
+
if (cliFlags.targets?.length) {
|
|
270
295
|
return cliFlags.targets.map(({ path: outputPath, format }) => {
|
|
271
296
|
if (format === 'pdf') {
|
|
272
297
|
return {
|
|
273
|
-
path:
|
|
298
|
+
path: path.resolve(outputPath),
|
|
274
299
|
format,
|
|
275
300
|
renderMode,
|
|
276
301
|
preflight,
|
|
@@ -279,29 +304,28 @@ async function mergeConfig(cliFlags, config, context) {
|
|
|
279
304
|
}
|
|
280
305
|
else {
|
|
281
306
|
return {
|
|
282
|
-
path:
|
|
307
|
+
path: path.resolve(outputPath),
|
|
283
308
|
format,
|
|
284
309
|
};
|
|
285
310
|
}
|
|
286
311
|
});
|
|
287
312
|
}
|
|
288
|
-
if (config
|
|
313
|
+
if (config?.output) {
|
|
289
314
|
return (Array.isArray(config.output) ? config.output : [config.output]).map((target) => {
|
|
290
|
-
var _a, _b, _c, _d;
|
|
291
315
|
const targetObj = typeof target === 'string' ? { path: target } : target;
|
|
292
|
-
const outputPath =
|
|
293
|
-
const format =
|
|
294
|
-
if (!
|
|
316
|
+
const outputPath = path.resolve(context, targetObj.path);
|
|
317
|
+
const format = targetObj.format ?? detectOutputFormat(outputPath);
|
|
318
|
+
if (!checkOutputFormat(format)) {
|
|
295
319
|
throw new Error(`Unknown format: ${format}`);
|
|
296
320
|
}
|
|
297
321
|
if (format === 'pdf') {
|
|
298
|
-
const outputRenderMode =
|
|
299
|
-
const outputPreflight =
|
|
300
|
-
if (!
|
|
322
|
+
const outputRenderMode = targetObj.renderMode ?? renderMode;
|
|
323
|
+
const outputPreflight = targetObj.preflight ?? preflight;
|
|
324
|
+
if (!checkRenderMode(outputRenderMode)) {
|
|
301
325
|
throw new Error(`Unknown renderMode: ${outputRenderMode}`);
|
|
302
326
|
}
|
|
303
327
|
if (outputPreflight !== null &&
|
|
304
|
-
!
|
|
328
|
+
!checkPreflightMode(outputPreflight)) {
|
|
305
329
|
throw new Error(`Unknown preflight: ${outputPreflight}`);
|
|
306
330
|
}
|
|
307
331
|
return {
|
|
@@ -310,7 +334,7 @@ async function mergeConfig(cliFlags, config, context) {
|
|
|
310
334
|
format,
|
|
311
335
|
renderMode: outputRenderMode,
|
|
312
336
|
preflight: outputPreflight,
|
|
313
|
-
preflightOption:
|
|
337
|
+
preflightOption: targetObj.preflightOption ?? preflightOption,
|
|
314
338
|
};
|
|
315
339
|
}
|
|
316
340
|
else {
|
|
@@ -319,10 +343,10 @@ async function mergeConfig(cliFlags, config, context) {
|
|
|
319
343
|
});
|
|
320
344
|
}
|
|
321
345
|
// Outputs a pdf file if any output configuration is not set
|
|
322
|
-
const filename =
|
|
346
|
+
const filename = config?.title ? `${config.title}.pdf` : 'output.pdf';
|
|
323
347
|
return [
|
|
324
348
|
{
|
|
325
|
-
path:
|
|
349
|
+
path: path.resolve(context, filename),
|
|
326
350
|
format: 'pdf',
|
|
327
351
|
renderMode,
|
|
328
352
|
preflight,
|
|
@@ -333,9 +357,11 @@ async function mergeConfig(cliFlags, config, context) {
|
|
|
333
357
|
const commonOpts = {
|
|
334
358
|
entryContextDir,
|
|
335
359
|
workspaceDir,
|
|
360
|
+
themesDir,
|
|
336
361
|
includeAssets,
|
|
337
362
|
outputs,
|
|
338
363
|
themeIndexes,
|
|
364
|
+
rootThemes,
|
|
339
365
|
size,
|
|
340
366
|
cropMarks,
|
|
341
367
|
bleed,
|
|
@@ -364,69 +390,70 @@ async function mergeConfig(cliFlags, config, context) {
|
|
|
364
390
|
const parsedConfig = cliFlags.input
|
|
365
391
|
? await composeSingleInputConfig(commonOpts, cliFlags, config)
|
|
366
392
|
: await composeProjectConfig(commonOpts, cliFlags, config, context);
|
|
367
|
-
|
|
393
|
+
debug('parsedConfig', parsedConfig);
|
|
368
394
|
checkUnusedCliFlags(parsedConfig, cliFlags);
|
|
369
395
|
return parsedConfig;
|
|
370
396
|
}
|
|
371
|
-
exports.mergeConfig = mergeConfig;
|
|
372
397
|
async function composeSingleInputConfig(otherConfig, cliFlags, config) {
|
|
373
|
-
|
|
374
|
-
util_1.debug('entering single entry config mode');
|
|
398
|
+
debug('entering single entry config mode');
|
|
375
399
|
let sourcePath;
|
|
376
400
|
let workspaceDir;
|
|
377
401
|
let input;
|
|
378
402
|
const entries = [];
|
|
379
403
|
const exportAliases = [];
|
|
380
404
|
const tmpPrefix = `.vs-${Date.now()}.`;
|
|
381
|
-
if (cliFlags.input &&
|
|
405
|
+
if (cliFlags.input && isUrlString(cliFlags.input)) {
|
|
382
406
|
sourcePath = cliFlags.input;
|
|
383
407
|
workspaceDir = otherConfig.workspaceDir;
|
|
384
408
|
input = { format: 'webbook', entry: sourcePath };
|
|
385
409
|
}
|
|
386
410
|
else {
|
|
387
|
-
sourcePath =
|
|
388
|
-
workspaceDir =
|
|
389
|
-
input =
|
|
411
|
+
sourcePath = path.resolve(cliFlags.input);
|
|
412
|
+
workspaceDir = path.dirname(sourcePath);
|
|
413
|
+
input = detectInputFormat(sourcePath);
|
|
390
414
|
// Check file exists
|
|
391
|
-
|
|
415
|
+
statFileSync(sourcePath);
|
|
392
416
|
}
|
|
393
417
|
if (input.format === 'markdown') {
|
|
394
418
|
// Single input file; create temporary file
|
|
395
|
-
const type =
|
|
396
|
-
const metadata = parseFileMetadata(type, sourcePath, workspaceDir);
|
|
397
|
-
const target =
|
|
398
|
-
.resolve(workspaceDir, `${tmpPrefix}${
|
|
419
|
+
const type = detectManuscriptMediaType(sourcePath);
|
|
420
|
+
const metadata = parseFileMetadata({ type, sourcePath, workspaceDir });
|
|
421
|
+
const target = path
|
|
422
|
+
.resolve(workspaceDir, `${tmpPrefix}${path.basename(sourcePath)}`)
|
|
399
423
|
.replace(/\.md$/, '.html');
|
|
400
|
-
await
|
|
424
|
+
await touchTmpFile(target);
|
|
425
|
+
const themes = metadata.themes ?? [...otherConfig.rootThemes];
|
|
426
|
+
themes.forEach((t) => otherConfig.themeIndexes.add(t));
|
|
401
427
|
entries.push({
|
|
402
428
|
type,
|
|
403
429
|
source: sourcePath,
|
|
404
430
|
target,
|
|
405
431
|
title: metadata.title,
|
|
406
|
-
|
|
432
|
+
themes,
|
|
407
433
|
});
|
|
408
434
|
exportAliases.push({
|
|
409
435
|
source: target,
|
|
410
|
-
target:
|
|
436
|
+
target: path.resolve(workspaceDir, path.basename(sourcePath).replace(/\.md$/, '.html')),
|
|
411
437
|
});
|
|
412
438
|
}
|
|
413
439
|
const manifestDeclaration = await (async () => {
|
|
414
|
-
var _a, _b, _c, _d;
|
|
415
440
|
if (input.format === 'markdown') {
|
|
416
441
|
// create temporary manifest file
|
|
417
|
-
const manifestPath =
|
|
418
|
-
await
|
|
442
|
+
const manifestPath = path.resolve(workspaceDir, `${tmpPrefix}${MANIFEST_FILENAME}`);
|
|
443
|
+
await touchTmpFile(manifestPath);
|
|
419
444
|
exportAliases.push({
|
|
420
445
|
source: manifestPath,
|
|
421
|
-
target:
|
|
446
|
+
target: path.resolve(workspaceDir, MANIFEST_FILENAME),
|
|
422
447
|
});
|
|
423
448
|
return {
|
|
424
449
|
manifestPath,
|
|
425
450
|
manifestAutoGenerate: {
|
|
426
|
-
title:
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
451
|
+
title: cliFlags.title ??
|
|
452
|
+
config?.title ??
|
|
453
|
+
(entries.length === 1 && entries[0].title
|
|
454
|
+
? entries[0].title
|
|
455
|
+
: path.basename(sourcePath)),
|
|
456
|
+
author: cliFlags.author ?? config?.author ?? '',
|
|
430
457
|
},
|
|
431
458
|
};
|
|
432
459
|
}
|
|
@@ -440,7 +467,7 @@ async function composeSingleInputConfig(otherConfig, cliFlags, config) {
|
|
|
440
467
|
return { epubOpfPath: input.entry };
|
|
441
468
|
}
|
|
442
469
|
else if (input.format === 'epub') {
|
|
443
|
-
const { epubOpfPath } = await
|
|
470
|
+
const { epubOpfPath } = await openEpubToTmpDirectory(input.entry);
|
|
444
471
|
return { epubOpfPath };
|
|
445
472
|
}
|
|
446
473
|
else {
|
|
@@ -456,61 +483,69 @@ async function composeSingleInputConfig(otherConfig, cliFlags, config) {
|
|
|
456
483
|
};
|
|
457
484
|
}
|
|
458
485
|
async function composeProjectConfig(otherConfig, cliFlags, config, context) {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
const
|
|
462
|
-
const
|
|
463
|
-
|
|
464
|
-
? util_1.readJSON(pkgJsonPath)
|
|
486
|
+
debug('entering project config mode');
|
|
487
|
+
const { entryContextDir, workspaceDir, themesDir, themeIndexes, rootThemes, outputs, } = otherConfig;
|
|
488
|
+
const pkgJsonPath = path.resolve(entryContextDir, 'package.json');
|
|
489
|
+
const pkgJson = fs.existsSync(pkgJsonPath)
|
|
490
|
+
? readJSON(pkgJsonPath)
|
|
465
491
|
: undefined;
|
|
466
492
|
if (pkgJson) {
|
|
467
|
-
|
|
493
|
+
debug('located package.json path', pkgJsonPath);
|
|
468
494
|
}
|
|
469
|
-
const autoGeneratedTocPath =
|
|
470
|
-
const projectTitle =
|
|
471
|
-
const projectAuthor =
|
|
495
|
+
const autoGeneratedTocPath = path.resolve(workspaceDir, typeof config?.toc === 'string' ? config.toc : TOC_FILENAME);
|
|
496
|
+
const projectTitle = cliFlags.title ?? config?.title ?? pkgJson?.name;
|
|
497
|
+
const projectAuthor = cliFlags.author ?? config?.author ?? pkgJson?.author;
|
|
472
498
|
function parseEntry(entry) {
|
|
473
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
474
499
|
if (!('path' in entry)) {
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
500
|
+
const themes = entry.theme
|
|
501
|
+
? [entry.theme].flat().map((theme) => parseTheme({
|
|
502
|
+
theme,
|
|
503
|
+
context,
|
|
504
|
+
workspaceDir,
|
|
505
|
+
themesDir,
|
|
506
|
+
}))
|
|
507
|
+
: [...rootThemes];
|
|
508
|
+
themes.forEach((t) => themeIndexes.add(t));
|
|
480
509
|
return {
|
|
481
510
|
rel: 'contents',
|
|
482
511
|
target: autoGeneratedTocPath,
|
|
483
|
-
title:
|
|
484
|
-
|
|
512
|
+
title: entry.title ?? config?.tocTitle ?? TOC_TITLE,
|
|
513
|
+
themes,
|
|
485
514
|
};
|
|
486
515
|
}
|
|
487
|
-
const sourcePath =
|
|
488
|
-
const contextEntryPath =
|
|
489
|
-
const targetPath =
|
|
516
|
+
const sourcePath = path.resolve(entryContextDir, entry.path); // abs
|
|
517
|
+
const contextEntryPath = path.relative(entryContextDir, sourcePath); // rel
|
|
518
|
+
const targetPath = path
|
|
490
519
|
.resolve(workspaceDir, contextEntryPath)
|
|
491
520
|
.replace(/\.md$/, '.html');
|
|
492
|
-
if (!
|
|
521
|
+
if (!isUrlString(sourcePath)) {
|
|
493
522
|
// Check file exists
|
|
494
|
-
|
|
495
|
-
}
|
|
496
|
-
const type = input_1.detectManuscriptMediaType(sourcePath);
|
|
497
|
-
const metadata = parseFileMetadata(type, sourcePath, workspaceDir);
|
|
498
|
-
const title = (_e = (_d = entry.title) !== null && _d !== void 0 ? _d : metadata.title) !== null && _e !== void 0 ? _e : projectTitle;
|
|
499
|
-
const theme = (_g = (_f = parseTheme(entry.theme, context, workspaceDir)) !== null && _f !== void 0 ? _f : metadata.theme) !== null && _g !== void 0 ? _g : themeIndexes[0];
|
|
500
|
-
if (theme &&
|
|
501
|
-
themeIndexes.every((t) => !util_1.pathEquals(t.location, theme.location))) {
|
|
502
|
-
themeIndexes.push(theme);
|
|
523
|
+
statFileSync(sourcePath);
|
|
503
524
|
}
|
|
525
|
+
const type = detectManuscriptMediaType(sourcePath);
|
|
526
|
+
const metadata = parseFileMetadata({
|
|
527
|
+
type,
|
|
528
|
+
sourcePath,
|
|
529
|
+
workspaceDir,
|
|
530
|
+
themesDir,
|
|
531
|
+
});
|
|
532
|
+
const title = entry.title ?? metadata.title ?? projectTitle;
|
|
533
|
+
const themes = entry.theme
|
|
534
|
+
? [entry.theme]
|
|
535
|
+
.flat()
|
|
536
|
+
.map((theme) => parseTheme({ theme, context, workspaceDir, themesDir }))
|
|
537
|
+
: metadata.themes ?? [...rootThemes];
|
|
538
|
+
themes.forEach((t) => themeIndexes.add(t));
|
|
504
539
|
return {
|
|
505
540
|
type,
|
|
506
541
|
source: sourcePath,
|
|
507
542
|
target: targetPath,
|
|
508
543
|
title,
|
|
509
|
-
|
|
544
|
+
themes,
|
|
510
545
|
...(entry.rel && { rel: entry.rel }),
|
|
511
546
|
};
|
|
512
547
|
}
|
|
513
|
-
const entries =
|
|
548
|
+
const entries = config?.entry
|
|
514
549
|
? (Array.isArray(config.entry) ? config.entry : [config.entry])
|
|
515
550
|
.map(normalizeEntry)
|
|
516
551
|
.map(parseEntry)
|
|
@@ -524,16 +559,16 @@ async function composeProjectConfig(otherConfig, cliFlags, config, context) {
|
|
|
524
559
|
fallbackProjectTitle = entries[0].title;
|
|
525
560
|
}
|
|
526
561
|
else {
|
|
527
|
-
fallbackProjectTitle =
|
|
528
|
-
|
|
562
|
+
fallbackProjectTitle = path.basename(outputs[0].path);
|
|
563
|
+
log(`\n${chalk.yellow('Could not find any appropriate publication title. We set ')}${chalk.bold.yellow(`"${fallbackProjectTitle}"`)}${chalk.yellow(' as a fallback.')}`);
|
|
529
564
|
}
|
|
530
565
|
}
|
|
531
|
-
if (!!
|
|
566
|
+
if (!!config?.toc && !entries.find(({ rel }) => rel === 'contents')) {
|
|
532
567
|
entries.unshift({
|
|
533
568
|
rel: 'contents',
|
|
534
569
|
target: autoGeneratedTocPath,
|
|
535
|
-
title:
|
|
536
|
-
|
|
570
|
+
title: config?.tocTitle ?? TOC_TITLE,
|
|
571
|
+
themes: [...rootThemes],
|
|
537
572
|
});
|
|
538
573
|
}
|
|
539
574
|
return {
|
|
@@ -541,17 +576,17 @@ async function composeProjectConfig(otherConfig, cliFlags, config, context) {
|
|
|
541
576
|
entries,
|
|
542
577
|
input: {
|
|
543
578
|
format: 'pub-manifest',
|
|
544
|
-
entry:
|
|
579
|
+
entry: path.join(workspaceDir, MANIFEST_FILENAME),
|
|
545
580
|
},
|
|
546
581
|
exportAliases: [],
|
|
547
|
-
manifestPath:
|
|
582
|
+
manifestPath: path.join(workspaceDir, MANIFEST_FILENAME),
|
|
548
583
|
manifestAutoGenerate: {
|
|
549
584
|
title: projectTitle || fallbackProjectTitle,
|
|
550
585
|
author: projectAuthor || '',
|
|
551
586
|
},
|
|
552
587
|
};
|
|
553
588
|
}
|
|
554
|
-
function checkUnusedCliFlags(config, cliFlags) {
|
|
589
|
+
export function checkUnusedCliFlags(config, cliFlags) {
|
|
555
590
|
const unusedFlags = [];
|
|
556
591
|
if (!config.manifestPath) {
|
|
557
592
|
if (cliFlags.theme) {
|
|
@@ -568,11 +603,10 @@ function checkUnusedCliFlags(config, cliFlags) {
|
|
|
568
603
|
}
|
|
569
604
|
}
|
|
570
605
|
if (unusedFlags.length) {
|
|
571
|
-
|
|
606
|
+
log('\n');
|
|
572
607
|
unusedFlags.forEach((flag) => {
|
|
573
|
-
|
|
608
|
+
log(`${chalk.bold.yellow(flag)}${chalk.bold.yellow(` flag seems to be set but the current export setting doesn't support this. This option will be ignored.`)}`);
|
|
574
609
|
});
|
|
575
610
|
}
|
|
576
611
|
}
|
|
577
|
-
exports.checkUnusedCliFlags = checkUnusedCliFlags;
|
|
578
612
|
//# sourceMappingURL=config.js.map
|