@equinor/fusion-framework-dev-server 1.1.31 → 2.0.0
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 +34 -21
- package/README.md +8 -1
- package/dist/esm/create-dev-server-config.js +39 -16
- package/dist/esm/create-dev-server-config.js.map +1 -1
- package/dist/esm/create-dev-server.js +33 -3
- package/dist/esm/create-dev-server.js.map +1 -1
- package/dist/esm/index.js +26 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/process-services.js +12 -9
- package/dist/esm/process-services.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/create-dev-server-config.d.ts +32 -16
- package/dist/types/create-dev-server.d.ts +33 -3
- package/dist/types/index.d.ts +28 -0
- package/dist/types/process-services.d.ts +12 -9
- package/dist/types/types.d.ts +44 -12
- package/dist/types/version.d.ts +1 -1
- package/package.json +9 -9
- package/src/create-dev-server-config.ts +39 -16
- package/src/create-dev-server.ts +33 -3
- package/src/index.ts +29 -0
- package/src/process-services.ts +12 -9
- package/src/types.ts +44 -12
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @equinor/fusion-framework-dev-server
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- abffa53: Major version bump for Fusion Framework React 19 release.
|
|
8
|
+
|
|
9
|
+
All packages are bumped to the next major version as part of the React 19 upgrade. This release drops support for React versions below 18 and includes breaking changes across the framework.
|
|
10
|
+
|
|
11
|
+
**Breaking changes:**
|
|
12
|
+
- Peer dependencies now require React 18 or 19 (`^18.0.0 || ^19.0.0`)
|
|
13
|
+
- React Router upgraded from v6 to v7
|
|
14
|
+
- Navigation module refactored with new history API
|
|
15
|
+
- `renderComponent` and `renderApp` now use `createRoot` API
|
|
16
|
+
|
|
17
|
+
**Migration:**
|
|
18
|
+
- Update your React version to 18.0.0 or higher before upgrading
|
|
19
|
+
- Replace `NavigationProvider.createRouter()` with `@equinor/fusion-framework-react-router`
|
|
20
|
+
- See individual package changelogs for package-specific migration steps
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- aa35c46: chore: bump @vitejs/plugin-react from 5.1.4 to 6.0.1
|
|
25
|
+
- 32bcf83: Bump `vite` from `7.3.1` to `8.0.0`.
|
|
26
|
+
|
|
27
|
+
Vite 8 replaces Rollup with Rolldown and esbuild with Oxc for faster builds.
|
|
28
|
+
No breaking API changes affect this codebase. The `dev-server` peerDependency
|
|
29
|
+
is widened to accept both Vite 7 and Vite 8.
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [abffa53]
|
|
32
|
+
- Updated dependencies [32bcf83]
|
|
33
|
+
- @equinor/fusion-framework-vite-plugin-api-service@2.0.0
|
|
34
|
+
- @equinor/fusion-framework-vite-plugin-spa@4.0.0
|
|
35
|
+
- @equinor/fusion-log@2.0.0
|
|
36
|
+
|
|
3
37
|
## 1.1.31
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -169,20 +203,17 @@
|
|
|
169
203
|
This update addresses a security vulnerability in Vite's development server and includes bug fixes for improved compatibility. The update ensures secure development environments and better plugin ecosystem compatibility.
|
|
170
204
|
|
|
171
205
|
**Changes:**
|
|
172
|
-
|
|
173
206
|
- Updated Vite from v7.1.10 to v7.1.12
|
|
174
207
|
- Includes security fix for development server file system checks
|
|
175
208
|
- Includes compatibility fix for CommonJS plugin
|
|
176
209
|
- No breaking changes or API modifications
|
|
177
210
|
|
|
178
211
|
**Security Fix (v7.1.11):**
|
|
179
|
-
|
|
180
212
|
- **dev**: trim trailing slash before `server.fs.deny` check ([#20968](https://github.com/vitejs/vite/issues/20968))
|
|
181
213
|
- Prevents potential path traversal vulnerability in development server
|
|
182
214
|
- Only affects development environment, not production builds
|
|
183
215
|
|
|
184
216
|
**Bug Fix (v7.1.12):**
|
|
185
|
-
|
|
186
217
|
- **deps**: downgrade commonjs plugin to 28.0.6 to avoid rollup/plugins issues ([#20990](https://github.com/vitejs/vite/issues/20990))
|
|
187
218
|
- Improves compatibility with Rollup plugin ecosystem
|
|
188
219
|
- Prevents potential build issues
|
|
@@ -240,7 +271,6 @@
|
|
|
240
271
|
### Patch Changes
|
|
241
272
|
|
|
242
273
|
- [`56c27ec`](https://github.com/equinor/fusion-framework/commit/56c27ec9de03e07e725eecfdf2c028a1e29b6ece) Thanks [@odinr](https://github.com/odinr)! - Updated workspace dependencies to use exact version specifiers for consistent release behavior.
|
|
243
|
-
|
|
244
274
|
- Changed workspace dependencies from `workspace:^` to `workspace:*` across CLI, dev-server, and SPA vite plugin packages
|
|
245
275
|
- Ensures exact version resolution within the monorepo for predictable builds and releases
|
|
246
276
|
- Affects both dependencies and devDependencies where applicable
|
|
@@ -263,7 +293,6 @@
|
|
|
263
293
|
### Patch Changes
|
|
264
294
|
|
|
265
295
|
- [#3443](https://github.com/equinor/fusion-framework/pull/3443) [`2291483`](https://github.com/equinor/fusion-framework/commit/2291483b10ea288102155839dc47dcfe2addc22c) Thanks [@eikeland](https://github.com/eikeland)! - Fix OPTIONS requests missing Allow header after Vite 7 update
|
|
266
|
-
|
|
267
296
|
- Disabled Vite's internal CORS handling by setting `server.cors: false`
|
|
268
297
|
- This allows backend services to properly handle OPTIONS requests with correct headers
|
|
269
298
|
- Resolves issue where OPTIONS requests were not forwarded to backend after Vite 7 upgrade
|
|
@@ -278,7 +307,6 @@
|
|
|
278
307
|
- [#3349](https://github.com/equinor/fusion-framework/pull/3349) [`c511123`](https://github.com/equinor/fusion-framework/commit/c511123c835e24e9ddefcc4c47c2455f5df12087) Thanks [@dependabot](https://github.com/apps/dependabot)! - chore: bump vite from 6.x to 7.1.5
|
|
279
308
|
|
|
280
309
|
Major version update of Vite build tool across all packages. This update includes:
|
|
281
|
-
|
|
282
310
|
- Enhanced build performance and caching
|
|
283
311
|
- Better error reporting with code frames
|
|
284
312
|
- Improved TypeScript integration
|
|
@@ -286,7 +314,6 @@
|
|
|
286
314
|
- New development server features
|
|
287
315
|
|
|
288
316
|
### Links
|
|
289
|
-
|
|
290
317
|
- [Vite 7.1.5 Release Notes](https://github.com/vitejs/vite/releases/tag/v7.1.5)
|
|
291
318
|
- [Vite 7.x Migration Guide](https://vitejs.dev/guide/migration)
|
|
292
319
|
|
|
@@ -297,18 +324,15 @@
|
|
|
297
324
|
Major version update of Vitest testing framework for dev-server package.
|
|
298
325
|
|
|
299
326
|
### Breaking Changes
|
|
300
|
-
|
|
301
327
|
- Updated from Vitest v2 to v3
|
|
302
328
|
- Test runner behavior improvements
|
|
303
329
|
|
|
304
330
|
### New Features
|
|
305
|
-
|
|
306
331
|
- Enhanced test performance
|
|
307
332
|
- Better error handling and reporting
|
|
308
333
|
- Updated Vite integration (v6.3.5)
|
|
309
334
|
|
|
310
335
|
### Links
|
|
311
|
-
|
|
312
336
|
- [Vitest v3.2.4 Release Notes](https://github.com/vitest-dev/vitest/releases/tag/v3.2.4)
|
|
313
337
|
- [Vitest v3 Migration Guide](https://vitest.dev/guide/migration.html)
|
|
314
338
|
|
|
@@ -323,7 +347,6 @@
|
|
|
323
347
|
- [#2910](https://github.com/equinor/fusion-framework/pull/2910) [`07cc985`](https://github.com/equinor/fusion-framework/commit/07cc9857e1427b574e011cc319518e701dba784d) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updated vitest from 2.1.9 to 3.2.4 across all packages.
|
|
324
348
|
|
|
325
349
|
## Breaking Changes
|
|
326
|
-
|
|
327
350
|
- **Node.js Requirements**: Requires Node.js 18+ (already satisfied)
|
|
328
351
|
- **Vite Compatibility**: Updated to work with Vite 7.x (already using Vite 7.1.5)
|
|
329
352
|
- **Snapshot Format**: Snapshots now use backtick quotes (\`) instead of single quotes
|
|
@@ -331,18 +354,15 @@
|
|
|
331
354
|
- **TypeScript Support**: Enhanced TypeScript integration and type definitions
|
|
332
355
|
|
|
333
356
|
## Security Updates
|
|
334
|
-
|
|
335
357
|
- CVE-2025-24963: Browser mode serves arbitrary files (fixed in 2.1.9)
|
|
336
358
|
- CVE-2025-24964: Remote Code Execution vulnerability (fixed in 2.1.9)
|
|
337
359
|
|
|
338
360
|
## Migration Notes
|
|
339
|
-
|
|
340
361
|
- Test snapshots may need regeneration due to quote format changes
|
|
341
362
|
- Some test configurations might need updates for new TypeScript support
|
|
342
363
|
- Peer dependency warnings for @vitest/coverage-v8 are expected and safe to ignore
|
|
343
364
|
|
|
344
365
|
## Links
|
|
345
|
-
|
|
346
366
|
- [Vitest 3.0 Migration Guide](https://vitest.dev/guide/migration)
|
|
347
367
|
- [Vitest 3.2.4 Release Notes](https://github.com/vitest-dev/vitest/releases/tag/v3.2.4)
|
|
348
368
|
|
|
@@ -358,7 +378,6 @@
|
|
|
358
378
|
- [#3330](https://github.com/equinor/fusion-framework/pull/3330) [`3590104`](https://github.com/equinor/fusion-framework/commit/3590104bdf3bba3386cdec7e2692078e6a92bd01) Thanks [@odinr](https://github.com/odinr)! - Enhanced dev server configuration by removing `vite-tsconfig-paths` plugin.
|
|
359
379
|
|
|
360
380
|
> The responsibility for adding the `vite-tsconfig-paths` plugin has been moved to `@equinor/fusion-framework-cli`, which now provides it via the `overrides` parameter in `createDevServerConfig`. This ensures consistent TypeScript path resolution in both development and build environments.
|
|
361
|
-
|
|
362
381
|
- Removed `vite-tsconfig-paths` dependency from package.json
|
|
363
382
|
- Removed plugin usage from `create-dev-server-config.ts`
|
|
364
383
|
|
|
@@ -371,7 +390,6 @@
|
|
|
371
390
|
### Patch Changes
|
|
372
391
|
|
|
373
392
|
- [#3327](https://github.com/equinor/fusion-framework/pull/3327) [`22d6d3b`](https://github.com/equinor/fusion-framework/commit/22d6d3b7753da8ad30054839e8a6083850a208fa) Thanks [@odinr](https://github.com/odinr)! - Enhanced dev server configuration with improved React and TypeScript path resolution support.
|
|
374
|
-
|
|
375
393
|
- Added `@vitejs/plugin-react` for better React development experience
|
|
376
394
|
- Added `vite-tsconfig-paths` for improved TypeScript path resolution
|
|
377
395
|
- Updated `create-dev-server-config.ts` to include both plugins in the vite configuration
|
|
@@ -385,7 +403,6 @@
|
|
|
385
403
|
For more details, visit the [GitHub repository](https://github.com/equinor/fusion-framework/tree/main/packages/dev-server/README.md).
|
|
386
404
|
|
|
387
405
|
**Features**
|
|
388
|
-
|
|
389
406
|
- _`createDevServer` Function_: Simplifies the creation of a development server using a configuration object.
|
|
390
407
|
- _`createDevServerConfig` Function_: Generates a Vite-compatible configuration for the development server.
|
|
391
408
|
- _SPA Support_: Includes `spa.templateEnv` for defining environment variables specific to Single Page Applications.
|
|
@@ -396,7 +413,6 @@
|
|
|
396
413
|
**Dependencies**
|
|
397
414
|
|
|
398
415
|
The following dependencies were added to support the new package:
|
|
399
|
-
|
|
400
416
|
- `@equinor/fusion-framework-vite-plugin-api-service`
|
|
401
417
|
- `@equinor/fusion-framework-vite-plugin-spa`
|
|
402
418
|
- `@equinor/fusion-log`
|
|
@@ -519,7 +535,6 @@
|
|
|
519
535
|
### Patch Changes
|
|
520
536
|
|
|
521
537
|
- [#3075](https://github.com/equinor/fusion-framework/pull/3075) [`84c16d7`](https://github.com/equinor/fusion-framework/commit/84c16d74c3235f809ce4c3e75868be12010ed695) Thanks [@odinr](https://github.com/odinr)! - Add `prepack` script to `dev-portal` and `dev-server` packages
|
|
522
|
-
|
|
523
538
|
- Added a `prepack` script to `@equinor/fusion-framework-dev-portal` and `@equinor/fusion-framework-dev-server` to ensure the build runs before packaging.
|
|
524
539
|
- This helps guarantee that the latest build artifacts are included when publishing these packages.
|
|
525
540
|
|
|
@@ -530,7 +545,6 @@
|
|
|
530
545
|
- [#3074](https://github.com/equinor/fusion-framework/pull/3074) [`6b034e5`](https://github.com/equinor/fusion-framework/commit/6b034e5459094cea0c0f2490335eef3092390a13) Thanks [@odinr](https://github.com/odinr)! - Introduced a new package, `@equinor/fusion-framework-dev-server`, designed to provide a development server tailored for Fusion Framework applications. Built on top of Vite, it seamlessly integrates Vite and Fusion Framework configurations.
|
|
531
546
|
|
|
532
547
|
**Features**
|
|
533
|
-
|
|
534
548
|
- _`createDevServer` Function_: Simplifies the creation of a development server using a configuration object.
|
|
535
549
|
- _`createDevServerConfig` Function_: Generates a Vite-compatible configuration for the development server.
|
|
536
550
|
- _SPA Support_: Includes `spa.templateEnv` for defining environment variables specific to Single Page Applications.
|
|
@@ -541,7 +555,6 @@
|
|
|
541
555
|
**Dependencies**
|
|
542
556
|
|
|
543
557
|
The following dependencies were added to support the new package:
|
|
544
|
-
|
|
545
558
|
- `@equinor/fusion-framework-vite-plugin-api-service`
|
|
546
559
|
- `@equinor/fusion-framework-vite-plugin-spa`
|
|
547
560
|
- `@equinor/fusion-log`
|
package/README.md
CHANGED
|
@@ -46,6 +46,8 @@ await devServer.listen();
|
|
|
46
46
|
devServer.printUrls();
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
If you only need the Vite configuration object without starting the server, use `createDevServerConfig(options, overrides?)` instead. This returns a `UserConfig` that you can pass to Vite directly or merge with other configurations.
|
|
50
|
+
|
|
49
51
|
## Configuration
|
|
50
52
|
|
|
51
53
|
The dev server accepts a configuration object with the following structure:
|
|
@@ -66,7 +68,10 @@ Configure the Single Page Application environment and template generation:
|
|
|
66
68
|
// Application title
|
|
67
69
|
title: 'My Application',
|
|
68
70
|
|
|
69
|
-
// Service discovery settings
|
|
71
|
+
// Service discovery settings (SPA-side — tells the browser where to find services)
|
|
72
|
+
// The API-side counterpart is `api.serviceDiscoveryUrl` which sets up server-side proxying.
|
|
73
|
+
// During development you can redirect individual services to local URLs by storing
|
|
74
|
+
// overrides in sessionStorage under the key "overriddenServiceDiscoveryUrls".
|
|
70
75
|
serviceDiscovery: {
|
|
71
76
|
url: 'https://service-discovery.example.com',
|
|
72
77
|
scopes: ['scope1', 'scope2'],
|
|
@@ -111,6 +116,8 @@ Configure API proxying and service discovery:
|
|
|
111
116
|
serviceDiscoveryUrl: 'https://service-discovery.example.com',
|
|
112
117
|
|
|
113
118
|
// Optional: Custom service processing
|
|
119
|
+
// Takes an array of FusionService objects ({ key, uri, name }) from discovery
|
|
120
|
+
// and returns { data: FusionService[], routes: ApiRoute[] } with proxy routes.
|
|
114
121
|
processServices: (services, route) => {
|
|
115
122
|
// Process and return services with routes
|
|
116
123
|
return processServices(services, route);
|
|
@@ -4,39 +4,62 @@ import apiServicePlugin, { createProxyHandler, } from '@equinor/fusion-framework
|
|
|
4
4
|
import fusionSpaPlugin from '@equinor/fusion-framework-vite-plugin-spa';
|
|
5
5
|
import { ConsoleLogger, LogLevel } from '@equinor/fusion-log';
|
|
6
6
|
import { processServices as defaultProcessServices } from './process-services.js';
|
|
7
|
+
/**
|
|
8
|
+
* Create a default {@link ConsoleLogger} instance for the dev server.
|
|
9
|
+
*
|
|
10
|
+
* @param lvl - Log verbosity level; defaults to {@link LogLevel.Info}.
|
|
11
|
+
* @param title - Logger title printed as a prefix in console output; defaults to `'dev-server'`.
|
|
12
|
+
* @returns A configured {@link ConsoleLogger} instance.
|
|
13
|
+
*/
|
|
7
14
|
const createDefaultLogger = (lvl = LogLevel.Info, title = 'dev-server') => {
|
|
8
15
|
const logger = new ConsoleLogger(title);
|
|
9
16
|
logger.level = lvl;
|
|
10
17
|
return logger;
|
|
11
18
|
};
|
|
12
19
|
/**
|
|
13
|
-
*
|
|
20
|
+
* Build a Vite {@link import('vite').UserConfig | UserConfig} for a Fusion Framework dev server
|
|
21
|
+
* without starting the server.
|
|
22
|
+
*
|
|
23
|
+
* Use this function when you need control over the server lifecycle (e.g. to pass the config
|
|
24
|
+
* to another Vite tool). For a simpler create-and-listen workflow, use {@link createDevServer}.
|
|
14
25
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
26
|
+
* The generated config includes:
|
|
27
|
+
* - `@vitejs/plugin-react` for React Fast Refresh / HMR
|
|
28
|
+
* - `@equinor/fusion-framework-vite-plugin-api-service` for service discovery proxying
|
|
29
|
+
* - `@equinor/fusion-framework-vite-plugin-spa` for template environment injection
|
|
30
|
+
* - CORS disabled so backend services handle OPTIONS with proper headers
|
|
19
31
|
*
|
|
20
|
-
* @
|
|
32
|
+
* @template TEnv - Environment variable shape extending `Partial<TemplateEnv>`, used to type-check
|
|
33
|
+
* the SPA template environment object or factory function.
|
|
34
|
+
* @param options - Development server options containing SPA, API, and logging settings.
|
|
35
|
+
* @param overrides - Optional Vite config merged on top of the generated base config via
|
|
36
|
+
* {@link import('vite').mergeConfig | mergeConfig}.
|
|
37
|
+
* @returns A fully resolved Vite `UserConfig` ready for {@link import('vite').createServer | createServer}.
|
|
21
38
|
*
|
|
22
39
|
* @remarks
|
|
23
|
-
* -
|
|
24
|
-
* -
|
|
25
|
-
* - The
|
|
26
|
-
* - Includes plugins for API service handling and SPA template environment generation.
|
|
27
|
-
* - CORS is disabled to allow backend services to handle OPTIONS requests with proper headers.
|
|
40
|
+
* - `spa.templateEnv` accepts either a static object or a factory function returning the environment.
|
|
41
|
+
* - `api.processServices` defaults to the built-in {@link processServices} when omitted.
|
|
42
|
+
* - The default log level is `Info`; set `log.level` to `4` for debug output.
|
|
28
43
|
*
|
|
29
44
|
* @example
|
|
30
45
|
* ```typescript
|
|
46
|
+
* import { createDevServerConfig } from '@equinor/fusion-framework-dev-server';
|
|
47
|
+
* import { createServer } from 'vite';
|
|
48
|
+
*
|
|
31
49
|
* const config = createDevServerConfig({
|
|
32
50
|
* spa: {
|
|
33
|
-
* templateEnv: {
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
51
|
+
* templateEnv: {
|
|
52
|
+
* portal: { id: 'my-portal' },
|
|
53
|
+
* title: 'My App',
|
|
54
|
+
* serviceDiscovery: { url: 'https://discovery.example.com', scopes: [] },
|
|
55
|
+
* msal: { clientId: 'cid', tenantId: 'tid', redirectUri: '/auth/cb', requiresAuth: 'true' },
|
|
56
|
+
* },
|
|
38
57
|
* },
|
|
58
|
+
* api: { serviceDiscoveryUrl: 'https://discovery.example.com' },
|
|
39
59
|
* });
|
|
60
|
+
*
|
|
61
|
+
* const server = await createServer(config);
|
|
62
|
+
* await server.listen();
|
|
40
63
|
* ```
|
|
41
64
|
*/
|
|
42
65
|
export const createDevServerConfig = (options, overrides) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-dev-server-config.js","sourceRoot":"","sources":["../../src/create-dev-server-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAmB,MAAM,MAAM,CAAC;AAElE,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAE/C,OAAO,gBAAgB,EAAE,EACvB,kBAAkB,GACnB,MAAM,mDAAmD,CAAC;AAE3D,OAAO,eAAe,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,eAAe,IAAI,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAIlF,MAAM,mBAAmB,GAAG,CAAC,MAAgB,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,YAAY,EAAE,EAAE;IAClF,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC;IACnB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"create-dev-server-config.js","sourceRoot":"","sources":["../../src/create-dev-server-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAmB,MAAM,MAAM,CAAC;AAElE,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAE/C,OAAO,gBAAgB,EAAE,EACvB,kBAAkB,GACnB,MAAM,mDAAmD,CAAC;AAE3D,OAAO,eAAe,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE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AAC;aACvC,CAAC;SACH;QACD,MAAM,EAAE;YACN,6FAA6F;YAC7F,sFAAsF;YACtF,IAAI,EAAE,KAAK;SACZ;QACD,OAAO,EAAE;YACP,WAAW,EAAE;YACb,gBAAgB,CACd;gBACE,YAAY,EAAE,kBAAkB,CAAC,GAAG,CAAC,mBAAmB,EAAE,eAAe,EAAE;oBACzE,MAAM,EAAE,gBAAgB;iBACzB,CAAC;gBACF,MAAM,EAAE,GAAG,CAAC,MAAM;aACnB,EACD;gBACE,MAAM,EAAE,gBAAgB;aACzB,CACF;YACD,eAAe,CAAC,EAAE,mBAAmB,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;SAC5D;KACF,CAAC,CAAC;IACH,OAAO,WAAW,CAAC,UAAU,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
import { createServer } from 'vite';
|
|
2
2
|
import { createDevServerConfig } from './create-dev-server-config.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Create and return a fully configured Vite development server for a Fusion Framework application.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Combines SPA template environment injection, service discovery proxying, and React HMR into
|
|
7
|
+
* a single ready-to-listen server instance. Use this function when you want the default
|
|
8
|
+
* development workflow; use {@link createDevServerConfig} instead if you only need the Vite
|
|
9
|
+
* configuration object without starting the server.
|
|
10
|
+
*
|
|
11
|
+
* @param options - Development server configuration including SPA template environment,
|
|
12
|
+
* API proxy settings, and optional logging overrides.
|
|
13
|
+
* @param overrides - Optional Vite {@link import('vite').UserConfig | UserConfig} merged on top
|
|
14
|
+
* of the generated configuration (e.g. custom port, extra plugins).
|
|
15
|
+
* @returns A promise that resolves to a Vite {@link import('vite').ViteDevServer | ViteDevServer}
|
|
16
|
+
* ready for {@link import('vite').ViteDevServer.listen | listen()} and
|
|
17
|
+
* {@link import('vite').ViteDevServer.printUrls | printUrls()}.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { createDevServer } from '@equinor/fusion-framework-dev-server';
|
|
22
|
+
*
|
|
23
|
+
* const server = await createDevServer({
|
|
24
|
+
* spa: {
|
|
25
|
+
* templateEnv: {
|
|
26
|
+
* portal: { id: 'my-portal' },
|
|
27
|
+
* title: 'My App',
|
|
28
|
+
* serviceDiscovery: { url: 'https://discovery.example.com', scopes: [] },
|
|
29
|
+
* msal: { clientId: 'id', tenantId: 'tid', redirectUri: '/auth/callback', requiresAuth: 'true' },
|
|
30
|
+
* },
|
|
31
|
+
* },
|
|
32
|
+
* api: { serviceDiscoveryUrl: 'https://discovery.example.com' },
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* await server.listen();
|
|
36
|
+
* server.printUrls();
|
|
37
|
+
* ```
|
|
8
38
|
*/
|
|
9
39
|
export const createDevServer = async (options, overrides) => {
|
|
10
40
|
const config = createDevServerConfig(options, overrides);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-dev-server.js","sourceRoot":"","sources":["../../src/create-dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAmB,MAAM,MAAM,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAItE
|
|
1
|
+
{"version":3,"file":"create-dev-server.js","sourceRoot":"","sources":["../../src/create-dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAmB,MAAM,MAAM,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAItE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,OAAyB,EAAE,SAAsB,EAAE,EAAE;IACzF,MAAM,MAAM,GAAG,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* Development server for Fusion Framework applications.
|
|
5
|
+
*
|
|
6
|
+
* Provides a pre-configured Vite dev server with integrated service discovery proxying,
|
|
7
|
+
* SPA template environment injection, and React HMR support. Use this package when you
|
|
8
|
+
* need a local development environment that mirrors production Fusion portal behaviour.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Main entry points:
|
|
12
|
+
* - {@link createDevServer} — create and start a fully configured Vite dev server
|
|
13
|
+
* - {@link createDevServerConfig} — build a Vite `UserConfig` without starting the server
|
|
14
|
+
* - {@link processServices} — remap Fusion service URIs to local proxy routes
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { createDevServer } from '@equinor/fusion-framework-dev-server';
|
|
19
|
+
*
|
|
20
|
+
* const server = await createDevServer({
|
|
21
|
+
* api: { serviceDiscoveryUrl: 'https://discovery.example.com' },
|
|
22
|
+
* });
|
|
23
|
+
* await server.listen();
|
|
24
|
+
* server.printUrls();
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
1
27
|
export { processServices } from './process-services.js';
|
|
2
28
|
export { default, createDevServer } from './create-dev-server.js';
|
|
3
29
|
export { createDevServerConfig } from './create-dev-server-config.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAKtE,cAAc,YAAY,CAAC"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* and
|
|
2
|
+
* Remap Fusion service discovery entries so their URIs point through the local dev server proxy,
|
|
3
|
+
* and generate matching Vite proxy routes for each service.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @param
|
|
10
|
-
* @
|
|
11
|
-
* @
|
|
5
|
+
* Use this as the default `api.processServices` handler in {@link DevServerOptions}, or call it
|
|
6
|
+
* inside a custom handler to get the base mapping before applying additional transformations
|
|
7
|
+
* (e.g. adding mock services or filtering environments).
|
|
8
|
+
*
|
|
9
|
+
* @param data - Array of {@link FusionService} entries returned by the service discovery endpoint.
|
|
10
|
+
* @param args - Context provided by the API service plugin.
|
|
11
|
+
* @param args.route - Base route path used to construct local proxy URLs (e.g. `'/services-proxy'`).
|
|
12
|
+
* @param args.request - Incoming HTTP request; the `referer` header is used to resolve the local origin.
|
|
13
|
+
* @returns An object with `data` (services with rewritten URIs) and `routes` (Vite proxy route configs).
|
|
14
|
+
* @throws {Error} When `data` is not an array, indicating an unexpected service discovery response.
|
|
12
15
|
*
|
|
13
16
|
* @example
|
|
14
17
|
* ```typescript
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-services.js","sourceRoot":"","sources":["../../src/process-services.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"process-services.js","sourceRoot":"","sources":["../../src/process-services.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG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ist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
|