Skip to content

Commit

Permalink
fix: package json exports (#448)
Browse files Browse the repository at this point in the history
* fix: conditional exports

* chore: update dependencies

* style: eslint fixes

* fix: add `node10` require fallbacks

https://github.com/andrewbranch/example-subpath-exports-ts-compat

* chore: update version

* chore: change gitignore to root paths

* chore: regenerate documentation
  • Loading branch information
schoero authored Jan 1, 2025
1 parent 5572c2e commit 01d51fe
Show file tree
Hide file tree
Showing 39 changed files with 4,790 additions and 3,750 deletions.
17 changes: 12 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
node_modules
tests/output
examples/output
lib
local
.DS_Store
.env

node_modules

/tests/output
/examples/output

/lib
/pdf
/svg
/errors
/types
/utils
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ Once you have imported SwissQRBill and PDFKit, it is quite easy to create a simp

```js
import { createWriteStream } from "node:fs";

import PDFDocument from "pdfkit";
import { SwissQRBill } from "swissqrbill/pdf";

Expand Down
20 changes: 10 additions & 10 deletions docs/bundle/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ Defined in: [src/bundle/index.ts](../../src/bundle/index.ts#L3C7)

#### Class: svg.SwissQRBill

Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L45C0)
Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L44C0)

##### Description

Expand Down Expand Up @@ -610,7 +610,7 @@ writeFileSync("qr-bill.svg", svg.toString());

##### Constructor: new svg.SwissQRBill(data\[, options\])

Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L56C2)
Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L55C2)

###### Parameters

Expand All @@ -627,7 +627,7 @@ Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L56C2)

`public`

Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L47C2)
Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L46C2)

###### Type

Expand All @@ -639,7 +639,7 @@ Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L47C2)

`public`

Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L87C2)
Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L86C2)

###### Return Type

Expand All @@ -655,7 +655,7 @@ Outputs the SVG as a string.

`public`

Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L97C2)
Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L96C2)

###### Return Type

Expand All @@ -669,13 +669,13 @@ Returns the SVG element.

#### Class: svg.SwissQRCode

Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L10C0)
Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L9C0)

<br/>

##### Constructor: new svg.SwissQRCode(data\[, size\])

Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L21C2)
Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L20C2)

###### Parameters

Expand All @@ -700,7 +700,7 @@ Creates a Swiss QR Code.

`public`

Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L12C2)
Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L11C2)

###### Type

Expand All @@ -712,7 +712,7 @@ Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L12C2)

`public`

Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L58C2)
Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L57C2)

###### Return Type

Expand All @@ -728,7 +728,7 @@ Outputs the SVG as a string.

`public`

Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L68C2)
Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L67C2)

###### Return Type

Expand Down
3 changes: 1 addition & 2 deletions docs/how-to-create-a-complete-qr-bill.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

## Introduction

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)
][stackblitz]
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)][stackblitz]

In this guide you will learn how you can use SwissQRBill to create a complete PDF file and then attach the QR slip to the bottom of the page.
We will use [PDFKit][npm-pdfkit] to create a PDF document with a Logo, title and the address of the biller, as well as the recipient.
Expand Down
12 changes: 4 additions & 8 deletions docs/importing.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ Each example below is available as a StackBlitz project.

#### Node.js: ES Module import

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)
][node-esm-javascript]
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)][node-esm-javascript]

Importing the library in Node.js using ES modules is straight forward. You can use the following import statement:

Expand All @@ -37,8 +36,7 @@ import { SwissQRBill } from "swissqrbill/svg";

#### Node.js: CommonJS import

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)
][node-cjs-javascript]
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)][node-cjs-javascript]

SwissQRBill provides a CommonJS module for legacy Node.js applications. You can require the library as follows:

Expand All @@ -55,8 +53,7 @@ const { SwissQRBill } = require("swissqrbill/svg");

### Browser: Bundling with webpack

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)
][browser-bundling-with-webpack]
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)][browser-bundling-with-webpack]

> **Warning**
>
Expand All @@ -66,8 +63,7 @@ As PDFKit internally relies on several different built in modules of Node.js, it

### Browser: Pre-built bundle

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)
][browser-pre-built-bundle]
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz_small.svg)][browser-pre-built-bundle]

> **Warning**
>
Expand Down
20 changes: 10 additions & 10 deletions docs/svg/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

### Class: SwissQRBill

Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L45C0)
Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L44C0)

#### Description

Expand Down Expand Up @@ -71,7 +71,7 @@ writeFileSync("qr-bill.svg", svg.toString());

#### Constructor: new SwissQRBill(data\[, options\])

Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L56C2)
Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L55C2)

##### Parameters

Expand All @@ -88,7 +88,7 @@ Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L56C2)

`public`

Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L47C2)
Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L46C2)

##### Type

Expand All @@ -100,7 +100,7 @@ Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L47C2)

`public`

Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L87C2)
Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L86C2)

##### Return Type

Expand All @@ -116,7 +116,7 @@ Outputs the SVG as a string.

`public`

Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L97C2)
Defined in: [src/svg/swissqrbill.ts](../../src/svg/swissqrbill.ts#L96C2)

##### Return Type

Expand All @@ -130,13 +130,13 @@ Returns the SVG element.

### Class: SwissQRCode

Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L10C0)
Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L9C0)

<br/>

#### Constructor: new SwissQRCode(data\[, size\])

Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L21C2)
Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L20C2)

##### Parameters

Expand All @@ -161,7 +161,7 @@ Creates a Swiss QR Code.

`public`

Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L12C2)
Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L11C2)

##### Type

Expand All @@ -173,7 +173,7 @@ Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L12C2)

`public`

Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L58C2)
Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L57C2)

##### Return Type

Expand All @@ -189,7 +189,7 @@ Outputs the SVG as a string.

`public`

Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L68C2)
Defined in: [src/svg/swissqrcode.ts](../../src/svg/swissqrcode.ts#L67C2)

##### Return Type

Expand Down
9 changes: 8 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ export default [
...sharedRules,

{
ignores: ["src/shared/qr-code-generator.ts"]
ignores: [
"src/shared/qr-code-generator.ts",
"pdf",
"svg",
"utils",
"types",
"errors"
]
},
{
files: ["**/*.ts"],
Expand Down
3 changes: 1 addition & 2 deletions examples/browser-bundling-with-webpack/src/pdf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import fs from "fs";

import BlobStream from "blob-stream";
import fs from "fs";
import PDFDocument from "pdfkit";
import HelveticaBold from "pdfkit/js/data/Helvetica-Bold.afm";
import Helvetica from "pdfkit/js/data/Helvetica.afm";
Expand Down
1 change: 0 additions & 1 deletion examples/how-to-create-a-complete-qr-bill/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createWriteStream } from "fs";

import PDFDocument from "pdfkit";
import { SwissQRBill, Table } from "swissqrbill/pdf";
import { mm2pt } from "swissqrbill/utils";
Expand Down
1 change: 0 additions & 1 deletion examples/node-cjs-javascript/src/pdf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { createWriteStream } = require("fs");

const PDFDocument = require("pdfkit");
const { SwissQRBill } = require("swissqrbill/pdf");

Expand Down
1 change: 0 additions & 1 deletion examples/node-cjs-javascript/src/svg.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { writeFileSync } = require("fs");

const { SwissQRBill } = require("swissqrbill/svg");

const data = require("./data.js");
Expand Down
1 change: 0 additions & 1 deletion examples/node-esm-javascript/src/pdf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createWriteStream } from "fs";

import PDFDocument from "pdfkit";
import { SwissQRBill } from "swissqrbill/pdf";

Expand Down
1 change: 0 additions & 1 deletion examples/node-esm-javascript/src/svg.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { writeFileSync } from "fs";

import { SwissQRBill } from "swissqrbill/svg";

import { data } from "./data.js";
Expand Down
Loading

0 comments on commit 01d51fe

Please sign in to comment.