Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
039dfa4
Auto update documentation
Apr 15, 2025
8ff596d
Bump vite from 6.2.6 to 6.3.4
dependabot[bot] Apr 30, 2025
b75b506
Merge pull request #760 from smapiot/dependabot/npm_and_yarn/vite-6.3.4
FlorianRappl May 2, 2025
a144f0f
docs: fixed typo
leyakak May 14, 2025
896b665
Merge pull request #761 from leyakak/develop
FlorianRappl May 14, 2025
39fbef3
Bump undici from 6.21.1 to 6.21.3
dependabot[bot] May 15, 2025
66cb975
Merge pull request #762 from smapiot/dependabot/npm_and_yarn/undici-6…
FlorianRappl May 15, 2025
903b901
Merge branch 'documentation' of https://github.com/smapiot/piral into…
FlorianRappl May 27, 2025
3fd2a95
Improved script output
FlorianRappl May 27, 2025
cd530ca
Updated monorepo doc
FlorianRappl May 27, 2025
d470dcf
Updated monorepo guide
FlorianRappl May 28, 2025
d0804ad
Improved error message
FlorianRappl May 29, 2025
75f7a65
Extended documentation
FlorianRappl May 31, 2025
53e793f
Updated for Angular 20
FlorianRappl Jun 2, 2025
262ca49
Updated webpack5 to avoid outputting emit CSS files
FlorianRappl Jun 4, 2025
8401991
Working on remote types
FlorianRappl Jun 11, 2025
b8b7ff1
Patch from remote
FlorianRappl Jun 26, 2025
5b70187
Fixed webpack issue
FlorianRappl Jun 29, 2025
9d089fa
Defensively use internal #764
FlorianRappl Jun 29, 2025
14d352d
Added typings
FlorianRappl Jun 30, 2025
a026b9c
Merge branch 'develop' of https://github.com/smapiot/piral into develop
FlorianRappl Jun 30, 2025
f58f713
Improved newline handling
FlorianRappl Jun 30, 2025
3bf8590
Working on declaration feature
FlorianRappl Jun 30, 2025
401f79e
Updated deps
FlorianRappl Jul 1, 2025
844170b
Changed to use hierarchical call
FlorianRappl Jul 1, 2025
cee5206
Bump form-data from 4.0.1 to 4.0.4
dependabot[bot] Jul 22, 2025
495aa77
Merge pull request #766 from smapiot/dependabot/npm_and_yarn/form-dat…
FlorianRappl Jul 22, 2025
93ab5f9
Bump axios from 1.10.0 to 1.11.0
dependabot[bot] Jul 23, 2025
ff7d73f
Merge pull request #767 from smapiot/dependabot/npm_and_yarn/axios-1.…
FlorianRappl Jul 24, 2025
61cdca1
Started with doc improvements
FlorianRappl Aug 5, 2025
0739b7f
Draft for #769
FlorianRappl Aug 5, 2025
73f7d0d
Updated test
FlorianRappl Aug 5, 2025
dcb57d0
fix(piral-modals): Modals weren’t stacking correctly on top of each o…
pranav-hsg Aug 11, 2025
3b65778
fix(piral-modals): Stack latest modal on top.
pranav-hsg Aug 12, 2025
6088797
Merge branch 'develop' of https://github.com/smapiot/piral into develop
FlorianRappl Aug 12, 2025
6ae23ab
Merge pull request #773 from pranav-hsg/hotfix/piral-modal-stack-ontop
FlorianRappl Aug 12, 2025
5554e26
Merge branch 'develop' of https://github.com/smapiot/piral into develop
FlorianRappl Aug 12, 2025
3fec5d6
Improved size reporter
FlorianRappl Aug 12, 2025
5fd9a02
Support webpack promise config and esm config files
grant-progress Aug 14, 2025
6416f1e
fix usage of extendConfig
grant-progress Aug 14, 2025
c761841
update readme for promise version
grant-progress Aug 14, 2025
5ef5945
more concise webpack config promise support
grant-progress Aug 18, 2025
311be80
Merge pull request #774 from grant-progress/feat/webpack-promise-config
FlorianRappl Aug 26, 2025
1d4b668
Updated changelog
FlorianRappl Aug 28, 2025
da6ba34
Updated tmp
FlorianRappl Sep 1, 2025
86bea28
Bump vite from 6.3.4 to 6.3.6
dependabot[bot] Sep 10, 2025
985069b
Merge pull request #776 from smapiot/dependabot/npm_and_yarn/vite-6.3.6
FlorianRappl Sep 10, 2025
8a77a86
Typings
FlorianRappl Sep 10, 2025
60cabcc
Merge branch 'develop' of https://github.com/smapiot/piral into develop
FlorianRappl Sep 10, 2025
f4236dc
Improved security context violation
FlorianRappl Sep 10, 2025
fe19358
Merge branch 'develop' of https://github.com/smapiot/piral into develop
FlorianRappl Sep 10, 2025
7d163a2
Removed findDOMNode usage
FlorianRappl Sep 11, 2025
3a689f6
Cosmetics
FlorianRappl Sep 11, 2025
466fb9b
Removed use of patchPiralTypes
FlorianRappl Sep 14, 2025
46d7d86
Updated kras
FlorianRappl Sep 19, 2025
ead50fc
Updated remote types
FlorianRappl Sep 26, 2025
4bcb3cd
Apply suggestions from code review
FlorianRappl Sep 26, 2025
b11f02b
Extended scaffolded pilet.json
FlorianRappl Sep 26, 2025
6f7ff88
Output error message in case there is no value
FlorianRappl Sep 26, 2025
9f99e9e
Improved types generation
FlorianRappl Sep 26, 2025
d010345
Provide warning and skip
FlorianRappl Sep 26, 2025
9928f60
Merge branch 'develop' of https://github.com/smapiot/piral into develop
FlorianRappl Sep 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
with:
node-version: "20.12.2"
- run: yarn install
- run: yarn install --ignore-scripts
- name: Report changes
run: node ./tools/size-reporter.mjs
env:
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Piral Changelog

## 1.9.0 (tbd)

- Fixed platform providers for `piral-ng` with Angular 20 in non-standalone form (#764)
- Fixed debug mode deserialization in case of modifications from other security contexts (#775)
- Removed `container` property from the `unhandled-error` event arguments (#777)
- Improved dialog order in `piral-modals` (#773) by @pranav-hsg
- Improved output when installation of packages fails (#759)
- Improved error message when template resolution fails (#763)
- Updated some dependencies such as `axios` (#765)
- Updated `dets` to latest release
- Updated `piral-cli-webpack5` to never output empty `main.css` files in pilets
- Updated `piral-oidc` to use up-to-date `oidc-client-ts` instead of discontinued `oidc-client` library (#769)
- Added support for Angular 20 in `piral-ng`
- Added warning in `piral-cli` when shared dependencies are wrongly declared (#768)
- Added support for Promise-based Webpack configuration files in `piral-cli-webpack5` (#774) by @grant-progress
- Added `remoteTypesSource` to *piral.json* for specifying an URL for extra declarations
- Added `remoteTypesTarget` to *pilet.json* for storing obtained extra declarations locally

## 1.8.5 (April 15, 2025)

- Fixed generation of declarations during `pilet build` in the `piral-cli`
Expand Down
49 changes: 48 additions & 1 deletion docs/concepts/T03-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Registry selection:

A custom template is just an npm package that fulfills the following requirements:

1. Expose a CommonJS module (`main` in the *package.json*)
1. Expose a **CommonJS module** (`main` in the *package.json*)
2. Have a `default` export being a function specified below
3. Have `template` and either `pilet` (for pilets) or `piral` (for Piral instances) as keyword

Expand Down Expand Up @@ -84,3 +84,50 @@ interface ExecutionDetails {
```

This way, the template packages are essentially factories to create virtual files which are then written out by the `piral-cli`.

The easiest way to have a convenient codebase and adhere to the CommonJS output is to use a bundler such as `esbuild`. For instance, the following code (stored in *src/index.js*) would not work directly:

```js
import { createPiletTemplateFactory } from '@smapiot/template-utils';

const root = resolve(__dirname, '..');

export default createPiletTemplateFactory(root, () => [
{
languages: ['js', 'ts'],
name: 'foo.txt',
target: '<src>/foo.txt',
},
]);
```

Here, we use an ES module. To bring that conveniently and efficiently into a CommonJS module you can use the following *package.json*:

```json
{
"name": "@custom/template",
"version": "1.0.0",
"keywords": ["template", "pilet"],
"engines": {
"node": ">=16.0",
"piral": "1.x"
},
"templateOptions": {},
"author": "Your name",
"license": "MIT",
"main": "lib/index.js",
"files": [
"lib",
"src",
"templates"
],
"scripts": {
"build": "esbuild src/index.js --bundle --outfile=./lib/index.js --platform=node"
},
"devDependencies": {
"@smapiot/template-utils": "^1.0.13"
}
}
```

Importantly, you can run `npm run build` to convert the original ES module codebase to a single file stored in *lib/index.js*. This way, you do not need to declare runtime dependencies such as `@smapiot/template-utils` (they can remain a development-only dependency) and you obtain a legit CommonJS module.
15 changes: 14 additions & 1 deletion docs/static/schemas/pilet-v0.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@
],
"description": "The default behavior for implicitly defined versions of shared dependencies."
},
"remoteTypesTarget": {
"description": "The absolute or relative location of the file that is written with the remote types, if any. Default is './src/remote.d.ts'.",
"oneOf": [
{
"type": "boolean",
"description": "A truthy value indicates that the default value should be used. Otherwise, nothing is written."
},
{
"type": "string",
"description": "The absolute or relative location of the file with the remote types."
}
]
},
"piralInstances": {
"type": "object",
"description": "The app shells to be used for debugging the pilet. Each key defines the name of a Piral instance to be selectable.",
Expand Down Expand Up @@ -58,4 +71,4 @@
}
}
}
}
}
4 changes: 4 additions & 0 deletions docs/static/schemas/piral-v0.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
],
"description": "Defines how the styles for the web components are transported. 'inline' puts them on the web components when rendering, 'sheet' includes a stylesheet when bundling, 'none' requires you to include them somewhere. By default, 'inline' is used."
},
"remoteTypesSource": {
"type": "string",
"description": "The URL of the generated d.ts combining extra type information from all pilets."
},
"shared": {
"type": "array",
"items": {
Expand Down
47 changes: 0 additions & 47 deletions docs/tutorials/11-server-side-rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,53 +168,6 @@ The diagram below shows this sequence.

**Remark**: The replacement for the embedded data needs to be placed *before* the root module (in the example above `<script src="index.tsx"></script>`) is referenced.

The embedded data is either the data from the pilet feed (this section) or the data from the feed including the pilets (see next section).

## Embedding the Pilets

Embedding the pilet feed may already be enough to provide improved startup performance. Nevertheless, especially for "cold starts", i.e., where no pilets have yet been seen or loaded, it can make sense to also deliver the pilets with the initial response.

Following the approach described beforehand, we can extend the `sendIndex` function to also include the pilets.

The only thing to add is the `getPilet` function in the provided options. This way, we can tell the SSR utility how to retrieve a pilet from its link.

```ts
import axios from 'axios';
import { createApp } from '../common/app';

const feedUrl = 'https://feed.piral.cloud/api/v1/pilet/sample';

function readRemoteText(link: string) {
return axios.get(link).then(res => res.data);
}

async function readRemoteJson(link: string) {
const content = await readRemoteText(link);
return JSON.parse(content);
}

async function sendIndex(_: express.Request, res: express.Response) {
const app = createApp();
const content = await renderFromServer(app, {
getPilet(url) {
return readRemoteText(url);
},
async getPiletsMetadata() {
const res = await readRemoteJson(feedUrl);
return res.items;
},
fillTemplate(body, script) {
return indexHtml
.replace('<div id="app"></div>', `<div id="app">${body}</div>`)
.replace('<noscript id="data"></noscript>', script);
},
});
res.send(content);
}
```

Generally, this approach gives us quite some flexibility. It allows us to use caching in addition to HTTP requests. It also allows us to embed a pilet feed directly on the server-side, potentially not requiring any feed seen outside.

## Conclusion

SSR can be helpful to improve startup performance and user experience. The cost of optimizing the backend is, however, not negligible and should be considered, too. Providing the fastest response possible to pilet feed and general page requests could be already sufficient to ensure a great user experience.
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/15-share-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ The rule of thumb for sharing the type declarations is: Everything exported top-

### Exported Modules

To simplify the process illustrated in the previous two sections you can use a special key called `shared` in your *pilet.json*, e.g.:
To simplify the process illustrated in the previous two sections you can use a special key called `shared` in your *piral.json*, e.g.:

```json
{
Expand Down
Loading
Loading