@equinor/fusion-framework-vite-plugin-spa 1.0.0-next.3 → 1.0.0-next.6
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 +41 -0
- package/dist/esm/plugin.js +13 -8
- package/dist/esm/plugin.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/html/bootstrap.js +32672 -0
- package/dist/html/bootstrap.js.map +1 -0
- package/dist/html/sw.js +171 -0
- package/dist/html/sw.js.map +1 -0
- 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 +19 -12
- package/rollup.config.js +20 -0
- package/src/plugin.ts +16 -8
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @equinor/fusion-framework-vite-plugin-spa
|
|
2
2
|
|
|
3
|
+
## 1.0.0-next.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3075](https://github.com/equinor/fusion-framework/pull/3075) [`713cb15`](https://github.com/equinor/fusion-framework/commit/713cb15c5f1607e7f7285940a58165d97d8e41df) Thanks [@odinr](https://github.com/odinr)! - Refactor plugin internals for improved Vite compatibility and maintainability:
|
|
8
|
+
|
|
9
|
+
- Made `resolveId` and `config` hooks async to support dynamic import resolution for virtual modules.
|
|
10
|
+
- Improved resource alias resolution for `/@fusion-spa-bootstrap.js` and `/@fusion-spa-sw.js` using `import.meta.resolve` and `fileURLToPath`.
|
|
11
|
+
- Enhanced environment variable handling by merging plugin and loaded environments, and defining them on `config.define`.
|
|
12
|
+
- Ensured the Vite dev server allows access to the correct `../html` directory for SPA templates.
|
|
13
|
+
- Added more robust logging for environment configuration and plugin setup.
|
|
14
|
+
|
|
15
|
+
## 1.0.0-next.5
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#3075](https://github.com/equinor/fusion-framework/pull/3075) [`ea96493`](https://github.com/equinor/fusion-framework/commit/ea96493d95336f682e31a7b63161783ae7c99a63) Thanks [@odinr](https://github.com/odinr)! - Refactor build output and entrypoints for SPA Vite plugin:
|
|
20
|
+
|
|
21
|
+
- Change main export entrypoint to `./dist/bin/index.js` (was `./dist/esm/index.js`).
|
|
22
|
+
- Remove the `./html` export subpath.
|
|
23
|
+
- Update Rollup config to bundle from `dist/esm` to `dist/bin` and adjust input/output accordingly.
|
|
24
|
+
- Remove `postbuild` script and add `prebuild` script for TypeScript project references build.
|
|
25
|
+
- Minor formatting improvements in `package.json`.
|
|
26
|
+
|
|
27
|
+
These changes improve the build pipeline and clarify the published entrypoints for consumers.
|
|
28
|
+
|
|
29
|
+
## 1.0.0-next.4
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- [#3075](https://github.com/equinor/fusion-framework/pull/3075) [`8870e73`](https://github.com/equinor/fusion-framework/commit/8870e73bd6d4141142c69c11c67b5b154bc80023) Thanks [@odinr](https://github.com/odinr)! - Update build system and dependencies:
|
|
34
|
+
|
|
35
|
+
- Switch build script to use Rollup with a new `rollup.config.js` for ESM output
|
|
36
|
+
- Add postbuild script to emit TypeScript declarations
|
|
37
|
+
- Move all dependencies to devDependencies for clarity
|
|
38
|
+
- Add and update Rollup-related devDependencies (including plugins and types)
|
|
39
|
+
- Update `pnpm-lock.yaml` to reflect new and updated dependencies
|
|
40
|
+
- Minor formatting and consistency improvements in `package.json` and `tsconfig.json`
|
|
41
|
+
|
|
42
|
+
These changes modernize the build process and improve maintainability for the SPA Vite plugin package.
|
|
43
|
+
|
|
3
44
|
## 1.0.0-next.3
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
1
2
|
import mergeWith from 'lodash.mergewith';
|
|
2
3
|
import defaultTemplate from './html/index.html.js';
|
|
3
4
|
import { objectToEnv } from './util/object-to-env.js';
|
|
@@ -15,16 +16,20 @@ export const plugin = (options) => {
|
|
|
15
16
|
const log = options?.logger;
|
|
16
17
|
return {
|
|
17
18
|
name: 'fusion-framework-plugin-spa',
|
|
18
|
-
resolveId(id) {
|
|
19
|
+
resolveId: async (id) => {
|
|
19
20
|
// resolve resource aliases to the correct path
|
|
20
21
|
switch (id) {
|
|
21
|
-
case '/@fusion-spa-bootstrap.js':
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
case '/@fusion-spa-bootstrap.js': {
|
|
23
|
+
const file = await import.meta.resolve('@equinor/fusion-framework-vite-plugin-spa/bootstrap.js');
|
|
24
|
+
return fileURLToPath(file);
|
|
25
|
+
}
|
|
26
|
+
case '/@fusion-spa-sw.js': {
|
|
27
|
+
const file = await import.meta.resolve('@equinor/fusion-framework-vite-plugin-spa/sw.js');
|
|
28
|
+
return fileURLToPath(file);
|
|
29
|
+
}
|
|
25
30
|
}
|
|
26
31
|
},
|
|
27
|
-
config(config, configEnv) {
|
|
32
|
+
config: async (config, configEnv) => {
|
|
28
33
|
const templateEnvPrefix = options?.templateEnvPrefix ?? 'FUSION_SPA_';
|
|
29
34
|
// generate environment variables from plugin options
|
|
30
35
|
const pluginEnvObj = { ...defaultEnv, ...options?.generateTemplateEnv?.(configEnv) };
|
|
@@ -43,8 +48,8 @@ export const plugin = (options) => {
|
|
|
43
48
|
config.server ??= {};
|
|
44
49
|
config.server.fs ??= {};
|
|
45
50
|
config.server.fs.allow ??= [];
|
|
46
|
-
// allow access to the
|
|
47
|
-
config.server.fs.allow.push(new URL('
|
|
51
|
+
// allow access to the html directory
|
|
52
|
+
config.server.fs.allow.push(new URL('../html', import.meta.url).pathname);
|
|
48
53
|
log?.info(`plugin configured for ${env.FUSION_SPA_PORTAL_ID}`);
|
|
49
54
|
},
|
|
50
55
|
configureServer(server) {
|
package/dist/esm/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,OAAO,eAAe,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAsBrD;;GAEG;AACH,MAAM,UAAU,GAAyB;IACvC,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,2BAA2B;CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,OAA6B,EACrB,EAAE;IACV,qBAAqB;IACrB,MAAM,aAAa,GAAG,OAAO,EAAE,QAAQ,IAAI,eAAe,CAAC;IAC3D,MAAM,GAAG,GAAG,OAAO,EAAE,MAAM,CAAC;IAE5B,OAAO;QACL,IAAI,EAAE,6BAA6B;QACnC,SAAS,
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,OAAO,eAAe,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAsBrD;;GAEG;AACH,MAAM,UAAU,GAAyB;IACvC,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,2BAA2B;CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,OAA6B,EACrB,EAAE;IACV,qBAAqB;IACrB,MAAM,aAAa,GAAG,OAAO,EAAE,QAAQ,IAAI,eAAe,CAAC;IAC3D,MAAM,GAAG,GAAG,OAAO,EAAE,MAAM,CAAC;IAE5B,OAAO;QACL,IAAI,EAAE,6BAA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