@lwrjs/core 0.7.2 → 0.7.3

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
- const dir = (0, import_dir.createResourceDir)(url, outputDir);
185
- const localeDir = (0, import_dir.createResourceDir)(url, (0, import_path.join)(outputDir, siteConfig.locale));
186
- const filePath = (0, import_path.join)(dir, "index.html");
187
- const fileLocalePath = (0, import_path.join)(localeDir, "index.html");
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
- const dir = createResourceDir(url, outputDir);
257
- const localeDir = createResourceDir(url, join(outputDir, siteConfig.locale));
258
- // TODO: We assume HTML, revisit this in the future
259
- // This fails for routes configured with non-html file extensions.
260
- // Example Route: "path": "/mixed_templates.md", (Configured as '/mixed_templates' would work)
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
- const filePath = join(dir, 'index.html');
263
- const fileLocalePath = join(localeDir, 'index.html');
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.2",
7
+ "version": "0.7.3",
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.2",
37
- "@lwrjs/asset-registry": "0.7.2",
38
- "@lwrjs/asset-transformer": "0.7.2",
39
- "@lwrjs/base-template-engine": "0.7.2",
40
- "@lwrjs/base-view-provider": "0.7.2",
41
- "@lwrjs/base-view-transformer": "0.7.2",
42
- "@lwrjs/client-modules": "0.7.2",
43
- "@lwrjs/compiler": "0.7.2",
44
- "@lwrjs/diagnostics": "0.7.2",
45
- "@lwrjs/fs-asset-provider": "0.7.2",
46
- "@lwrjs/html-view-provider": "0.7.2",
47
- "@lwrjs/loader": "0.7.2",
48
- "@lwrjs/lwc-module-provider": "0.7.2",
49
- "@lwrjs/lwc-ssr": "0.7.2",
50
- "@lwrjs/markdown-view-provider": "0.7.2",
51
- "@lwrjs/module-bundler": "0.7.2",
52
- "@lwrjs/module-registry": "0.7.2",
53
- "@lwrjs/npm-module-provider": "0.7.2",
54
- "@lwrjs/nunjucks-view-provider": "0.7.2",
55
- "@lwrjs/o11y": "0.7.2",
56
- "@lwrjs/resource-registry": "0.7.2",
57
- "@lwrjs/router": "0.7.2",
58
- "@lwrjs/server": "0.7.2",
59
- "@lwrjs/shared-utils": "0.7.2",
60
- "@lwrjs/view-registry": "0.7.2",
36
+ "@lwrjs/app-service": "0.7.3",
37
+ "@lwrjs/asset-registry": "0.7.3",
38
+ "@lwrjs/asset-transformer": "0.7.3",
39
+ "@lwrjs/base-template-engine": "0.7.3",
40
+ "@lwrjs/base-view-provider": "0.7.3",
41
+ "@lwrjs/base-view-transformer": "0.7.3",
42
+ "@lwrjs/client-modules": "0.7.3",
43
+ "@lwrjs/compiler": "0.7.3",
44
+ "@lwrjs/diagnostics": "0.7.3",
45
+ "@lwrjs/fs-asset-provider": "0.7.3",
46
+ "@lwrjs/html-view-provider": "0.7.3",
47
+ "@lwrjs/loader": "0.7.3",
48
+ "@lwrjs/lwc-module-provider": "0.7.3",
49
+ "@lwrjs/lwc-ssr": "0.7.3",
50
+ "@lwrjs/markdown-view-provider": "0.7.3",
51
+ "@lwrjs/module-bundler": "0.7.3",
52
+ "@lwrjs/module-registry": "0.7.3",
53
+ "@lwrjs/npm-module-provider": "0.7.3",
54
+ "@lwrjs/nunjucks-view-provider": "0.7.3",
55
+ "@lwrjs/o11y": "0.7.3",
56
+ "@lwrjs/resource-registry": "0.7.3",
57
+ "@lwrjs/router": "0.7.3",
58
+ "@lwrjs/server": "0.7.3",
59
+ "@lwrjs/shared-utils": "0.7.3",
60
+ "@lwrjs/view-registry": "0.7.3",
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.2"
68
+ "@lwrjs/types": "0.7.3"
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": "1467a95aa5dcf6901e1122f6025ffd4f22237a3f"
76
+ "gitHead": "579f94fac6c6c923dcab1e51d9d9169af7fedd1d"
77
77
  }