@equinor/fusion-framework-cli 10.7.2 → 10.7.4-next-c88655f3c93bff52499b1301c9a009301f818f5a
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/bin/build-application.js +11 -21
- package/dist/bin/build-application.js.map +1 -1
- package/dist/bin/bundle-application.js +5 -14
- package/dist/bin/bundle-application.js.map +1 -1
- package/dist/bin/create-dev-serve.js +18 -28
- package/dist/bin/create-dev-serve.js.map +1 -1
- package/dist/bin/create-export-config.js +5 -15
- package/dist/bin/create-export-config.js.map +1 -1
- package/dist/bin/create-export-manifest.js +20 -30
- package/dist/bin/create-export-manifest.js.map +1 -1
- package/dist/bin/dev-portal/AppLoader.js +6 -4
- package/dist/bin/dev-portal/AppLoader.js.map +1 -1
- package/dist/bin/dev-portal/BookMarkSideSheet.js +1 -1
- package/dist/bin/dev-portal/BookMarkSideSheet.js.map +1 -1
- package/dist/bin/dev-portal/ContextSelector/ContextSelector.js +1 -2
- package/dist/bin/dev-portal/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/bin/dev-portal/ContextSelector/useContextResolver.js +17 -21
- package/dist/bin/dev-portal/ContextSelector/useContextResolver.js.map +1 -1
- package/dist/bin/dev-portal/FusionLogo.js +1 -1
- package/dist/bin/dev-portal/FusionLogo.js.map +1 -1
- package/dist/bin/dev-portal/Header.js +3 -4
- package/dist/bin/dev-portal/Header.js.map +1 -1
- package/dist/bin/dev-portal/PersonSideSheet/index.js +1 -1
- package/dist/bin/dev-portal/PersonSideSheet/index.js.map +1 -1
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerApp.js +2 -3
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerApp.js.map +1 -1
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerPortal.js +1 -4
- package/dist/bin/dev-portal/PersonSideSheet/sheets/FeatureTogglerPortal.js.map +1 -1
- package/dist/bin/dev-portal/config.js +5 -14
- package/dist/bin/dev-portal/config.js.map +1 -1
- package/dist/bin/dev-portal/useAppContextNavigation.js +12 -10
- package/dist/bin/dev-portal/useAppContextNavigation.js.map +1 -1
- package/dist/bin/main.app.js +15 -26
- package/dist/bin/main.app.js.map +1 -1
- package/dist/bin/public/assets/index-zNJWGyEE.js +3686 -0
- package/dist/bin/public/index.html +1 -1
- package/dist/bin/publish-application.js +12 -21
- package/dist/bin/publish-application.js.map +1 -1
- package/dist/bin/tag-application.js +8 -17
- package/dist/bin/tag-application.js.map +1 -1
- package/dist/bin/upload-application.js +8 -17
- package/dist/bin/upload-application.js.map +1 -1
- package/dist/bin/upload-export-config.js +8 -17
- package/dist/bin/upload-export-config.js.map +1 -1
- package/dist/bin/utils/execute-command.js +4 -13
- package/dist/bin/utils/execute-command.js.map +1 -1
- package/dist/bin/utils/format.js +1 -2
- package/dist/bin/utils/format.js.map +1 -1
- package/dist/bin/utils/getEndpointUrl.js +6 -15
- package/dist/bin/utils/getEndpointUrl.js.map +1 -1
- package/dist/bin/utils/isAppRegistered.js +4 -13
- package/dist/bin/utils/isAppRegistered.js.map +1 -1
- package/dist/bin/utils/load-app-config.js +4 -13
- package/dist/bin/utils/load-app-config.js.map +1 -1
- package/dist/bin/utils/load-manifest.js +5 -14
- package/dist/bin/utils/load-manifest.js.map +1 -1
- package/dist/bin/utils/load-package.js +7 -13
- package/dist/bin/utils/load-package.js.map +1 -1
- package/dist/bin/utils/load-vite-config.js +10 -19
- package/dist/bin/utils/load-vite-config.js.map +1 -1
- package/dist/bin/utils/proxy-request-logger.js +1 -2
- package/dist/bin/utils/proxy-request-logger.js.map +1 -1
- package/dist/bin/utils/publishAppConfig.js +4 -13
- package/dist/bin/utils/publishAppConfig.js.map +1 -1
- package/dist/bin/utils/requireToken.js +1 -2
- package/dist/bin/utils/requireToken.js.map +1 -1
- package/dist/bin/utils/spinner.js +12 -25
- package/dist/bin/utils/spinner.js.map +1 -1
- package/dist/bin/utils/tagAppBundle.js +4 -13
- package/dist/bin/utils/tagAppBundle.js.map +1 -1
- package/dist/bin/utils/uploadAppBundle.js +5 -14
- package/dist/bin/utils/uploadAppBundle.js.map +1 -1
- package/dist/lib/app-config.js +10 -20
- package/dist/lib/app-config.js.map +1 -1
- package/dist/lib/app-manifest.js +14 -24
- package/dist/lib/app-manifest.js.map +1 -1
- package/dist/lib/app-package.js +3 -12
- package/dist/lib/app-package.js.map +1 -1
- package/dist/lib/plugins/app-assets/app-asset-plugin.js +35 -41
- package/dist/lib/plugins/app-assets/app-asset-plugin.js.map +1 -1
- package/dist/lib/plugins/app-assets/resolve-asset-id.js +3 -12
- package/dist/lib/plugins/app-assets/resolve-asset-id.js.map +1 -1
- package/dist/lib/plugins/app-proxy/app-proxy-plugin.js +15 -29
- package/dist/lib/plugins/app-proxy/app-proxy-plugin.js.map +1 -1
- package/dist/lib/plugins/app-settings/index.js +6 -17
- package/dist/lib/plugins/app-settings/index.js.map +1 -1
- package/dist/lib/plugins/external-public/external-public-plugin.js +20 -22
- package/dist/lib/plugins/external-public/external-public-plugin.js.map +1 -1
- package/dist/lib/plugins/help-proxy/help-proxy-plugin.js +4 -15
- package/dist/lib/plugins/help-proxy/help-proxy-plugin.js.map +1 -1
- package/dist/lib/utils/assert.js +4 -5
- package/dist/lib/utils/assert.js.map +1 -1
- package/dist/lib/utils/config.js +18 -35
- package/dist/lib/utils/config.js.map +1 -1
- package/dist/lib/utils/file-exists.js +5 -14
- package/dist/lib/utils/file-exists.js.map +1 -1
- package/dist/lib/utils/parse-json-request.js +6 -17
- package/dist/lib/utils/parse-json-request.js.map +1 -1
- package/dist/lib/utils/ts-transpile.js +14 -20
- package/dist/lib/utils/ts-transpile.js.map +1 -1
- package/dist/lib/vite-config.js +16 -28
- package/dist/lib/vite-config.js.map +1 -1
- package/dist/lib/vite-logger.js +1 -1
- package/dist/lib/vite-logger.js.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +18 -18
- package/dist/bin/public/assets/index-QigocmfE.js +0 -3614
package/dist/lib/app-package.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { existsSync } from 'node:fs';
|
|
11
2
|
import { dirname, relative } from 'node:path';
|
|
12
3
|
import { readPackageUp, } from 'read-package-up';
|
|
@@ -70,12 +61,12 @@ export const assertPackage = (pkg) => {
|
|
|
70
61
|
* @returns A promise that resolves to the found package information.
|
|
71
62
|
* @throws Will throw an error if the `package.json` file is not found.
|
|
72
63
|
*/
|
|
73
|
-
export const resolveAppPackage = (options) =>
|
|
74
|
-
const result =
|
|
64
|
+
export const resolveAppPackage = async (options) => {
|
|
65
|
+
const result = await readPackageUp(options);
|
|
75
66
|
if (!result) {
|
|
76
67
|
throw Error('failed to find package.json');
|
|
77
68
|
}
|
|
78
69
|
return result;
|
|
79
|
-
}
|
|
70
|
+
};
|
|
80
71
|
export default resolveAppPackage;
|
|
81
72
|
//# sourceMappingURL=app-package.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-package.js","sourceRoot":"","sources":["../../src/lib/app-package.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-package.js","sourceRoot":"","sources":["../../src/lib/app-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,S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AAG,CAAC,CAAC,CAAC;IAC3B,MAAM,CAAC,iBAAiB,CAAC,GAAqB,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EACpC,OAAkC,EACL,EAAE;IAC/B,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { createFilter } from 'vite';
|
|
11
2
|
import { emitAssetSync } from './emit-asset.js';
|
|
12
3
|
import { resolveAssetId } from './resolve-asset-id.js';
|
|
@@ -54,39 +45,42 @@ export const AppAssetExportPlugin = (options = {}) => {
|
|
|
54
45
|
configResolved(config) {
|
|
55
46
|
viteConfig = config;
|
|
56
47
|
},
|
|
57
|
-
resolveId(source, importer, opts) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (!shouldIncludeAsset) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
// emit asset and index the asset path
|
|
77
|
-
const { outDir, assetsDir } = viteConfig.build;
|
|
78
|
-
const assetPath = emitAssetSync(this, id, {
|
|
79
|
-
name,
|
|
80
|
-
outDir,
|
|
81
|
-
assetsDir,
|
|
82
|
-
});
|
|
83
|
-
assetsPathMap.set(id, assetPath);
|
|
84
|
-
}
|
|
85
|
-
catch (err) {
|
|
86
|
-
this.warn(err.message);
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
48
|
+
async resolveId(source, importer, opts) {
|
|
49
|
+
if (viteConfig.build.lib === false) {
|
|
50
|
+
this.warn('this plugin is only for vite build lib');
|
|
51
|
+
}
|
|
52
|
+
// skip resolves triggered by plugin self
|
|
53
|
+
if (opts.custom?.caller === PLUGIN_NAME) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
// resolve asset ID, the ID should refer to the actual asset file
|
|
57
|
+
const assetId = await resolveAssetId(this, source, importer ?? '', {
|
|
58
|
+
...opts,
|
|
59
|
+
custom: {
|
|
60
|
+
...opts.custom,
|
|
61
|
+
caller: PLUGIN_NAME,
|
|
62
|
+
},
|
|
89
63
|
});
|
|
64
|
+
// skip if asset is not found or filtered out
|
|
65
|
+
const { id } = assetId ?? {};
|
|
66
|
+
const shouldIncludeAsset = id && filter(id);
|
|
67
|
+
if (!shouldIncludeAsset) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
// emit asset and index the asset path
|
|
72
|
+
const { outDir, assetsDir } = viteConfig.build;
|
|
73
|
+
const assetPath = emitAssetSync(this, id, {
|
|
74
|
+
name,
|
|
75
|
+
outDir,
|
|
76
|
+
assetsDir,
|
|
77
|
+
});
|
|
78
|
+
assetsPathMap.set(id, assetPath);
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
this.warn(err.message);
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
90
84
|
},
|
|
91
85
|
load(id) {
|
|
92
86
|
// lookup asset path and export as URL
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-asset-plugin.js","sourceRoot":"","sources":["../../../../src/lib/plugins/app-assets/app-asset-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-asset-plugin.js","sourceRoot":"","sources":["../../../../src/lib/plugins/app-assets/app-asset-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAwD,MAAM,MAAM,CAAC;AAE1F,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG5D,MAAM,cAAc,GAAG,4BAA4B,CAAC,gBAAgB,CAAC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,UAII,EAAE,EACE,EAAE;IACV,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,cAAc,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5D,IAAI,UAA0B,CAAC;IAE/B,MAAM,aAAa,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEvD,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAE9C,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,OAAO;QACd,cAAc,CAAC,MAAM;YACnB,UAAU,GAAG,MAAM,CAAC;QACtB,CAAC;QACD,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI;YACpC,IA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S,EAAE,CAAC;gBACd,0DAA0D;gBAC1D,OAAO,6CAA6C,SAAS,0BAA0B,CAAC;YAC1F,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import fs from 'node:fs';
|
|
11
2
|
import path from 'node:path';
|
|
12
3
|
import { PLUGIN_NAME } from './static.js';
|
|
@@ -40,7 +31,7 @@ const localResolve = (id, importer) => {
|
|
|
40
31
|
* 2. If the ID is a relative path, it resolves the path relative to the importer and returns an object with the resolved ID, marked as external and resolved by the plugin.
|
|
41
32
|
* 3. For all other cases, it delegates the resolution to the context's resolve method.
|
|
42
33
|
*/
|
|
43
|
-
export const resolveAssetId = (context, id, importer, options) =>
|
|
34
|
+
export const resolveAssetId = async (context, id, importer, options) => {
|
|
44
35
|
const resolve = localResolve(id, importer);
|
|
45
36
|
/**
|
|
46
37
|
* Check if the asset can be resolved locally.
|
|
@@ -58,6 +49,6 @@ export const resolveAssetId = (context, id, importer, options) => __awaiter(void
|
|
|
58
49
|
if (resolve && fs.existsSync(resolve.id)) {
|
|
59
50
|
return resolve;
|
|
60
51
|
}
|
|
61
|
-
return
|
|
62
|
-
}
|
|
52
|
+
return await context.resolve(id, importer, options);
|
|
53
|
+
};
|
|
63
54
|
//# sourceMappingURL=resolve-asset-id.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-asset-id.js","sourceRoot":"","sources":["../../../../src/lib/plugins/app-assets/resolve-asset-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-asset-id.js","sourceRoot":"","sources":["../../../../src/lib/plugins/app-assets/resolve-asset-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;GAEG;AACH,MAAM,YAAY,GAAG,CAAC,EAAU,EAAE,QAAgB,EAA4B,EAAE;IAC9E,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;IAC/D,CAAC;IAED,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YAC5C,QAAQ,EAAE,UAAU;YACpB,UAAU,EAAE,WAAW;SACxB,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,OAAsB,EACtB,EAAU,EACV,QAAgB,EAChB,OAAiD,EACd,EAAE;IACrC,MAAM,OAAO,GAAG,YAAY,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC3C;;;;;;;;;;;;OAYG;IACH,IAAI,OAAO,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;QACzC,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC,CAAC"}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
/**
|
|
11
2
|
* Preserve token for executing proxy assets
|
|
12
3
|
*
|
|
@@ -66,10 +57,8 @@ export const appProxyPlugin = (options) => {
|
|
|
66
57
|
name: 'fusion:app-proxy',
|
|
67
58
|
apply: 'serve',
|
|
68
59
|
config(config) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
(_a = config.server) !== null && _a !== void 0 ? _a : (config.server = {});
|
|
72
|
-
(_b = (_c = config.server).proxy) !== null && _b !== void 0 ? _b : (_c.proxy = {});
|
|
60
|
+
config.server ??= {};
|
|
61
|
+
config.server.proxy ??= {};
|
|
73
62
|
config.server.proxy[proxyPath] = {
|
|
74
63
|
target,
|
|
75
64
|
changeOrigin: true,
|
|
@@ -92,7 +81,6 @@ export const appProxyPlugin = (options) => {
|
|
|
92
81
|
};
|
|
93
82
|
},
|
|
94
83
|
configureServer(server) {
|
|
95
|
-
var _a, _b, _c;
|
|
96
84
|
const { app } = options;
|
|
97
85
|
// disable local assets if no app configuration provided
|
|
98
86
|
if (!app)
|
|
@@ -100,38 +88,36 @@ export const appProxyPlugin = (options) => {
|
|
|
100
88
|
// serve app config if request matches the current app and version
|
|
101
89
|
const configPath = [
|
|
102
90
|
proxyPath,
|
|
103
|
-
|
|
91
|
+
app.configPath ?? `apps/${app.key}/builds/${app.version}/config`,
|
|
104
92
|
].join('/');
|
|
105
|
-
server.middlewares.use(configPath, (_req, res) =>
|
|
93
|
+
server.middlewares.use(configPath, async (_req, res) => {
|
|
106
94
|
res.setHeader('content-type', 'application/json');
|
|
107
|
-
res.end(JSON.stringify(
|
|
108
|
-
})
|
|
95
|
+
res.end(JSON.stringify(await app.generateConfig()));
|
|
96
|
+
});
|
|
109
97
|
// serve app manifest if request matches the current app
|
|
110
|
-
const manifestPath = [proxyPath,
|
|
111
|
-
server.middlewares.use((req, res, next) =>
|
|
112
|
-
var _a;
|
|
98
|
+
const manifestPath = [proxyPath, app.manifestPath ?? `apps/${app.key}`].join('/');
|
|
99
|
+
server.middlewares.use(async (req, res, next) => {
|
|
113
100
|
// We only want to match the exact path
|
|
114
|
-
const [requestPath] = (
|
|
101
|
+
const [requestPath] = (req.url ?? '').split('?');
|
|
115
102
|
if (requestPath === manifestPath) {
|
|
116
103
|
res.setHeader('content-type', 'application/json');
|
|
117
|
-
res.end(JSON.stringify(
|
|
104
|
+
res.end(JSON.stringify(await app.generateManifest()));
|
|
118
105
|
return;
|
|
119
106
|
}
|
|
120
107
|
next();
|
|
121
|
-
})
|
|
108
|
+
});
|
|
122
109
|
// serve local bundles if request matches the current app and version
|
|
123
110
|
const bundlePath = [
|
|
124
111
|
proxyPath,
|
|
125
|
-
|
|
112
|
+
app.bundlePath ?? `bundles/apps/${app.key}/${app.version}`,
|
|
126
113
|
].join('/');
|
|
127
|
-
server.middlewares.use((req, _res, next) =>
|
|
128
|
-
|
|
129
|
-
if ((_a = req.url) === null || _a === void 0 ? void 0 : _a.match(bundlePath)) {
|
|
114
|
+
server.middlewares.use(async (req, _res, next) => {
|
|
115
|
+
if (req.url?.match(bundlePath)) {
|
|
130
116
|
// remove proxy path from url
|
|
131
117
|
req.url = req.url.replace(bundlePath, '');
|
|
132
118
|
}
|
|
133
119
|
next();
|
|
134
|
-
})
|
|
120
|
+
});
|
|
135
121
|
},
|
|
136
122
|
};
|
|
137
123
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-proxy-plugin.js","sourceRoot":"","sources":["../../../../src/lib/plugins/app-proxy/app-proxy-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-proxy-plugin.js","sourceRoot":"","sources":["../../../../src/lib/plugins/app-proxy/app-proxy-plugin.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;GAcG;AACH,IAAI,iBAAiB,GAAG,EAAE,CAAC;AAqD3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAA8B,EAAU,EAAE;IACvE,MAAM,EACJ,KAAK,EAAE,EAAE,UAAU,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAC9D,GAAG,OAAO,CAAC;IACZ,OAAO;QACL,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,OAAO;QACd,MAAM,CAAC,MAAM;YACX,MAAM,CAAC,MAAM,KAAK,EAAE,CAAC;YACrB,MAAM,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE,CAAC;YAC3B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG;gBAC/B,MAAM;gBACN,YAAY,EAAE,IAAI;gBAClB,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;gBAC9C,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;oBACnB,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,EAAE;wBAChC,MAAM,KAAK,GA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AAE,IAAI,EAAE,EAAE;gBAC9C,uCAAuC;gBACvC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACjD,IAAI,WAAW,KAAK,YAAY,EAAE,CAAC;oBACjC,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;oBAClD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;oBACtD,OAAO;gBACT,CAAC;gBAED,IAAI,EAAE,CAAC;YACT,CAAC,CAAC,CAAC;YAEH,qEAAqE;YACrE,MAAM,UAAU,GAAG;gBACjB,SAAS;gBACT,GAAG,CAAC,UAAU,IAAI,gBAAgB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE;aAC3D,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACZ,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;gBAC/C,IAAI,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;oBAC/B,6BAA6B;oBAC7B,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;gBAC7C,CAAC;gBACD,IAAI,EAAE,CAAC;YACT,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import parseJsonFromRequest from '../../utils/parse-json-request.js';
|
|
11
2
|
/**
|
|
12
3
|
* This plugin provides a simple way to manage application settings in a local development environment.
|
|
@@ -23,23 +14,21 @@ import parseJsonFromRequest from '../../utils/parse-json-request.js';
|
|
|
23
14
|
* - Responds with the current application settings in JSON format.
|
|
24
15
|
*/
|
|
25
16
|
export function appSettingsPlugin(options) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const pathMatch = new RegExp((_b = options.match) !== null && _b !== void 0 ? _b : '/persons/me/apps/.*/settings');
|
|
17
|
+
let appSettings = options.defaultSettings ?? {};
|
|
18
|
+
const pathMatch = new RegExp(options.match ?? '/persons/me/apps/.*/settings');
|
|
29
19
|
return {
|
|
30
20
|
name: 'app-settings',
|
|
31
21
|
configureServer(server) {
|
|
32
|
-
server.middlewares.use((req, res, next) =>
|
|
33
|
-
|
|
34
|
-
if (!((_a = req.url) === null || _a === void 0 ? void 0 : _a.match(pathMatch))) {
|
|
22
|
+
server.middlewares.use(async (req, res, next) => {
|
|
23
|
+
if (!req.url?.match(pathMatch)) {
|
|
35
24
|
return next();
|
|
36
25
|
}
|
|
37
26
|
if (req.method === 'PUT') {
|
|
38
|
-
appSettings =
|
|
27
|
+
appSettings = await parseJsonFromRequest(req);
|
|
39
28
|
}
|
|
40
29
|
res.setHeader('content-type', 'application/json');
|
|
41
30
|
res.end(JSON.stringify(appSettings));
|
|
42
|
-
})
|
|
31
|
+
});
|
|
43
32
|
},
|
|
44
33
|
};
|
|
45
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/plugins/app-settings/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/plugins/app-settings/index.ts"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,MAAM,mCAAmC,CAAC;AAmBrE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAiC;IACjE,IAAI,WAAW,GAAG,OAAO,CAAC,eAAe,IAAI,EAAE,CAAC;IAChD,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,8BAA8B,CAAC,CAAC;IAC9E,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,eAAe,CAAC,MAAM;YACpB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;gBAC9C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;oBAC/B,OAAO,IAAI,EAAE,CAAC;gBAChB,CAAC;gBAED,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;oBACzB,WAAW,GAAG,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC;gBAChD,CAAC;gBAED,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;gBAClD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;YACvC,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { join } from 'node:path';
|
|
11
2
|
import { readFileSync, existsSync } from 'node:fs';
|
|
12
3
|
import mime from 'mime';
|
|
@@ -37,7 +28,7 @@ import { createFilter } from 'vite';
|
|
|
37
28
|
*/
|
|
38
29
|
export const externalPublicPlugin = (path, options) => {
|
|
39
30
|
let viteConfig;
|
|
40
|
-
const assetFilter = createFilter(options
|
|
31
|
+
const assetFilter = createFilter(options?.include, options?.exclude);
|
|
41
32
|
return {
|
|
42
33
|
name: 'fusion:external-public',
|
|
43
34
|
apply: 'serve',
|
|
@@ -46,14 +37,12 @@ export const externalPublicPlugin = (path, options) => {
|
|
|
46
37
|
},
|
|
47
38
|
configureServer(server) {
|
|
48
39
|
// serve the static assets from the provided path
|
|
49
|
-
server.middlewares.use((req, res, next) =>
|
|
50
|
-
var _a;
|
|
40
|
+
server.middlewares.use(async (req, res, next) => {
|
|
51
41
|
const [urlPath] = req.url.split('?');
|
|
52
42
|
const assetPath = join(path, urlPath);
|
|
53
43
|
if (!assetFilter(assetPath) ||
|
|
54
|
-
(
|
|
55
44
|
// skip if the request is for index.html
|
|
56
|
-
|
|
45
|
+
req.url?.match('index.html') ||
|
|
57
46
|
// skip if request is for a source file
|
|
58
47
|
existsSync(join(viteConfig.root, urlPath)) ||
|
|
59
48
|
// skip if asset is in publicDir
|
|
@@ -65,37 +54,46 @@ export const externalPublicPlugin = (path, options) => {
|
|
|
65
54
|
try {
|
|
66
55
|
const content = readFileSync(assetPath);
|
|
67
56
|
const contentType = mime.getType(assetPath) || 'application/octet-stream';
|
|
68
|
-
res.writeHead(200,
|
|
57
|
+
res.writeHead(200, {
|
|
58
|
+
'content-type': contentType,
|
|
59
|
+
'content-length': Buffer.byteLength(content),
|
|
60
|
+
'cache-control': 'no-cache',
|
|
61
|
+
...server.config.server.headers,
|
|
62
|
+
});
|
|
69
63
|
res.end(content);
|
|
70
64
|
}
|
|
71
65
|
catch (e) {
|
|
72
66
|
next(e);
|
|
73
67
|
}
|
|
74
|
-
})
|
|
68
|
+
});
|
|
75
69
|
// intercept requests to serve the index.html file
|
|
76
|
-
server.middlewares.use((req, res, next) =>
|
|
77
|
-
var _a;
|
|
70
|
+
server.middlewares.use(async (req, res, next) => {
|
|
78
71
|
if (
|
|
79
72
|
// Only accept GET or HEAD
|
|
80
73
|
(req.method !== 'GET' && req.method !== 'HEAD') ||
|
|
81
74
|
// Only accept text/html
|
|
82
|
-
!
|
|
75
|
+
!req.headers.accept?.includes('text/html')) {
|
|
83
76
|
return next();
|
|
84
77
|
}
|
|
85
78
|
try {
|
|
86
79
|
// load the raw html from provided path
|
|
87
80
|
const htmlRaw = readFileSync(join(path, 'index.html'), 'utf-8');
|
|
88
81
|
// transform the html, this is where vite plugin hooks are applied
|
|
89
|
-
const html =
|
|
82
|
+
const html = await server.transformIndexHtml(req.url, htmlRaw, req.originalUrl);
|
|
90
83
|
// apply content headers and configured additional headers
|
|
91
|
-
res.writeHead(200,
|
|
84
|
+
res.writeHead(200, {
|
|
85
|
+
'content-type': 'text/html',
|
|
86
|
+
'content-length': Buffer.byteLength(html),
|
|
87
|
+
'cache-control': 'no-cache',
|
|
88
|
+
...server.config.server.headers,
|
|
89
|
+
});
|
|
92
90
|
// send the transformed html and end the response
|
|
93
91
|
res.end(html);
|
|
94
92
|
}
|
|
95
93
|
catch (e) {
|
|
96
94
|
next(e);
|
|
97
95
|
}
|
|
98
|
-
})
|
|
96
|
+
});
|
|
99
97
|
},
|
|
100
98
|
};
|
|
101
99
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-public-plugin.js","sourceRoot":"","sources":["../../../../src/lib/plugins/external-public/external-public-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"external-public-plugin.js","sourceRoot":"","sources":["../../../../src/lib/plugins/external-public/external-public-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAwD,MAAM,MAAM,CAAC;AAE1F;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,IAAY,EACZ,OAGC,EACO,EAAE;IACV,IAAI,UAA0B,CAAC;IAE/B,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAErE,OAAO;QACL,IAAI,EAAE,wBAAwB;QAC9B,KAAK,EAAE,OAAO;QACd,cAAc,CAAC,MAAM;YACnB,UAAU,GAAG,MAAM,CAAC;QACtB,CAAC;QACD,eAAe,CAAC,MAAM;YACpB,iDAAiD;YACjD,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;gBAC9C,MAAM,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,GAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAEtC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBAEtC,IACE,CAAC,WAAW,CAAC,SAAS,CAAC;oBACvB,wCAAwC;oBACxC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC;oBAC5B,uCAAuC;oBACvC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;oBAC1C,gCAAgC;oBAChC,U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AAkE;oBAClE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAI,EAAE,OAAO,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;oBAEjF,0DAA0D;oBAC1D,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE;wBACjB,cAAc,EAAE,WAAW;wBAC3B,gBAAgB,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;wBACzC,eAAe,EAAE,UAAU;wBAC3B,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO;qBAChC,CAAC,CAAC;oBAEH,iDAAiD;oBACjD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAChB,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,IAAI,CAAC,CAAC,CAAC,CAAC;gBACV,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
/**
|
|
11
2
|
* Preserce token for executing proxy assets
|
|
12
3
|
*
|
|
@@ -53,10 +44,8 @@ export const helpProxyPlugin = (options) => {
|
|
|
53
44
|
name: 'fusion:help-proxy',
|
|
54
45
|
apply: 'serve',
|
|
55
46
|
config(config) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
(_a = config.server) !== null && _a !== void 0 ? _a : (config.server = {});
|
|
59
|
-
(_b = (_c = config.server).proxy) !== null && _b !== void 0 ? _b : (_c.proxy = {});
|
|
47
|
+
config.server ??= {};
|
|
48
|
+
config.server.proxy ??= {};
|
|
60
49
|
config.server.proxy[proxyPath] = {
|
|
61
50
|
target,
|
|
62
51
|
changeOrigin: true,
|
|
@@ -74,14 +63,14 @@ export const helpProxyPlugin = (options) => {
|
|
|
74
63
|
};
|
|
75
64
|
},
|
|
76
65
|
configureServer(server) {
|
|
77
|
-
server.middlewares.use(proxyPath, (req, res, next) =>
|
|
66
|
+
server.middlewares.use(proxyPath, async (req, res, next) => {
|
|
78
67
|
if (req.headers.authorization) {
|
|
79
68
|
__HELP_API_TOKEN__ = req.headers.authorization || '';
|
|
80
69
|
res.end();
|
|
81
70
|
return;
|
|
82
71
|
}
|
|
83
72
|
next();
|
|
84
|
-
})
|
|
73
|
+
});
|
|
85
74
|
},
|
|
86
75
|
};
|
|
87
76
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-proxy-plugin.js","sourceRoot":"","sources":["../../../../src/lib/plugins/help-proxy/help-proxy-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"help-proxy-plugin.js","sourceRoot":"","sources":["../../../../src/lib/plugins/help-proxy/help-proxy-plugin.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,IAAI,kBAAkB,GAAG,EAAE,CAAC;AAiB5B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAA+B,EAAU,EAAE;IACzE,MAAM,EACJ,KAAK,EAAE,EAAE,UAAU,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAC9D,GAAG,OAAO,CAAC;IAEZ,OAAO;QACL,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assertObject(value, message) {
|
|
|
11
11
|
assert(typeof value === 'object', message);
|
|
12
12
|
}
|
|
13
13
|
function assertObjectEntryValue(value, prop, message) {
|
|
14
|
-
assert(!!value, message
|
|
14
|
+
assert(!!value, message ?? `missing value of property ${prop}`);
|
|
15
15
|
}
|
|
16
16
|
export function assertObjectEntries(
|
|
17
17
|
// extends Record<string, unknown> = unknown>(
|
|
18
18
|
value, options) {
|
|
19
|
-
|
|
20
|
-
const preMessage = (_a = options === null || options === void 0 ? void 0 : options.preMessage) !== null && _a !== void 0 ? _a : '';
|
|
19
|
+
const preMessage = options?.preMessage ?? '';
|
|
21
20
|
assert(typeof value === 'object', `${preMessage} to be an <object>`);
|
|
22
|
-
const assertion =
|
|
23
|
-
const props =
|
|
21
|
+
const assertion = options?.assertion ?? assertObjectEntryValue;
|
|
22
|
+
const props = options?.props ?? Object.keys(value);
|
|
24
23
|
for (const prop of props) {
|
|
25
24
|
assert(prop in value, `${preMessage} to have property [${String(prop)}]`);
|
|
26
25
|
assertion(value[prop], prop, `${preMessage} property [${String(prop)}] to have value`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.js","sourceRoot":"","sources":["../../../src/lib/utils/assert.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;AAElC,MAAM,UAAU,YAAY,CAAC,KAAc,EAAE,OAAgB;IAC3D,MAAM,CACJ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EACpB,IAAI,cAAc,CAAC;QACjB,OAAO;QACP,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,UAAU;KACrB,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,OAAwB;IAClE,MAAM,CAAC,OAAO,KAAK,KAAK,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC7C,CA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M,CAAC,IAAI,IAAI,KAAK,EAAE,GAAG,UAAU,sBAAsB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1E,SAAS,CACP,KAAK,CAAC,IAAe,CAAC,EACtB,IAAoB,EACpB,GAAG,UAAU,cAAc,MAAM,CAAC,IAAI,CAAC,iBAAiB,CACzD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/lib/utils/config.js
CHANGED
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
-
var t = {};
|
|
12
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
-
t[p] = s[p];
|
|
14
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
-
t[p[i]] = s[p[i]];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
1
|
import { readFile } from 'node:fs/promises';
|
|
22
2
|
import { extname } from 'node:path';
|
|
23
3
|
import { findUpMultiple } from 'find-up';
|
|
@@ -30,25 +10,28 @@ export const supportedExt = ['.ts', '.mjs', '.js', '.json'];
|
|
|
30
10
|
/**
|
|
31
11
|
* @param filename name if config file without extension
|
|
32
12
|
*/
|
|
33
|
-
export const findConfigs = (filename, options) =>
|
|
34
|
-
const
|
|
13
|
+
export const findConfigs = async (filename, options) => {
|
|
14
|
+
const { extensions, ...findOptions } = options ?? {};
|
|
35
15
|
extensions && assertConfigFileType(extensions);
|
|
36
|
-
return findUpMultiple((extensions
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
16
|
+
return findUpMultiple((extensions ?? supportedExt).map((ext) => [filename, ext].join('')), {
|
|
17
|
+
...findOptions,
|
|
18
|
+
type: 'file',
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
export const resolveConfig = async (filename, options) => {
|
|
22
|
+
const [file] = await findConfigs(filename, options?.find);
|
|
40
23
|
if (file) {
|
|
41
24
|
return {
|
|
42
25
|
path: file,
|
|
43
|
-
config:
|
|
26
|
+
config: await loadConfig(file),
|
|
44
27
|
};
|
|
45
28
|
}
|
|
46
|
-
}
|
|
29
|
+
};
|
|
47
30
|
function assertConfigFileType(value, message) {
|
|
48
31
|
const values = typeof value === 'string' ? [value] : value;
|
|
49
32
|
for (const ext of values) {
|
|
50
33
|
assert(supportedExt.includes(ext), new AssertionError({
|
|
51
|
-
message: message
|
|
34
|
+
message: message ?? 'unsupported file type',
|
|
52
35
|
actual: value,
|
|
53
36
|
expected: supportedExt.join('|'),
|
|
54
37
|
}));
|
|
@@ -59,24 +42,24 @@ const configExtname = (file) => {
|
|
|
59
42
|
assertConfigFileType(ext);
|
|
60
43
|
return ext;
|
|
61
44
|
};
|
|
62
|
-
export const loadConfig = (file) =>
|
|
63
|
-
assert(
|
|
45
|
+
export const loadConfig = async (file) => {
|
|
46
|
+
assert(await fileExists(file, { assert: true }), `failed to access file ${file}`);
|
|
64
47
|
switch (configExtname(file)) {
|
|
65
48
|
case '.ts': {
|
|
66
|
-
return loadConfig(
|
|
49
|
+
return loadConfig(await transpile(file));
|
|
67
50
|
}
|
|
68
51
|
case '.mjs':
|
|
69
52
|
case '.js': {
|
|
70
|
-
const result = (
|
|
53
|
+
const result = (await import(String(pathToFileURL(file)))).default;
|
|
71
54
|
return typeof result === 'function' ? result : () => result;
|
|
72
55
|
}
|
|
73
56
|
case '.json': {
|
|
74
|
-
return () =>
|
|
57
|
+
return async () => JSON.parse(await readFile(file, 'utf-8'));
|
|
75
58
|
}
|
|
76
59
|
default:
|
|
77
60
|
throw Error('unsupported file type');
|
|
78
61
|
}
|
|
79
|
-
}
|
|
62
|
+
};
|
|
80
63
|
export function initiateConfig(config, ...args) {
|
|
81
64
|
return Promise.resolve(config(...args));
|
|
82
65
|
}
|