@equinor/fusion-framework-vite-plugin-spa 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/esm/version.js +1 -1
- package/dist/html/bootstrap.js +38 -117
- package/dist/html/bootstrap.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/html/index.html.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +11 -4
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @equinor/fusion-framework-vite-plugin-spa
|
|
2
2
|
|
|
3
|
+
## 1.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3579](https://github.com/equinor/fusion-framework/pull/3579) [`b6a64d9`](https://github.com/equinor/fusion-framework/commit/b6a64d94bad7248c06b3aa7d65d7d698052437c7) Thanks [@Noggling](https://github.com/Noggling)! - Add peer dependencies to SPA Vite plugin
|
|
8
|
+
|
|
9
|
+
Added peer dependencies to ensure proper dependency resolution for the SPA Vite plugin. This change declares the Fusion Framework modules that the plugin expects to be available in the consuming application:
|
|
10
|
+
|
|
11
|
+
- `@equinor/fusion-framework-module`
|
|
12
|
+
- `@equinor/fusion-framework-module-http`
|
|
13
|
+
- `@equinor/fusion-framework-module-msal`
|
|
14
|
+
- `@equinor/fusion-framework-module-service-discovery`
|
|
15
|
+
- `@equinor/fusion-framework-module-telemetry`
|
|
16
|
+
|
|
17
|
+
This ensures that consumers are aware of the required dependencies and helps prevent runtime errors due to missing modules.
|
|
18
|
+
|
|
3
19
|
## 1.2.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/dist/esm/version.js
CHANGED
package/dist/html/bootstrap.js
CHANGED
|
@@ -19962,7 +19962,7 @@ const configureHttpClient = (name, args) => ({
|
|
|
19962
19962
|
var MsalModuleVersion;
|
|
19963
19963
|
(function (MsalModuleVersion) {
|
|
19964
19964
|
MsalModuleVersion["V2"] = "v2";
|
|
19965
|
-
MsalModuleVersion["Latest"] = "5.0
|
|
19965
|
+
MsalModuleVersion["Latest"] = "5.1.0";
|
|
19966
19966
|
})(MsalModuleVersion || (MsalModuleVersion = {}));
|
|
19967
19967
|
|
|
19968
19968
|
const VersionSchema = z.string().transform((x) => String(semver.coerce(x)));
|
|
@@ -38198,84 +38198,6 @@ class ConsoleLogger extends Logger {
|
|
|
38198
38198
|
};
|
|
38199
38199
|
}
|
|
38200
38200
|
|
|
38201
|
-
var VersionMessageType;
|
|
38202
|
-
(function (VersionMessageType) {
|
|
38203
|
-
VersionMessageType["MajorIncompatibility"] = "major-incompatibility";
|
|
38204
|
-
VersionMessageType["MinorMismatch"] = "minor-mismatch";
|
|
38205
|
-
VersionMessageType["PatchDifference"] = "patch-difference";
|
|
38206
|
-
VersionMessageType["InvalidVersion"] = "invalid-version";
|
|
38207
|
-
VersionMessageType["InvalidLatestVersion"] = "invalid-latest-version";
|
|
38208
|
-
VersionMessageType["IncompatibleVersion"] = "incompatible-version";
|
|
38209
|
-
})(VersionMessageType || (VersionMessageType = {}));
|
|
38210
|
-
|
|
38211
|
-
/**
|
|
38212
|
-
* Creates a human-readable version message based on the version message type.
|
|
38213
|
-
*
|
|
38214
|
-
* This function generates descriptive error messages for different version compatibility
|
|
38215
|
-
* scenarios, helping developers understand version-related issues.
|
|
38216
|
-
*
|
|
38217
|
-
* @param type - The type of version message to create
|
|
38218
|
-
* @param requestedVersion - The version that was requested by the user
|
|
38219
|
-
* @param latestVersion - The latest available version in the system
|
|
38220
|
-
* @returns A formatted, human-readable version message string
|
|
38221
|
-
*
|
|
38222
|
-
* @example
|
|
38223
|
-
* ```typescript
|
|
38224
|
-
* const message = createVersionMessage(
|
|
38225
|
-
* VersionMessageType.MajorIncompatibility,
|
|
38226
|
-
* '3.0.0',
|
|
38227
|
-
* '2.1.0'
|
|
38228
|
-
* );
|
|
38229
|
-
* // Returns: "Requested major version 3.0.0 is greater than the latest major version 2.1.0"
|
|
38230
|
-
* ```
|
|
38231
|
-
*
|
|
38232
|
-
* @example
|
|
38233
|
-
* ```typescript
|
|
38234
|
-
* const message = createVersionMessage(
|
|
38235
|
-
* VersionMessageType.MinorMismatch,
|
|
38236
|
-
* '2.1.0',
|
|
38237
|
-
* '2.2.0'
|
|
38238
|
-
* );
|
|
38239
|
-
* // Returns: "Minor version mismatch, requested 2.1.0, latest 2.2.0"
|
|
38240
|
-
* ```
|
|
38241
|
-
*/
|
|
38242
|
-
const createVersionMessage = (type, requestedVersion, latestVersion) => {
|
|
38243
|
-
// Convert versions to strings for consistent formatting
|
|
38244
|
-
const requestedVersionString = String(requestedVersion);
|
|
38245
|
-
const latestVersionString = String(latestVersion);
|
|
38246
|
-
switch (type) {
|
|
38247
|
-
case VersionMessageType.MajorIncompatibility:
|
|
38248
|
-
return `Requested major version ${requestedVersionString} is greater than the latest major version ${latestVersionString}`;
|
|
38249
|
-
case VersionMessageType.InvalidVersion:
|
|
38250
|
-
return `Invalid version ${requestedVersionString}`;
|
|
38251
|
-
case VersionMessageType.InvalidLatestVersion:
|
|
38252
|
-
return `Failed to parse latest version "${latestVersionString}" - this indicates the version.ts file was not generated correctly. Check for import errors in the build process.`;
|
|
38253
|
-
case VersionMessageType.MinorMismatch:
|
|
38254
|
-
return `Minor version mismatch, requested ${requestedVersionString}, latest ${latestVersionString}`;
|
|
38255
|
-
case VersionMessageType.PatchDifference:
|
|
38256
|
-
return `Patch version difference, requested ${requestedVersionString}, latest ${latestVersionString}`;
|
|
38257
|
-
case VersionMessageType.IncompatibleVersion:
|
|
38258
|
-
return `Incompatible version, requested ${requestedVersionString}, latest ${latestVersionString}`;
|
|
38259
|
-
default:
|
|
38260
|
-
return createVersionMessage(VersionMessageType.IncompatibleVersion, requestedVersion, latestVersion);
|
|
38261
|
-
}
|
|
38262
|
-
};
|
|
38263
|
-
|
|
38264
|
-
/**
|
|
38265
|
-
* Creates a VersionError instance with a formatted message.
|
|
38266
|
-
*
|
|
38267
|
-
* This is a helper function that creates a VersionError with a human-readable
|
|
38268
|
-
* message based on the error type and version information.
|
|
38269
|
-
*
|
|
38270
|
-
* @param type - The type of version error
|
|
38271
|
-
* @param requestedVersion - The version that was requested
|
|
38272
|
-
* @param latestVersion - The latest available version
|
|
38273
|
-
* @param options - Additional error options including the error type
|
|
38274
|
-
* @returns A new VersionError instance with formatted message
|
|
38275
|
-
*/
|
|
38276
|
-
const createVersionError = (type, requestedVersion, latestVersion, options) => {
|
|
38277
|
-
return new VersionError(createVersionMessage(type, requestedVersion, latestVersion), requestedVersion, latestVersion, { ...options, type });
|
|
38278
|
-
};
|
|
38279
38201
|
/**
|
|
38280
38202
|
* Error class for version-related issues in the MSAL module.
|
|
38281
38203
|
*
|
|
@@ -38311,14 +38233,8 @@ class VersionError extends Error {
|
|
|
38311
38233
|
requestedVersion;
|
|
38312
38234
|
/** The latest available version in the system */
|
|
38313
38235
|
latestVersion;
|
|
38314
|
-
/** The specific type of version error that occurred */
|
|
38315
|
-
type;
|
|
38316
38236
|
/** The error name for instanceof checks */
|
|
38317
38237
|
static Name = 'VersionError';
|
|
38318
|
-
/** Reference to the VersionMessageType enum for convenience */
|
|
38319
|
-
static Type = VersionMessageType;
|
|
38320
|
-
/** Factory method for creating VersionError instances with formatted messages */
|
|
38321
|
-
static create = createVersionError;
|
|
38322
38238
|
/**
|
|
38323
38239
|
* Creates a new VersionError instance.
|
|
38324
38240
|
*
|
|
@@ -38333,7 +38249,6 @@ class VersionError extends Error {
|
|
|
38333
38249
|
// Store versions as strings
|
|
38334
38250
|
this.requestedVersion = String(requestedVersion);
|
|
38335
38251
|
this.latestVersion = String(latestVersion);
|
|
38336
|
-
this.type = options?.type;
|
|
38337
38252
|
}
|
|
38338
38253
|
}
|
|
38339
38254
|
|
|
@@ -38382,35 +38297,41 @@ function resolveVersion(version) {
|
|
|
38382
38297
|
// Parse the requested version, defaulting to latest if not provided
|
|
38383
38298
|
const versionString = version || MsalModuleVersion.Latest;
|
|
38384
38299
|
// Parse versions using coerce for backward compatibility
|
|
38385
|
-
const wantedVersion = semver.coerce(versionString);
|
|
38386
38300
|
const latestVersion = semver.coerce(MsalModuleVersion.Latest);
|
|
38387
|
-
// Validate that the requested version is a valid semver
|
|
38388
|
-
if (!wantedVersion) {
|
|
38389
|
-
throw VersionError.create(VersionError.Type.InvalidVersion, versionString, MsalModuleVersion.Latest);
|
|
38390
|
-
}
|
|
38391
38301
|
// This should never happen! Indicates version.ts was not generated correctly
|
|
38392
38302
|
// This is a critical build-time issue that needs immediate attention
|
|
38393
38303
|
if (!latestVersion) {
|
|
38394
|
-
throw VersionError
|
|
38304
|
+
throw new VersionError(`Failed to parse latest version "${MsalModuleVersion.Latest}" - this indicates the version.ts file was not generated correctly. Check for import errors in the build process.`, versionString, MsalModuleVersion.Latest);
|
|
38395
38305
|
}
|
|
38396
|
-
|
|
38397
|
-
//
|
|
38398
|
-
if (wantedVersion
|
|
38399
|
-
|
|
38306
|
+
let wantedVersion = semver.coerce(versionString);
|
|
38307
|
+
// Validate that the requested version is a valid semver
|
|
38308
|
+
if (!wantedVersion) {
|
|
38309
|
+
const missingVersionWarning = new VersionError(`Failed to parse requested version "${versionString}"`, versionString, MsalModuleVersion.Latest);
|
|
38310
|
+
warnings.push(missingVersionWarning.message);
|
|
38311
|
+
wantedVersion = latestVersion;
|
|
38312
|
+
}
|
|
38313
|
+
if (wantedVersion.major < latestVersion.major) {
|
|
38314
|
+
const majorBehindVersionWarning = new VersionError(`Requested major version ${wantedVersion.major} is behind the latest major version ${latestVersion.major}`, wantedVersion, latestVersion);
|
|
38315
|
+
warnings.push(majorBehindVersionWarning.message);
|
|
38400
38316
|
}
|
|
38401
38317
|
// Minor version mismatch - add warning but don't throw
|
|
38402
38318
|
// This helps developers stay aware of version differences without breaking functionality
|
|
38403
38319
|
if (wantedVersion.major === latestVersion.major && wantedVersion.minor !== latestVersion.minor) {
|
|
38404
|
-
const minorMismatchWarning = VersionError
|
|
38320
|
+
const minorMismatchWarning = new VersionError(`Requested minor version ${wantedVersion.minor} is different from the latest minor version ${latestVersion.minor}`, wantedVersion, latestVersion);
|
|
38405
38321
|
warnings.push(minorMismatchWarning.message);
|
|
38406
38322
|
}
|
|
38407
38323
|
// Find the corresponding enum version for the requested major version
|
|
38408
38324
|
// This is used for module configuration and feature detection
|
|
38409
|
-
|
|
38410
|
-
// If no matching enum version is found,
|
|
38411
|
-
//
|
|
38325
|
+
let enumVersion = Object.values(MsalModuleVersion).find((x) => semver.coerce(x)?.major === wantedVersion.major);
|
|
38326
|
+
// If no matching enum version is found, fall back to the latest available
|
|
38327
|
+
// This allows forward compatibility with future versions
|
|
38412
38328
|
if (!enumVersion) {
|
|
38413
|
-
|
|
38329
|
+
enumVersion = MsalModuleVersion.Latest;
|
|
38330
|
+
// Only warn if this is a future version (higher than latest)
|
|
38331
|
+
if (wantedVersion.major > latestVersion.major) {
|
|
38332
|
+
const fallbackWarning = new VersionError(`Requested major version ${wantedVersion.major} is greater than the latest major version ${latestVersion.major}. Falling back to latest version.`, wantedVersion, latestVersion);
|
|
38333
|
+
warnings.push(fallbackWarning.message);
|
|
38334
|
+
}
|
|
38414
38335
|
}
|
|
38415
38336
|
// Return comprehensive version resolution result
|
|
38416
38337
|
return {
|
|
@@ -38429,12 +38350,8 @@ class AuthProvider {
|
|
|
38429
38350
|
get version() {
|
|
38430
38351
|
return new SemanticVersion(MsalModuleVersion.Latest);
|
|
38431
38352
|
}
|
|
38432
|
-
/** @deprecated */
|
|
38433
|
-
get defaultClient() {
|
|
38434
|
-
return this.getClient();
|
|
38435
|
-
}
|
|
38436
38353
|
get defaultAccount() {
|
|
38437
|
-
return this.
|
|
38354
|
+
return this.client.account;
|
|
38438
38355
|
}
|
|
38439
38356
|
/** @deprecated */
|
|
38440
38357
|
get defaultConfig() {
|
|
@@ -38444,8 +38361,7 @@ class AuthProvider {
|
|
|
38444
38361
|
this._config = _config;
|
|
38445
38362
|
this.#client = this.createClient();
|
|
38446
38363
|
}
|
|
38447
|
-
|
|
38448
|
-
getClient() {
|
|
38364
|
+
get client() {
|
|
38449
38365
|
return this.#client;
|
|
38450
38366
|
}
|
|
38451
38367
|
/** @deprecated */
|
|
@@ -38458,10 +38374,9 @@ class AuthProvider {
|
|
|
38458
38374
|
async handleRedirect() {
|
|
38459
38375
|
const { redirectUri } = this.defaultConfig || {};
|
|
38460
38376
|
if (window.location.pathname === redirectUri) {
|
|
38461
|
-
const
|
|
38462
|
-
const
|
|
38463
|
-
|
|
38464
|
-
await client.handleRedirectPromise();
|
|
38377
|
+
const logger = this.client.getLogger();
|
|
38378
|
+
const { requestOrigin } = this.client;
|
|
38379
|
+
await this.client.handleRedirectPromise();
|
|
38465
38380
|
if (requestOrigin === redirectUri) {
|
|
38466
38381
|
logger.warning(`detected callback loop from url ${redirectUri}, redirecting to root`);
|
|
38467
38382
|
window.location.replace('/');
|
|
@@ -38473,7 +38388,7 @@ class AuthProvider {
|
|
|
38473
38388
|
return null;
|
|
38474
38389
|
}
|
|
38475
38390
|
acquireToken(req) {
|
|
38476
|
-
return this.
|
|
38391
|
+
return this.client.acquireToken(req);
|
|
38477
38392
|
}
|
|
38478
38393
|
async acquireAccessToken(req) {
|
|
38479
38394
|
const token = await this.acquireToken(req);
|
|
@@ -38481,14 +38396,14 @@ class AuthProvider {
|
|
|
38481
38396
|
}
|
|
38482
38397
|
async login(options) {
|
|
38483
38398
|
// skip login if already logged in and has valid claims
|
|
38484
|
-
if (options?.onlyIfRequired && this.
|
|
38399
|
+
if (options?.onlyIfRequired && this.client.hasValidClaims) {
|
|
38485
38400
|
return;
|
|
38486
38401
|
}
|
|
38487
|
-
await this.
|
|
38402
|
+
await this.client.login();
|
|
38488
38403
|
}
|
|
38489
38404
|
async logout(options) {
|
|
38490
38405
|
// TODO - might have an option for popup or redirect
|
|
38491
|
-
await this.
|
|
38406
|
+
await this.client.logoutRedirect({
|
|
38492
38407
|
postLogoutRedirectUri: options?.redirectUri,
|
|
38493
38408
|
account: this.defaultAccount,
|
|
38494
38409
|
});
|
|
@@ -38510,6 +38425,12 @@ class AuthProvider {
|
|
|
38510
38425
|
switch (prop) {
|
|
38511
38426
|
case 'version':
|
|
38512
38427
|
return target.version;
|
|
38428
|
+
case 'client':
|
|
38429
|
+
return target.client;
|
|
38430
|
+
// @ts-expect-error - this is deprecated since version 5.0.1
|
|
38431
|
+
case 'defaultClient':
|
|
38432
|
+
console.warn('defaultClient is deprecated, use client instead');
|
|
38433
|
+
return target.client;
|
|
38513
38434
|
case 'defaultAccount':
|
|
38514
38435
|
return target.defaultAccount;
|
|
38515
38436
|
case 'defaultConfig':
|
|
@@ -45382,7 +45303,7 @@ async function registerServiceWorker(framework) {
|
|
|
45382
45303
|
}
|
|
45383
45304
|
|
|
45384
45305
|
// Generated by genversion.
|
|
45385
|
-
const version = '1.2.
|
|
45306
|
+
const version = '1.2.1';
|
|
45386
45307
|
|
|
45387
45308
|
// Allow dynamic import without vite
|
|
45388
45309
|
const importWithoutVite = (path) => import(/* @vite-ignore */ path);
|