execonvert 0.5.2 → 0.5.4
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/CHANGELOG.md +21 -0
- package/dist/cli/cli/execonvert.js +21 -2
- package/dist/cli/src/docx-import.js +4 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,27 @@ Categorías usadas: **Añadido**, **Cambiado**, **Corregido**, **Eliminado**.
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [0.5.4] - 2026-09-05
|
|
13
|
+
|
|
14
|
+
### Corregido
|
|
15
|
+
- Una opción mal escrita con un solo guion (por ejemplo `-o salida.elpx`) se
|
|
16
|
+
tomaba como si fuera un archivo de entrada y se descartaba sin decir nada,
|
|
17
|
+
mientras la conversión escribía en su destino por defecto. Si allí ya había un
|
|
18
|
+
archivo con ese nombre, se sobrescribía sin aviso. Ahora se rechaza como
|
|
19
|
+
opción desconocida. Para elegir la salida siguen estando
|
|
20
|
+
`execonvert <entrada> <salida>` y `--out-dir`.
|
|
21
|
+
- Los archivos de entrada que se descartan por no admitir la conversión pedida
|
|
22
|
+
se anuncian por la salida de errores en lugar de desaparecer en silencio.
|
|
23
|
+
|
|
24
|
+
## [0.5.3] - 2026-09-05
|
|
25
|
+
|
|
26
|
+
### Corregido
|
|
27
|
+
- Los `.elpx` generados desde `.docx` y `.md` se escribían sin comprimir, de
|
|
28
|
+
modo que ocupaban unas cuatro veces más de lo debido: un proyecto que
|
|
29
|
+
eXeLearning guarda en 2,4 MB salía de 10,3 MB. El empaquetado usa ahora el
|
|
30
|
+
mismo nivel de compresión habitual del formato, sin coste apreciable de
|
|
31
|
+
tiempo. Los archivos anteriores siguen abriéndose con normalidad.
|
|
32
|
+
|
|
12
33
|
## [0.5.2] - 2026-09-05
|
|
13
34
|
|
|
14
35
|
### Corregido
|
|
@@ -10,9 +10,9 @@ import { convertElpToElpx } from '../src/legacy-elp.js';
|
|
|
10
10
|
import { convertMarkdownToElpx } from '../src/markdown-import.js';
|
|
11
11
|
import { installCliRuntime } from './runtime.js';
|
|
12
12
|
import { automaticCheck, autoCheckAllowed, runUpdate, updateText } from './updates.js';
|
|
13
|
-
const CLI_VERSION = '0.5.
|
|
13
|
+
const CLI_VERSION = '0.5.4'.startsWith('__')
|
|
14
14
|
? String(JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8')).version)
|
|
15
|
-
: '0.5.
|
|
15
|
+
: '0.5.4';
|
|
16
16
|
const cliMessages = {
|
|
17
17
|
es: {
|
|
18
18
|
'help.title': 'CLI de eXeConvert',
|
|
@@ -31,6 +31,7 @@ const cliMessages = {
|
|
|
31
31
|
'help.output.docx': 'desde .docx: .elpx',
|
|
32
32
|
'help.output.markdown': 'desde .md/.txt: .elpx',
|
|
33
33
|
'help.option.to': 'Formato de salida para conversión múltiple (elpx, docx, md, pdf). Los archivos no compatibles se ignoran.',
|
|
34
|
+
'warn.skippedInput': 'Aviso: se ignora {file}: no se puede convertir a {format}.',
|
|
34
35
|
'help.option.outDir': 'Directorio de salida (por defecto: mismo directorio que cada entrada)',
|
|
35
36
|
'help.option.json': 'Imprime JSON legible por máquina',
|
|
36
37
|
'help.option.pages': 'Exporta solo las referencias de página seleccionadas de un .elpx',
|
|
@@ -79,6 +80,7 @@ const cliMessages = {
|
|
|
79
80
|
'help.output.docx': 'des de .docx: .elpx',
|
|
80
81
|
'help.output.markdown': 'des de .md/.txt: .elpx',
|
|
81
82
|
'help.option.to': 'Format de sortida per a conversió múltiple (elpx, docx, md, pdf). Els fitxers no compatibles s’ignoren.',
|
|
83
|
+
'warn.skippedInput': 'Avís: s’ignora {file}: no es pot convertir a {format}.',
|
|
82
84
|
'help.option.outDir': 'Directori de sortida (per defecte: mateix directori que cada entrada)',
|
|
83
85
|
'help.option.json': 'Imprimeix JSON llegible per màquines',
|
|
84
86
|
'help.option.pages': 'Exporta només les referències de pàgina seleccionades d’un .elpx',
|
|
@@ -127,6 +129,7 @@ const cliMessages = {
|
|
|
127
129
|
'help.output.docx': 'from .docx: .elpx',
|
|
128
130
|
'help.output.markdown': 'from .md/.txt: .elpx',
|
|
129
131
|
'help.option.to': 'Output format for batch conversion (elpx, docx, md, pdf). Incompatible files are skipped.',
|
|
132
|
+
'warn.skippedInput': 'Warning: skipping {file}: it cannot be converted to {format}.',
|
|
130
133
|
'help.option.outDir': 'Output directory (default: same directory as each input)',
|
|
131
134
|
'help.option.json': 'Print machine-readable JSON',
|
|
132
135
|
'help.option.pages': 'Export only selected page refs from an .elpx input',
|
|
@@ -343,6 +346,12 @@ function parseOptionFlags(args, defaults, t) {
|
|
|
343
346
|
for (let index = 0; index < args.length; index += 1) {
|
|
344
347
|
const value = args[index];
|
|
345
348
|
if (!value.startsWith('--')) {
|
|
349
|
+
// A single dash is a mistyped option, not a file: taking it as one made
|
|
350
|
+
// "-o out.elpx" silently convert to the default destination instead,
|
|
351
|
+
// which can overwrite an existing file next to the input.
|
|
352
|
+
if (value.length > 1 && value.startsWith('-')) {
|
|
353
|
+
throw new Error(t('error.unknownOption', { value }));
|
|
354
|
+
}
|
|
346
355
|
positionals.push(value);
|
|
347
356
|
continue;
|
|
348
357
|
}
|
|
@@ -767,6 +776,16 @@ async function runBatch(args) {
|
|
|
767
776
|
return false;
|
|
768
777
|
}
|
|
769
778
|
});
|
|
779
|
+
// Skipping is deliberate for globs like "*.docx --to pdf", but doing it in
|
|
780
|
+
// silence hides typos: an unknown option taken as a filename disappeared
|
|
781
|
+
// without a word while the conversion wrote to its default destination.
|
|
782
|
+
if (!args.json) {
|
|
783
|
+
for (const inputPath of inputPaths) {
|
|
784
|
+
if (!eligible.includes(inputPath)) {
|
|
785
|
+
stderr.write(i18n.t('warn.skippedInput', { file: basename(inputPath), format: toRaw }) + '\n');
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
}
|
|
770
789
|
let count = 0;
|
|
771
790
|
for (const inputPath of eligible) {
|
|
772
791
|
if (!args.json) {
|
|
@@ -440,7 +440,10 @@ function buildElpxFromTemplate(template, project) {
|
|
|
440
440
|
const { entries } = template;
|
|
441
441
|
entries['content.xml'] = new TextEncoder().encode(generateContentXml(project));
|
|
442
442
|
addPreviewHtmlEntries(entries, project);
|
|
443
|
-
|
|
443
|
+
// Stored entries made a .elpx four times bigger than the one eXeLearning
|
|
444
|
+
// writes for the same project. Level 6 is what the format is usually packed
|
|
445
|
+
// with, and the bundled runtime compresses well.
|
|
446
|
+
return zipSync(entries, { level: 6 });
|
|
444
447
|
}
|
|
445
448
|
function buildStandalonePreviewPages(project, entries, previewOptions = {}) {
|
|
446
449
|
const pages = getPreviewPages(project);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "execonvert",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"test:updates": "node --import tsx --test tests/updates.test.ts",
|
|
40
40
|
"test:runtime": "node scripts/test-runtime.mjs",
|
|
41
41
|
"test:cli": "node --test tests/cli-update.test.mjs",
|
|
42
|
-
"test:docx": "node --test tests/docx-omml.test.mjs"
|
|
42
|
+
"test:docx": "node --test tests/docx-omml.test.mjs",
|
|
43
|
+
"test:args": "node --test tests/cli-args.test.mjs"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
45
46
|
"@resvg/resvg-js": "^2.6.2",
|