@lwrjs/core 0.6.0-alpha.14 → 0.6.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/index.cjs +4 -0
- package/build/cjs/middlewares/api-middleware.cjs +2 -2
- package/build/cjs/tools/static-generation.cjs +2 -2
- package/build/es/index.js +6 -0
- package/build/es/middlewares/api-middleware.js +2 -2
- package/build/es/tools/static-generation.js +6 -2
- package/package.json +28 -28
package/build/cjs/index.cjs
CHANGED
|
@@ -236,6 +236,10 @@ function createServer(config) {
|
|
|
236
236
|
async function generateStaticSite(config) {
|
|
237
237
|
config = config || {};
|
|
238
238
|
config.serverType = "fs";
|
|
239
|
+
const {serverMode} = config;
|
|
240
|
+
if (serverMode === "dev" || serverMode === "compat") {
|
|
241
|
+
console.warn("[WARN] static generation in `dev` or `compat` mode is currently not fully supported");
|
|
242
|
+
}
|
|
239
243
|
const lwrApp = createServer(config);
|
|
240
244
|
overrideConfigAsSrc(lwrApp);
|
|
241
245
|
await lwrApp.init();
|
|
@@ -130,7 +130,7 @@ function apiMiddleware(app, context) {
|
|
|
130
130
|
const {ownHash, moduleEntry} = await moduleRegistry.getModule(moduleId, ctx.runtimeParams);
|
|
131
131
|
if (ownHash) {
|
|
132
132
|
const jsonQuery = req.isJsonRequest() ? `${ctx.runtimeEnvironment.debug ? "&" : "?"}json` : "";
|
|
133
|
-
const uri = await moduleRegistry.resolveModuleUri({...moduleId, version: moduleEntry.version}, ctx.runtimeEnvironment, ctx.runtimeParams);
|
|
133
|
+
const uri = await moduleRegistry.resolveModuleUri({...moduleId, version: moduleEntry.version}, ctx.runtimeEnvironment, ctx.runtimeParams, ownHash);
|
|
134
134
|
res.set({
|
|
135
135
|
Location: `${uri}${jsonQuery}`
|
|
136
136
|
});
|
|
@@ -239,7 +239,7 @@ function apiMiddleware(app, context) {
|
|
|
239
239
|
const {ownHash, moduleEntry} = await moduleRegistry.getModule(moduleId, ctx.runtimeParams);
|
|
240
240
|
if (ownHash) {
|
|
241
241
|
const jsonQuery = req.isJsonRequest() ? `${ctx.runtimeEnvironment.debug ? "&" : "?"}json` : "";
|
|
242
|
-
const uri = await moduleRegistry.resolveModuleUri({...moduleId, version: moduleEntry.version}, ctx.runtimeEnvironment, ctx.runtimeParams);
|
|
242
|
+
const uri = await moduleRegistry.resolveModuleUri({...moduleId, version: moduleEntry.version}, ctx.runtimeEnvironment, ctx.runtimeParams, ownHash);
|
|
243
243
|
res.set({
|
|
244
244
|
Location: `${uri}${jsonQuery}`
|
|
245
245
|
});
|
|
@@ -117,12 +117,12 @@ var SiteGenerator = class {
|
|
|
117
117
|
if (moduleDefinition) {
|
|
118
118
|
const imports = moduleDefinition.linkedModuleRecord?.imports || moduleDefinition.bundleRecord?.imports || [];
|
|
119
119
|
for (const importModule of imports) {
|
|
120
|
-
const jsUri = (0, import_shared_utils.getSpecifier)(importModule);
|
|
120
|
+
const jsUri = importModule.specifier.startsWith("/") ? importModule.specifier : (0, import_shared_utils.getSpecifier)(importModule);
|
|
121
121
|
dispatchRequests.push(this.dispatchJSResourceRecursive(jsUri, dispatcher, siteConfig));
|
|
122
122
|
}
|
|
123
123
|
const dynamicImports = moduleDefinition.linkedModuleRecord?.dynamicImports || moduleDefinition.bundleRecord?.dynamicImports || [];
|
|
124
124
|
for (const importModule of dynamicImports) {
|
|
125
|
-
const jsUri = (0, import_shared_utils.getSpecifier)(importModule);
|
|
125
|
+
const jsUri = importModule.specifier.startsWith("/") ? importModule.specifier : (0, import_shared_utils.getSpecifier)(importModule);
|
|
126
126
|
dispatchRequests.push(this.dispatchJSResourceRecursive(jsUri, dispatcher, siteConfig));
|
|
127
127
|
}
|
|
128
128
|
}
|
package/build/es/index.js
CHANGED
|
@@ -203,6 +203,12 @@ export function createServer(config) {
|
|
|
203
203
|
export async function generateStaticSite(config) {
|
|
204
204
|
config = config || {};
|
|
205
205
|
config.serverType = 'fs'; // override serverType
|
|
206
|
+
const { serverMode } = config;
|
|
207
|
+
if (serverMode === 'dev' || serverMode === 'compat') {
|
|
208
|
+
// TODO: dynamic imports are not generated in dev mode
|
|
209
|
+
// https://github.com/salesforce/lwr/issues/1111
|
|
210
|
+
console.warn('[WARN] static generation in `dev` or `compat` mode is currently not fully supported');
|
|
211
|
+
}
|
|
206
212
|
const lwrApp = createServer(config);
|
|
207
213
|
overrideConfigAsSrc(lwrApp);
|
|
208
214
|
await lwrApp.init();
|
|
@@ -123,7 +123,7 @@ export default function apiMiddleware(app, context) {
|
|
|
123
123
|
const jsonQuery = req.isJsonRequest()
|
|
124
124
|
? `${ctx.runtimeEnvironment.debug ? '&' : '?'}json`
|
|
125
125
|
: '';
|
|
126
|
-
const uri = await moduleRegistry.resolveModuleUri({ ...moduleId, version: moduleEntry.version }, ctx.runtimeEnvironment, ctx.runtimeParams);
|
|
126
|
+
const uri = await moduleRegistry.resolveModuleUri({ ...moduleId, version: moduleEntry.version }, ctx.runtimeEnvironment, ctx.runtimeParams, ownHash);
|
|
127
127
|
res.set({
|
|
128
128
|
// This redirects to a signed URI
|
|
129
129
|
Location: `${uri}${jsonQuery}`,
|
|
@@ -261,7 +261,7 @@ export default function apiMiddleware(app, context) {
|
|
|
261
261
|
const jsonQuery = req.isJsonRequest()
|
|
262
262
|
? `${ctx.runtimeEnvironment.debug ? '&' : '?'}json`
|
|
263
263
|
: '';
|
|
264
|
-
const uri = await moduleRegistry.resolveModuleUri({ ...moduleId, version: moduleEntry.version }, ctx.runtimeEnvironment, ctx.runtimeParams);
|
|
264
|
+
const uri = await moduleRegistry.resolveModuleUri({ ...moduleId, version: moduleEntry.version }, ctx.runtimeEnvironment, ctx.runtimeParams, ownHash);
|
|
265
265
|
res.set({
|
|
266
266
|
// This redirects to a signed URI
|
|
267
267
|
Location: `${uri}${jsonQuery}`,
|
|
@@ -151,7 +151,9 @@ export default class SiteGenerator {
|
|
|
151
151
|
const imports = moduleDefinition.linkedModuleRecord?.imports || moduleDefinition.bundleRecord?.imports || [];
|
|
152
152
|
// /1/module/esm/0/l/en-US/mi/lwc
|
|
153
153
|
for (const importModule of imports) {
|
|
154
|
-
const jsUri =
|
|
154
|
+
const jsUri = importModule.specifier.startsWith('/')
|
|
155
|
+
? importModule.specifier
|
|
156
|
+
: getSpecifier(importModule);
|
|
155
157
|
dispatchRequests.push(this.dispatchJSResourceRecursive(jsUri, dispatcher, siteConfig));
|
|
156
158
|
}
|
|
157
159
|
// Dynamic imports
|
|
@@ -159,7 +161,9 @@ export default class SiteGenerator {
|
|
|
159
161
|
moduleDefinition.bundleRecord?.dynamicImports ||
|
|
160
162
|
[];
|
|
161
163
|
for (const importModule of dynamicImports) {
|
|
162
|
-
const jsUri =
|
|
164
|
+
const jsUri = importModule.specifier.startsWith('/')
|
|
165
|
+
? importModule.specifier
|
|
166
|
+
: getSpecifier(importModule);
|
|
163
167
|
dispatchRequests.push(this.dispatchJSResourceRecursive(jsUri, dispatcher, siteConfig));
|
|
164
168
|
}
|
|
165
169
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.6.0-alpha.
|
|
7
|
+
"version": "0.6.0-alpha.15",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,31 +33,31 @@
|
|
|
33
33
|
"package.cjs"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@lwrjs/app-service": "0.6.0-alpha.
|
|
37
|
-
"@lwrjs/asset-registry": "0.6.0-alpha.
|
|
38
|
-
"@lwrjs/asset-transformer": "0.6.0-alpha.
|
|
39
|
-
"@lwrjs/base-template-engine": "0.6.0-alpha.
|
|
40
|
-
"@lwrjs/base-view-provider": "0.6.0-alpha.
|
|
41
|
-
"@lwrjs/base-view-transformer": "0.6.0-alpha.
|
|
42
|
-
"@lwrjs/client-modules": "0.6.0-alpha.
|
|
43
|
-
"@lwrjs/compiler": "0.6.0-alpha.
|
|
44
|
-
"@lwrjs/diagnostics": "0.6.0-alpha.
|
|
45
|
-
"@lwrjs/fs-asset-provider": "0.6.0-alpha.
|
|
46
|
-
"@lwrjs/html-view-provider": "0.6.0-alpha.
|
|
47
|
-
"@lwrjs/loader": "0.6.0-alpha.
|
|
48
|
-
"@lwrjs/lwc-module-provider": "0.6.0-alpha.
|
|
49
|
-
"@lwrjs/lwc-ssr": "0.6.0-alpha.
|
|
50
|
-
"@lwrjs/markdown-view-provider": "0.6.0-alpha.
|
|
51
|
-
"@lwrjs/module-bundler": "0.6.0-alpha.
|
|
52
|
-
"@lwrjs/module-registry": "0.6.0-alpha.
|
|
53
|
-
"@lwrjs/npm-module-provider": "0.6.0-alpha.
|
|
54
|
-
"@lwrjs/nunjucks-view-provider": "0.6.0-alpha.
|
|
55
|
-
"@lwrjs/o11y": "0.6.0-alpha.
|
|
56
|
-
"@lwrjs/resource-registry": "0.6.0-alpha.
|
|
57
|
-
"@lwrjs/router": "0.6.0-alpha.
|
|
58
|
-
"@lwrjs/server": "0.6.0-alpha.
|
|
59
|
-
"@lwrjs/shared-utils": "0.6.0-alpha.
|
|
60
|
-
"@lwrjs/view-registry": "0.6.0-alpha.
|
|
36
|
+
"@lwrjs/app-service": "0.6.0-alpha.15",
|
|
37
|
+
"@lwrjs/asset-registry": "0.6.0-alpha.15",
|
|
38
|
+
"@lwrjs/asset-transformer": "0.6.0-alpha.15",
|
|
39
|
+
"@lwrjs/base-template-engine": "0.6.0-alpha.15",
|
|
40
|
+
"@lwrjs/base-view-provider": "0.6.0-alpha.15",
|
|
41
|
+
"@lwrjs/base-view-transformer": "0.6.0-alpha.15",
|
|
42
|
+
"@lwrjs/client-modules": "0.6.0-alpha.15",
|
|
43
|
+
"@lwrjs/compiler": "0.6.0-alpha.15",
|
|
44
|
+
"@lwrjs/diagnostics": "0.6.0-alpha.15",
|
|
45
|
+
"@lwrjs/fs-asset-provider": "0.6.0-alpha.15",
|
|
46
|
+
"@lwrjs/html-view-provider": "0.6.0-alpha.15",
|
|
47
|
+
"@lwrjs/loader": "0.6.0-alpha.15",
|
|
48
|
+
"@lwrjs/lwc-module-provider": "0.6.0-alpha.15",
|
|
49
|
+
"@lwrjs/lwc-ssr": "0.6.0-alpha.15",
|
|
50
|
+
"@lwrjs/markdown-view-provider": "0.6.0-alpha.15",
|
|
51
|
+
"@lwrjs/module-bundler": "0.6.0-alpha.15",
|
|
52
|
+
"@lwrjs/module-registry": "0.6.0-alpha.15",
|
|
53
|
+
"@lwrjs/npm-module-provider": "0.6.0-alpha.15",
|
|
54
|
+
"@lwrjs/nunjucks-view-provider": "0.6.0-alpha.15",
|
|
55
|
+
"@lwrjs/o11y": "0.6.0-alpha.15",
|
|
56
|
+
"@lwrjs/resource-registry": "0.6.0-alpha.15",
|
|
57
|
+
"@lwrjs/router": "0.6.0-alpha.15",
|
|
58
|
+
"@lwrjs/server": "0.6.0-alpha.15",
|
|
59
|
+
"@lwrjs/shared-utils": "0.6.0-alpha.15",
|
|
60
|
+
"@lwrjs/view-registry": "0.6.0-alpha.15",
|
|
61
61
|
"dompurify": "^2.3.0",
|
|
62
62
|
"fs-extra": "^10.0.0",
|
|
63
63
|
"jsdom": "^16.7.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"qs": "^6.9.4"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@lwrjs/types": "0.6.0-alpha.
|
|
70
|
+
"@lwrjs/types": "0.6.0-alpha.15"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"lwc": ">= 1.x <= 2.x"
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": ">=14.15.4 <17"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "ebff01c190ee6f2777028f103e51446a1a8f00f7"
|
|
79
79
|
}
|