@lwrjs/core 0.13.0-alpha.1 → 0.13.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.
- package/build/cjs/context/provider.cjs +1 -1
- package/build/cjs/middleware/resource-middleware.cjs +1 -1
- package/build/cjs/tools/static-generation.cjs +12 -8
- package/build/cjs/tools/utils/network-dispatcher.cjs +1 -1
- package/build/es/context/provider.js +1 -1
- package/build/es/middleware/resource-middleware.js +1 -1
- package/build/es/tools/static-generation.js +13 -11
- package/build/es/tools/utils/network-dispatcher.js +2 -2
- package/package.json +31 -31
|
@@ -55,7 +55,7 @@ function createProviderContext(serverContext) {
|
|
|
55
55
|
notifyViewSourceChanged,
|
|
56
56
|
notifyAssetSourceChanged
|
|
57
57
|
} = serverContext.appEmitter;
|
|
58
|
-
const siteMetadata = staticSiteGenerator.outputDir && import_fs.default.existsSync(staticSiteGenerator.outputDir) ? new import_site_metadata.SiteMetadataImpl({rootDir: staticSiteGenerator.outputDir}) : void 0;
|
|
58
|
+
const siteMetadata = staticSiteGenerator.outputDir && import_fs.default.existsSync(staticSiteGenerator.outputDir) ? new import_site_metadata.SiteMetadataImpl({rootDir: staticSiteGenerator.outputDir, i18n}) : void 0;
|
|
59
59
|
return {
|
|
60
60
|
appObserver: (0, import_shared_utils.deepFreeze)({onModuleDefinitionChange, onModuleSourceChange}),
|
|
61
61
|
appEmitter: {
|
|
@@ -51,7 +51,7 @@ function createResourceMiddleware(context) {
|
|
|
51
51
|
res.status(200).type(resource.type).stream(resource.stream());
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
res.status(404).send(import_diagnostics.descriptions.UNRESOLVABLE.RESOURCE(resourceId.specifier).message);
|
|
54
|
+
res.status(404).send(import_diagnostics.descriptions.UNRESOLVABLE.RESOURCE(resourceId.specifier, resourceId.version).message);
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
function resourceMiddleware(app, context) {
|
|
@@ -232,14 +232,18 @@ var SiteGenerator = class {
|
|
|
232
232
|
addBundleToSiteMetadata(bundleDefinition, url, siteConfig) {
|
|
233
233
|
if (siteConfig.siteMetadata) {
|
|
234
234
|
const locale = siteConfig.locale;
|
|
235
|
-
const specifier =
|
|
236
|
-
const imports = bundleDefinition.bundleRecord.imports?.map((moduleRef) => (0,
|
|
237
|
-
const dynamicImports = bundleDefinition.bundleRecord.dynamicImports?.map((moduleRef) => (0,
|
|
235
|
+
const specifier = (0, import_site_metadata.getSiteBundleId)(bundleDefinition, locale, siteConfig.i18n);
|
|
236
|
+
const imports = bundleDefinition.bundleRecord.imports?.map((moduleRef) => (0, import_site_metadata.getSiteBundleId)(moduleRef, locale, siteConfig.i18n)) || [];
|
|
237
|
+
const dynamicImports = bundleDefinition.bundleRecord.dynamicImports?.map((moduleRef) => (0, import_site_metadata.getSiteBundleId)(moduleRef, locale, siteConfig.i18n));
|
|
238
|
+
const includedModules = bundleDefinition.bundleRecord.includedModules?.map((moduleRef) => {
|
|
239
|
+
const moduleId = (0, import_shared_utils.explodeSpecifier)(moduleRef);
|
|
240
|
+
return (0, import_site_metadata.getSiteBundleId)(moduleId, locale, siteConfig.i18n);
|
|
241
|
+
}) || [];
|
|
238
242
|
const version = bundleDefinition.version === import_shared_utils.VERSION_NOT_PROVIDED ? void 0 : bundleDefinition.version;
|
|
239
243
|
const bundleMetadata = {
|
|
240
244
|
version,
|
|
241
245
|
path: decodeURIComponent(url),
|
|
242
|
-
includedModules
|
|
246
|
+
includedModules,
|
|
243
247
|
imports,
|
|
244
248
|
dynamicImports
|
|
245
249
|
};
|
|
@@ -256,14 +260,14 @@ var SiteGenerator = class {
|
|
|
256
260
|
additionalInfo: resourceDefinition
|
|
257
261
|
});
|
|
258
262
|
} else {
|
|
259
|
-
const specifier = resourceDefinition.specifier;
|
|
260
263
|
const resourceMetadata = {
|
|
261
264
|
path: decodeURIComponent(url),
|
|
262
265
|
mimeType: resourceDefinition.type,
|
|
263
|
-
inline: resourceDefinition.inline
|
|
266
|
+
inline: resourceDefinition.inline,
|
|
267
|
+
version: resourceDefinition.version
|
|
264
268
|
};
|
|
265
269
|
const siteResources = siteConfig.siteMetadata.getSiteResources();
|
|
266
|
-
siteResources.resources[
|
|
270
|
+
siteResources.resources[(0, import_site_metadata.getSiteResourceId)(resourceDefinition)] = resourceMetadata;
|
|
267
271
|
}
|
|
268
272
|
}
|
|
269
273
|
}
|
|
@@ -555,7 +559,7 @@ var SiteGenerator = class {
|
|
|
555
559
|
endpoints,
|
|
556
560
|
skipBaseDocumentGeneration,
|
|
557
561
|
...featureFlags,
|
|
558
|
-
siteMetadata: new import_site_metadata.SiteMetadataImpl({rootDir: outputDir}),
|
|
562
|
+
siteMetadata: new import_site_metadata.SiteMetadataImpl({rootDir: outputDir, i18n}),
|
|
559
563
|
i18n
|
|
560
564
|
};
|
|
561
565
|
}
|
|
@@ -79,7 +79,7 @@ var NetworkDispatcher = class {
|
|
|
79
79
|
const jsonResponse = JSON.parse(body);
|
|
80
80
|
resolve(jsonResponse);
|
|
81
81
|
} catch (err) {
|
|
82
|
-
const message =
|
|
82
|
+
const message = !(0, import_shared_utils.isLocalDev)() ? `unexpected response body: [${method}][${lang}] ${url}: '${body}'` : `unexpected response body: [${method}][${lang}] ${url}`;
|
|
83
83
|
if (import_diagnostics.logger.isDebugEnabled()) {
|
|
84
84
|
import_diagnostics.logger.warn({
|
|
85
85
|
label: `NetworkDispatcher`,
|
|
@@ -7,7 +7,7 @@ export function createProviderContext(serverContext) {
|
|
|
7
7
|
const { onModuleDefinitionChange, onModuleSourceChange } = serverContext.appObserver;
|
|
8
8
|
const { notifyModuleDefinitionChanged, notifyModuleSourceChanged, notifyViewSourceChanged, notifyAssetSourceChanged, } = serverContext.appEmitter;
|
|
9
9
|
const siteMetadata = staticSiteGenerator.outputDir && fs.existsSync(staticSiteGenerator.outputDir)
|
|
10
|
-
? new SiteMetadataImpl({ rootDir: staticSiteGenerator.outputDir })
|
|
10
|
+
? new SiteMetadataImpl({ rootDir: staticSiteGenerator.outputDir, i18n })
|
|
11
11
|
: undefined;
|
|
12
12
|
return {
|
|
13
13
|
appObserver: deepFreeze({ onModuleDefinitionChange, onModuleSourceChange }),
|
|
@@ -23,7 +23,7 @@ function createResourceMiddleware(context) {
|
|
|
23
23
|
res.status(200).type(resource.type).stream(resource.stream());
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
res.status(404).send(descriptions.UNRESOLVABLE.RESOURCE(resourceId.specifier).message);
|
|
26
|
+
res.status(404).send(descriptions.UNRESOLVABLE.RESOURCE(resourceId.specifier, resourceId.version).message);
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
export function resourceMiddleware(app, context) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { performance } from 'perf_hooks';
|
|
2
2
|
import { logger } from '@lwrjs/diagnostics';
|
|
3
|
-
import { getSpecifier, getFeatureFlags, hashContent, isSelfUrl, getModuleUriPrefix, getMappingUriPrefix, isExternalUrl, mimeLookup, getViewUri, sortLocalesByFallback, VERSION_NOT_PROVIDED, PROTOCOL_FILE, normalizeFromFileURL, isExternalSpecifier, } from '@lwrjs/shared-utils';
|
|
4
|
-
import { SiteMetadataImpl } from '@lwrjs/static/site-metadata';
|
|
3
|
+
import { getSpecifier, getFeatureFlags, hashContent, isSelfUrl, getModuleUriPrefix, getMappingUriPrefix, isExternalUrl, mimeLookup, getViewUri, sortLocalesByFallback, VERSION_NOT_PROVIDED, PROTOCOL_FILE, normalizeFromFileURL, isExternalSpecifier, explodeSpecifier, } from '@lwrjs/shared-utils';
|
|
4
|
+
import { SiteMetadataImpl, getSiteBundleId, getSiteResourceId } from '@lwrjs/static/site-metadata';
|
|
5
5
|
import { join, dirname, extname, normalize } from 'path';
|
|
6
6
|
import fs from 'fs-extra';
|
|
7
7
|
import { writeResponse } from './utils/stream.js';
|
|
@@ -299,16 +299,18 @@ export default class SiteGenerator {
|
|
|
299
299
|
addBundleToSiteMetadata(bundleDefinition, url, siteConfig) {
|
|
300
300
|
if (siteConfig.siteMetadata) {
|
|
301
301
|
const locale = siteConfig.locale;
|
|
302
|
-
const specifier = siteConfig.i18n
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
const
|
|
306
|
-
|
|
302
|
+
const specifier = getSiteBundleId(bundleDefinition, locale, siteConfig.i18n);
|
|
303
|
+
const imports = bundleDefinition.bundleRecord.imports?.map((moduleRef) => getSiteBundleId(moduleRef, locale, siteConfig.i18n)) || [];
|
|
304
|
+
const dynamicImports = bundleDefinition.bundleRecord.dynamicImports?.map((moduleRef) => getSiteBundleId(moduleRef, locale, siteConfig.i18n));
|
|
305
|
+
const includedModules = bundleDefinition.bundleRecord.includedModules?.map((moduleRef) => {
|
|
306
|
+
const moduleId = explodeSpecifier(moduleRef);
|
|
307
|
+
return getSiteBundleId(moduleId, locale, siteConfig.i18n);
|
|
308
|
+
}) || [];
|
|
307
309
|
const version = bundleDefinition.version === VERSION_NOT_PROVIDED ? undefined : bundleDefinition.version;
|
|
308
310
|
const bundleMetadata = {
|
|
309
311
|
version,
|
|
310
312
|
path: decodeURIComponent(url),
|
|
311
|
-
includedModules
|
|
313
|
+
includedModules,
|
|
312
314
|
imports,
|
|
313
315
|
dynamicImports,
|
|
314
316
|
};
|
|
@@ -326,14 +328,14 @@ export default class SiteGenerator {
|
|
|
326
328
|
});
|
|
327
329
|
}
|
|
328
330
|
else {
|
|
329
|
-
const specifier = resourceDefinition.specifier;
|
|
330
331
|
const resourceMetadata = {
|
|
331
332
|
path: decodeURIComponent(url),
|
|
332
333
|
mimeType: resourceDefinition.type,
|
|
333
334
|
inline: resourceDefinition.inline,
|
|
335
|
+
version: resourceDefinition.version,
|
|
334
336
|
};
|
|
335
337
|
const siteResources = siteConfig.siteMetadata.getSiteResources();
|
|
336
|
-
siteResources.resources[
|
|
338
|
+
siteResources.resources[getSiteResourceId(resourceDefinition)] = resourceMetadata;
|
|
337
339
|
}
|
|
338
340
|
}
|
|
339
341
|
}
|
|
@@ -738,7 +740,7 @@ export default class SiteGenerator {
|
|
|
738
740
|
skipBaseDocumentGeneration,
|
|
739
741
|
// Only include LEGACY_LOADER if true
|
|
740
742
|
...featureFlags,
|
|
741
|
-
siteMetadata: new SiteMetadataImpl({ rootDir: outputDir }),
|
|
743
|
+
siteMetadata: new SiteMetadataImpl({ rootDir: outputDir, i18n }),
|
|
742
744
|
i18n,
|
|
743
745
|
};
|
|
744
746
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import http from 'http';
|
|
2
2
|
import https from 'https';
|
|
3
3
|
import { logger } from '@lwrjs/diagnostics';
|
|
4
|
-
import { isModuleOrBundleUrl } from '@lwrjs/shared-utils';
|
|
4
|
+
import { isLocalDev, isModuleOrBundleUrl } from '@lwrjs/shared-utils';
|
|
5
5
|
export default class NetworkDispatcher {
|
|
6
6
|
constructor(port, internalRequestKey) {
|
|
7
7
|
this.port = port || 3000;
|
|
@@ -53,7 +53,7 @@ export default class NetworkDispatcher {
|
|
|
53
53
|
resolve(jsonResponse);
|
|
54
54
|
}
|
|
55
55
|
catch (err) {
|
|
56
|
-
const message =
|
|
56
|
+
const message = !isLocalDev() // avoid giant log messages during local dev
|
|
57
57
|
? `unexpected response body: [${method}][${lang}] ${url}: '${body}'`
|
|
58
58
|
: `unexpected response body: [${method}][${lang}] ${url}`;
|
|
59
59
|
if (logger.isDebugEnabled()) {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.13.0-alpha.
|
|
7
|
+
"version": "0.13.0-alpha.10",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -43,34 +43,34 @@
|
|
|
43
43
|
"build": "tsc -b"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@lwrjs/app-service": "0.13.0-alpha.
|
|
47
|
-
"@lwrjs/asset-registry": "0.13.0-alpha.
|
|
48
|
-
"@lwrjs/asset-transformer": "0.13.0-alpha.
|
|
49
|
-
"@lwrjs/base-view-provider": "0.13.0-alpha.
|
|
50
|
-
"@lwrjs/base-view-transformer": "0.13.0-alpha.
|
|
51
|
-
"@lwrjs/client-modules": "0.13.0-alpha.
|
|
52
|
-
"@lwrjs/config": "0.13.0-alpha.
|
|
53
|
-
"@lwrjs/diagnostics": "0.13.0-alpha.
|
|
54
|
-
"@lwrjs/esbuild": "0.13.0-alpha.
|
|
55
|
-
"@lwrjs/fs-asset-provider": "0.13.0-alpha.
|
|
56
|
-
"@lwrjs/fs-watch": "0.13.0-alpha.
|
|
57
|
-
"@lwrjs/html-view-provider": "0.13.0-alpha.
|
|
58
|
-
"@lwrjs/instrumentation": "0.13.0-alpha.
|
|
59
|
-
"@lwrjs/loader": "0.13.0-alpha.
|
|
60
|
-
"@lwrjs/lwc-module-provider": "0.13.0-alpha.
|
|
61
|
-
"@lwrjs/lwc-ssr": "0.13.0-alpha.
|
|
62
|
-
"@lwrjs/markdown-view-provider": "0.13.0-alpha.
|
|
63
|
-
"@lwrjs/module-bundler": "0.13.0-alpha.
|
|
64
|
-
"@lwrjs/module-registry": "0.13.0-alpha.
|
|
65
|
-
"@lwrjs/npm-module-provider": "0.13.0-alpha.
|
|
66
|
-
"@lwrjs/nunjucks-view-provider": "0.13.0-alpha.
|
|
67
|
-
"@lwrjs/o11y": "0.13.0-alpha.
|
|
68
|
-
"@lwrjs/resource-registry": "0.13.0-alpha.
|
|
69
|
-
"@lwrjs/router": "0.13.0-alpha.
|
|
70
|
-
"@lwrjs/server": "0.13.0-alpha.
|
|
71
|
-
"@lwrjs/shared-utils": "0.13.0-alpha.
|
|
72
|
-
"@lwrjs/static": "0.13.0-alpha.
|
|
73
|
-
"@lwrjs/view-registry": "0.13.0-alpha.
|
|
46
|
+
"@lwrjs/app-service": "0.13.0-alpha.10",
|
|
47
|
+
"@lwrjs/asset-registry": "0.13.0-alpha.10",
|
|
48
|
+
"@lwrjs/asset-transformer": "0.13.0-alpha.10",
|
|
49
|
+
"@lwrjs/base-view-provider": "0.13.0-alpha.10",
|
|
50
|
+
"@lwrjs/base-view-transformer": "0.13.0-alpha.10",
|
|
51
|
+
"@lwrjs/client-modules": "0.13.0-alpha.10",
|
|
52
|
+
"@lwrjs/config": "0.13.0-alpha.10",
|
|
53
|
+
"@lwrjs/diagnostics": "0.13.0-alpha.10",
|
|
54
|
+
"@lwrjs/esbuild": "0.13.0-alpha.10",
|
|
55
|
+
"@lwrjs/fs-asset-provider": "0.13.0-alpha.10",
|
|
56
|
+
"@lwrjs/fs-watch": "0.13.0-alpha.10",
|
|
57
|
+
"@lwrjs/html-view-provider": "0.13.0-alpha.10",
|
|
58
|
+
"@lwrjs/instrumentation": "0.13.0-alpha.10",
|
|
59
|
+
"@lwrjs/loader": "0.13.0-alpha.10",
|
|
60
|
+
"@lwrjs/lwc-module-provider": "0.13.0-alpha.10",
|
|
61
|
+
"@lwrjs/lwc-ssr": "0.13.0-alpha.10",
|
|
62
|
+
"@lwrjs/markdown-view-provider": "0.13.0-alpha.10",
|
|
63
|
+
"@lwrjs/module-bundler": "0.13.0-alpha.10",
|
|
64
|
+
"@lwrjs/module-registry": "0.13.0-alpha.10",
|
|
65
|
+
"@lwrjs/npm-module-provider": "0.13.0-alpha.10",
|
|
66
|
+
"@lwrjs/nunjucks-view-provider": "0.13.0-alpha.10",
|
|
67
|
+
"@lwrjs/o11y": "0.13.0-alpha.10",
|
|
68
|
+
"@lwrjs/resource-registry": "0.13.0-alpha.10",
|
|
69
|
+
"@lwrjs/router": "0.13.0-alpha.10",
|
|
70
|
+
"@lwrjs/server": "0.13.0-alpha.10",
|
|
71
|
+
"@lwrjs/shared-utils": "0.13.0-alpha.10",
|
|
72
|
+
"@lwrjs/static": "0.13.0-alpha.10",
|
|
73
|
+
"@lwrjs/view-registry": "0.13.0-alpha.10",
|
|
74
74
|
"chokidar": "^3.6.0",
|
|
75
75
|
"esbuild": "^0.9.7",
|
|
76
76
|
"fs-extra": "^11.2.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"ws": "^8.16.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@lwrjs/types": "0.13.0-alpha.
|
|
83
|
+
"@lwrjs/types": "0.13.0-alpha.10",
|
|
84
84
|
"@types/ws": "^8.5.10",
|
|
85
85
|
"mock-fs": "^5.2.0"
|
|
86
86
|
},
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"volta": {
|
|
94
94
|
"extends": "../../../package.json"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "53e2a825868b4c9b1662419b531c80be13afd779"
|
|
97
97
|
}
|