Skip to content

Commit e09888e

Browse files
committed
feat(ghoulscript): add renderPageAsImage and getInfo
1 parent 99f2374 commit e09888e

File tree

23 files changed

+3505
-275
lines changed

23 files changed

+3505
-275
lines changed

.eslintignore

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional stylelint cache
58+
.stylelintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variable files
76+
.env
77+
.env.development.local
78+
.env.test.local
79+
.env.production.local
80+
.env.local
81+
82+
# parcel-bundler cache (https://parceljs.org/)
83+
.cache
84+
.parcel-cache
85+
86+
# Next.js build output
87+
.next
88+
out
89+
90+
# Nuxt.js build / generate output
91+
.nuxt
92+
dist
93+
94+
# Gatsby files
95+
.cache/
96+
# Comment in the public line in if your project uses Gatsby and not Next.js
97+
# https://nextjs.org/blog/next-9-1#public-directory-support
98+
# public
99+
100+
# vuepress build output
101+
.vuepress/dist
102+
103+
# vuepress v2.x temp and cache directory
104+
.temp
105+
.cache
106+
107+
# Docusaurus cache and generated files
108+
.docusaurus
109+
110+
# Serverless directories
111+
.serverless/
112+
113+
# FuseBox cache
114+
.fusebox/
115+
116+
# DynamoDB Local files
117+
.dynamodb/
118+
119+
# TernJS port file
120+
.tern-port
121+
122+
# Stores VSCode versions used for testing VSCode extensions
123+
.vscode-test
124+
125+
# yarn v2
126+
.yarn/cache
127+
.yarn/unplugged
128+
.yarn/build-state.yml
129+
.yarn/install-state.gz
130+
.pnp.*
131+
.DS_Store
132+
133+
packages/ghostscript/ghostpdl
134+
out/

.eslintrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": ["@privyid/eslint-config-persona"],
3+
"parserOptions": {
4+
"project": ["./tsconfig.json", "./packages/*/tsconfig.json"]
5+
}
6+
}

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
yarn run lint-staged

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

package.json

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,36 @@
44
"private": true,
55
"workspaces": [
66
"packages/*"
7-
]
7+
],
8+
"scripts": {
9+
"lint": "eslint . --ext .js,.vue,.ts --format pretty",
10+
"fix": "yarn lint --fix",
11+
"postinstall": "husky"
12+
},
13+
"lint-staged": {
14+
"*.(js|ts|vue)": [
15+
"eslint --fix"
16+
]
17+
},
18+
"devDependencies": {
19+
"@privyid/eslint-config-persona": "^1.0.0-rc.6",
20+
"@tsconfig/node20": "^20.1.4",
21+
"@typescript-eslint/eslint-plugin": "5.62.0",
22+
"@typescript-eslint/parser": "5.62.0",
23+
"@vue/eslint-config-typescript": "13.0.0",
24+
"eslint": "8.57.0",
25+
"eslint-config-standard-with-typescript": "21.0.1",
26+
"eslint-formatter-pretty": "5.0.0",
27+
"eslint-plugin-align-assignments": "1.1.2",
28+
"eslint-plugin-import": "2.29.1",
29+
"eslint-plugin-n": "16.6.2",
30+
"eslint-plugin-node": "11.1.0",
31+
"eslint-plugin-promise": "6.1.1",
32+
"eslint-plugin-unicorn": "48.0.1",
33+
"eslint-plugin-varspacing": "1.2.2",
34+
"eslint-plugin-vue": "9.23.0",
35+
"husky": "^9.0.11",
36+
"lint-staged": "^15.2.5",
37+
"typescript": "5.4.5"
38+
}
839
}

packages/ghostscript/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Special Thank ❤️
44

5-
[@jsscheller]((https://github.com/jsscheller/ghostscript-wasm)) - for build script.
5+
[@jsscheller](https://github.com/jsscheller/ghostscript-wasm) - for build script.

packages/ghostscript/build.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ export GS_LDFLAGS="\
3333
--post-js "$ROOT/build/post.js" \
3434
--closure 1 \
3535
-s STACK_SIZE=131072 \
36-
-s USE_ZLIB=1 \
3736
-s EXPORT_ES6=1 \
3837
-s BINARYEN_EXTRA_PASSES=\"--pass-arg=max-func-params@39\" \
3938
-s WASM_BIGINT=1 \
4039
-s INITIAL_MEMORY=67108864 \
4140
-s ALLOW_MEMORY_GROWTH=1 \
4241
-s EXPORTED_RUNTIME_METHODS='[\"callMain\",\"FS\",\"NODEFS\",\"WORKERFS\",\"ENV\"]' \
43-
-s INCOMING_MODULE_JS_API='[\"noInitialRun\",\"noFSInit\",\"locateFile\",\"preRun\",\"instantiateWasm\"]' \
42+
-s INCOMING_MODULE_JS_API='[\"noInitialRun\",\"noFSInit\",\"locateFile\",\"preRun\",\"instantiateWasm\",\"print\",\"printErr\"]' \
4443
-s NO_DISABLE_EXCEPTION_CATCHING=1 \
4544
-s MODULARIZE=1 \
4645
"

packages/ghostscript/build/gs.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = function (...args) {
22
return import('./gs.js')
3-
.then(m => m.default.call(this, ...args))
3+
.then((m) => m.default.call(this, ...args))
44
}

packages/ghostscript/build/gs.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
interface GSModule extends EmscriptenModule {
22
version: string,
3-
callMain: (args: string[]) => Promise<number>
3+
callMain: (args: string[]) => Promise<number>,
44
FS: typeof FS,
55
NODEFS: Emscripten.FileSystemType,
66
WORKERFS: Emscripten.FileSystemType,

packages/ghostscript/build/post-build.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1+
/* eslint-disable unicorn/prefer-top-level-await */
12
import { writeFile, readFile } from 'node:fs/promises'
2-
import { fileURLToPath } from 'url';
3-
import { dirname, resolve } from 'path'
3+
import { fileURLToPath } from 'node:url'
4+
import { dirname, resolve } from 'node:path'
45
import { EOL } from 'node:os'
56

6-
const __filename = fileURLToPath(import.meta.url)
7-
const __dirname = dirname(__filename)
7+
const _filename = fileURLToPath(import.meta.url)
8+
const _dirname = dirname(_filename)
89

910
async function applyVersion () {
10-
const pkgJSON = JSON.parse(await readFile(resolve(__dirname, '../package.json')))
11-
const fileJS = resolve(__dirname, '../dist/gs.js')
11+
const pkgJSON = JSON.parse(await readFile(resolve(_dirname, '../package.json')))
12+
const fileJS = resolve(_dirname, '../dist/gs.js')
1213
const origin = await readFile(fileJS)
1314

1415
await writeFile(fileJS, origin.toString().replace('__VERSION__', pkgJSON.version))
1516
}
1617

1718
async function createDTS () {
18-
const emscriptenDTS = await readFile(resolve(__dirname, '../../../node_modules/@types/emscripten/index.d.ts'))
19-
const gsDTS = await readFile(resolve(__dirname, './gs.d.ts'))
19+
const emscriptenDTS = await readFile(resolve(_dirname, '../../../node_modules/@types/emscripten/index.d.ts'))
20+
const gsDTS = await readFile(resolve(_dirname, './gs.d.ts'))
2021

21-
await writeFile(resolve(__dirname, '../dist/gs.d.ts'), `${emscriptenDTS}${EOL}${gsDTS}`)
22+
await writeFile(resolve(_dirname, '../dist/gs.d.ts'), `${emscriptenDTS}${EOL}${gsDTS}`)
2223
}
2324

2425
async function main () {

0 commit comments

Comments
 (0)