@deckflow/office2html 0.1.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,8 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const { spawnSync } = require('child_process');
5
+ const { getBinaryPath } = require('../index.js');
6
+
7
+ const result = spawnSync(getBinaryPath(), process.argv.slice(2), { stdio: 'inherit' });
8
+ process.exit(result.status ?? 1);
package/index.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ export interface ConvertOptions {
2
+ /** Output directory (CLI -o/--output). */
3
+ output: string;
4
+ verbose?: boolean;
5
+ noPlayer?: boolean;
6
+ notes?: boolean;
7
+ includeHiddenSlides?: boolean;
8
+ /** 1-based page filter, e.g. "1,2,5-10". */
9
+ pages?: string;
10
+ noLazySlides?: boolean;
11
+ }
12
+
13
+ export interface ConvertResult {
14
+ indexHtmlPath: string;
15
+ exitCode: number;
16
+ stdout: string;
17
+ stderr: string;
18
+ }
19
+
20
+ export function getBinaryPath(): string;
21
+ export function convert(pptxPath: string, options: ConvertOptions): Promise<ConvertResult>;
22
+ export function convertSync(pptxPath: string, options: ConvertOptions): ConvertResult;
package/index.js ADDED
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ const knownPackages = {
4
+ 'darwin arm64': '@deckflow/office2html-darwin-arm64',
5
+ 'darwin x64': '@deckflow/office2html-darwin-x64',
6
+ 'linux x64': '@deckflow/office2html-linux-x64',
7
+ 'win32 x64': '@deckflow/office2html-win32-x64',
8
+ };
9
+
10
+ function pkgForCurrentPlatform() {
11
+ const key = `${process.platform} ${process.arch}`;
12
+ const pkg = knownPackages[key];
13
+ if (!pkg) {
14
+ throw new Error(
15
+ `Unsupported platform: ${key}. Supported: ${Object.keys(knownPackages).join(', ')}`,
16
+ );
17
+ }
18
+ return pkg;
19
+ }
20
+
21
+ let platformModule;
22
+ try {
23
+ const pkg = pkgForCurrentPlatform();
24
+ require.resolve(pkg);
25
+ platformModule = require(pkg);
26
+ } catch (err) {
27
+ const pkg = pkgForCurrentPlatform();
28
+ const hint =
29
+ 'Install with optional dependencies enabled (avoid --omit=optional / --no-optional).';
30
+ if (err && err.code === 'MODULE_NOT_FOUND') {
31
+ throw new Error(
32
+ `Platform package "${pkg}" is not installed for ${process.platform} ${process.arch}. ${hint}`,
33
+ );
34
+ }
35
+ throw err;
36
+ }
37
+
38
+ module.exports = platformModule;
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@deckflow/office2html",
3
+ "version": "0.1.0",
4
+ "optionalDependencies": {
5
+ "@deckflow/office2html-linux-x64": "0.1.0",
6
+ "@deckflow/office2html-darwin-x64": "0.1.0",
7
+ "@deckflow/office2html-darwin-arm64": "0.1.0",
8
+ "@deckflow/office2html-win32-x64": "0.1.0"
9
+ },
10
+ "main": "index.js",
11
+ "types": "index.d.ts",
12
+ "files": [
13
+ "index.js",
14
+ "index.d.ts",
15
+ "bin"
16
+ ],
17
+ "bin": {
18
+ "office2html": "bin/office2html.js"
19
+ },
20
+ "exports": {
21
+ ".": {
22
+ "types": "./index.d.ts",
23
+ "default": "./index.js"
24
+ }
25
+ }
26
+ }