Skip to content

Commit 057f624

Browse files
committed
chore: update docs
1 parent cadbd09 commit 057f624

File tree

9 files changed

+39
-67
lines changed

9 files changed

+39
-67
lines changed

examples/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Please read every example project's `README.md` carefully, since almost _- if not all -_ projects work differently!
44

5+
> **Warning:** You may see CDN links for bundle installation at certain sections of each documentation.
6+
You should look at these as examples/feature show-offs! You are free to store your bundles on your server as well,
7+
or in certain cases install them via NPM! Using CDNs is not mandatory.
8+
59
## Bare Pandino showcase
610

711
- [basic-browser-js](./basic-browser-js)

examples/nodejs-cjs/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const Pandino = require("@pandino/pandino");
21
const path = require("path");
2+
const Pandino = require("@pandino/pandino");
33
const loaderConfiguration = require("@pandino/loader-configuration-nodejs");
44

55
const deploymentRoot = path.normalize(path.join(__dirname, 'deploy'));

packages/@pandino/bundle-installer-dom/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,17 @@ Define a `<script type="pandino-manifests" />` tag in your `index.html`, e.g.:
3232
E.g.: directly via the Pandino instance.
3333

3434
```javascript
35-
let pandino: Bundle;
35+
import loaderConfiguration from 'https://unpkg.com/@pandino/loader-configuration-dom/dist/loader-configuration-dom.mjs';
36+
import Pandino from 'https://unpkg.com/@pandino/pandino/dist/esm/pandino.mjs';
3637

37-
// ...
38+
const pandino = new Pandino({
39+
...loaderConfiguration,
40+
});
3841

39-
pandino.getBundleContext().installBundle('./bundle-installer-dom-manifest.json');
42+
await pandino.init();
43+
await pandino.start();
44+
45+
await pandino.getBundleContext().installBundle('https://unpkg.com/@pandino/bundle-installer-dom/dist/bundle-installer-dom-manifest.json');
4046
```
4147

4248
## License

packages/@pandino/bundle-installer-nodejs/README.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,19 @@ documentation(s).
2222
### Setup Pandino and the Bundle Installer Bundle
2323

2424
```javascript
25-
const Pandino = require("@pandino/pandino").default;
26-
const bundleInstallerHeaders = require('@pandino/bundle-installer-nodejs').default;
25+
import Pandino from '@pandino/pandino';
26+
import loaderConfiguration from '@pandino/loader-configuration-nodejs';
27+
import bundleInstallerHeaders from '@pandino/bundle-installer-nodejs';
2728
const path = require("path");
28-
const fs = require("fs");
2929

3030
const deploymentRoot = path.normalize(path.join(__dirname, 'deploy'));
3131

3232
(async () => {
3333
const app = express();
3434
const port = 3000;
3535
const pandino = new Pandino({
36+
...loaderConfiguration,
3637
'pandino.deployment.root': deploymentRoot,
37-
'pandino.bundle.importer': {
38-
import: (deploymentRoot, activatorLocation) => {
39-
return require(path.normalize(path.join(deploymentRoot, activatorLocation)));
40-
},
41-
},
42-
'pandino.manifest.fetcher': {
43-
fetch: async (deploymentRoot, uri) => {
44-
const data = fs.readFileSync(path.normalize(path.join(deploymentRoot, uri)), {encoding: 'utf8'});
45-
return JSON.parse(data);
46-
},
47-
},
4838
});
4939

5040
await pandino.init();

packages/@pandino/loader-configuration-dom/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Obtain the library from a CDN or NPM (`@pandino/loader-configuration-dom`). Impo
88
constructor argument.
99

1010
```javascript
11-
import loaderConfiguration from 'https://unpkg.com/@pandino/loader-configuration-dom@0.8.14/dist/loader-configuration-dom.mjs';
12-
import Pandino from 'https://unpkg.com/@pandino/pandino@0.8.14/dist/esm/pandino.mjs';
11+
import loaderConfiguration from 'https://unpkg.com/@pandino/loader-configuration-dom/dist/loader-configuration-dom.mjs';
12+
import Pandino from 'https://unpkg.com/@pandino/pandino/dist/esm/pandino.mjs';
1313

1414
const pandino = new Pandino({
1515
...loaderConfiguration,

packages/@pandino/pandino/README.md

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -17,49 +17,32 @@ documentation(s).
1717

1818
```html
1919
<script type="module">
20-
window.addEventListener('DOMContentLoaded', async () => {
21-
const Pandino = (await import('./pandino.mjs')).default;
20+
import loaderConfiguration from 'https://unpkg.com/@pandino/loader-configuration-dom/dist/loader-configuration-dom.mjs';
21+
import Pandino from 'https://unpkg.com/@pandino/pandino/dist/esm/pandino.mjs';
22+
2223
const pandino = new Pandino({
23-
'pandino.deployment.root': location.href,
24-
'pandino.bundle.importer': {
25-
import: (deploymentRoot, activatorLocation) => import(activatorLocation),
26-
},
27-
'pandino.manifest.fetcher': {
28-
fetch: async (deploymentRoot, uri) => (await fetch(uri)).json(),
29-
},
24+
...loaderConfiguration,
3025
});
31-
26+
3227
await pandino.init();
3328
await pandino.start();
34-
29+
3530
console.log(pandino.getBundleContext());
36-
});
3731
</script>
3832
```
3933

4034
## Adding Pandino to a TypeScript project (e.g. with Webpack)
4135

42-
Install Pandino via `npm install --save @pandino/pandino @pandino/pandino-api`.
36+
Install Pandino via `npm install --save @pandino/pandino @pandino/loader-configuration-dom`.
4337

4438
Initialize it somewhere close in you applications own init logic, e.g.:
4539

4640
```typescript
4741
import Pandino from '@pandino/pandino';
48-
import {
49-
PANDINO_MANIFEST_FETCHER_PROP,
50-
PANDINO_BUNDLE_IMPORTER_PROP,
51-
DEPLOYMENT_ROOT_PROP,
52-
} from '@pandino/pandino-api';
42+
import loaderConfiguration from '@pandino/loader-configuration-dom';
5343

5444
const pandino = new Pandino({
55-
[DEPLOYMENT_ROOT_PROP]: location.href + 'deploy',
56-
[PANDINO_MANIFEST_FETCHER_PROP]: {
57-
fetch: async (deploymentRoot: string, uri: string) => (await fetch(deploymentRoot + '/' + uri)).json(),
58-
},
59-
[PANDINO_BUNDLE_IMPORTER_PROP]: {
60-
import: (deploymentRoot: string, activatorLocation: string, manifestLocation: string) =>
61-
import(/* webpackIgnore: true */ deploymentRoot + '/' + activatorLocation),
62-
},
45+
...loaderConfiguration,
6346
});
6447

6548
await pandino.init();
@@ -70,30 +53,19 @@ await pandino.getBundleContext().installBundle('some-bundle-manifest.json');
7053

7154
## Adding Pandino to a NodeJS (CJS) project
7255

73-
Install Pandino via `npm install --save @pandino/pandino`.
56+
Install Pandino via `npm install --save @pandino/pandino @pandino/loader-configuration-nodejs`.
7457

7558
Initialize it somewhere close in you applications own init logic, e.g.:
7659

7760
```javascript
78-
const Pandino = require("@pandino/pandino").default;
79-
const path = require("path");
80-
const fs = require("fs");
61+
const Pandino = require("@pandino/pandino");
62+
const loaderConfiguration = require("@pandino/loader-configuration-nodejs");
8163

8264
const deploymentRoot = path.normalize(path.join(__dirname, 'deploy'));
8365

8466
const pandino = new Pandino({
85-
'pandino.deployment.root': deploymentRoot,
86-
'pandino.bundle.importer': {
87-
import: (deploymentRoot, activatorLocation) => {
88-
return require(path.normalize(path.join(deploymentRoot, activatorLocation)));
89-
},
90-
},
91-
'pandino.manifest.fetcher': {
92-
fetch: async (deploymentRoot, uri) => {
93-
const data = fs.readFileSync(path.normalize(path.join(deploymentRoot, uri)), { encoding: 'utf8' });
94-
return JSON.parse(data);
95-
},
96-
},
67+
...loaderConfiguration,
68+
'pandino.deployment.root': deploymentRoot,
9769
});
9870

9971
(async () => {

packages/@pandino/persistence-manager-api/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
66
[![Conventional Changelog](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-conventional--changelog-e10079.svg?style=flat)](https://github.com/conventional-changelog/conventional-changelog)
77

8-
Support persisting Configuration Data.
8+
API support for persisting Configuration Data.
99

1010
## Context
1111

packages/@pandino/persistence-manager-localstorage/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ documentation(s).
2323
<script type="pandino-manifests">
2424
[
2525
...,
26-
"./persistence-manager-localstorage-manifest.json"
26+
"https://unpkg.com/@pandino/persistence-manager-localstorage/dist/esm/persistence-manager-localstorage-manifest.json"
2727
]
2828
</script>
2929
```
@@ -37,7 +37,7 @@ const pandino: Bundle;
3737

3838
// ...
3939

40-
pandino.getBundleContext().installBundle('./persistence-manager-localstorage-manifest.json');
40+
pandino.getBundleContext().installBundle('https://unpkg.com/@pandino/persistence-manager-localstorage/dist/esm/persistence-manager-localstorage-manifest.json');
4141
```
4242

4343
## Usage

packages/@pandino/persistence-manager-memory/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ documentation(s).
2323
<script type="pandino-manifests">
2424
[
2525
...,
26-
"./persistence-manager-memory-manifest.json"
26+
"https://unpkg.com/@pandino/[email protected]/dist/esm/persistence-manager-memory-manifest.json"
2727
]
2828
</script>
2929
```
@@ -37,7 +37,7 @@ const pandino: Bundle;
3737

3838
// ...
3939

40-
pandino.getBundleContext().installBundle('./persistence-manager-memory-manifest.json');
40+
pandino.getBundleContext().installBundle('https://unpkg.com/@pandino/[email protected]/dist/esm/persistence-manager-memory-manifest.json');
4141
```
4242

4343
## Usage

0 commit comments

Comments
 (0)