Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.3.3 #640

Merged
merged 25 commits into from
Nov 2, 2023
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5e910a5
Auto update documentation
Oct 23, 2023
3628187
Added implementation for fallback
FlorianRappl Oct 24, 2023
62955ba
Improved Angular component bundles
FlorianRappl Oct 24, 2023
94e3460
Bump crypto-js from 4.1.1 to 4.2.0
dependabot[bot] Oct 25, 2023
3da0780
Merge pull request #638 from smapiot/dependabot/npm_and_yarn/crypto-j…
FlorianRappl Oct 25, 2023
d7f2633
Consider the absence of devDependencies in a package.json.
manuelroemer Oct 26, 2023
dc3358f
Merge pull request #639 from smapiot/fix/cli-error-on-missing-dev-dep…
FlorianRappl Oct 26, 2023
813adfe
Moved the npm clients to a dedicated space
FlorianRappl Oct 27, 2023
a2c0db8
Merge branch 'develop' of https://github.com/Smapiot/piral into develop
FlorianRappl Oct 27, 2023
bf99fd9
Updated README
FlorianRappl Oct 27, 2023
34a6484
Fixed usage of tslib
FlorianRappl Oct 27, 2023
16831bc
Improved utils to work with vite
FlorianRappl Oct 27, 2023
6fc038d
Corrected import path
FlorianRappl Oct 27, 2023
12ac968
Fixed tests
FlorianRappl Oct 27, 2023
b1bc8cb
Support cat override
FlorianRappl Oct 27, 2023
3d58cdb
Started migration to vitest
FlorianRappl Oct 28, 2023
eb74c53
Continued with migration to vitest
FlorianRappl Oct 29, 2023
1084da0
Migrating the plugins
FlorianRappl Oct 29, 2023
b7b2355
Migrated tooling
FlorianRappl Oct 30, 2023
63c0f3c
Migrated
FlorianRappl Oct 30, 2023
e517fb6
Corrected all plugin tests
FlorianRappl Oct 30, 2023
c98f935
Finished migration of framework tests
FlorianRappl Oct 30, 2023
c5ce4a9
Updated vitest migration
FlorianRappl Oct 30, 2023
6e9f4e6
Change to use default import
FlorianRappl Oct 30, 2023
8a1fa7b
Updated pilet declaration
FlorianRappl Nov 1, 2023
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Piral Changelog

## 1.3.3 (tbd)

- Fixed inlined source maps for CSS files of Angular components
- Fixed import in `piral-core` prevent `piral-cli-vite` to properly build
- Updated direct usage of `tslib` in `piral-base`
- Updated to latest version of `dets`
- Added implementation for the `FallbackComponent` attribute in `piral-blazor`

## 1.3.2 (October 23, 2023)

- Fixed issue with loading order for global Blazor pilets in `piral-blazor`
9 changes: 0 additions & 9 deletions jest.config.js

This file was deleted.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@
"lint": "tslint -c tslint.json 'src/**/*.{ts,tsx}' --project tsconfig.json",
"prettify": "prettier --config prettier.config.js --write \"src/**/*.{ts,tsx}\"",
"cleanup": "lerna run cleanup",
"test": "jest --forceExit --runInBand",
"test": "vitest run",
"prepublish": "yarn build",
"release": "lerna publish",
"docgen:codes": "node tools/generate-message-docs.js",
@@ -51,7 +51,6 @@
},
"devDependencies": {
"@jsenv/file-size-impact": "12.1.1",
"@types/enzyme": "^3.1.18",
"caniuse-lite": "^1.0.30001341",
"esbuild": "^0.13.6",
"lerna": "^6.0.1",
@@ -61,7 +60,8 @@
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.0.1",
"typedoc": "0.25.2",
"typescript": "5.2.2"
"typescript": "5.2.2",
"vitest": "^0.34.6"
},
"resolutions": {
"ansi-html": "0.0.9",
10 changes: 7 additions & 3 deletions src/converters/piral-blazor/README.md
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ where `my-app-shell` should refer to the name of the NPM package of your app she
Exposing components looks like:

```cs
@attribute [ExposePilet("sample-page")]
@attribute [PiralExtension("sample-page")]

<div>
<p>
@@ -58,9 +58,11 @@ Exposing components looks like:
}
```

For more details visit the [Piral.Blazor](https://github.com/smapiot/Piral.Blazor) repository.

## Architecture

Blazor with Piral works from two sides. We have the app shell's side and the side of the microfrontends. This package allows to connect both sides, by placing a set of shared functionality in the app shell.
Blazor with Piral works from two sides. We have the app shell's side and the side of the micro frontends. This package allows to connect both sides, by placing a set of shared functionality in the app shell.

![Architecture Diagram](https://raw.githubusercontent.com/smapiot/piral/documentation/docs/diagrams/blazor-architecture.png)

@@ -94,6 +96,8 @@ There is only a single argument, which refers to the name of the exposed Blazor

::: summary: For pilet authors

**Note**: If you use the .NET template (and specifically the `Piral.Blazor.Tools` package) then the whole JavaScript code will be generated for you. There is nothing you will need to do - even though you can also manually extend the generated JavaScript module.

You can use the `fromBlazor` function from the Pilet API to convert your Blazor components to components usable by your Piral instance.

Example use:
@@ -133,7 +137,7 @@ export function setup(piral: PiletApi) {

In this case, you'll also have to install the `blazor` package. `piral-blazor` will use this under the hood to access the Blazor libraries.

To maximize compatibility, the major and minor version of the `blazor` package should correspond to the major and minor version of .NET Blazor you want to use (e.g., `blazor@3.2.x` will resolve to the .NET Blazor `3.2` release train). It should be noted that the patch level is not aligned. If a specific patch level is desired, consult the `blazor` package documentation.
To maximize compatibility, the major and minor version of the `blazor` package should correspond to the major and minor version of .NET Blazor you want to use (e.g., `blazor@3.2.x` will resolve to the outdated .NET Blazor `3.2` release train - more recent ones look like `blazor@7.0.0`). It should be noted that the patch level is not aligned. If a specific patch level is desired, consult the `blazor` package documentation.

:::

6 changes: 5 additions & 1 deletion src/converters/piral-blazor/src/events.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { ExtensionRegistration } from 'piral-core';
import { createElement } from 'react';
import { isInternalNavigation, performInternalNavigation } from './navigation';

const blazorRootId = 'blazor-root';
@@ -79,7 +80,10 @@ export function emitRenderEvent(
fallbackComponent: string | null,
) {
const target = findTarget(source);
const empty = typeof fallbackComponent === 'string' ? () => {} : undefined;
const empty =
typeof fallbackComponent === 'string'
? () => createElement('piral-extension', { name: fallbackComponent, params })
: undefined;
const order =
typeof sourceRef !== 'undefined'
? (elements: Array<ExtensionRegistration>) => {
1 change: 1 addition & 0 deletions src/converters/piral-ng/extend-webpack.js
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ module.exports =
loader: cssLoader,
options: {
esModule: false,
sourceMap: false,
},
};
const htmlLoaderNoModule = {
1 change: 1 addition & 0 deletions src/converters/piral-ng/src/queue.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it, expect } from 'vitest';
import { enqueue } from './queue';

describe('queue', () => {
7 changes: 4 additions & 3 deletions src/framework/piral-base/src/aggregate.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import 'systemjs/dist/system.js';
import 'systemjs/dist/extras/named-register.js';

import { describe, it, expect, vitest } from 'vitest';
import { runPilet } from './aggregate';

describe('Piral-Base aggregate module', () => {
it('createPilet calls the setup method of the pilet', async () => {
const create: any = jest.fn(() => ({}));
const setup = jest.fn();
const create: any = vitest.fn(() => ({}));
const setup = vitest.fn();
await runPilet(
create,
{
@@ -22,7 +23,7 @@ describe('Piral-Base aggregate module', () => {
});

it('createPilet does not call due to invalid api creator', async () => {
const setup = jest.fn();
const setup = vitest.fn();
await runPilet(
undefined,
{
7 changes: 4 additions & 3 deletions src/framework/piral-base/src/api.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it, expect, vitest } from 'vitest';
import { initializeApi, mergeApis } from './api';

const moduleMetadata = {
@@ -11,9 +12,9 @@ const moduleMetadata = {
describe('API Module', () => {
it('createCoreApi pluginMeta returns the metadata', () => {
const container = {
on: jest.fn(),
off: jest.fn(),
emit: jest.fn(),
on: vitest.fn(),
off: vitest.fn(),
emit: vitest.fn(),
};
const api = initializeApi(moduleMetadata, container);
expect(api.meta).toEqual({
5 changes: 2 additions & 3 deletions src/framework/piral-base/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { __assign } from 'tslib';
import type { PiletMetadata, EventEmitter, PiletApi, PiletApiExtender } from './types';

export function initializeApi(target: PiletMetadata, events: EventEmitter): PiletApi {
@@ -7,12 +6,12 @@ export function initializeApi(target: PiletMetadata, events: EventEmitter): Pile
once: events.once,
off: events.off,
emit: events.emit,
meta: __assign({}, target),
meta: Object.assign({}, target),
};
}

export function mergeApis(api: PiletApi, extenders: Array<PiletApiExtender<Partial<PiletApi>>>, target: PiletMetadata) {
const frags = extenders.map((extender) => extender(api, target));
__assign(api, ...frags);
Object.assign(api, ...frags);
return api;
}
11 changes: 6 additions & 5 deletions src/framework/piral-base/src/create.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import 'systemjs/dist/system.js';
import 'systemjs/dist/extras/named-register.js';

import { describe, it, expect, vitest } from 'vitest';
import { startLoadingPilets } from './create';

describe('Piral-Base create module', () => {
it('startLoadingPilets triggers the selected strategy', async () => {
const reporter = jest.fn();
const reporter = vitest.fn();
const loading = startLoadingPilets({
createApi() {
return undefined;
@@ -41,7 +42,7 @@ describe('Piral-Base create module', () => {
});

it('startLoadingPilets disconnects properly', async () => {
const reporter = jest.fn();
const reporter = vitest.fn();
const loading = startLoadingPilets({
createApi() {
return undefined;
@@ -60,7 +61,7 @@ describe('Piral-Base create module', () => {
});

it('startLoadingPilets with a failing strategy', async () => {
const reporter = jest.fn();
const reporter = vitest.fn();
const err = new Error('Failed to load');
const loading = startLoadingPilets({
createApi() {
@@ -83,7 +84,7 @@ describe('Piral-Base create module', () => {
});

it('startLoadingPilets with some delivered pilets', async () => {
const reporter = jest.fn();
const reporter = vitest.fn();
const pilet1: any = {};
const pilet2: any = {};
const pilet3: any = {};
@@ -110,7 +111,7 @@ describe('Piral-Base create module', () => {
});

it('startLoadingPilets triggers the standard strategy', async () => {
const reporter = jest.fn();
const reporter = vitest.fn();
const loading = startLoadingPilets({
createApi() {
return undefined;
26 changes: 13 additions & 13 deletions src/framework/piral-base/src/events.test.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
/**
* @vitest-environment jsdom
*/
import { describe, it, expect, vitest } from 'vitest';
import { createListener } from './events';

describe('Events Module', () => {
it('add and emit event', (done) => {
it('add and emit event', () => {
const events = createListener(undefined);
const mockCallback = jest.fn();
const mockCallback = vitest.fn();
events.on('init', mockCallback);
events.emit('init', undefined);

setTimeout(() => {
expect(mockCallback).toHaveBeenCalledTimes(1);
done();
}, 1);
});

it('does only react to self events when different states', (done) => {
it('does only react to self events when different states', () => {
const events1 = createListener({});
const events2 = createListener({});
const mockCallback = jest.fn();
const mockCallback = vitest.fn();
events1.on('init', mockCallback);
events2.emit('init', undefined);

setTimeout(() => {
expect(mockCallback).toHaveBeenCalledTimes(0);
done();
}, 1);
});

it('does only react to self events when same state', (done) => {
it('does only react to self events when same state', () => {
const state = {};
const events1 = createListener(state);
const events2 = createListener(state);
const mockCallback = jest.fn();
const mockCallback = vitest.fn();
events1.on('init', mockCallback);
events2.emit('init', undefined);

setTimeout(() => {
expect(mockCallback).toHaveBeenCalledTimes(1);
done();
}, 1);
});

@@ -47,20 +48,19 @@ describe('Events Module', () => {

it('should not try to remove non-existing listener', () => {
const events = createListener(undefined);
events.off('init', jest.fn());
events.off('init', vitest.fn());
});

it('should not be possible to emit after event removed', (done) => {
it('should not be possible to emit after event removed', () => {
const events = createListener(undefined);
const mockCallback = jest.fn();
const mockCallback = vitest.fn();
events.on('init', mockCallback);
events.emit('init', undefined);
events.off('init', mockCallback);
events.emit('init', undefined);

setTimeout(() => {
expect(mockCallback).toHaveBeenCalledTimes(1);
done();
}, 1);
});
});
4 changes: 4 additions & 0 deletions src/framework/piral-base/src/inspect.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/**
* @vitest-environment jsdom
*/
import 'systemjs/dist/system.js';
import 'systemjs/dist/extras/named-register.js';

import { describe, it, expect } from 'vitest';
import { inspectPilet } from './inspect';

describe('inspect pilet module', () => {
Loading