@lwrjs/app-service 0.11.0-alpha.0 → 0.11.0-alpha.10
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.
|
@@ -25,20 +25,19 @@ var __toModule = (module2) => {
|
|
|
25
25
|
__markAsModule(exports);
|
|
26
26
|
__export(exports, {
|
|
27
27
|
createAppRouteViewBootstrapModule: () => createAppRouteViewBootstrapModule,
|
|
28
|
-
createAppWorkerBootstrapModule: () => createAppWorkerBootstrapModule
|
|
29
|
-
normalizeBootstrap: () => normalizeBootstrap
|
|
28
|
+
createAppWorkerBootstrapModule: () => createAppWorkerBootstrapModule
|
|
30
29
|
});
|
|
31
30
|
var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
|
|
32
31
|
function getDefaultImportName(service) {
|
|
33
|
-
return `loaderService_${service
|
|
32
|
+
return (0, import_shared_utils.stringToVariableName)(`loaderService_${service}`);
|
|
34
33
|
}
|
|
35
34
|
function createServicesSource(services) {
|
|
36
|
-
const imports = services.map((
|
|
37
|
-
const defaultImportName = getDefaultImportName(
|
|
38
|
-
return `import ${defaultImportName} from '${
|
|
35
|
+
const imports = services.map(({name}) => {
|
|
36
|
+
const defaultImportName = getDefaultImportName(name);
|
|
37
|
+
return `import ${defaultImportName} from '${name}'`;
|
|
39
38
|
});
|
|
40
|
-
const body = services.map((
|
|
41
|
-
const defaultImportName = getDefaultImportName(
|
|
39
|
+
const body = services.map(({name}) => {
|
|
40
|
+
const defaultImportName = getDefaultImportName(name);
|
|
42
41
|
return `${defaultImportName}(services)`;
|
|
43
42
|
});
|
|
44
43
|
return [...imports, ...body].join(";\n") + ";";
|
|
@@ -65,12 +64,6 @@ function getServiceApiModule(format, moduleLoader) {
|
|
|
65
64
|
return moduleLoader;
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
|
-
function normalizeBootstrap(bootstrap) {
|
|
69
|
-
return {
|
|
70
|
-
...import_shared_utils.DEFAULT_LWR_BOOTSTRAP_CONFIG,
|
|
71
|
-
...bootstrap
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
67
|
function createAppRouteViewBootstrapModule(route, options, lockerConfig) {
|
|
75
68
|
const {bootstrap} = route;
|
|
76
69
|
const {services, syntheticShadow, ssr} = bootstrap;
|
|
@@ -100,11 +93,11 @@ esmLoaderInit({ imports, index, importMappings, endpoints });`,
|
|
|
100
93
|
ssr && `polyfillDeclarativeShadowDom();`,
|
|
101
94
|
`
|
|
102
95
|
// initialize additional non-configured root components
|
|
103
|
-
const { rootComponents,
|
|
96
|
+
const { rootComponents, serverData } = clientBootstrapConfig;
|
|
104
97
|
Promise.all(rootComponents.map(async (rootSpecifier) => {
|
|
105
98
|
const element = toKebabCase(rootSpecifier);
|
|
106
99
|
return import(rootSpecifier).then(({default: Ctor}) => {
|
|
107
|
-
init([[element, Ctor]],
|
|
100
|
+
init([[element, Ctor]], serverData);
|
|
108
101
|
});
|
|
109
102
|
return;
|
|
110
103
|
}));`,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LwrLockerConfig, NormalizedLwrErrorRoute, NormalizedLwrRoute } from '@lwrjs/types';
|
|
2
2
|
/**
|
|
3
3
|
* Create the virtual source for the application bootstrap module with a worker root
|
|
4
4
|
* @returns the generated source
|
|
5
5
|
*/
|
|
6
6
|
export declare function createAppWorkerBootstrapModule(workerSpecifier: string, route: NormalizedLwrRoute | NormalizedLwrErrorRoute, options: ModuleSourceOptions): string;
|
|
7
|
-
export declare function normalizeBootstrap(bootstrap?: LwrAppBootstrapConfig): NormalizedLwrAppBootstrapConfig;
|
|
8
7
|
interface ModuleSourceOptions {
|
|
9
8
|
hmrEnabled: boolean;
|
|
10
9
|
format: string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { stringToVariableName } from '@lwrjs/shared-utils';
|
|
2
2
|
function getDefaultImportName(service) {
|
|
3
|
-
return `loaderService_${service
|
|
3
|
+
return stringToVariableName(`loaderService_${service}`);
|
|
4
4
|
}
|
|
5
5
|
function createServicesSource(services) {
|
|
6
|
-
const imports = services.map((
|
|
7
|
-
const defaultImportName = getDefaultImportName(
|
|
8
|
-
return `import ${defaultImportName} from '${
|
|
6
|
+
const imports = services.map(({ name }) => {
|
|
7
|
+
const defaultImportName = getDefaultImportName(name);
|
|
8
|
+
return `import ${defaultImportName} from '${name}'`;
|
|
9
9
|
});
|
|
10
|
-
const body = services.map((
|
|
11
|
-
const defaultImportName = getDefaultImportName(
|
|
10
|
+
const body = services.map(({ name }) => {
|
|
11
|
+
const defaultImportName = getDefaultImportName(name);
|
|
12
12
|
return `${defaultImportName}(services)`;
|
|
13
13
|
});
|
|
14
14
|
return [...imports, ...body].join(';\n') + ';';
|
|
@@ -48,12 +48,6 @@ function getServiceApiModule(format, moduleLoader) {
|
|
|
48
48
|
return moduleLoader;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
export function normalizeBootstrap(bootstrap) {
|
|
52
|
-
return {
|
|
53
|
-
...DEFAULT_LWR_BOOTSTRAP_CONFIG,
|
|
54
|
-
...bootstrap,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
51
|
/**
|
|
58
52
|
* Create the virtual source for the application bootstrap module
|
|
59
53
|
* @returns the generated source
|
|
@@ -106,11 +100,11 @@ esmLoaderInit({ imports, index, importMappings, endpoints });`,
|
|
|
106
100
|
ssr && `polyfillDeclarativeShadowDom();`,
|
|
107
101
|
`
|
|
108
102
|
// initialize additional non-configured root components
|
|
109
|
-
const { rootComponents,
|
|
103
|
+
const { rootComponents, serverData } = clientBootstrapConfig;
|
|
110
104
|
Promise.all(rootComponents.map(async (rootSpecifier) => {
|
|
111
105
|
const element = toKebabCase(rootSpecifier);
|
|
112
106
|
return import(rootSpecifier).then(({default: Ctor}) => {
|
|
113
|
-
init([[element, Ctor]],
|
|
107
|
+
init([[element, Ctor]], serverData);
|
|
114
108
|
});
|
|
115
109
|
return;
|
|
116
110
|
}));`,
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.11.0-alpha.
|
|
7
|
+
"version": "0.11.0-alpha.10",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"build/**/*.d.ts"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@lwrjs/diagnostics": "0.11.0-alpha.
|
|
37
|
-
"@lwrjs/shared-utils": "0.11.0-alpha.
|
|
36
|
+
"@lwrjs/diagnostics": "0.11.0-alpha.10",
|
|
37
|
+
"@lwrjs/shared-utils": "0.11.0-alpha.10"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@lwrjs/types": "0.11.0-alpha.
|
|
40
|
+
"@lwrjs/types": "0.11.0-alpha.10"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=16.0.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "34b1e289e8de12531f5624b64512e870157195d4"
|
|
46
46
|
}
|