packaging working, need to fix json import assertion

This commit is contained in:
Felix Kaspar 2024-01-12 18:39:57 +01:00
parent 9c1588d150
commit c07e247a2a
5 changed files with 1629 additions and 1364 deletions

2894
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,45 +1,49 @@
{ {
"name": "@stirling-pdf/server-node", "name": "@stirling-pdf/server-node",
"version": "0.0.0", "version": "0.0.0",
"description": "", "description": "",
"//": "end pkgroll config", "type": "module",
"type": "module", "exports": "./dist/index.js",
"exports": "./dist/index.js", "imports": {
"imports": { "#pdfcpu": "../../shared-operations/src/wasm/pdfcpu/pdfcpu-wrapper.server.js"
"#pdfcpu": "../../shared-operations/src/wasm/pdfcpu/pdfcpu-wrapper.server.js" },
}, "optionalDependencies": {
"optionalDependencies": { "canvas": "^2.11.2"
"canvas": "^2.11.2" },
}, "scripts": {
"files": [ "dev": "npx tsx watch src/index.ts",
"/shared-operations/src/wasm/pdfcpu/pdfcpu.wasm" "build": "npm run prebuild && pkgroll && npm run postbuild",
], "start": "node ./dist/index.js",
"scripts": {
"build": "pkgroll", "prebuild": "rimraf ./dist",
"start": "node ./dist/index.js", "postbuild": "npm run copy-locales && npm run copy-pdfcpu",
"dev": "npx tsx watch src/index.ts" "copy-locales": "copyfiles -u 3 ../shared-operations/src/locales/**/*.json dist",
}, "copy-pdfcpu": "copyfiles -u 5 ../shared-operations/src/wasm/pdfcpu/pdfcpu.wasm dist"
"keywords": [], },
"author": "", "keywords": [],
"license": "ISC", "author": "",
"dependencies": { "license": "ISC",
"@esbuild/win32-x64": "^0.19.10", "dependencies": {
"@types/archiver": "^6.0.1", "@esbuild/win32-x64": "^0.19.10",
"@types/express": "^4.17.21", "@types/archiver": "^6.0.1",
"@types/multer": "^1.4.10", "@types/express": "^4.17.21",
"@wasmer/wasmfs": "^0.12.0", "@types/multer": "^1.4.10",
"archiver": "^6.0.1", "@wasmer/wasmfs": "^0.12.0",
"express": "^4.18.2", "archiver": "^6.0.1",
"express-fileupload": "^1.4.2", "express": "^4.18.2",
"joi": "^17.11.0", "express-fileupload": "^1.4.2",
"jsqr": "^1.4.0", "joi": "^17.11.0",
"multer": "^1.4.5-lts.1", "jsqr": "^1.4.0",
"pdf-lib": "^1.17.1", "multer": "^1.4.5-lts.1",
"tsconfig-paths": "^4.2.0" "pdf-lib": "^1.17.1",
}, "tsconfig-paths": "^4.2.0"
"devDependencies": { },
"pkgroll": "^2.0.1", "devDependencies": {
"ts-node-dev": "^2.0.0", "copyfiles": "^2.4.1",
"typescript": "^5.2.2" "pkgroll": "^2.0.1",
"rimraf": "^5.0.5",
"ts-node-dev": "^2.0.0",
"typescript": "^5.2.2"
}
} }
}

View File

@ -1,4 +1,4 @@
import "@stirling-pdf/shared-operations/src/locales/i18next.config"; import "@stirling-pdf/shared-operations/src/i18next.config";
import express from "express"; import express from "express";
const app = express(); const app = express();

View File

@ -2,10 +2,10 @@ import i18next from "i18next";
import resourcesToBackend from "i18next-resources-to-backend"; import resourcesToBackend from "i18next-resources-to-backend";
i18next i18next
.use(resourcesToBackend((language, namespace) => import(`./${namespace}/${language}.json`))) .use(resourcesToBackend((language, namespace) => import(`./locales/${namespace}/${language}.json`)))
.init({ .init({
// debug: true, // debug: true,
ns: ["common"], // Preload this namespace, no need to add the others ns: ["common"], // Preload this namespace, no need to add the others, they will load once their module is loaded
defaultNS: "common", defaultNS: "common",
fallbackLng: "en", fallbackLng: "en",
interpolation: { interpolation: {

View File

@ -1,7 +1,8 @@
import { WasmFs } from '@wasmer/wasmfs'; import { WasmFs } from '@wasmer/wasmfs';
import path from "path"; import path from "path";
import { fileURLToPath } from 'url';
let nodeWasmLocation = "../shared-operations/src/wasm/pdfcpu/"; // TODO: Replace with __dirname let nodeWasmLocation = path.dirname(fileURLToPath(import.meta.url));
let fs; let fs;
const wasmfs = new WasmFs(); const wasmfs = new WasmFs();