@lwrjs/view-registry 0.5.7 → 0.5.11-236-1

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.
@@ -34,7 +34,6 @@ function getViewBootstrapConfigurationResource(viewInfo, config, runtimeEnvironm
34
34
  const isESM = format === "esm";
35
35
  const defaultUrl = (0, import_shared_utils.getModuleUriPrefix)(runtimeEnvironment, runtimeParams);
36
36
  const mapping = (0, import_shared_utils.getMappingUriPrefix)(runtimeEnvironment, runtimeParams);
37
- const locale = runtimeParams?.locale;
38
37
  const endpoints = {
39
38
  uris: {
40
39
  mapping,
@@ -56,12 +55,13 @@ function getViewBootstrapConfigurationResource(viewInfo, config, runtimeEnvironm
56
55
  `globalThis.process = { env: { NODE_ENV: "${runtimeEnvironment.serverMode}" } };`
57
56
  ].filter(Boolean).join("\n");
58
57
  if (viewInfo.configAsSrc) {
59
- const url = viewInfo.url || "/";
58
+ const viewUrl = viewInfo.url || "/";
59
+ const url = (0, import_shared_utils.getClientBootstrapConfigurationUri)({id: viewInfo.id, url: viewUrl}, runtimeEnvironment, runtimeParams);
60
60
  return {
61
61
  type: CONTENT_TYPE,
62
62
  content: configString,
63
63
  inline: false,
64
- src: `/${apiVersion}/application/${format}/l/${locale}/ai/${viewInfo.id}/configuration/ci${url}`
64
+ src: url
65
65
  };
66
66
  } else {
67
67
  return {
@@ -30,7 +30,6 @@ __export(exports, {
30
30
  getModuleResource: () => getModuleResource,
31
31
  getModuleResourceByUri: () => getModuleResourceByUri,
32
32
  getRouteHandler: () => getRouteHandler,
33
- getViewConfigurationUri: () => getViewConfigurationUri,
34
33
  isViewResponse: () => isViewResponse,
35
34
  normalizeRenderOptions: () => normalizeRenderOptions,
36
35
  normalizeRenderedResult: () => normalizeRenderedResult,
@@ -149,13 +148,6 @@ async function getRouteHandler(path, {cacheDir, rootDir}) {
149
148
  throw new Error(`Unable to get routeHandler: ${path}`);
150
149
  }
151
150
  }
152
- function getViewConfigurationUri(viewRequest, route, runtimeEnvironment, runtimeParams) {
153
- const {url} = viewRequest;
154
- const {apiVersion, format} = runtimeEnvironment;
155
- const {locale} = runtimeParams;
156
- const {id} = route;
157
- return `/${apiVersion}/application/${format}/l/${locale}/ai/${id}/configuration/ci${url}`;
158
- }
159
151
  async function toJsonFormat(viewRequest, viewDefinition, route, runtimeEnvironment, runtimeParams, moduleRegistry) {
160
152
  const {viewRecord} = viewDefinition;
161
153
  const {bootstrap, id: appName} = route;
@@ -188,7 +180,7 @@ async function toJsonFormat(viewRequest, viewDefinition, route, runtimeEnvironme
188
180
  });
189
181
  resources.push({
190
182
  type: "application/javascript",
191
- src: getViewConfigurationUri(viewRequest, route, runtimeEnvironment, runtimeParams)
183
+ src: (0, import_shared_utils.getClientBootstrapConfigurationUri)({url: viewRequest.url, id: route.id}, runtimeEnvironment, runtimeParams)
192
184
  });
193
185
  }
194
186
  const mappingUrl = (0, import_shared_utils.getMappingUriPrefix)(runtimeEnvironment, runtimeParams);
@@ -1,11 +1,10 @@
1
- import { getMappingUriPrefix, getModuleUriPrefix } from '@lwrjs/shared-utils';
1
+ import { getMappingUriPrefix, getModuleUriPrefix, getClientBootstrapConfigurationUri, } from '@lwrjs/shared-utils';
2
2
  const CONTENT_TYPE = 'application/javascript';
3
3
  export function getViewBootstrapConfigurationResource(viewInfo, config, runtimeEnvironment, runtimeParams) {
4
4
  const { compat, debug, hmrEnabled, apiVersion, format } = runtimeEnvironment;
5
5
  const isESM = format === 'esm';
6
6
  const defaultUrl = getModuleUriPrefix(runtimeEnvironment, runtimeParams);
7
7
  const mapping = getMappingUriPrefix(runtimeEnvironment, runtimeParams);
8
- const locale = runtimeParams?.locale;
9
8
  const endpoints = {
10
9
  uris: {
11
10
  mapping,
@@ -31,12 +30,13 @@ export function getViewBootstrapConfigurationResource(viewInfo, config, runtimeE
31
30
  .filter(Boolean)
32
31
  .join('\n');
33
32
  if (viewInfo.configAsSrc) {
34
- const url = viewInfo.url || '/';
33
+ const viewUrl = viewInfo.url || '/';
34
+ const url = getClientBootstrapConfigurationUri({ id: viewInfo.id, url: viewUrl }, runtimeEnvironment, runtimeParams);
35
35
  return {
36
36
  type: CONTENT_TYPE,
37
37
  content: configString,
38
38
  inline: false,
39
- src: `/${apiVersion}/application/${format}/l/${locale}/ai/${viewInfo.id}/configuration/ci${url}`,
39
+ src: url,
40
40
  };
41
41
  }
42
42
  else {
@@ -17,7 +17,6 @@ interface RouteHandlerContext {
17
17
  * @param param1 - directories
18
18
  */
19
19
  export declare function getRouteHandler(path: string, { cacheDir, rootDir }: RouteHandlerContext): Promise<RouteHandlerFunction>;
20
- export declare function getViewConfigurationUri(viewRequest: ViewRequest, route: LwrRoute | LwrErrorRoute, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): string;
21
20
  export declare function toJsonFormat(viewRequest: ViewRequest, viewDefinition: LinkedViewDefinition, route: LwrRoute | LwrErrorRoute, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams, moduleRegistry: ModuleRegistry): Promise<ViewResponse>;
22
21
  export declare function getModuleResource(moduleId: Pick<ModuleId, 'specifier' | 'version'>, moduleRegistry: ModuleRegistry, runtimeEnvironment: RuntimeEnvironment, runtimeParams?: RuntimeParams, isPreload?: boolean): Promise<ResourceDefinition>;
23
22
  export declare function getModuleResourceByUri(moduleUri: string, runtimeEnvironment: RuntimeEnvironment, isPreload?: boolean): ResourceDefinition;
package/build/es/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import { explodeSpecifier, getMappingUriPrefix, getSpecifier, resolveFileExtension, transpileTs, DEFAULT_TITLE, } from '@lwrjs/shared-utils';
1
+ import { explodeSpecifier, getMappingUriPrefix, getSpecifier, resolveFileExtension, transpileTs, DEFAULT_TITLE, getClientBootstrapConfigurationUri, } from '@lwrjs/shared-utils';
2
2
  import libPath from 'path';
3
3
  import { basename, extname } from 'path';
4
4
  import { lookup } from 'mime-types';
@@ -122,13 +122,6 @@ export async function getRouteHandler(path, { cacheDir, rootDir }) {
122
122
  throw new Error(`Unable to get routeHandler: ${path}`);
123
123
  }
124
124
  }
125
- export function getViewConfigurationUri(viewRequest, route, runtimeEnvironment, runtimeParams) {
126
- const { url } = viewRequest;
127
- const { apiVersion, format } = runtimeEnvironment;
128
- const { locale } = runtimeParams;
129
- const { id } = route;
130
- return `/${apiVersion}/application/${format}/l/${locale}/ai/${id}/configuration/ci${url}`;
131
- }
132
125
  export async function toJsonFormat(viewRequest, viewDefinition, route, runtimeEnvironment, runtimeParams, moduleRegistry) {
133
126
  const { viewRecord } = viewDefinition;
134
127
  const { bootstrap, id: appName } = route;
@@ -166,7 +159,7 @@ export async function toJsonFormat(viewRequest, viewDefinition, route, runtimeEn
166
159
  // If bootstrapGraph exists exposes its resources via configuration URL
167
160
  resources.push({
168
161
  type: 'application/javascript',
169
- src: getViewConfigurationUri(viewRequest, route, runtimeEnvironment, runtimeParams),
162
+ src: getClientBootstrapConfigurationUri({ url: viewRequest.url, id: route.id }, runtimeEnvironment, runtimeParams),
170
163
  });
171
164
  }
172
165
  const mappingUrl = getMappingUriPrefix(runtimeEnvironment, runtimeParams);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.5.7",
7
+ "version": "0.5.11-236-1",
8
8
  "homepage": "https://lwr.dev/",
9
9
  "repository": {
10
10
  "type": "git",
@@ -30,16 +30,15 @@
30
30
  "build/**/*.d.ts"
31
31
  ],
32
32
  "dependencies": {
33
- "@lwrjs/app-service": "0.5.7",
34
- "@lwrjs/diagnostics": "0.5.7",
35
- "@lwrjs/shared-utils": "0.5.7",
33
+ "@lwrjs/app-service": "0.5.11-236-1",
34
+ "@lwrjs/diagnostics": "0.5.11-236-1",
35
+ "@lwrjs/shared-utils": "0.5.11-236-1",
36
36
  "magic-string": "^0.25.7"
37
37
  },
38
38
  "devDependencies": {
39
- "@lwrjs/types": "0.5.7"
39
+ "@lwrjs/types": "0.5.11-236-1"
40
40
  },
41
41
  "engines": {
42
42
  "node": ">=14.15.4 <17"
43
- },
44
- "gitHead": "406dbaa1c1f7a08b067e47c1c01d0b5295df3e5b"
43
+ }
45
44
  }
package/LICENSE DELETED
@@ -1,10 +0,0 @@
1
- MIT LICENSE
2
-
3
- Copyright (c) 2020, Salesforce.com, Inc.
4
- All rights reserved.
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
-
8
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
-
10
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.