@lwrjs/app-service 0.6.0-alpha.1 → 0.6.0-alpha.13
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.
|
@@ -73,25 +73,33 @@ function normalizeBootstrap(bootstrap) {
|
|
|
73
73
|
}
|
|
74
74
|
function createAppRouteViewBootstrapModule(route, options, lockerConfig) {
|
|
75
75
|
const {bootstrap} = route;
|
|
76
|
-
const {services, syntheticShadow} = bootstrap;
|
|
76
|
+
const {services, syntheticShadow, experimentalSSR} = bootstrap;
|
|
77
77
|
const isAMD = options.format === "amd";
|
|
78
78
|
const isESM = options.format === "esm";
|
|
79
79
|
const servicesSource = bootstrap.services && createServicesSource(bootstrap.services);
|
|
80
80
|
const serviceApiModule = getServiceApiModule(options.format, options.moduleLoader);
|
|
81
|
+
const bootstrapModule = experimentalSSR ? "lwr/initSsr" : "lwr/init";
|
|
81
82
|
return [
|
|
82
83
|
"/* This module is generated */",
|
|
84
|
+
isESM && `import { getClientBootstrapConfig } from 'lwr/preInit';`,
|
|
83
85
|
syntheticShadow && `import '@lwc/synthetic-shadow';`,
|
|
84
86
|
services && services.length && `import { services } from '${serviceApiModule}';`,
|
|
85
87
|
servicesSource,
|
|
86
88
|
isESM && options.hmrEnabled && `import { initHMR } from 'lwr/hmr';`,
|
|
87
|
-
`import { init
|
|
89
|
+
isESM && `import { init as esmLoaderInit } from 'lwr/esmLoader';`,
|
|
90
|
+
`import { init, toKebabCase } from '${bootstrapModule}';`,
|
|
88
91
|
isAMD && lockerConfig && lockerConfig.enabled && lockerConfig.clientOnly && `
|
|
89
92
|
import { registerLockerDefine } from 'lwr/lockerDefine';
|
|
90
93
|
registerLockerDefine(${JSON.stringify(lockerConfig.trustedComponents)});
|
|
91
94
|
`,
|
|
95
|
+
isESM && `const clientBootstrapConfig = getClientBootstrapConfig()`,
|
|
96
|
+
isAMD && `const clientBootstrapConfig = globalThis.LWR`,
|
|
97
|
+
isESM && `
|
|
98
|
+
const { imports, index, importMappings, endpoints } = clientBootstrapConfig;
|
|
99
|
+
esmLoaderInit({ imports, index, importMappings, endpoints });`,
|
|
92
100
|
`
|
|
93
101
|
// initialize additional non-configured root components
|
|
94
|
-
const { rootComponents } =
|
|
102
|
+
const { rootComponents } = clientBootstrapConfig;
|
|
95
103
|
Promise.all(rootComponents.map(async (rootSpecifier) => {
|
|
96
104
|
const element = toKebabCase(rootSpecifier);
|
|
97
105
|
if (globalThis.performance) {
|
|
@@ -105,7 +113,11 @@ Promise.all(rootComponents.map(async (rootSpecifier) => {
|
|
|
105
113
|
isESM && options.hmrEnabled && `
|
|
106
114
|
// HMR related initialization
|
|
107
115
|
const viewMetadata = globalThis._lwrRuntimeDebug.viewMetadata;
|
|
108
|
-
const hmrEndpoint =
|
|
109
|
-
initHMR(hmrEndpoint, viewMetadata)
|
|
116
|
+
const hmrEndpoint = clientBootstrapConfig.endpoints.uris.hmr;
|
|
117
|
+
initHMR(hmrEndpoint, viewMetadata);`,
|
|
118
|
+
isAMD && `
|
|
119
|
+
globalThis.LWR = Object.freeze({
|
|
120
|
+
define: globalThis.LWR.define,
|
|
121
|
+
});`
|
|
110
122
|
].filter(Boolean).join("\n");
|
|
111
123
|
}
|
package/build/es/identity.js
CHANGED
|
@@ -2,10 +2,10 @@ import { parsePackageSpecifier } from '@lwrjs/shared-utils';
|
|
|
2
2
|
/*
|
|
3
3
|
App Identity Taxonomy and Schema
|
|
4
4
|
Application identity is an extension of the URI package identity semantics:
|
|
5
|
-
https://rfcs.lwc.dev/rfcs/
|
|
5
|
+
https://rfcs.lwc.dev/rfcs/lwr/0000-uri-patterns#identity-semantics
|
|
6
6
|
|
|
7
7
|
Based on the App identity semantics:
|
|
8
|
-
https://rfcs.lwc.dev/rfcs/
|
|
8
|
+
https://rfcs.lwc.dev/rfcs/lwr/0000-lwr-bootstrap#application-definition-identifier-constraints
|
|
9
9
|
|
|
10
10
|
The combined schema for the domain of all application resource identities is described by the following
|
|
11
11
|
EBNF grammar:
|
|
@@ -60,23 +60,29 @@ export function normalizeBootstrap(bootstrap) {
|
|
|
60
60
|
*/
|
|
61
61
|
export function createAppRouteViewBootstrapModule(route, options, lockerConfig) {
|
|
62
62
|
const { bootstrap } = route;
|
|
63
|
-
const { services, syntheticShadow } = bootstrap;
|
|
63
|
+
const { services, syntheticShadow, experimentalSSR } = bootstrap;
|
|
64
64
|
const isAMD = options.format === 'amd';
|
|
65
65
|
const isESM = options.format === 'esm';
|
|
66
66
|
const servicesSource = bootstrap.services && createServicesSource(bootstrap.services);
|
|
67
67
|
const serviceApiModule = getServiceApiModule(options.format, options.moduleLoader);
|
|
68
|
+
const bootstrapModule = experimentalSSR ? 'lwr/initSsr' : 'lwr/init';
|
|
68
69
|
return [
|
|
69
70
|
'/* This module is generated */',
|
|
71
|
+
// pre app initialization step
|
|
72
|
+
// TODO: enable for AMD once https://github.com/salesforce/lwr/issues/1087 is implemented
|
|
73
|
+
isESM && `import { getClientBootstrapConfig } from 'lwr/preInit';`,
|
|
70
74
|
// conditional shadow
|
|
71
75
|
syntheticShadow && `import '@lwc/synthetic-shadow';`,
|
|
72
|
-
// Import
|
|
76
|
+
// Import bootstrap services
|
|
73
77
|
services && services.length && `import { services } from '${serviceApiModule}';`,
|
|
74
78
|
// import and register the configured services
|
|
75
79
|
servicesSource,
|
|
76
80
|
// HMR (ESM format only)
|
|
77
81
|
isESM && options.hmrEnabled && `import { initHMR } from 'lwr/hmr';`,
|
|
82
|
+
// Import the ESM module initializer
|
|
83
|
+
isESM && `import { init as esmLoaderInit } from 'lwr/esmLoader';`,
|
|
78
84
|
// init module
|
|
79
|
-
`import { init, toKebabCase } from '
|
|
85
|
+
`import { init, toKebabCase } from '${bootstrapModule}';`,
|
|
80
86
|
// locker
|
|
81
87
|
isAMD &&
|
|
82
88
|
lockerConfig &&
|
|
@@ -86,9 +92,18 @@ export function createAppRouteViewBootstrapModule(route, options, lockerConfig)
|
|
|
86
92
|
import { registerLockerDefine } from 'lwr/lockerDefine';
|
|
87
93
|
registerLockerDefine(${JSON.stringify(lockerConfig.trustedComponents)});
|
|
88
94
|
`,
|
|
95
|
+
// grab client bootstrap config
|
|
96
|
+
isESM && `const clientBootstrapConfig = getClientBootstrapConfig()`,
|
|
97
|
+
// TODO: https://github.com/salesforce/lwr/issues/1087
|
|
98
|
+
isAMD && `const clientBootstrapConfig = globalThis.LWR`,
|
|
99
|
+
// Initialize the ESM loader with the Client Bootstrap Config
|
|
100
|
+
isESM &&
|
|
101
|
+
`
|
|
102
|
+
const { imports, index, importMappings, endpoints } = clientBootstrapConfig;
|
|
103
|
+
esmLoaderInit({ imports, index, importMappings, endpoints });`,
|
|
89
104
|
`
|
|
90
105
|
// initialize additional non-configured root components
|
|
91
|
-
const { rootComponents } =
|
|
106
|
+
const { rootComponents } = clientBootstrapConfig;
|
|
92
107
|
Promise.all(rootComponents.map(async (rootSpecifier) => {
|
|
93
108
|
const element = toKebabCase(rootSpecifier);
|
|
94
109
|
if (globalThis.performance) {
|
|
@@ -104,8 +119,15 @@ Promise.all(rootComponents.map(async (rootSpecifier) => {
|
|
|
104
119
|
`
|
|
105
120
|
// HMR related initialization
|
|
106
121
|
const viewMetadata = globalThis._lwrRuntimeDebug.viewMetadata;
|
|
107
|
-
const hmrEndpoint =
|
|
122
|
+
const hmrEndpoint = clientBootstrapConfig.endpoints.uris.hmr;
|
|
108
123
|
initHMR(hmrEndpoint, viewMetadata);`,
|
|
124
|
+
// TODO: can be removed following https://github.com/salesforce/lwr/issues/1092
|
|
125
|
+
// LAST TASK: Cleanup globalThis.LWR in AMD
|
|
126
|
+
isAMD &&
|
|
127
|
+
`
|
|
128
|
+
globalThis.LWR = Object.freeze({
|
|
129
|
+
define: globalThis.LWR.define,
|
|
130
|
+
});`,
|
|
109
131
|
]
|
|
110
132
|
.filter(Boolean)
|
|
111
133
|
.join('\n');
|
package/package.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.6.0-alpha.
|
|
8
|
-
"homepage": "https://
|
|
7
|
+
"version": "0.6.0-alpha.13",
|
|
8
|
+
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/salesforce/lwr.git",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"build/**/*.d.ts"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@lwrjs/diagnostics": "0.6.0-alpha.
|
|
37
|
-
"@lwrjs/shared-utils": "0.6.0-alpha.
|
|
36
|
+
"@lwrjs/diagnostics": "0.6.0-alpha.13",
|
|
37
|
+
"@lwrjs/shared-utils": "0.6.0-alpha.13"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@lwrjs/types": "0.6.0-alpha.
|
|
40
|
+
"@lwrjs/types": "0.6.0-alpha.13"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=14.15.4 <17"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "056d10307fe29540d1586f8fd75e357b82ce2acc"
|
|
46
46
|
}
|