@lwrjs/core 0.7.2 → 0.7.5
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.
|
@@ -101,8 +101,8 @@ var SiteGenerator = class {
|
|
|
101
101
|
const {visitedUrls} = siteConfig;
|
|
102
102
|
if (!visitedUrls.has(url)) {
|
|
103
103
|
visitedUrls.add(url);
|
|
104
|
-
if (url.indexOf("/:") !== -1) {
|
|
105
|
-
console.error("Skipped url with variable path segment: " + url);
|
|
104
|
+
if (url.indexOf("/:") !== -1 || url.indexOf("*") !== -1) {
|
|
105
|
+
console.error("Skipped generation of url with variable path segment: " + url);
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
let context;
|
|
@@ -181,10 +181,17 @@ var SiteGenerator = class {
|
|
|
181
181
|
}
|
|
182
182
|
async handleHtmlResource(url, context, siteConfig, dispatcher) {
|
|
183
183
|
const {outputDir} = siteConfig;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
184
|
+
let fileName = "index.html";
|
|
185
|
+
let directoryPath = url;
|
|
186
|
+
if (url.endsWith(".html") || url.endsWith(".xml")) {
|
|
187
|
+
const lastPathIndex = url.lastIndexOf("/") + 1;
|
|
188
|
+
fileName = url.substring(lastPathIndex, url.length);
|
|
189
|
+
directoryPath = url.substring(0, lastPathIndex);
|
|
190
|
+
}
|
|
191
|
+
const dir = (0, import_dir.createResourceDir)(directoryPath, outputDir);
|
|
192
|
+
const localeDir = (0, import_dir.createResourceDir)(directoryPath, (0, import_path.join)(outputDir, siteConfig.locale));
|
|
193
|
+
const filePath = (0, import_path.join)(dir, fileName);
|
|
194
|
+
const fileLocalePath = (0, import_path.join)(localeDir, fileName);
|
|
188
195
|
if (siteConfig.locale.toLowerCase().startsWith("en")) {
|
|
189
196
|
siteConfig.viewPaths.add(filePath);
|
|
190
197
|
await (0, import_stream.writeResponse)(context, filePath);
|
|
@@ -108,8 +108,8 @@ export default class SiteGenerator {
|
|
|
108
108
|
visitedUrls.add(url); // Maintain a list of visited urls here to avoid potential infinite loops
|
|
109
109
|
// Skip urls with path segment variables (i.e. '/custom/:bar')
|
|
110
110
|
// Users can specify specific urls via the '_additionalRoutePaths' config property
|
|
111
|
-
if (url.indexOf('/:') !== -1) {
|
|
112
|
-
console.error('Skipped url with variable path segment: ' + url);
|
|
111
|
+
if (url.indexOf('/:') !== -1 || url.indexOf('*') !== -1) {
|
|
112
|
+
console.error('Skipped generation of url with variable path segment: ' + url);
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
// Generate resource
|
|
@@ -253,14 +253,24 @@ export default class SiteGenerator {
|
|
|
253
253
|
*/
|
|
254
254
|
async handleHtmlResource(url, context, siteConfig, dispatcher) {
|
|
255
255
|
const { outputDir } = siteConfig;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
//
|
|
259
|
-
//
|
|
260
|
-
|
|
256
|
+
let fileName = 'index.html';
|
|
257
|
+
let directoryPath = url;
|
|
258
|
+
// If we have a route path that ends with a html or xml file extension,
|
|
259
|
+
// use that last path segment for the file name
|
|
260
|
+
if (url.endsWith('.html') || url.endsWith('.xml')) {
|
|
261
|
+
const lastPathIndex = url.lastIndexOf('/') + 1;
|
|
262
|
+
fileName = url.substring(lastPathIndex, url.length);
|
|
263
|
+
directoryPath = url.substring(0, lastPathIndex);
|
|
264
|
+
}
|
|
265
|
+
const dir = createResourceDir(directoryPath, outputDir);
|
|
266
|
+
const localeDir = createResourceDir(directoryPath, join(outputDir, siteConfig.locale));
|
|
267
|
+
// TODO: Should we handle routes with non-html extensions differently?
|
|
268
|
+
// Example Route: "path": "/mixed_templates.md" (not sure why you would do this)
|
|
261
269
|
// "contentTemplate": "$contentDir/composed_markdown.md"
|
|
262
|
-
|
|
263
|
-
|
|
270
|
+
// Today this will get written to /mixed_templates.md/index.html
|
|
271
|
+
// Which we workaround by setting "renderSingle": true in serve.json
|
|
272
|
+
const filePath = join(dir, fileName);
|
|
273
|
+
const fileLocalePath = join(localeDir, fileName);
|
|
264
274
|
// Default Path (only write once)
|
|
265
275
|
// The default locale is english
|
|
266
276
|
if (siteConfig.locale.toLowerCase().startsWith('en')) {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.7.
|
|
7
|
+
"version": "0.7.5",
|
|
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.7.
|
|
37
|
-
"@lwrjs/asset-registry": "0.7.
|
|
38
|
-
"@lwrjs/asset-transformer": "0.7.
|
|
39
|
-
"@lwrjs/base-template-engine": "0.7.
|
|
40
|
-
"@lwrjs/base-view-provider": "0.7.
|
|
41
|
-
"@lwrjs/base-view-transformer": "0.7.
|
|
42
|
-
"@lwrjs/client-modules": "0.7.
|
|
43
|
-
"@lwrjs/compiler": "0.7.
|
|
44
|
-
"@lwrjs/diagnostics": "0.7.
|
|
45
|
-
"@lwrjs/fs-asset-provider": "0.7.
|
|
46
|
-
"@lwrjs/html-view-provider": "0.7.
|
|
47
|
-
"@lwrjs/loader": "0.7.
|
|
48
|
-
"@lwrjs/lwc-module-provider": "0.7.
|
|
49
|
-
"@lwrjs/lwc-ssr": "0.7.
|
|
50
|
-
"@lwrjs/markdown-view-provider": "0.7.
|
|
51
|
-
"@lwrjs/module-bundler": "0.7.
|
|
52
|
-
"@lwrjs/module-registry": "0.7.
|
|
53
|
-
"@lwrjs/npm-module-provider": "0.7.
|
|
54
|
-
"@lwrjs/nunjucks-view-provider": "0.7.
|
|
55
|
-
"@lwrjs/o11y": "0.7.
|
|
56
|
-
"@lwrjs/resource-registry": "0.7.
|
|
57
|
-
"@lwrjs/router": "0.7.
|
|
58
|
-
"@lwrjs/server": "0.7.
|
|
59
|
-
"@lwrjs/shared-utils": "0.7.
|
|
60
|
-
"@lwrjs/view-registry": "0.7.
|
|
36
|
+
"@lwrjs/app-service": "0.7.5",
|
|
37
|
+
"@lwrjs/asset-registry": "0.7.5",
|
|
38
|
+
"@lwrjs/asset-transformer": "0.7.5",
|
|
39
|
+
"@lwrjs/base-template-engine": "0.7.5",
|
|
40
|
+
"@lwrjs/base-view-provider": "0.7.5",
|
|
41
|
+
"@lwrjs/base-view-transformer": "0.7.5",
|
|
42
|
+
"@lwrjs/client-modules": "0.7.5",
|
|
43
|
+
"@lwrjs/compiler": "0.7.5",
|
|
44
|
+
"@lwrjs/diagnostics": "0.7.5",
|
|
45
|
+
"@lwrjs/fs-asset-provider": "0.7.5",
|
|
46
|
+
"@lwrjs/html-view-provider": "0.7.5",
|
|
47
|
+
"@lwrjs/loader": "0.7.5",
|
|
48
|
+
"@lwrjs/lwc-module-provider": "0.7.5",
|
|
49
|
+
"@lwrjs/lwc-ssr": "0.7.5",
|
|
50
|
+
"@lwrjs/markdown-view-provider": "0.7.5",
|
|
51
|
+
"@lwrjs/module-bundler": "0.7.5",
|
|
52
|
+
"@lwrjs/module-registry": "0.7.5",
|
|
53
|
+
"@lwrjs/npm-module-provider": "0.7.5",
|
|
54
|
+
"@lwrjs/nunjucks-view-provider": "0.7.5",
|
|
55
|
+
"@lwrjs/o11y": "0.7.5",
|
|
56
|
+
"@lwrjs/resource-registry": "0.7.5",
|
|
57
|
+
"@lwrjs/router": "0.7.5",
|
|
58
|
+
"@lwrjs/server": "0.7.5",
|
|
59
|
+
"@lwrjs/shared-utils": "0.7.5",
|
|
60
|
+
"@lwrjs/view-registry": "0.7.5",
|
|
61
61
|
"fs-extra": "^10.1.0",
|
|
62
62
|
"jsonc-parser": "^3.0.0",
|
|
63
63
|
"ms": "^2.1.3",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"qs": "^6.9.4"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@lwrjs/types": "0.7.
|
|
68
|
+
"@lwrjs/types": "0.7.5"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"lwc": ">= 1.x <= 2.x"
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": ">=14.15.4 <19"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "a30a1ca0d171c56914d65dd8747bfdfbd3529efa"
|
|
77
77
|
}
|