latex-kit 0.0.0-stage → 0.3.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.
@@ -0,0 +1,163 @@
1
+ import { ENGINES } from '@latex-kit/render';
2
+ import { documentJsonSchema, generateTypes, loadDocument } from '@latex-kit/schema';
3
+ import { formatDiagnostic, LATEX_KIT_STY, VARIANTS } from '@latex-kit/template';
4
+ import { existsSync, mkdirSync, writeFileSync } from 'fs';
5
+ import { join, relative } from 'path';
6
+ import chalk from 'yanse';
7
+ import { UsageError } from './args';
8
+ import { buildBlank, buildDocument, BuildError } from './build';
9
+ import { checkProject, templateFields } from './check';
10
+ import { Project } from './project';
11
+ function printDiagnostics(ds, json) {
12
+ if (json)
13
+ return;
14
+ for (const d of ds)
15
+ console.error((d.severity === 'error' ? chalk.red : chalk.yellow)(formatDiagnostic(d)));
16
+ }
17
+ const rel = (p) => (p ? relative(process.cwd(), p) : null);
18
+ export async function buildCommand(argv) {
19
+ const variant = (argv.variant ?? (argv.final ? 'final' : 'draft'));
20
+ if (!VARIANTS.includes(variant))
21
+ throw new UsageError(`--variant must be one of ${VARIANTS.join(', ')}`);
22
+ if (argv.engine && !ENGINES.includes(argv.engine))
23
+ throw new UsageError(`--engine must be one of ${ENGINES.join(', ')}`);
24
+ const project = await Project.open(argv.root);
25
+ const options = {
26
+ variant,
27
+ strict: argv.strict === undefined ? undefined : Boolean(argv.strict),
28
+ engine: argv.engine,
29
+ backend: argv.local ? 'local' : undefined,
30
+ image: argv.image,
31
+ platform: argv.platform,
32
+ verify: Boolean(argv.verify),
33
+ texOnly: Boolean(argv['tex-only']),
34
+ };
35
+ const json = Boolean(argv.json);
36
+ const log = (s) => !json && console.error(s);
37
+ const targets = [];
38
+ const files = (argv._ ?? []).map(String);
39
+ if (variant === 'blank' && files.length === 0) {
40
+ const names = argv.template ? [String(argv.template)] : project.templateNames();
41
+ for (const n of names)
42
+ targets.push({ label: `template ${n}`, run: () => buildBlank(project, n, options) });
43
+ }
44
+ else {
45
+ let docs = files.length ? files.map((f) => join(process.cwd(), f)) : project.documentFiles();
46
+ for (const f of docs)
47
+ if (!existsSync(f))
48
+ throw new UsageError(`no such document: ${rel(f)}`);
49
+ if (argv.template) {
50
+ const wanted = String(argv.template);
51
+ const keep = [];
52
+ for (const f of docs)
53
+ if ((await loadDocument(f, { dataDir: project.dataDir })).record.template === wanted)
54
+ keep.push(f);
55
+ docs = keep;
56
+ }
57
+ for (const f of docs)
58
+ targets.push({ label: rel(f), run: () => buildDocument(project, f, options) });
59
+ }
60
+ if (targets.length === 0) {
61
+ log(chalk.yellow(`nothing to build (no documents in ${project.rel(project.documentsDir)}/)`));
62
+ return 0;
63
+ }
64
+ const results = [];
65
+ let failed = 0;
66
+ for (const t of targets) {
67
+ log(chalk.dim(`building ${t.label} (${variant})…`));
68
+ try {
69
+ const r = await t.run();
70
+ printDiagnostics(r.diagnostics, json);
71
+ const bad = r.verified === false;
72
+ if (bad)
73
+ failed++;
74
+ results.push({ ...r, tex: rel(r.tex), pdf: rel(r.pdf), diagnostics: r.diagnostics.length });
75
+ if (!json) {
76
+ console.log(`${bad ? chalk.red('✗') : chalk.green('✓')} ${rel(r.pdf ?? r.tex)}${r.docId ? chalk.dim(` ${r.docId}`) : ''}`);
77
+ if (r.minted)
78
+ console.log(chalk.dim(` minted ${r.docId} and saved it in ${t.label}`));
79
+ if (r.verified !== undefined)
80
+ console.log(r.verified ? chalk.dim(' byte-identical on a second build') : chalk.red(' second build differs'));
81
+ if (!r.reproducible)
82
+ console.log(chalk.yellow(' not reproducible: some inputs are not committed, so the build date is "now"'));
83
+ }
84
+ }
85
+ catch (e) {
86
+ failed++;
87
+ if (e instanceof BuildError) {
88
+ printDiagnostics(e.diagnostics, json);
89
+ if (!json)
90
+ console.error(chalk.red(`✗ ${t.label}: ${e.message}`));
91
+ results.push({ target: t.label, error: e.message, diagnostics: e.diagnostics });
92
+ }
93
+ else {
94
+ if (!json)
95
+ console.error(chalk.red(`✗ ${t.label}: ${e.message}`));
96
+ results.push({ target: t.label, error: e.message });
97
+ }
98
+ }
99
+ }
100
+ if (json)
101
+ console.log(JSON.stringify(results, null, 2));
102
+ return failed ? 1 : 0;
103
+ }
104
+ export async function checkCommand(argv) {
105
+ const project = await Project.open(argv.root);
106
+ const r = await checkProject(project);
107
+ const errors = r.diagnostics.filter((d) => d.severity === 'error').length;
108
+ const warnings = r.diagnostics.length - errors;
109
+ if (argv.json) {
110
+ console.log(JSON.stringify(r, null, 2));
111
+ }
112
+ else {
113
+ printDiagnostics(r.diagnostics, false);
114
+ const summary = `${r.templates.length} template${r.templates.length === 1 ? '' : 's'}, ${r.documents.length} document${r.documents.length === 1 ? '' : 's'}: ${errors} error${errors === 1 ? '' : 's'}, ${warnings} warning${warnings === 1 ? '' : 's'}`;
115
+ console.log(errors ? chalk.red(`✗ ${summary}`) : `${chalk.green('✓')} ${summary}`);
116
+ }
117
+ return errors ? 1 : 0;
118
+ }
119
+ export async function fieldsCommand(argv) {
120
+ const name = argv._?.[0];
121
+ if (!name)
122
+ throw new UsageError('usage: latex-kit fields <template>');
123
+ const project = await Project.open(argv.root);
124
+ const { fields, diagnostics } = await templateFields(project, String(name));
125
+ if (argv.json) {
126
+ console.log(JSON.stringify(fields, null, 2));
127
+ return 0;
128
+ }
129
+ printDiagnostics(diagnostics, false);
130
+ const width = Math.max(...fields.map((f) => f.absolute.length), 4);
131
+ for (const f of fields) {
132
+ const filters = f.filters.length ? chalk.cyan(` | ${f.filters.join(' | ')}`) : '';
133
+ console.log(`${f.absolute.padEnd(width)} ${chalk.dim(f.kind.padEnd(5))} ${chalk.dim(`${f.file}:${f.line}`)}${filters}`);
134
+ }
135
+ return diagnostics.some((d) => d.severity === 'error') ? 1 : 0;
136
+ }
137
+ export async function typegenCommand(argv) {
138
+ const project = await Project.open(argv.root);
139
+ let n = 0;
140
+ for (const name of project.templateNames()) {
141
+ const t = await project.template(name);
142
+ if (!t.jsonSchema)
143
+ continue;
144
+ const schemaFile = join(t.dir, `${name}.schema.json`);
145
+ const typesFile = join(t.dir, 'types.d.ts');
146
+ writeFileSync(schemaFile, JSON.stringify(documentJsonSchema(name, t.jsonSchema), null, 2) + '\n');
147
+ writeFileSync(typesFile, `// Generated by latex-kit typegen from schema.ts. Do not edit.\n${generateTypes(name, t.jsonSchema)}\n`);
148
+ console.log(`${chalk.green('✓')} ${rel(schemaFile)} ${rel(typesFile)}`);
149
+ n++;
150
+ }
151
+ if (n === 0)
152
+ console.log(chalk.yellow('no templates with a schema.ts'));
153
+ return 0;
154
+ }
155
+ export async function styCommand(argv) {
156
+ const project = await Project.open(argv.root);
157
+ const dir = argv._?.[0] ? join(process.cwd(), String(argv._[0])) : project.templatesDir;
158
+ mkdirSync(dir, { recursive: true });
159
+ const file = join(dir, 'latex-kit.sty');
160
+ writeFileSync(file, LATEX_KIT_STY);
161
+ console.log(`${chalk.green('✓')} ${rel(file)} (lets editors compile templates as blank previews)`);
162
+ return 0;
163
+ }
@@ -0,0 +1,43 @@
1
+ import { JsonSchema, TemplateMeta, z } from '@latex-kit/schema';
2
+ import { CompiledTemplate } from '@latex-kit/template';
3
+ import { ResolvedConfig } from './config';
4
+ export interface Template {
5
+ name: string;
6
+ dir: string;
7
+ texFile: string;
8
+ compiled: CompiledTemplate;
9
+ schemaFile: string | null;
10
+ schema: z.ZodType | null;
11
+ jsonSchema: JsonSchema | null;
12
+ meta: TemplateMeta;
13
+ }
14
+ /** A latex-kit project: a folder with templates, data and documents. */
15
+ export declare class Project {
16
+ readonly root: string;
17
+ readonly config: ResolvedConfig;
18
+ private templates;
19
+ private snippets;
20
+ private constructor();
21
+ static open(root?: string): Promise<Project>;
22
+ path(...parts: string[]): string;
23
+ rel(file: string): string;
24
+ get templatesDir(): string;
25
+ get dataDir(): string;
26
+ get documentsDir(): string;
27
+ get outDir(): string;
28
+ /** Template names: folders under templates/ that contain template.tex. */
29
+ templateNames(): string[];
30
+ /** Document record files under documents/ (any depth). */
31
+ documentFiles(): string[];
32
+ /** A document's name: its path under documents/ without extension, `/` → `-`. */
33
+ documentName(file: string): string;
34
+ template(name: string): Promise<Template>;
35
+ private loadTemplate;
36
+ /**
37
+ * \snippet{name}: first next to the file that uses it, then in snippets/.
38
+ * `.tex` is added when the name has no extension. Never outside the project.
39
+ */
40
+ loadSnippet: (name: string, from: string) => CompiledTemplate | null;
41
+ /** Absolute paths of every snippet loaded so far. */
42
+ snippetFiles(): string[];
43
+ }
package/esm/project.js ADDED
@@ -0,0 +1,125 @@
1
+ import { DATA_EXTENSIONS, loadTemplateSchema, toJsonSchema } from '@latex-kit/schema';
2
+ import { compileTemplate } from '@latex-kit/template';
3
+ import { existsSync, readdirSync, readFileSync, statSync } from 'fs';
4
+ import { basename, dirname, extname, isAbsolute, join, relative, resolve } from 'path';
5
+ import { loadConfig } from './config';
6
+ const SCHEMA_FILES = ['schema.ts', 'schema.mts', 'schema.js', 'schema.mjs', 'schema.cjs'];
7
+ /** A latex-kit project: a folder with templates, data and documents. */
8
+ export class Project {
9
+ root;
10
+ config;
11
+ templates = new Map();
12
+ snippets = new Map();
13
+ constructor(root, config) {
14
+ this.root = root;
15
+ this.config = config;
16
+ }
17
+ static async open(root = process.cwd()) {
18
+ const abs = resolve(root);
19
+ return new Project(abs, await loadConfig(abs));
20
+ }
21
+ path(...parts) {
22
+ return join(this.root, ...parts);
23
+ }
24
+ rel(file) {
25
+ return relative(process.cwd(), file) || '.';
26
+ }
27
+ get templatesDir() {
28
+ return this.path(this.config.templates);
29
+ }
30
+ get dataDir() {
31
+ return this.path(this.config.data);
32
+ }
33
+ get documentsDir() {
34
+ return this.path(this.config.documents);
35
+ }
36
+ get outDir() {
37
+ return this.path(this.config.out);
38
+ }
39
+ /** Template names: folders under templates/ that contain template.tex. */
40
+ templateNames() {
41
+ if (!existsSync(this.templatesDir))
42
+ return [];
43
+ return readdirSync(this.templatesDir)
44
+ .filter((n) => !n.startsWith('.') && !n.startsWith('_'))
45
+ .filter((n) => existsSync(join(this.templatesDir, n, 'template.tex')))
46
+ .sort();
47
+ }
48
+ /** Document record files under documents/ (any depth). */
49
+ documentFiles() {
50
+ const out = [];
51
+ const walk = (dir) => {
52
+ if (!existsSync(dir))
53
+ return;
54
+ for (const name of readdirSync(dir).sort()) {
55
+ if (name.startsWith('.') || name.startsWith('_'))
56
+ continue;
57
+ const p = join(dir, name);
58
+ if (statSync(p).isDirectory())
59
+ walk(p);
60
+ else if (DATA_EXTENSIONS.includes(extname(name).toLowerCase()) && !name.endsWith('.d.ts'))
61
+ out.push(p);
62
+ }
63
+ };
64
+ walk(this.documentsDir);
65
+ return out;
66
+ }
67
+ /** A document's name: its path under documents/ without extension, `/` → `-`. */
68
+ documentName(file) {
69
+ const rel = relative(this.documentsDir, file);
70
+ const base = rel.startsWith('..') || isAbsolute(rel) ? basename(file) : rel;
71
+ return base.slice(0, -extname(base).length).split(/[\\/]/).join('-');
72
+ }
73
+ template(name) {
74
+ let t = this.templates.get(name);
75
+ if (!t) {
76
+ t = this.loadTemplate(name);
77
+ this.templates.set(name, t);
78
+ }
79
+ return t;
80
+ }
81
+ async loadTemplate(name) {
82
+ if (!/^[A-Za-z0-9_-]+$/.test(name))
83
+ throw new Error(`invalid template name "${name}"`);
84
+ const dir = join(this.templatesDir, name);
85
+ const texFile = join(dir, 'template.tex');
86
+ if (!existsSync(texFile)) {
87
+ const known = this.templateNames();
88
+ throw new Error(`no template "${name}" (expected ${this.rel(texFile)}${known.length ? `; templates: ${known.join(', ')}` : ''})`);
89
+ }
90
+ const compiled = compileTemplate(readFileSync(texFile, 'utf8'), this.rel(texFile));
91
+ const schemaFile = SCHEMA_FILES.map((f) => join(dir, f)).find((f) => existsSync(f)) ?? null;
92
+ let schema = null;
93
+ let meta = {};
94
+ let jsonSchema = null;
95
+ if (schemaFile) {
96
+ ({ schema, meta } = await loadTemplateSchema(schemaFile));
97
+ jsonSchema = toJsonSchema(schema);
98
+ }
99
+ return { name, dir, texFile, compiled, schemaFile, schema, jsonSchema, meta };
100
+ }
101
+ /**
102
+ * \snippet{name}: first next to the file that uses it, then in snippets/.
103
+ * `.tex` is added when the name has no extension. Never outside the project.
104
+ */
105
+ loadSnippet = (name, from) => {
106
+ const file = name.endsWith('.tex') ? name : `${name}.tex`;
107
+ const candidates = [resolve(dirname(resolve(from)), file), join(this.path(this.config.snippets), file)];
108
+ for (const c of candidates) {
109
+ const rel = relative(this.root, c);
110
+ if (rel.startsWith('..') || isAbsolute(rel) || !existsSync(c))
111
+ continue;
112
+ let compiled = this.snippets.get(c);
113
+ if (!compiled) {
114
+ compiled = compileTemplate(readFileSync(c, 'utf8'), this.rel(c));
115
+ this.snippets.set(c, compiled);
116
+ }
117
+ return compiled;
118
+ }
119
+ return null;
120
+ };
121
+ /** Absolute paths of every snippet loaded so far. */
122
+ snippetFiles() {
123
+ return [...this.snippets.keys()];
124
+ }
125
+ }
@@ -0,0 +1,3 @@
1
+ import type { Inquirerer } from 'inquirerer';
2
+ import type { ParsedArgs } from 'minimist';
3
+ export declare function renderCommand(argv: Partial<ParsedArgs>, prompter: Inquirerer): Promise<number>;
package/esm/render.js ADDED
@@ -0,0 +1,82 @@
1
+ import { formatDiagnostic, render, RenderError } from '@latex-kit/render';
2
+ import { rmSync } from 'fs';
3
+ import { dirname, relative } from 'path';
4
+ import chalk from 'yanse';
5
+ import { renderOptionsFromArgv, UsageError } from './args';
6
+ function summary(r) {
7
+ return {
8
+ pdf: relative(process.cwd(), r.pdf),
9
+ sha256: r.sha256,
10
+ engine: r.engine,
11
+ backend: r.backend,
12
+ image: r.image,
13
+ sourceDateEpoch: r.sourceDateEpoch,
14
+ epochSource: r.epochSource,
15
+ reproducible: r.reproducible,
16
+ warnings: r.diagnostics.filter((d) => d.severity === 'warning').length,
17
+ };
18
+ }
19
+ export async function renderCommand(argv, prompter) {
20
+ let opts;
21
+ try {
22
+ opts = renderOptionsFromArgv(argv);
23
+ }
24
+ catch (e) {
25
+ if (e instanceof UsageError) {
26
+ console.error(chalk.red(e.message));
27
+ return 2;
28
+ }
29
+ throw e;
30
+ }
31
+ if (!opts.file) {
32
+ const answers = await prompter.prompt({}, [
33
+ { type: 'text', name: 'file', message: 'Which .tex file?', required: true },
34
+ ]);
35
+ opts.file = answers.file;
36
+ }
37
+ const log = (s) => {
38
+ if (!argv.json)
39
+ console.error(s);
40
+ };
41
+ try {
42
+ log(chalk.dim(`rendering ${opts.file} with ${opts.engine} (${opts.backend})…`));
43
+ const first = await render({ ...opts, file: opts.file });
44
+ for (const d of first.diagnostics)
45
+ log(chalk.yellow(formatDiagnostic(d)));
46
+ if (!first.reproducible) {
47
+ log(chalk.yellow('warning: no SOURCE_DATE_EPOCH and the file is not committed; the build date is "now", so builds will differ'));
48
+ }
49
+ let verified;
50
+ if (argv.verify) {
51
+ const verifyDir = `${opts.outDir}.verify`;
52
+ log(chalk.dim('rendering again to check the output is byte-identical…'));
53
+ const second = await render({ ...opts, file: opts.file, outDir: verifyDir, sourceDateEpoch: first.sourceDateEpoch });
54
+ verified = second.sha256 === first.sha256;
55
+ rmSync(dirname(second.pdf), { recursive: true, force: true });
56
+ }
57
+ if (argv.json) {
58
+ console.log(JSON.stringify({ ...summary(first), verified }, null, 2));
59
+ }
60
+ else {
61
+ console.log(`${chalk.green('✓')} ${relative(process.cwd(), first.pdf)}`);
62
+ console.log(chalk.dim(` sha256 ${first.sha256}`));
63
+ console.log(chalk.dim(` date ${new Date(first.sourceDateEpoch * 1000).toISOString()} (from ${first.epochSource})`));
64
+ if (verified !== undefined) {
65
+ console.log(verified ? `${chalk.green('✓')} byte-identical on a second build` : chalk.red('✗ second build differs'));
66
+ }
67
+ }
68
+ return verified === false ? 1 : 0;
69
+ }
70
+ catch (e) {
71
+ if (e instanceof RenderError) {
72
+ console.error(chalk.red(e.message));
73
+ for (const d of e.diagnostics)
74
+ console.error(formatDiagnostic(d));
75
+ if (e.diagnostics.length === 0 && e.output) {
76
+ console.error(chalk.dim(e.output.split('\n').slice(-25).join('\n')));
77
+ }
78
+ return 1;
79
+ }
80
+ throw e;
81
+ }
82
+ }
package/esm/usage.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function help(command?: string): void;
package/esm/usage.js ADDED
@@ -0,0 +1,73 @@
1
+ const MAIN = `latex-kit — build typed, reproducible LaTeX documents
2
+
3
+ Usage
4
+ latex-kit <command> [options]
5
+
6
+ Project commands (run in a folder with templates/, data/, documents/)
7
+ build [documents…] Fill templates with records and build PDFs
8
+ check Check templates, schemas, records and IDs without TeX
9
+ fields <template> List every field a template reads
10
+ typegen Write JSON Schema and .d.ts for each template's data
11
+ sty [dir] Write latex-kit.sty so editors can preview templates
12
+
13
+ Other commands
14
+ render <file.tex> Build a plain .tex file with latexmk in a pinned image
15
+ doctor Check Docker, the image and local TeX
16
+
17
+ Options
18
+ -h, --help Show help (latex-kit help <command> for details)
19
+ -v, --version Show the version
20
+ `;
21
+ const RENDER = `latex-kit render <file.tex> [options]
22
+
23
+ Builds <file.tex> with latexmk. The build date is taken from
24
+ SOURCE_DATE_EPOCH, else the file's last git commit, so the same commit
25
+ always produces the same PDF bytes.
26
+
27
+ Options
28
+ -o, --out <dir> Output directory, relative to --root (default: out)
29
+ -e, --engine <name> lualatex (default), xelatex or pdflatex
30
+ --root <dir> Directory TeX can see (default: current directory)
31
+ --image <ref> Docker image (default: pinned pyramation/latex digest)
32
+ --platform <os/arch> Docker --platform (default: linux/amd64 for the default image)
33
+ --local Use latexmk on PATH instead of Docker (not pinned)
34
+ --source-date-epoch <s> Build timestamp in seconds since 1970
35
+ --verify Build twice and fail if the PDFs differ
36
+ --json Print a JSON summary on stdout
37
+
38
+ Only lualatex is byte-reproducible in the default image.
39
+ `;
40
+ const BUILD = `latex-kit build [documents…] [options]
41
+
42
+ Fills each document's template with its data and builds a PDF in
43
+ out/<document>/. Without arguments, builds every record in documents/.
44
+
45
+ Variants
46
+ --variant draft (default) DRAFT watermark and stamp; missing values show
47
+ as red markers (they fail instead when CI=true or --strict)
48
+ --variant final No marks. Missing values fail. Mints a document ID on the
49
+ --final first build and saves it in the record (JSON/YAML)
50
+ --variant signed Like final; templates can test \\when{$variant == "signed"}
51
+ --variant blank Every field is a labelled line. With no documents, builds
52
+ each template (or --template <name>) as an empty form
53
+
54
+ Options
55
+ --template <name> Only documents that use this template
56
+ --strict Fail on missing values in drafts too
57
+ -e, --engine <name> lualatex (default), xelatex or pdflatex
58
+ --local Use latexmk on PATH instead of Docker
59
+ --image <ref> Docker image (default: pinned pyramation/latex)
60
+ --verify Build twice and fail unless the PDFs are identical
61
+ --tex-only Write the .tex without running TeX
62
+ --json JSON results on stdout
63
+ --root <dir> Project folder (default: current directory)
64
+ `;
65
+ const DOCTOR = `latex-kit doctor [--image <ref>] [--json]
66
+
67
+ Reports the Node version, whether Docker is running, whether the image is
68
+ pulled and whether it runs natively on this machine, and whether latexmk
69
+ is available for --local builds. Exits 1 if rendering cannot work.
70
+ `;
71
+ export function help(command) {
72
+ console.log(command === 'render' ? RENDER : command === 'doctor' ? DOCTOR : command === 'build' ? BUILD : MAIN);
73
+ }
package/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * latex-kit: typed, reproducible LaTeX documents.
3
+ *
4
+ * The CLI is `latex-kit`. This module is what project files import:
5
+ * `defineConfig` for latex-kit.config.ts, and `z` plus the shared types and
6
+ * `ref()` for templates' schema.ts and TypeScript records.
7
+ */
8
+ export * from './build';
9
+ export * from './check';
10
+ export * from './config';
11
+ export * from './project';
12
+ export * from '@latex-kit/schema';
package/index.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * latex-kit: typed, reproducible LaTeX documents.
19
+ *
20
+ * The CLI is `latex-kit`. This module is what project files import:
21
+ * `defineConfig` for latex-kit.config.ts, and `z` plus the shared types and
22
+ * `ref()` for templates' schema.ts and TypeScript records.
23
+ */
24
+ __exportStar(require("./build"), exports);
25
+ __exportStar(require("./check"), exports);
26
+ __exportStar(require("./config"), exports);
27
+ __exportStar(require("./project"), exports);
28
+ __exportStar(require("@latex-kit/schema"), exports);
package/package.json CHANGED
@@ -1,6 +1,55 @@
1
1
  {
2
2
  "name": "latex-kit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.0",
4
+ "description": "Build typed, reproducible LaTeX documents from the command line",
5
+ "author": "Constructive <developers@constructive.io>",
6
+ "main": "index.js",
7
+ "module": "esm/index.js",
8
+ "types": "index.d.ts",
9
+ "homepage": "https://github.com/constructive-io/latex-kit",
10
+ "license": "MIT",
11
+ "publishConfig": {
12
+ "access": "public",
13
+ "directory": "dist"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/constructive-io/latex-kit"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/constructive-io/latex-kit/issues"
21
+ },
22
+ "scripts": {
23
+ "copy": "makage assets",
24
+ "clean": "makage clean",
25
+ "prepublishOnly": "npm run build",
26
+ "build": "makage build",
27
+ "build:dev": "makage build --dev",
28
+ "lint": "eslint . --fix",
29
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest",
30
+ "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
31
+ },
32
+ "devDependencies": {
33
+ "@types/minimist": "^1.2.5",
34
+ "makage": "^0.8.0"
35
+ },
36
+ "keywords": [
37
+ "latex",
38
+ "tex",
39
+ "pdf",
40
+ "cli",
41
+ "reproducible-builds"
42
+ ],
43
+ "bin": {
44
+ "latex-kit": "cli.js"
45
+ },
46
+ "dependencies": {
47
+ "@latex-kit/render": "0.3.0",
48
+ "@latex-kit/schema": "0.2.0",
49
+ "@latex-kit/template": "0.2.0",
50
+ "inquirerer": "^4.9.5",
51
+ "minimist": "^1.2.8",
52
+ "yanse": "^0.2.3"
53
+ },
54
+ "gitHead": "0da7d546606627d73d38647b02b29cd4df4addd4"
55
+ }
@@ -0,0 +1,6 @@
1
+ import type { ParsedArgs } from 'minimist';
2
+ export declare function buildCommand(argv: Partial<ParsedArgs>): Promise<number>;
3
+ export declare function checkCommand(argv: Partial<ParsedArgs>): Promise<number>;
4
+ export declare function fieldsCommand(argv: Partial<ParsedArgs>): Promise<number>;
5
+ export declare function typegenCommand(argv: Partial<ParsedArgs>): Promise<number>;
6
+ export declare function styCommand(argv: Partial<ParsedArgs>): Promise<number>;