Skip to content

Commit

Permalink
Merge pull request #702 from smapiot/develop
Browse files Browse the repository at this point in the history
Release 1.6.0
  • Loading branch information
FlorianRappl committed Jul 8, 2024
2 parents 6afd871 + 1c113ff commit a622b61
Show file tree
Hide file tree
Showing 112 changed files with 1,148 additions and 1,155 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Piral Changelog

## 1.6.0 (July 5, 2024)

- Fixed event dispatching for providers in `piral-blazor`
- Fixed navigation storm in angular pilets (#672)
- Fixed declaration merging for `moduleResolution` set to `bundler` (#701)
- Removed legacy `require` (CommonJS) output in `piral-core` and related libs
- Improved setup of event listeners in `piral-blazor` (#696)
- Improved fallback signature in `piral-translate`
- Improved streaming update in `piral-update`
- Updated dependencies
- Added `--strict-port` option to the `piral-cli` debug commands (#699)
- Added update capabilities to `piral-blazor` extension boundaries
- Added `piral-error-overlay` to `piral-debug-utils`
- Added `unhandled-error` event fired from the `ErrorBoundary`

## 1.5.6 (May 21, 2024)

- Fixed issue with `piral-cli-webpack5` when modifying the config entry point
Expand Down
3 changes: 2 additions & 1 deletion docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ We think that Piral hits a sweet spot that makes development easy and fun while
| TypeScript Support | ✔️ || ✔️ | ✔️ || ✔️ |
| Stitching Location | Client | Client | Client | Client | Server | Client |
| Free Deployments | ✔️ | ✔️ || ✔️ | ✔️ | ✔️ |
| Free Development | ✔️ |||| ✔️ |||
| Free Development | ✔️ |||| ✔️ ||
| Decoupled Sharing | ✔️ ||||||
| Shared Dependencies | ✔️ | ✔️ | ✔️ ||||

Expand All @@ -100,6 +100,7 @@ There are more alternatives, which have not been listed for brevity. Some of the
- [One App](https://github.com/americanexpress/one-app)
- [PuzzleJs](https://github.com/puzzle-js/puzzle-js)
- [NUT](https://github.com/nut-project/nut)
- [Isomorphic Layout Composer (ILC)](https://github.com/namecheap/ilc/)

## Feature Explanation

Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/23.1-monorepo-lerna.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ We begin with a new fresh directory:
```sh
git init
npm init -y
npx lerna init
npx lerna init --packages="packages/*"
```

With these three commands we
Expand Down Expand Up @@ -146,10 +146,10 @@ We moved over the `devDependencies` and added a `postinstall` script that just r
`lerna run` is a utility to run one command (if available) in all packages. Any package that has, e.g., a `declaration` script will run it when `lerna run declaration` is triggered. This is very handy for building - only specify a `build` command in each package and now you can build all packages by using `lerna run build`.
:::

Now it's time to resolve the dependencies in our monorepo. We should always use `lerna bootstrap` for this:
Now it's time to resolve the dependencies in our monorepo. We should always use the install command of the package manager for this, e.g., for Yarn:

```sh
npx lerna bootstrap
yarn install
```

If everything seems fine you can try to build your app shell for the first time:
Expand Down
10 changes: 1 addition & 9 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"cacheableOperations": [
"build",
"build:convert",
"build:commonjs",
"build:esnext",
"build:commonjs:tsc",
"build:commonjs:system",
"build:esnext:tsc",
"build:esnext:system",
"build:codegen",
Expand All @@ -35,14 +32,9 @@
"{projectRoot}/convert.d.ts"
]
},
"build:commonjs": {
"outputs": [
"{projectRoot}/lib"
]
},
"build:esnext": {
"outputs": [
"{projectRoot}/esm"
"{projectRoot}/lib"
]
},
"build:docs": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"underscore": "1.12.1",
"parse-url": "8.1.0",
"postcss": "8.4.31",
"pug": "^3.0.3",
"rc": "1.2.8",
"rxjs": "7.5.6",
"set-value": "4.0.1",
Expand All @@ -90,6 +91,6 @@
"tar": "^6.2.0",
"trim-newlines": "3.0.1",
"tslib": "2.5.2",
"ws": "7.4.6"
"ws": "7.5.10"
}
}
2 changes: 1 addition & 1 deletion src/converters/piral-aurelia/convert.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createConverter } from './esm/converter';
import { createConverter } from './lib/converter';

export interface HtmlComponent<TProps> {
component: {
Expand Down
27 changes: 7 additions & 20 deletions src/converters/piral-aurelia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,20 @@
"author": "smapiot",
"homepage": "https://piral.io",
"license": "MIT",
"module": "esm/index.js",
"module": "lib/index.js",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./lib/index.js"
},
"./convert": {
"import": "./convert.js"
},
"./esm/*": {
"import": "./esm/*"
},
".": "./lib/index.js",
"./convert": "./convert.js",
"./lib/*": {
"require": "./lib/*"
},
"./_/*": {
"import": "./esm/*.js",
"require": "./lib/*.js"
"import": "./lib/*",
"types": "./lib/*.d.ts"
},
"./package.json": "./package.json"
},
"sideEffects": false,
"files": [
"esm",
"lib",
"src",
"convert.d.ts",
Expand All @@ -56,10 +44,9 @@
},
"scripts": {
"cleanup": "rimraf esm lib convert.d.ts convert.js",
"build": "yarn build:commonjs && yarn build:esnext && yarn build:convert",
"build": "yarn build:esnext && yarn build:convert",
"build:convert": "tsc convert.ts --skipLibCheck --declaration --module esnext",
"build:commonjs": "tsc --project tsconfig.json --outDir lib --module commonjs",
"build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
"build:esnext": "tsc --project tsconfig.json --outDir lib --module esnext",
"typedoc": "typedoc --json ../../../docs/types/piral-aurelia.json src --exclude \"src/**/*.test.*\"",
"test": "echo \"Error: run tests from root\" && exit 1"
},
Expand Down
6 changes: 3 additions & 3 deletions src/converters/piral-blazor/convert.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createConverter } from './esm/converter';
import { createDependencyLoader } from './esm/dependencies';
import type { BlazorOptions } from './esm/types';
import { createConverter } from './lib/converter';
import { createDependencyLoader } from './lib/dependencies';
import type { BlazorOptions } from './lib/types';

export interface HtmlComponent<TProps> {
component: {
Expand Down
27 changes: 7 additions & 20 deletions src/converters/piral-blazor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,21 @@
"author": "smapiot",
"homepage": "https://piral.io",
"license": "MIT",
"module": "esm/index.js",
"module": "lib/index.js",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./lib/index.js"
},
"./convert": {
"import": "./convert.js"
},
"./esm/*": {
"import": "./esm/*"
},
".": "./lib/index.js",
"./convert": "./convert.js",
"./lib/*": {
"require": "./lib/*"
},
"./_/*": {
"import": "./esm/*.js",
"require": "./lib/*.js"
"import": "./lib/*",
"types": "./lib/*.d.ts"
},
"./package.json": "./package.json"
},
"sideEffects": false,
"files": [
"infra.codegen",
"esm",
"lib",
"src",
"convert.d.ts",
Expand All @@ -59,10 +47,9 @@
},
"scripts": {
"cleanup": "rimraf esm lib convert.d.ts convert.js",
"build": "yarn build:commonjs && yarn build:esnext && yarn build:convert",
"build": "yarn build:esnext && yarn build:convert",
"build:convert": "tsc convert.ts --skipLibCheck --declaration --module esnext",
"build:commonjs": "tsc --project tsconfig.json --outDir lib --module commonjs",
"build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
"build:esnext": "tsc --project tsconfig.json --outDir lib --module esnext",
"typedoc": "typedoc --json ../../../docs/types/piral-blazor.json src --exclude \"src/**/*.test.*\"",
"test": "echo \"Error: run tests from root\" && exit 1"
},
Expand Down
31 changes: 12 additions & 19 deletions src/converters/piral-blazor/src/converter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { BaseComponentProps, Disposable, ForeignComponent } from 'piral-core';
import { addGlobalEventListeners, attachEvents, removeGlobalEventListeners } from './events';
import { attachLocalEvents } from './events';
import {
activate,
deactivate,
Expand Down Expand Up @@ -76,18 +76,18 @@ export function createConverter(
language?: LanguageOptions,
logLevel?: BlazorLogLevel,
) {
let configurable = false;
const bootLoader = createBootLoader(bootConfig.url, bootConfig.satellites);
const boot = (opts?: WebAssemblyStartOptions) =>
bootLoader(opts).then(async (res) => {
const [_, capabilities] = res;
bootLoader(opts).then(async ({ config, first }) => {
const [_, capabilities] = config;
configurable = capabilities.includes('configurable');

if (capabilities.includes('logging')) {
if (typeof logLevel === 'number') {
await setLogLevel(logLevel);
}
if (typeof logLevel === 'number' && capabilities.includes('logging')) {
await setLogLevel(logLevel);
}

if (capabilities.includes('events')) {
if (first && capabilities.includes('events')) {
const eventDispatcher = document.body.dispatchEvent;

// listen to all events for forwarding them
Expand Down Expand Up @@ -119,7 +119,7 @@ export function createConverter(
}

window.dispatchEvent(new CustomEvent('loaded-blazor-core'));
return res;
return config;
});
let loader = !lazy && boot(opts);
let listener: Disposable = undefined;
Expand All @@ -146,27 +146,21 @@ export function createConverter(
const nav = ctx.navigation;
el.setAttribute('data-blazor-pilet-root', 'true');

addGlobalEventListeners(el);

locals.state = 'fresh';
locals.next = noop;
locals.dispose = attachEvents(
locals.dispose = attachLocalEvents(
el,
(ev) => {
ev.stopPropagation();
const { target, props } = ev.detail;
const { target, props, configure } = ev.detail;
piral.renderHtmlExtension(target, props);
configurable && configure();
},
(ev) => {
ev.stopPropagation();
const { to, state, replace } = ev.detail;
replace ? nav.replace(to, state) : nav.push(to, state);
},
(ev) => {
ev.stopPropagation();
const { type, args } = ev.detail;
piral.emit(type, args);
},
);

function mountClassic(config: BlazorRootConfig) {
Expand Down Expand Up @@ -243,7 +237,6 @@ export function createConverter(
});
},
unmount(el, locals: BlazorLocals) {
removeGlobalEventListeners(el);
el.removeAttribute('data-blazor-pilet-root');
locals.dispose();
enqueueChange(locals, locals.unmount);
Expand Down
Loading

0 comments on commit a622b61

Please sign in to comment.