Fixed TS Build, still need it to package .wasm file

This commit is contained in:
Felix Kaspar 2023-12-29 00:10:25 +01:00
parent b2fdb7ec15
commit 0411a36b56
6 changed files with 325 additions and 8648 deletions

8929
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -16,8 +16,8 @@
"devDependencies": { "devDependencies": {
"concurrently": "^8.2.2" "concurrently": "^8.2.2"
}, },
"engines" : { "engines": {
"npm" : ">=7.24.2" "npm": ">=7.24.2"
}, },
"engineStrict" : true "engineStrict": true
} }

View File

@ -2,17 +2,29 @@
"name": "@stirling-pdf/server-node", "name": "@stirling-pdf/server-node",
"version": "0.0.0", "version": "0.0.0",
"description": "", "description": "",
"main": "index.js", "//": "start pkgroll config",
"scripts": { "type": "module",
"build": "npx tsc", "exports": "./dist/index.js",
"start": "node dist/index.js", "imports": {
"#pdfcpu": "../../shared-operations/src/wasm/pdfcpu/pdfcpu-wrapper.server.js"
},
"files": [
"/shared-operations/src/wasm/pdfcpu/pdfcpu.wasm"
],
"//": "end pkgroll config",
"scripts": {
"build": "pkgroll",
"start": "node ./dist/index.js",
"dev": "npx tsx watch src/index.ts" "dev": "npx tsx watch src/index.ts"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@stirling-pdf/shared-operations": "*", "@esbuild/win32-x64": "^0.19.10",
"@types/archiver": "^6.0.1",
"@types/express": "^4.17.21",
"@types/multer": "^1.4.10",
"@wasmer/wasmfs": "^0.12.0", "@wasmer/wasmfs": "^0.12.0",
"archiver": "^6.0.1", "archiver": "^6.0.1",
"express": "^4.18.2", "express": "^4.18.2",
@ -24,12 +36,8 @@
"tsconfig-paths": "^4.2.0" "tsconfig-paths": "^4.2.0"
}, },
"devDependencies": { "devDependencies": {
"@types/archiver": "^6.0.1", "pkgroll": "^2.0.1",
"@types/express": "^4.17.21",
"@types/multer": "^1.4.10",
"ts-node-dev": "^2.0.0", "ts-node-dev": "^2.0.0",
"typescript": "^5.2.2" "typescript": "^5.2.2"
}, }
"exports": "./dist/index.js",
"type": "module"
} }

View File

@ -6,7 +6,7 @@ import { getOperatorByName } from '@stirling-pdf/shared-operations/src/workflow/
import { Operator } from '@stirling-pdf/shared-operations/src/functions'; import { Operator } from '@stirling-pdf/shared-operations/src/functions';
import { PdfFile } from '@stirling-pdf/shared-operations/src/wrappers/PdfFile'; import { PdfFile } from '@stirling-pdf/shared-operations/src/wrappers/PdfFile';
import { respondWithPdfFiles } from 'utils/endpoint-utils'; import { respondWithPdfFiles } from '../../utils/endpoint-utils';
import { Action } from '@stirling-pdf/shared-operations/declarations/Action'; import { Action } from '@stirling-pdf/shared-operations/declarations/Action';
import { JoiPDFFileSchema } from '@stirling-pdf/shared-operations/src/wrappers/PdfFileJoi'; import { JoiPDFFileSchema } from '@stirling-pdf/shared-operations/src/wrappers/PdfFileJoi';

View File

@ -6,11 +6,14 @@
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"imports": {
"#pdfcpu": "./src/wasm/pdfcpu/pdfcpu-wrapper.server.js"
},
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"image-js": "^0.35.5", "image-js": "^0.35.5",
"pdf-lib": "^1.17.1", "pdf-lib": "^1.17.1",
"pdfjs-dist": "^4.0.189" "pdfjs-dist": "^4.0.269"
} }
} }

View File

@ -2,7 +2,6 @@
import { PdfFile, RepresentationType } from "../wrappers/PdfFile"; import { PdfFile, RepresentationType } from "../wrappers/PdfFile";
import { Operator, Progress, oneToOne } from "."; import { Operator, Progress, oneToOne } from ".";
// @ts-expect-error
import * as pdfcpuWrapper from "#pdfcpu"; // This is updated by tsconfig.json/paths for the context (browser, node, etc.) this module is used in. import * as pdfcpuWrapper from "#pdfcpu"; // This is updated by tsconfig.json/paths for the context (browser, node, etc.) this module is used in.
import Joi from "joi"; import Joi from "joi";