Skip to content

Commit a195373

Browse files
committed
build: ignore default case
1 parent bfbaebb commit a195373

File tree

7 files changed

+197
-199
lines changed

7 files changed

+197
-199
lines changed

README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ npm i pdfeasy
3030
```
3131

3232
```ts
33-
import { PDFEasy } from 'pdfeasy'
34-
35-
const pdfeasy = new PDFEasy()
33+
import pdfeasy from 'pdfeasy'
3634

3735
pdfeasy.new()
3836

@@ -226,7 +224,7 @@ pdfeasy.addFonts([
226224
])
227225
```
228226

229-
> **Attention!** Client-Side version not support relative/absolute font paths at this time.
227+
> **Attention!** Server-Side version not support relative/absolute font paths at this time.
230228
231229
## Resources
232230

demo/src/main.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PDFEasy, Utils } from 'pdfeasy'
1+
import pdfeasy, { Utils } from 'pdfeasy'
22
import './style.css'
33

44
const app = document.querySelector<HTMLDivElement>('#app')!
@@ -7,8 +7,6 @@ app.innerHTML = `
77
<iframe id="pdf">
88
`
99

10-
const pdfeasy = new PDFEasy()
11-
1210
pdfeasy.new({
1311
document: {
1412
margins: {

packages/nuxt/package.json

+61-61
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
1-
{
2-
"name": "nuxt-pdfeasy",
3-
"sideEffects": false,
4-
"author": {
5-
"email": "[email protected]",
6-
"name": "Novout",
7-
"url": "https://github.com/Novout"
8-
},
9-
"version": "1.2.1",
10-
"repository": "https://github.com/betterwrite/nuxt-pdfeasy",
11-
"description": "A PDF document generator to your Nuxt application.",
12-
"engines": {
13-
"node": ">=14.16"
14-
},
15-
"bugs": {
16-
"url": "https://github.com/betterwrite/nuxt-pdfeasy/issues"
17-
},
18-
"keywords": [
19-
"pdfkit",
20-
"pdf",
21-
"typescript",
22-
"javascript",
23-
"printing",
24-
"nuxt3"
25-
],
26-
"license": "MIT",
27-
"type": "module",
28-
"exports": {
29-
".": {
30-
"import": "./dist/module.mjs",
31-
"require": "./dist/module.cjs"
32-
}
33-
},
34-
"main": "./dist/module.cjs",
35-
"types": "./dist/types.d.ts",
36-
"files": [
37-
"dist",
38-
"package.json"
39-
],
40-
"scripts": {
41-
"build:prod": "pnpm run set",
42-
"build": "pnpm run set",
43-
"prepack": "pnpm run set",
44-
"set": "nuxi prepare && nuxt-module-build && nuxi prepare playground",
45-
"dev": "nuxi dev playground",
46-
"dev:build": "nuxi build playground",
47-
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground"
48-
},
49-
"dependencies": {
50-
"@nuxt/kit": "^3.5.3",
51-
"pdfeasy": "^1.2.1"
52-
},
53-
"devDependencies": {
54-
"@nuxt/module-builder": "^0.4.0",
55-
"@nuxt/schema": "^3.5.3",
56-
"@nuxtjs/eslint-config-typescript": "^12.0.0",
57-
"@types/node": "^18.11.9",
58-
"eslint": "^8.42.0",
59-
"nuxt": "^3.5.3"
60-
}
61-
}
1+
{
2+
"name": "nuxt-pdfeasy",
3+
"sideEffects": false,
4+
"author": {
5+
"email": "[email protected]",
6+
"name": "Novout",
7+
"url": "https://github.com/Novout"
8+
},
9+
"version": "1.2.1",
10+
"repository": "https://github.com/betterwrite/nuxt-pdfeasy",
11+
"description": "A PDF document generator to your Nuxt application.",
12+
"engines": {
13+
"node": ">=14.16"
14+
},
15+
"bugs": {
16+
"url": "https://github.com/betterwrite/nuxt-pdfeasy/issues"
17+
},
18+
"keywords": [
19+
"pdfkit",
20+
"pdf",
21+
"typescript",
22+
"javascript",
23+
"printing",
24+
"nuxt3"
25+
],
26+
"license": "MIT",
27+
"type": "module",
28+
"exports": {
29+
".": {
30+
"import": "./dist/module.mjs",
31+
"require": "./dist/module.cjs"
32+
}
33+
},
34+
"main": "./dist/module.cjs",
35+
"types": "./dist/types.d.ts",
36+
"files": [
37+
"dist",
38+
"package.json"
39+
],
40+
"scripts": {
41+
"build:prod": "pnpm run set",
42+
"build": "pnpm run set",
43+
"prepack": "pnpm run set",
44+
"set": "nuxi prepare && nuxt-module-build && nuxi prepare playground",
45+
"dev": "nuxi dev playground",
46+
"dev:build": "nuxi build playground",
47+
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground"
48+
},
49+
"dependencies": {
50+
"@nuxt/kit": "^3.5.3",
51+
"pdfeasy": "^1.2.1"
52+
},
53+
"devDependencies": {
54+
"@nuxt/module-builder": "^0.4.0",
55+
"@nuxt/schema": "^3.5.3",
56+
"@nuxtjs/eslint-config-typescript": "^12.0.0",
57+
"@types/node": "^18.11.9",
58+
"eslint": "^8.42.0",
59+
"nuxt": "^3.5.3"
60+
}
61+
}

packages/nuxt/playground/app.vue

+46-46
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
<template>
2-
<iframe id="pdf" />
3-
</template>
4-
5-
<script setup>
6-
import { useNuxtApp } from '#app';
7-
8-
const { $pdf } = useNuxtApp()
9-
10-
$pdf.new({
11-
plugins: [
12-
{
13-
page: [
14-
// simple counter footer
15-
({ Text }, context, current, total) => {
16-
// render in every page
17-
Text(`${current}/${total}`, { fontSize: 20 }, {
18-
x: context.width / 2,
19-
y: context.height - context.margins.bottom
20-
})
21-
},
22-
// simple header
23-
({ Text }, context, current, total) => {
24-
// render in every page
25-
Text('A Simple Header', {}, {
26-
x: context.width / 2,
27-
y: context.margins.top - 20
28-
})
29-
}
30-
]
31-
}
32-
]
33-
})
34-
35-
$pdf.add([
36-
{ raw: 'Hello NUXT!', text: { fontSize: 22 }},
37-
])
38-
39-
$pdf.run().then(blob => {
40-
const iframe = document.querySelector('#pdf')
41-
42-
iframe.src = blob
43-
}).catch((err) => {
44-
console.error(err)
45-
})
46-
</script>
1+
<template>
2+
<iframe id="pdf" />
3+
</template>
4+
5+
<script setup>
6+
import { useNuxtApp } from '#app';
7+
8+
const { $pdf } = useNuxtApp()
9+
10+
$pdf.new({
11+
plugins: [
12+
{
13+
page: [
14+
// simple counter footer
15+
({ Text }, context, current, total) => {
16+
// render in every page
17+
Text(`${current}/${total}`, { fontSize: 20 }, {
18+
x: context.width / 2,
19+
y: context.height - context.margins.bottom
20+
})
21+
},
22+
// simple header
23+
({ Text }, context, current, total) => {
24+
// render in every page
25+
Text('A Simple Header', {}, {
26+
x: context.width / 2,
27+
y: context.margins.top - 20
28+
})
29+
}
30+
]
31+
}
32+
]
33+
})
34+
35+
$pdf.add([
36+
{ raw: 'Hello NUXT!', text: { fontSize: 22 }},
37+
])
38+
39+
$pdf.run().then(blob => {
40+
const iframe = document.querySelector('#pdf')
41+
42+
iframe.src = blob
43+
}).catch((err) => {
44+
console.error(err)
45+
})
46+
</script>

packages/nuxt/src/runtime/plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineNuxtPlugin } from '#app'
2-
import { PDFEasy } from 'pdfeasy/dist/client.esm.js'
2+
import { PDFEasy } from 'pdfeasy'
33

44
export default defineNuxtPlugin(({ provide }) => {
55
provide('pdf', new PDFEasy())

0 commit comments

Comments
 (0)