@lwrjs/config 0.9.0-alpha.13 → 0.9.0-alpha.15
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/build/cjs/defaults.cjs +5 -0
- package/build/cjs/global-config.cjs +4 -0
- package/build/cjs/utils/module-loader.cjs +2 -1
- package/build/cjs/validation/app-config-context.cjs +1 -0
- package/build/cjs/validation/app-config.cjs +1 -0
- package/build/es/defaults.js +5 -0
- package/build/es/global-config.js +4 -0
- package/build/es/utils/module-loader.js +2 -1
- package/build/es/validation/app-config-context.d.ts +1 -1
- package/build/es/validation/app-config-context.js +1 -0
- package/build/es/validation/app-config.js +2 -0
- package/package.json +6 -5
package/build/cjs/defaults.cjs
CHANGED
|
@@ -64,6 +64,10 @@ var DEFAULT_MODULE_PROVIDERS = [
|
|
|
64
64
|
"@lwrjs/lwc-module-provider",
|
|
65
65
|
"@lwrjs/npm-module-provider"
|
|
66
66
|
];
|
|
67
|
+
var DEFAULT_BUNDLE_PROVIDERS = [
|
|
68
|
+
"@lwrjs/module-bundler/amd-bundle-provider",
|
|
69
|
+
"@lwrjs/module-bundler/esm-bundle-provider"
|
|
70
|
+
];
|
|
67
71
|
var DEFAULT_RESOURCE_PROVIDERS = ["@lwrjs/loader"];
|
|
68
72
|
var DEFAULT_VIEW_PROVIDERS = [
|
|
69
73
|
"@lwrjs/nunjucks-view-provider",
|
|
@@ -113,6 +117,7 @@ var DEFAULT_LWR_CONFIG = {
|
|
|
113
117
|
globalData: {},
|
|
114
118
|
hooks: [],
|
|
115
119
|
moduleProviders: DEFAULT_MODULE_PROVIDERS,
|
|
120
|
+
bundleProviders: DEFAULT_BUNDLE_PROVIDERS,
|
|
116
121
|
resourceProviders: DEFAULT_RESOURCE_PROVIDERS,
|
|
117
122
|
viewProviders: DEFAULT_VIEW_PROVIDERS,
|
|
118
123
|
viewTransformers: DEFAULT_VIEW_TRANSFORM_PLUGINS,
|
|
@@ -87,6 +87,7 @@ function normalizeConfig(config) {
|
|
|
87
87
|
lwc: (0, import_lwc.normalizeLwcConfig)(config.lwc),
|
|
88
88
|
hooks: (0, import_services.normalizeServices)(config.hooks),
|
|
89
89
|
moduleProviders: (0, import_services.normalizeServices)(config.moduleProviders),
|
|
90
|
+
bundleProviders: (0, import_services.normalizeServices)(config.bundleProviders),
|
|
90
91
|
assetProviders: (0, import_services.normalizeServices)(config.assetProviders),
|
|
91
92
|
assetTransformers: (0, import_services.normalizeServices)(config.assetTransformers),
|
|
92
93
|
resourceProviders: (0, import_services.normalizeServices)(config.resourceProviders),
|
|
@@ -116,6 +117,7 @@ function normalizeConfigPaths(config) {
|
|
|
116
117
|
},
|
|
117
118
|
hooks: (0, import_services.normalizeServicePaths)(config.hooks, rootDir),
|
|
118
119
|
moduleProviders: (0, import_services.normalizeServicePaths)(config.moduleProviders, rootDir),
|
|
120
|
+
bundleProviders: (0, import_services.normalizeServicePaths)(config.bundleProviders, rootDir),
|
|
119
121
|
assetProviders: (0, import_services.normalizeServicePaths)(config.assetProviders, rootDir),
|
|
120
122
|
assetTransformers: (0, import_services.normalizeServicePaths)(config.assetTransformers, rootDir),
|
|
121
123
|
resourceProviders: (0, import_services.normalizeServicePaths)(config.resourceProviders, rootDir),
|
|
@@ -160,6 +162,7 @@ async function loadConfig(config, options) {
|
|
|
160
162
|
}
|
|
161
163
|
async function loadServices(config) {
|
|
162
164
|
const moduleProviders = await (0, import_services.loadServiceEntries)(config.moduleProviders, config.rootDir, config.cacheDir);
|
|
165
|
+
const bundleProviders = await (0, import_services.loadServiceEntries)(config.bundleProviders, config.rootDir, config.cacheDir);
|
|
163
166
|
const assetProviders = await (0, import_services.loadServiceEntries)(config.assetProviders, config.rootDir, config.cacheDir);
|
|
164
167
|
const assetTransformers = await (0, import_services.loadServiceEntries)(config.assetTransformers, config.rootDir, config.cacheDir);
|
|
165
168
|
const resourceProviders = await (0, import_services.loadServiceEntries)(config.resourceProviders, config.rootDir, config.cacheDir);
|
|
@@ -167,6 +170,7 @@ async function loadServices(config) {
|
|
|
167
170
|
const viewTransformers = await (0, import_services.loadServiceEntries)(config.viewTransformers, config.rootDir, config.cacheDir);
|
|
168
171
|
return {
|
|
169
172
|
moduleProviders,
|
|
173
|
+
bundleProviders,
|
|
170
174
|
assetProviders,
|
|
171
175
|
assetTransformers,
|
|
172
176
|
resourceProviders,
|
|
@@ -27,13 +27,14 @@ __export(exports, {
|
|
|
27
27
|
loadModule: () => loadModule
|
|
28
28
|
});
|
|
29
29
|
var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
|
|
30
|
+
var import_typescript = __toModule(require("@lwrjs/shared-utils/typescript"));
|
|
30
31
|
async function loadModule(filepath, rootDir, cacheDir) {
|
|
31
32
|
let resolvedFilePath = (0, import_shared_utils.normalizeDirectory)(filepath, rootDir);
|
|
32
33
|
const resolvedCacheDir = (0, import_shared_utils.normalizeDirectory)(cacheDir, rootDir);
|
|
33
34
|
try {
|
|
34
35
|
if (resolvedFilePath.endsWith(".ts")) {
|
|
35
36
|
const fullPath = (0, import_shared_utils.resolveFileExtension)(resolvedFilePath);
|
|
36
|
-
resolvedFilePath = await (0,
|
|
37
|
+
resolvedFilePath = await (0, import_typescript.transpileTs)(fullPath, {rootDir, cacheDir: resolvedCacheDir});
|
|
37
38
|
}
|
|
38
39
|
const moduleEntry = await Promise.resolve().then(() => __toModule(require(resolvedFilePath)));
|
|
39
40
|
const output = moduleEntry.default || moduleEntry;
|
|
@@ -164,6 +164,7 @@ function validateRoot(node, validationContext, preMerge) {
|
|
|
164
164
|
validationContext.assertNotEmptyString((0, import_jsonc_parser.findNodeAtLocation)(node, ["globalDataDir"]), "globalDataDir");
|
|
165
165
|
validationContext.assertArrayOfServices((0, import_jsonc_parser.findNodeAtLocation)(node, ["hooks"]), "hooks");
|
|
166
166
|
validationContext.assertArrayOfServices((0, import_jsonc_parser.findNodeAtLocation)(node, ["moduleProviders"]), "moduleProviders");
|
|
167
|
+
validationContext.assertArrayOfServices((0, import_jsonc_parser.findNodeAtLocation)(node, ["bundleProviders"]), "bundleProviders");
|
|
167
168
|
validationContext.assertArrayOfServices((0, import_jsonc_parser.findNodeAtLocation)(node, ["viewProviders"]), "viewProviders");
|
|
168
169
|
validationContext.assertArrayOfServices((0, import_jsonc_parser.findNodeAtLocation)(node, ["resourceProviders"]), "resourceProviders");
|
|
169
170
|
validationContext.assertArrayOfServices((0, import_jsonc_parser.findNodeAtLocation)(node, ["assetProviders"]), "assetProviders");
|
package/build/es/defaults.js
CHANGED
|
@@ -28,6 +28,10 @@ const DEFAULT_MODULE_PROVIDERS = [
|
|
|
28
28
|
'@lwrjs/lwc-module-provider',
|
|
29
29
|
'@lwrjs/npm-module-provider',
|
|
30
30
|
];
|
|
31
|
+
const DEFAULT_BUNDLE_PROVIDERS = [
|
|
32
|
+
'@lwrjs/module-bundler/amd-bundle-provider',
|
|
33
|
+
'@lwrjs/module-bundler/esm-bundle-provider',
|
|
34
|
+
];
|
|
31
35
|
const DEFAULT_RESOURCE_PROVIDERS = ['@lwrjs/loader'];
|
|
32
36
|
const DEFAULT_VIEW_PROVIDERS = [
|
|
33
37
|
'@lwrjs/nunjucks-view-provider',
|
|
@@ -77,6 +81,7 @@ export const DEFAULT_LWR_CONFIG = {
|
|
|
77
81
|
globalData: {},
|
|
78
82
|
hooks: [],
|
|
79
83
|
moduleProviders: DEFAULT_MODULE_PROVIDERS,
|
|
84
|
+
bundleProviders: DEFAULT_BUNDLE_PROVIDERS,
|
|
80
85
|
resourceProviders: DEFAULT_RESOURCE_PROVIDERS,
|
|
81
86
|
viewProviders: DEFAULT_VIEW_PROVIDERS,
|
|
82
87
|
viewTransformers: DEFAULT_VIEW_TRANSFORM_PLUGINS,
|
|
@@ -113,6 +113,7 @@ function normalizeConfig(config) {
|
|
|
113
113
|
// normalize all services
|
|
114
114
|
hooks: normalizeServices(config.hooks),
|
|
115
115
|
moduleProviders: normalizeServices(config.moduleProviders),
|
|
116
|
+
bundleProviders: normalizeServices(config.bundleProviders),
|
|
116
117
|
assetProviders: normalizeServices(config.assetProviders),
|
|
117
118
|
assetTransformers: normalizeServices(config.assetTransformers),
|
|
118
119
|
resourceProviders: normalizeServices(config.resourceProviders),
|
|
@@ -154,6 +155,7 @@ function normalizeConfigPaths(config) {
|
|
|
154
155
|
// normalize all service paths
|
|
155
156
|
hooks: normalizeServicePaths(config.hooks, rootDir),
|
|
156
157
|
moduleProviders: normalizeServicePaths(config.moduleProviders, rootDir),
|
|
158
|
+
bundleProviders: normalizeServicePaths(config.bundleProviders, rootDir),
|
|
157
159
|
assetProviders: normalizeServicePaths(config.assetProviders, rootDir),
|
|
158
160
|
assetTransformers: normalizeServicePaths(config.assetTransformers, rootDir),
|
|
159
161
|
resourceProviders: normalizeServicePaths(config.resourceProviders, rootDir),
|
|
@@ -230,6 +232,7 @@ export async function loadConfig(config, options) {
|
|
|
230
232
|
*/
|
|
231
233
|
export async function loadServices(config) {
|
|
232
234
|
const moduleProviders = await loadServiceEntries(config.moduleProviders, config.rootDir, config.cacheDir);
|
|
235
|
+
const bundleProviders = await loadServiceEntries(config.bundleProviders, config.rootDir, config.cacheDir);
|
|
233
236
|
const assetProviders = await loadServiceEntries(config.assetProviders, config.rootDir, config.cacheDir);
|
|
234
237
|
const assetTransformers = await loadServiceEntries(config.assetTransformers, config.rootDir, config.cacheDir);
|
|
235
238
|
const resourceProviders = await loadServiceEntries(config.resourceProviders, config.rootDir, config.cacheDir);
|
|
@@ -237,6 +240,7 @@ export async function loadServices(config) {
|
|
|
237
240
|
const viewTransformers = await loadServiceEntries(config.viewTransformers, config.rootDir, config.cacheDir);
|
|
238
241
|
return {
|
|
239
242
|
moduleProviders,
|
|
243
|
+
bundleProviders,
|
|
240
244
|
assetProviders,
|
|
241
245
|
assetTransformers,
|
|
242
246
|
resourceProviders,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { normalizeDirectory, resolveFileExtension
|
|
1
|
+
import { normalizeDirectory, resolveFileExtension } from '@lwrjs/shared-utils';
|
|
2
|
+
import { transpileTs } from '@lwrjs/shared-utils/typescript';
|
|
2
3
|
export async function loadModule(filepath, rootDir, cacheDir) {
|
|
3
4
|
// ensure paths are fully resolved before loading source
|
|
4
5
|
let resolvedFilePath = normalizeDirectory(filepath, rootDir);
|
|
@@ -15,7 +15,7 @@ interface ConfigMap {
|
|
|
15
15
|
bootstrap: NormalizedLwrAppBootstrapConfig;
|
|
16
16
|
locker: RequiredLwrLockerConfig;
|
|
17
17
|
}
|
|
18
|
-
export declare const ROOT_ATTRIBUTE_KEYS: ["amdLoader", "apiVersion", "assets", "assetProviders", "assetTransformers", "bundleConfig", "cacheDir", "contentDir", "environment", "errorRoutes", "esmLoader", "staticSiteGenerator", "globalData", "globalDataDir", "hooks", "ignoreLwrConfigFile", "lwrConfigFile", "layoutsDir", "locker", "lwc", "lwrVersion", "moduleProviders", "port", "basePath", "resourceProviders", "rootDir", "routes", "serverMode", "serverType", "viewProviders", "viewTransformers"];
|
|
18
|
+
export declare const ROOT_ATTRIBUTE_KEYS: ["amdLoader", "apiVersion", "assets", "assetProviders", "assetTransformers", "bundleConfig", "bundleProviders", "cacheDir", "contentDir", "environment", "errorRoutes", "esmLoader", "staticSiteGenerator", "globalData", "globalDataDir", "hooks", "ignoreLwrConfigFile", "lwrConfigFile", "layoutsDir", "locker", "lwc", "lwrVersion", "moduleProviders", "port", "basePath", "resourceProviders", "rootDir", "routes", "serverMode", "serverType", "viewProviders", "viewTransformers"];
|
|
19
19
|
export declare const ASSET_DIR_ATTRIBUTE_KEYS: ["alias", "dir", "urlPath"];
|
|
20
20
|
export declare const ASSET_FILE_ATTRIBUTE_KEYS: ["alias", "file", "urlPath"];
|
|
21
21
|
export declare const LOCKER_ATTRIBUTE_KEYS: ["enabled", "trustedComponents", "clientOnly"];
|
|
@@ -178,6 +178,7 @@ function validateLocker(node, validationContext) {
|
|
|
178
178
|
* - rootDir, cacheDir, contentDir, layoutsDir, globalDataDir: strings
|
|
179
179
|
* - hooks: array of strings
|
|
180
180
|
* - moduleProviders: array of services
|
|
181
|
+
* - bundleProviders: array of services
|
|
181
182
|
* - viewProviders: array of services
|
|
182
183
|
* - resourceProviders: array of services
|
|
183
184
|
* - assetProviders: array of services
|
|
@@ -213,6 +214,7 @@ function validateRoot(node, validationContext, preMerge) {
|
|
|
213
214
|
validationContext.assertNotEmptyString(findNode(node, ['globalDataDir']), 'globalDataDir');
|
|
214
215
|
validationContext.assertArrayOfServices(findNode(node, ['hooks']), 'hooks');
|
|
215
216
|
validationContext.assertArrayOfServices(findNode(node, ['moduleProviders']), 'moduleProviders');
|
|
217
|
+
validationContext.assertArrayOfServices(findNode(node, ['bundleProviders']), 'bundleProviders');
|
|
216
218
|
validationContext.assertArrayOfServices(findNode(node, ['viewProviders']), 'viewProviders');
|
|
217
219
|
validationContext.assertArrayOfServices(findNode(node, ['resourceProviders']), 'resourceProviders');
|
|
218
220
|
validationContext.assertArrayOfServices(findNode(node, ['assetProviders']), 'assetProviders');
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.9.0-alpha.
|
|
7
|
+
"version": "0.9.0-alpha.15",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -32,16 +32,17 @@
|
|
|
32
32
|
"package.cjs"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@lwrjs/diagnostics": "0.9.0-alpha.
|
|
36
|
-
"@lwrjs/shared-utils": "0.9.0-alpha.
|
|
35
|
+
"@lwrjs/diagnostics": "0.9.0-alpha.15",
|
|
36
|
+
"@lwrjs/shared-utils": "0.9.0-alpha.15",
|
|
37
|
+
"esbuild": "^0.9.7",
|
|
37
38
|
"fs-extra": "^10.1.0",
|
|
38
39
|
"jsonc-parser": "^3.0.0"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@lwrjs/types": "0.9.0-alpha.
|
|
42
|
+
"@lwrjs/types": "0.9.0-alpha.15"
|
|
42
43
|
},
|
|
43
44
|
"engines": {
|
|
44
45
|
"node": ">=14.15.4 <19"
|
|
45
46
|
},
|
|
46
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "f32f103d2d5e516daccce1be69f68acd7b4b86fb"
|
|
47
48
|
}
|