@equinor/fusion-framework-vite-plugin-spa 1.0.0-next.5 → 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 +12 -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/{bin/html → html}/bootstrap.js +111 -109
- package/dist/html/bootstrap.js.map +1 -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 +14 -6
- package/rollup.config.js +1 -3
- package/src/plugin.ts +16 -8
- package/src/version.ts +1 -1
- package/dist/bin/_commonjsHelpers-BFTU3MAI.js +0 -8
- package/dist/bin/_commonjsHelpers-BFTU3MAI.js.map +0 -1
- package/dist/bin/html/bootstrap.js.map +0 -1
- package/dist/bin/html/sw.js.map +0 -1
- package/dist/bin/index.js +0 -20883
- package/dist/bin/index.js.map +0 -1
- /package/dist/{bin/html → html}/sw.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
3
15
|
## 1.0.0-next.5
|
|
4
16
|
|
|
5
17
|
### Minor 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;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EAAE,CAAC;oBACnF,OAAO,IAAI,EAAE,CAAC;gBAChB,CAAC;gBAED,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;gBAEtF,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE;oBACjB,cAAc,EAAE,WAAW;oBAC3B,gBAAgB,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;oBACzC,eAAe,EAAE,UAAU;oBAC3B,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO;iBAChC,CAAC,CAAC;gBAEH,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/esm/version.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
function getDefaultExportFromCjs (x) {
|
|
2
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
3
|
+
}
|
|
2
4
|
|
|
3
5
|
var re = {exports: {}};
|
|
4
6
|
|
|
@@ -9814,114 +9816,114 @@ const coerce = {
|
|
|
9814
9816
|
const NEVER = INVALID;
|
|
9815
9817
|
|
|
9816
9818
|
var z$1 = /*#__PURE__*/Object.freeze({
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
|
|
9835
|
-
|
|
9836
|
-
|
|
9837
|
-
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
|
|
9819
|
+
__proto__: null,
|
|
9820
|
+
BRAND: BRAND,
|
|
9821
|
+
DIRTY: DIRTY,
|
|
9822
|
+
EMPTY_PATH: EMPTY_PATH,
|
|
9823
|
+
INVALID: INVALID,
|
|
9824
|
+
NEVER: NEVER,
|
|
9825
|
+
OK: OK,
|
|
9826
|
+
ParseStatus: ParseStatus,
|
|
9827
|
+
Schema: ZodType,
|
|
9828
|
+
ZodAny: ZodAny,
|
|
9829
|
+
ZodArray: ZodArray,
|
|
9830
|
+
ZodBigInt: ZodBigInt,
|
|
9831
|
+
ZodBoolean: ZodBoolean,
|
|
9832
|
+
ZodBranded: ZodBranded,
|
|
9833
|
+
ZodCatch: ZodCatch,
|
|
9834
|
+
ZodDate: ZodDate,
|
|
9835
|
+
ZodDefault: ZodDefault,
|
|
9836
|
+
ZodDiscriminatedUnion: ZodDiscriminatedUnion,
|
|
9837
|
+
ZodEffects: ZodEffects,
|
|
9838
|
+
ZodEnum: ZodEnum,
|
|
9839
|
+
ZodError: ZodError,
|
|
9840
|
+
get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },
|
|
9841
|
+
ZodFunction: ZodFunction,
|
|
9842
|
+
ZodIntersection: ZodIntersection,
|
|
9843
|
+
ZodIssueCode: ZodIssueCode,
|
|
9844
|
+
ZodLazy: ZodLazy,
|
|
9845
|
+
ZodLiteral: ZodLiteral,
|
|
9846
|
+
ZodMap: ZodMap,
|
|
9847
|
+
ZodNaN: ZodNaN,
|
|
9848
|
+
ZodNativeEnum: ZodNativeEnum,
|
|
9849
|
+
ZodNever: ZodNever,
|
|
9850
|
+
ZodNull: ZodNull,
|
|
9851
|
+
ZodNullable: ZodNullable,
|
|
9852
|
+
ZodNumber: ZodNumber,
|
|
9853
|
+
ZodObject: ZodObject,
|
|
9854
|
+
ZodOptional: ZodOptional,
|
|
9855
|
+
ZodParsedType: ZodParsedType,
|
|
9856
|
+
ZodPipeline: ZodPipeline,
|
|
9857
|
+
ZodPromise: ZodPromise,
|
|
9858
|
+
ZodReadonly: ZodReadonly,
|
|
9859
|
+
ZodRecord: ZodRecord,
|
|
9860
|
+
ZodSchema: ZodType,
|
|
9861
|
+
ZodSet: ZodSet,
|
|
9862
|
+
ZodString: ZodString,
|
|
9863
|
+
ZodSymbol: ZodSymbol,
|
|
9864
|
+
ZodTransformer: ZodEffects,
|
|
9865
|
+
ZodTuple: ZodTuple,
|
|
9866
|
+
ZodType: ZodType,
|
|
9867
|
+
ZodUndefined: ZodUndefined,
|
|
9868
|
+
ZodUnion: ZodUnion,
|
|
9869
|
+
ZodUnknown: ZodUnknown,
|
|
9870
|
+
ZodVoid: ZodVoid,
|
|
9871
|
+
addIssueToContext: addIssueToContext,
|
|
9872
|
+
any: anyType,
|
|
9873
|
+
array: arrayType,
|
|
9874
|
+
bigint: bigIntType,
|
|
9875
|
+
boolean: booleanType,
|
|
9876
|
+
coerce: coerce,
|
|
9877
|
+
custom: custom,
|
|
9878
|
+
date: dateType,
|
|
9879
|
+
datetimeRegex: datetimeRegex,
|
|
9880
|
+
defaultErrorMap: errorMap,
|
|
9881
|
+
discriminatedUnion: discriminatedUnionType,
|
|
9882
|
+
effect: effectsType,
|
|
9883
|
+
enum: enumType,
|
|
9884
|
+
function: functionType,
|
|
9885
|
+
getErrorMap: getErrorMap,
|
|
9886
|
+
getParsedType: getParsedType,
|
|
9887
|
+
instanceof: instanceOfType,
|
|
9888
|
+
intersection: intersectionType,
|
|
9889
|
+
isAborted: isAborted,
|
|
9890
|
+
isAsync: isAsync,
|
|
9891
|
+
isDirty: isDirty,
|
|
9892
|
+
isValid: isValid,
|
|
9893
|
+
late: late,
|
|
9894
|
+
lazy: lazyType,
|
|
9895
|
+
literal: literalType,
|
|
9896
|
+
makeIssue: makeIssue,
|
|
9897
|
+
map: mapType,
|
|
9898
|
+
nan: nanType,
|
|
9899
|
+
nativeEnum: nativeEnumType,
|
|
9900
|
+
never: neverType,
|
|
9901
|
+
null: nullType,
|
|
9902
|
+
nullable: nullableType,
|
|
9903
|
+
number: numberType,
|
|
9904
|
+
object: objectType,
|
|
9905
|
+
get objectUtil () { return objectUtil; },
|
|
9906
|
+
oboolean: oboolean,
|
|
9907
|
+
onumber: onumber,
|
|
9908
|
+
optional: optionalType,
|
|
9909
|
+
ostring: ostring,
|
|
9910
|
+
pipeline: pipelineType,
|
|
9911
|
+
preprocess: preprocessType,
|
|
9912
|
+
promise: promiseType,
|
|
9913
|
+
quotelessJson: quotelessJson,
|
|
9914
|
+
record: recordType,
|
|
9915
|
+
set: setType,
|
|
9916
|
+
setErrorMap: setErrorMap,
|
|
9917
|
+
strictObject: strictObjectType,
|
|
9918
|
+
string: stringType,
|
|
9919
|
+
symbol: symbolType,
|
|
9920
|
+
transformer: effectsType,
|
|
9921
|
+
tuple: tupleType,
|
|
9922
|
+
undefined: undefinedType,
|
|
9923
|
+
union: unionType,
|
|
9924
|
+
unknown: unknownType,
|
|
9925
|
+
get util () { return util; },
|
|
9926
|
+
void: voidType
|
|
9925
9927
|
});
|
|
9926
9928
|
|
|
9927
9929
|
/**
|