Skip to content

Commit

Permalink
Update to improve the bundle size
Browse files Browse the repository at this point in the history
Also broke out source maps and have added two useful commands to generate overviews of the provider.bundle.js file and all modules.
  • Loading branch information
johnman committed Apr 8, 2024
1 parent 4cc8082 commit c71ca89
Show file tree
Hide file tree
Showing 12 changed files with 172 additions and 132 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ how-to/integrate-with-salesforce/public/js/preload.js
how-to/integrate-with-salesforce-basic/public/js/preload.js
# Bundle/builds
**/*.bundle.js
**/*.bundle.js.map
**/*.bundle.js.LICENSE.txt
**/build
./public*/
updatable-packages.txt
Expand Down
4 changes: 4 additions & 0 deletions how-to/workspace-platform-starter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## v17.2.0

- Updated default build options. No longer bundling fdc3 module just for error strings. We have a copy of the strings to remove the dependency from the output (as it increased the size of the provider js)
- Updated webpack config to use source-map instead of inline-source-map to have smaller js files by default (devtools will import the sourcemap). It also gives you the option of whether or not you copy source map files alongside the files.
- Changed to production instead of development for the webpack build in package.json to have a more efficient js file.
- Added some useful commands `npm run explore-platform` and `npm run explore-modules` which should be run after you have run an initial build `npm run build`. This provides an overview of the bundles that are produced and lets you track the size of your modules as well as the platform.
- Improved performance of switching schemes
- Improved performance of computing dock configuration, especially on theme changes.
- Added lifecycle events for `language-changed` which includes the selected locale and updated `page-changed` so that you can listen for when a page is focused as there is now a focus event.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/** Constants representing the errors that can be encountered when calling the `open` method on the DesktopAgent object (`fdc3`). */
export const OPEN_ERROR = {
/** Returned if the specified application is not found.*/
AppNotFound: "AppNotFound",
/** Returned if the specified application fails to launch correctly.*/
ErrorOnLaunch: "ErrorOnLaunch",
/** Returned if the specified application launches but fails to add a context listener in order to receive the context passed to the `fdc3.open` call.*/
AppTimeout: "AppTimeout",
/** Returned if the FDC3 desktop agent implementation is not currently able to handle the request.*/
ResolverUnavailable: "ResolverUnavailable",
/** Returned if a call to the `open` function is made with an invalid context argument. Contexts should be Objects with at least a `type` field that has a `string` value.*/
MalformedContext: "MalformedContext"
};
/** Constants representing the errors that can be encountered when calling the `findIntent`, `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the DesktopAgent (`fdc3`). */
export const RESOLVE_ERROR = {
/** SHOULD be returned if no apps are available that can resolve the intent and context combination.*/
NoAppsFound: "NoAppsFound",
/** Returned if the FDC3 desktop agent implementation is not currently able to handle the request.*/
ResolverUnavailable: "ResolverUnavailable",
/** Returned if the user cancelled the resolution request, for example by closing or cancelling a resolver UI.*/
UserCancelled: "UserCancelledResolution",
/** SHOULD be returned if a timeout cancels an intent resolution that required user interaction. Please use `ResolverUnavailable` instead for situations where a resolver UI or similar fails.*/
ResolverTimeout: "ResolverTimeout",
/** Returned if a specified target application is not available or a new instance of it cannot be opened. */
TargetAppUnavailable: "TargetAppUnavailable",
/** Returned if a specified target application instance is not available, for example because it has been closed. */
TargetInstanceUnavailable: "TargetInstanceUnavailable",
/** Returned if the intent and context could not be delivered to the selected application or instance, for example because it has not added an intent handler within a timeout.*/
IntentDeliveryFailed: "IntentDeliveryFailed",
/** Returned if a call to one of the `raiseIntent` functions is made with an invalid context argument. Contexts should be Objects with at least a `type` field that has a `string` value.*/
MalformedContext: "MalformedContext"
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { OpenError, ResolveError, type AppIdentifier } from "@finos/fdc3";
import type { AppIdentifier } from "@finos/fdc3";
import type OpenFin from "@openfin/core";
import { OPEN_ERROR as OpenError, RESOLVE_ERROR as ResolveError } from "../../fdc3/errors";
import type {
IntentRegistrationEntry,
ContextRegistrationEntry,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ResolveError } from "@finos/fdc3";
import type OpenFin from "@openfin/core";
import type { AppIntent } from "@openfin/workspace-platform";
import { RESOLVE_ERROR as ResolveError } from "../../fdc3/errors";
import type { PlatformApp } from "../../shapes/app-shapes";
import type { IntentResolverResponse, IntentResolverOptions } from "../../shapes/interopbroker-shapes";
import type { Logger } from "../../shapes/logger-shapes";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import {
OpenError,
ResolveError,
type AppIdentifier,
type AppMetadata,
type ImplementationMetadata,
type IntentResolution,
type ContextMetadata
import type {
AppIdentifier,
AppMetadata,
ImplementationMetadata,
IntentResolution,
ContextMetadata
} from "@finos/fdc3";
import type OpenFin from "@openfin/core";
import type { WindowPositioningOptions } from "workspace-platform-starter/shapes/browser-shapes";
Expand All @@ -18,6 +16,7 @@ import * as connectionProvider from "../connections";
import { hasEndpoint, requestResponse } from "../endpoint";
import { mapToAppMetaData as mapTo12AppMetaData } from "../fdc3/1.2/mapper";
import { mapToAppMetaData as mapTo20AppMetaData } from "../fdc3/2.0/mapper";
import { OPEN_ERROR as OpenError, RESOLVE_ERROR as ResolveError } from "../fdc3/errors";
import { bringToFront, launch } from "../launch";
import { createLogger } from "../logger-provider";
import { MANIFEST_TYPES } from "../manifest-types";
Expand Down
66 changes: 33 additions & 33 deletions how-to/workspace-platform-starter/client/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const alias = {
const configs = [
{
entry: './client/src/provider.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -36,7 +36,7 @@ const configs = [
},
{
entry: './client/src/shell.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -64,7 +64,7 @@ const configs = [
},
{
entry: './client/src/modules/auth/example/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -92,7 +92,7 @@ const configs = [
},
{
entry: './client/src/modules/endpoint/local-storage/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -120,7 +120,7 @@ const configs = [
},
{
entry: './client/src/modules/endpoint/channel/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -148,7 +148,7 @@ const configs = [
},
{
entry: './client/src/modules/endpoint/inline-apps/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -176,7 +176,7 @@ const configs = [
},
{
entry: './client/src/modules/init-options/interop/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -204,7 +204,7 @@ const configs = [
},
{
entry: './client/src/modules/init-options/launch-app/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -232,7 +232,7 @@ const configs = [
},
{
entry: './client/src/modules/log/console/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -260,7 +260,7 @@ const configs = [
},
{
entry: './client/src/modules/actions/opacity/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -288,7 +288,7 @@ const configs = [
},
{
entry: './client/src/modules/endpoint/example-connection-validation/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -316,7 +316,7 @@ const configs = [
},
{
entry: './client/src/modules/analytics/console/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -344,7 +344,7 @@ const configs = [
},
{
entry: './client/src/modules/composite/developer/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -372,7 +372,7 @@ const configs = [
},
{
entry: './client/src/modules/integrations/apps/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -400,7 +400,7 @@ const configs = [
},
{
entry: './client/src/modules/integrations/workspaces/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -428,7 +428,7 @@ const configs = [
},
{
entry: './client/src/modules/integrations/pages/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -456,7 +456,7 @@ const configs = [
},
{
entry: './client/src/modules/composite/about/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -484,7 +484,7 @@ const configs = [
},
{
entry: './client/src/modules/composite/pages/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -512,7 +512,7 @@ const configs = [
},
{
entry: './client/src/modules/composite/windows/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -540,7 +540,7 @@ const configs = [
},
{
entry: './client/src/modules/endpoint/example-context-processor/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -568,7 +568,7 @@ const configs = [
},
{
entry: './client/src/framework/fdc3/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -596,7 +596,7 @@ const configs = [
},
{
entry: './client/src/modules/actions/custom-menu/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -624,7 +624,7 @@ const configs = [
},
{
entry: './client/src/modules/auth/openid-connect/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -652,7 +652,7 @@ const configs = [
},
{
entry: './client/src/modules/endpoint/favorite-local-storage/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -680,7 +680,7 @@ const configs = [
},
{
entry: './client/src/modules/actions/favorites-menu/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -708,7 +708,7 @@ const configs = [
},
{
entry: './client/src/modules/composite/include-in-snapshot/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -736,7 +736,7 @@ const configs = [
},
{
entry: './client/src/modules/lifecycle/example-notification-service/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -764,7 +764,7 @@ const configs = [
},
{
entry: './client/src/modules/init-options/launch-workspace/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -792,7 +792,7 @@ const configs = [
},
{
entry: './client/src/modules/composite/default-workspace/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -820,7 +820,7 @@ const configs = [
},
{
entry: './client/src/modules/content-creation/view-position/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -848,7 +848,7 @@ const configs = [
},
{
entry: './client/src/modules/actions/window-platform/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -876,7 +876,7 @@ const configs = [
},
{
entry: './client/src/modules/share/pages/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down Expand Up @@ -904,7 +904,7 @@ const configs = [
},
{
entry: './client/src/modules/share/workspaces/index.ts',
devtool: 'inline-source-map',
devtool: 'source-map',
module: {
rules: [
{
Expand Down
Loading

0 comments on commit c71ca89

Please sign in to comment.