@lwc/lwc-dev-server 8.1.0 → 9.0.0
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/dist/cli/commands/devServer.js +71 -20
- package/dist/cli/commands/devServer.js.map +1 -1
- package/dist/cli/commands/index.js +1 -1
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/server/bundler/lexBundler.js +1 -19
- package/dist/server/bundler/lexBundler.js.map +1 -1
- package/dist/server/connection/client.d.ts +2 -3
- package/dist/server/connection/client.js +16 -25
- package/dist/server/connection/client.js.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +18 -11
- package/dist/server/index.js.map +1 -1
- package/dist/server/moduleGraph/index.d.ts +26 -3
- package/dist/server/moduleGraph/index.js +86 -10
- package/dist/server/moduleGraph/index.js.map +1 -1
- package/dist/server/moduleGraph/workspaceScanner/fileReader.d.ts +3 -1
- package/dist/server/moduleGraph/workspaceScanner/fileReader.js +4 -1
- package/dist/server/moduleGraph/workspaceScanner/fileReader.js.map +1 -1
- package/dist/server/moduleGraph/workspaceScanner/scanner.d.ts +3 -2
- package/dist/server/moduleGraph/workspaceScanner/scanner.js +7 -6
- package/dist/server/moduleGraph/workspaceScanner/scanner.js.map +1 -1
- package/dist/server/util/aes.d.ts +7 -0
- package/dist/server/util/aes.js +22 -0
- package/dist/server/util/aes.js.map +1 -0
- package/dist/types/serverConfig.d.ts +4 -7
- package/dist/types/serverConfig.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { existsSync, readFileSync, lstatSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { Command, Option, InvalidArgumentError } from 'commander';
|
|
4
|
-
import { LogLevel, MAX_CLIENT_COUNT } from '../../types/index.js';
|
|
4
|
+
import { Workspace, LogLevel, MAX_CLIENT_COUNT } from '../../types/index.js';
|
|
5
5
|
import { startLwcDevServer } from '../../server/index.js';
|
|
6
6
|
import ConsoleLogger from '../../server/consoleLogger.js';
|
|
7
|
-
|
|
8
|
-
return new Option('-t, --target <target>', '[string] configured target for deployment')
|
|
9
|
-
.choices(['lex', 'mrt', 'mobile'])
|
|
10
|
-
.default('lex');
|
|
11
|
-
}
|
|
7
|
+
const consoleLogger = new ConsoleLogger(LogLevel.info);
|
|
12
8
|
function getPortOption() {
|
|
13
9
|
return new Option('-p, --port <number>', `[number] set port`)
|
|
14
10
|
.env('PORT')
|
|
@@ -27,22 +23,81 @@ function parseNumArg(value) {
|
|
|
27
23
|
}
|
|
28
24
|
return parsedValue;
|
|
29
25
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
26
|
+
function configExists(configFilePath) {
|
|
27
|
+
return existsSync(configFilePath) && lstatSync(configFilePath).isFile();
|
|
28
|
+
}
|
|
29
|
+
function readConfig(configFile, workspace) {
|
|
30
|
+
const parsedConfig = JSON.parse(readFileSync(configFile, 'utf-8'));
|
|
31
|
+
let rootDir, lwc, https;
|
|
32
|
+
consoleLogger.log(LogLevel.debug, `Found config file at "${configFile}" and initializing dev server with it.`);
|
|
33
|
+
if (workspace === Workspace.Mrt && path.basename(configFile).startsWith('lwc')) {
|
|
34
|
+
lwc = parsedConfig;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
rootDir = parsedConfig.rootDir;
|
|
38
|
+
lwc = parsedConfig.lwc;
|
|
39
|
+
https = parsedConfig.https;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
rootDir,
|
|
43
|
+
lwc,
|
|
44
|
+
https,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* SalesforceCLI workspaces don't require a config file to be present
|
|
49
|
+
* @returns config absolute path | undefined
|
|
50
|
+
*/
|
|
51
|
+
function getDefaultConfig(rootDir, workspace) {
|
|
52
|
+
if (workspace === Workspace.Internal) {
|
|
53
|
+
const configFile = path.resolve(rootDir, 'lwc.config.json');
|
|
54
|
+
if (configExists(configFile)) {
|
|
55
|
+
return configFile;
|
|
56
|
+
}
|
|
36
57
|
consoleLogger.log(LogLevel.error, `Failed to find a valid config file at ${configFile}.`);
|
|
37
58
|
process.exit(1);
|
|
38
59
|
}
|
|
39
|
-
|
|
60
|
+
else if (workspace === Workspace.Mrt) {
|
|
61
|
+
// 1. we check for lwr.config
|
|
62
|
+
const configFile = path.resolve(rootDir, 'lwr.config.json');
|
|
63
|
+
if (configExists(configFile)) {
|
|
64
|
+
return configFile;
|
|
65
|
+
}
|
|
66
|
+
// 2. fallback to lwc.config
|
|
67
|
+
const configFile2 = path.resolve(rootDir, 'lwc.config.json');
|
|
68
|
+
if (configExists(configFile2)) {
|
|
69
|
+
return configFile2;
|
|
70
|
+
}
|
|
71
|
+
// 3. none of the configs are present
|
|
72
|
+
consoleLogger.log(LogLevel.error, `Failed to find a valid config file at ${configFile} OR ${configFile2}.`);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function resolveModuleRootDir(rootDir, entryDir) {
|
|
77
|
+
if (entryDir.startsWith('$rootDir')) {
|
|
78
|
+
return entryDir.replace(/^\$rootDir/, rootDir);
|
|
79
|
+
}
|
|
80
|
+
else if (path.isAbsolute(entryDir)) {
|
|
81
|
+
return entryDir;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// entryDir is a relative path
|
|
85
|
+
return path.resolve(rootDir, entryDir);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function normalizeConfig({ config, port, logLevel, workspace, maxClientCount = MAX_CLIENT_COUNT, }) {
|
|
89
|
+
let rootDir = process.cwd();
|
|
90
|
+
const configFile = config
|
|
91
|
+
? path.resolve(rootDir, config)
|
|
92
|
+
: getDefaultConfig(rootDir, workspace);
|
|
93
|
+
const modulePaths = [];
|
|
94
|
+
const parsedConfig = configFile ? readConfig(configFile, workspace) : {};
|
|
40
95
|
consoleLogger.log(LogLevel.debug, `Found config file at "${configFile}" and initializing dev server with it.`);
|
|
41
96
|
rootDir = parsedConfig.rootDir ?? rootDir;
|
|
42
97
|
if (parsedConfig.lwc?.modules) {
|
|
43
98
|
parsedConfig.lwc.modules.forEach((entry) => {
|
|
44
99
|
if (entry.dir) {
|
|
45
|
-
const resolvedDir = entry.dir
|
|
100
|
+
const resolvedDir = resolveModuleRootDir(rootDir, entry.dir);
|
|
46
101
|
if (existsSync(resolvedDir)) {
|
|
47
102
|
modulePaths.push(resolvedDir);
|
|
48
103
|
consoleLogger.log(LogLevel.debug, `FS-Watcher: Adding ${resolvedDir} to watch.`);
|
|
@@ -56,16 +111,14 @@ function normalizeConfig({ config, port, target, logLevel, workspace, maxClientC
|
|
|
56
111
|
const normalizedConfig = {
|
|
57
112
|
rootDir,
|
|
58
113
|
port,
|
|
59
|
-
protocol: 'wss',
|
|
60
|
-
host: 'localhost',
|
|
61
114
|
// Component paths to watch
|
|
62
115
|
paths: modulePaths,
|
|
63
|
-
targets: [target],
|
|
64
116
|
workspace,
|
|
65
117
|
logLevel,
|
|
66
118
|
maxClientCount,
|
|
67
119
|
};
|
|
68
120
|
if (parsedConfig.https) {
|
|
121
|
+
// @ts-expect-error : typescript is unable to deduce that if we are here then configFile exists
|
|
69
122
|
normalizedConfig.https = parseHttpsConfig(parsedConfig.https, path.dirname(configFile));
|
|
70
123
|
}
|
|
71
124
|
return normalizedConfig;
|
|
@@ -103,14 +156,12 @@ export function createDevServer() {
|
|
|
103
156
|
.aliases(['preview'])
|
|
104
157
|
.description('Start Dev Server')
|
|
105
158
|
.addOption(getPortOption())
|
|
106
|
-
.addOption(getTargetOption())
|
|
107
159
|
.addOption(getWorkspaceOption())
|
|
108
160
|
.action(async (_options, cmd) => {
|
|
109
|
-
const { config, port,
|
|
161
|
+
const { config, port, logLevel, workspace } = cmd.optsWithGlobals();
|
|
110
162
|
const serverConfig = normalizeConfig({
|
|
111
163
|
config,
|
|
112
164
|
port,
|
|
113
|
-
target,
|
|
114
165
|
logLevel: LogLevel[logLevel],
|
|
115
166
|
workspace,
|
|
116
167
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devServer.js","sourceRoot":"","sources":["../../../src/cli/commands/devServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"devServer.js","sourceRoot":"","sources":["../../../src/cli/commands/devServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,aAAa,MAAM,+BAA+B,CAAC;AAI1D,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAEvD,SAAS,aAAa;IAClB,OAAO,IAAI,MAAM,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;SACxD,GAAG,CAAC,MAAM,CAAC;SACX,SAAS,CAAC,WAAW,CAAC;SACtB,mBAAmB,EAAE,CAAC;AAC/B,CAAC;AAED,SAAS,kBAAkB;IACvB,OAAO,IAAI,MAAM,CACb,6BAA6B,EAC7B,+CAA+C,CAClD;SACI,OAAO,CAAC,CAAC,UAAU,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;SAC7C,OAAO,CAAC,U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CAAC;AACX,CAAC"}
|
|
@@ -8,7 +8,7 @@ function getVersion() {
|
|
|
8
8
|
export function createCLI() {
|
|
9
9
|
return new Command('lwc-dev-server')
|
|
10
10
|
.description('LWC Local Developement')
|
|
11
|
-
.addOption(new Option('-c, --config <file>', `[string] use specified lwc.config.json file`)
|
|
11
|
+
.addOption(new Option('-c, --config <file>', `[string] use specified lwc.config.json file`))
|
|
12
12
|
.addOption(new Option('--rootDir <directory>', `[string] use specified root directory`).default(process.cwd(), '"."'))
|
|
13
13
|
.addOption(new Option('--logLevel <level>', `[string] use specified log level`)
|
|
14
14
|
.env('LWC_LOG_LEVEL')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,SAAS,UAAU;IACf,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAC1B,YAAY,CAAC,IAAI,GAAG,CAAC,uBAAuB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAC3E,CAAC;IACF,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,SAAS;IACrB,OAAO,IAAI,OAAO,CAAC,gBAAgB,CAAC;SAC/B,WAAW,CAAC,wBAAwB,CAAC;SACrC,SAAS,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,SAAS,UAAU;IACf,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAC1B,YAAY,CAAC,IAAI,GAAG,CAAC,uBAAuB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAC3E,CAAC;IACF,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,SAAS;IACrB,OAAO,IAAI,OAAO,CAAC,gBAAgB,CAAC;SAC/B,WAAW,CAAC,wBAAwB,CAAC;SACrC,SAAS,CAAC,IAAI,MAAM,CAAC,qBAAqB,EAAE,6CAA6C,CAAC,CAAC;SAC3F,SAAS,CACN,IAAI,MAAM,CAAC,uBAAuB,EAAE,uCAAuC,CAAC,CAAC,OAAO,CAChF,OAAO,CAAC,GAAG,EAAE,EACb,KAAK,CACR,CACJ;SACA,SAAS,CACN,IAAI,MAAM,CAAC,oBAAoB,EAAE,kCAAkC,CAAC;SAC/D,GAAG,CAAC,eAAe,CAAC;SACpB,OAAO,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;SAChE,OAAO,CAAC,MAAM,CAAC,CACvB;SACA,UAAU,CAAC,eAAe,EAAE,CAAC;SAC7B,kBAAkB,EAAE;SACpB,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
1
|
import { compile as platformCompile } from '@lwc/sfdc-lwc-compiler';
|
|
3
2
|
import { Workspace, LogLevel } from '../../types/index.js';
|
|
4
|
-
import { readModule } from '../util/fileUtil.js';
|
|
5
|
-
/**
|
|
6
|
-
* Fetch files and source related to the modulePath that is being hot loaded.
|
|
7
|
-
* @param {DevServerContext} ctx DevServer object for stateful information
|
|
8
|
-
* @param {string} name Name of the component being compiled
|
|
9
|
-
* @param {string} namespace The namespace of the component
|
|
10
|
-
* @param {string} modulePath The formatted path for the file being compiled.
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
function getBundleFiles(ctx, name, namespace, modulePath) {
|
|
14
|
-
const moduleDir = `${namespace}/${name}`;
|
|
15
|
-
const moduleFilePath = ctx.moduleGraph.getFileByModulePath(modulePath);
|
|
16
|
-
const fileEntry = path.relative(moduleDir, modulePath);
|
|
17
|
-
// It can be assumed that the module file exists and the source can be read
|
|
18
|
-
const src = readModule(moduleFilePath);
|
|
19
|
-
return { [fileEntry]: src };
|
|
20
|
-
}
|
|
21
3
|
function transformOptionsToPlatformCompileConfig(ctx, transformOptions, modulePath) {
|
|
22
4
|
const { enableDynamicComponents, enableLightningWebSecurityTransforms, experimentalComplexExpressions, apiVersion, name, namespace, experimentalDynamicComponent, outputConfig, } = transformOptions;
|
|
23
5
|
const options = {
|
|
@@ -44,7 +26,7 @@ function transformOptionsToPlatformCompileConfig(ctx, transformOptions, modulePa
|
|
|
44
26
|
type: getBundleType(),
|
|
45
27
|
name: name,
|
|
46
28
|
namespace: namespace ?? 'c',
|
|
47
|
-
files:
|
|
29
|
+
files: ctx.moduleGraph.getModuleFiles(name, namespace ?? '', modulePath),
|
|
48
30
|
options,
|
|
49
31
|
};
|
|
50
32
|
const compilerConfigs = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexBundler.js","sourceRoot":"","sources":["../../../src/server/bundler/lexBundler.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"lexBundler.js","sourceRoot":"","sources":["../../../src/server/bundler/lexBundler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAyB,QAAQ,EAAU,MAAM,sBAAsB,CAAC;AAU1F,SAAS,uCAAuC,CAC5C,GAAqB,EACrB,gBAAkC,EAClC,UAAkB;IAElB,MAAM,EACF,uBAAuB,EACvB,oCAA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AAkB,EAClB,OAAyB,EACzB,MAAc;IAEd,MAAM,aAAa,GAAG,uCAAuC,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IACxF,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,aAAa,CAAC,CAAC;IAEpD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAClB,MAAM,CAAC,GAAG,CACN,QAAQ,CAAC,KAAK,EACd,qBAAqB,UAAU,sBAAsB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAC5F,CAAC;QACF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;IAC1E,CAAC;IAED,OAAO;QACH,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI;QAC9B,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE;KAC7E,CAAC;AACN,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Websocket from 'ws';
|
|
2
2
|
import { DevServerContext } from '../../types/devServer.js';
|
|
3
3
|
import { Connection } from './connection.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { HMR_Data, HMR_Data_Update } from '@lwc/lwc-dev-server-types';
|
|
5
5
|
import type { TransformOptions } from '@lwc/compiler';
|
|
6
6
|
/**
|
|
7
7
|
* Class representing a client that has connected to the dev server.
|
|
@@ -12,11 +12,10 @@ import type { TransformOptions } from '@lwc/compiler';
|
|
|
12
12
|
export declare class Client {
|
|
13
13
|
clientId: string;
|
|
14
14
|
url: string;
|
|
15
|
-
target: ClientTarget;
|
|
16
15
|
activePaths: Map<string, TransformOptions>;
|
|
17
16
|
connection: Connection;
|
|
18
17
|
ctx: DevServerContext;
|
|
19
|
-
constructor(clientId: string, url: string,
|
|
18
|
+
constructor(clientId: string, url: string, connection: Connection, ctx: DevServerContext);
|
|
20
19
|
addActivePaths(paths: {
|
|
21
20
|
modulePath: string;
|
|
22
21
|
compileOptions: TransformOptions;
|
|
@@ -16,11 +16,10 @@ const SUPPORTED_FETCH_EXTENSIONS = new Set(['.html', '.css', '.js']);
|
|
|
16
16
|
* by this class.
|
|
17
17
|
*/
|
|
18
18
|
export class Client {
|
|
19
|
-
constructor(clientId, url,
|
|
19
|
+
constructor(clientId, url, connection, ctx) {
|
|
20
20
|
this.activePaths = new Map();
|
|
21
21
|
this.clientId = clientId;
|
|
22
22
|
this.url = url;
|
|
23
|
-
this.target = target;
|
|
24
23
|
this.connection = connection;
|
|
25
24
|
this.connection.receive(this.messageCallback.bind(this));
|
|
26
25
|
this.ctx = ctx;
|
|
@@ -66,30 +65,22 @@ export class Client {
|
|
|
66
65
|
};
|
|
67
66
|
this.connection.send(error);
|
|
68
67
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
logger.log(LogLevel.debug, `Found no compile option for module path: ${modulePath}, check the __lwc_hmr_hot.register() call.`);
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
logger.log(LogLevel.debug, `[LWC Dev Server] Compiling ${modulePath}`);
|
|
77
|
-
const result = await compile(this.ctx, modulePath, compileOptions, logger);
|
|
78
|
-
if (!result.code) {
|
|
79
|
-
logger.log(LogLevel.error, `Compiling ${moduleFilePath} failed and there are compiler warnings: ${JSON.stringify(result.warnings)}`);
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
logger.log(LogLevel.debug, `[LWC Dev Server] Sending an updated ${modulePath}`);
|
|
83
|
-
this.connection.send({
|
|
84
|
-
type: 'module-update',
|
|
85
|
-
data: [{ modulePath, src: result.code }],
|
|
86
|
-
});
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
default:
|
|
90
|
-
logger.log(LogLevel.verbose, `Client target ${this.target} not supported currently.`);
|
|
91
|
-
break;
|
|
68
|
+
const compileOptions = this.getCompileOptions(modulePath);
|
|
69
|
+
if (!compileOptions) {
|
|
70
|
+
logger.log(LogLevel.debug, `Found no compile option for module path: ${modulePath}, check the __lwc_hmr_hot.register() call.`);
|
|
71
|
+
break;
|
|
92
72
|
}
|
|
73
|
+
logger.log(LogLevel.debug, `[LWC Dev Server] Compiling ${modulePath}`);
|
|
74
|
+
const result = await compile(this.ctx, modulePath, compileOptions, logger);
|
|
75
|
+
if (!result.code) {
|
|
76
|
+
logger.log(LogLevel.error, `Compiling ${moduleFilePath} failed and there are compiler warnings: ${JSON.stringify(result.warnings)}`);
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
logger.log(LogLevel.debug, `[LWC Dev Server] Sending an updated ${modulePath}`);
|
|
80
|
+
this.connection.send({
|
|
81
|
+
type: 'module-update',
|
|
82
|
+
data: [{ modulePath, src: result.code }],
|
|
83
|
+
});
|
|
93
84
|
break;
|
|
94
85
|
}
|
|
95
86
|
case 'register': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/server/connection/client.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/server/connection/client.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAWvD,MAAM,2BAA2B,GAA0B,IAAI,GAAG,CAAC;IAC/D,QAAQ;IACR,eAAe;IACf,eAAe;IACf,OAA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E,CAAC;YACjD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;IAED,KAAK;QACD,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC;YACjD,MAAM,CAAC,KAAK,EAAE,CAAC;QACnB,CAAC;QACD,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;IACnC,CAAC;IAED,IAAI;QACA,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;IACvC,CAAC;CACJ"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare class LWCServer {
|
|
|
17
17
|
clientPool: ClientPool;
|
|
18
18
|
wss: WebSocketServer;
|
|
19
19
|
context: DevServerContext;
|
|
20
|
+
identityToken?: string;
|
|
20
21
|
constructor(config: ServerConfig, wss: WebSocketServer, logger: Logger);
|
|
21
22
|
/**
|
|
22
23
|
* Initialize the WebSocketServer by adding message handlers for connections lifecycle events.
|
package/dist/server/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { ModuleGraph } from './moduleGraph/index.js';
|
|
|
6
6
|
import ConsoleLogger from './consoleLogger.js';
|
|
7
7
|
import { Client, ClientPool } from './connection/client.js';
|
|
8
8
|
import { Connection } from './connection/connection.js';
|
|
9
|
+
import { decrypt } from './util/aes.js';
|
|
9
10
|
/**
|
|
10
11
|
* This class represents the central place where the LWC dev server coordination occurs.
|
|
11
12
|
*
|
|
@@ -84,25 +85,31 @@ export class LWCServer {
|
|
|
84
85
|
}
|
|
85
86
|
switch (data.type) {
|
|
86
87
|
case 'init': {
|
|
87
|
-
const { data: { clientId, url,
|
|
88
|
+
const { data: { clientId, url, auth }, } = data;
|
|
88
89
|
if (this.clientPool.size() === this.context.config.maxClientCount) {
|
|
89
90
|
logger.log(LogLevel.error, `[LWC Dev Server] Max connection limit(${this.context.config.maxClientCount}) reached, ignoring new requests until existing connections are closed`);
|
|
90
91
|
socket.close();
|
|
91
92
|
return;
|
|
92
93
|
}
|
|
93
94
|
const connection = new Connection(socket, logger);
|
|
94
|
-
const client = new Client(clientId, url,
|
|
95
|
+
const client = new Client(clientId, url, connection, this.context);
|
|
95
96
|
this.clientPool.addClient(socket, client);
|
|
96
|
-
logger.log(LogLevel.info, `[LWC Dev Server] New connection for url: ${url}
|
|
97
|
+
logger.log(LogLevel.info, `[LWC Dev Server] New connection for url: ${url} registered. Client ID: ${clientId}`);
|
|
97
98
|
// TODO: The server should decode the auth challenge with its session key and return the challenge phrase
|
|
98
|
-
if (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
if (this.identityToken) {
|
|
100
|
+
if (!auth) {
|
|
101
|
+
logger.log(LogLevel.error, `[LWC Dev Server] Auth required`);
|
|
102
|
+
socket.close();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const decrypted = decrypt(auth.data.sessionTokenCipher, this.identityToken);
|
|
107
|
+
client.send({ type: 'auth-response', data: { sessionToken: decrypted } });
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
logger.log(LogLevel.error, `[LWC Dev Server] Failed to decrypt sessionToken. Closing socket.`);
|
|
111
|
+
socket.close();
|
|
112
|
+
}
|
|
106
113
|
}
|
|
107
114
|
break;
|
|
108
115
|
}
|
package/dist/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAkC,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB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,GAAG,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { FSWatcher } from 'chokidar';
|
|
|
2
2
|
import { ServerConfig, type Logger } from '../../types/index.js';
|
|
3
3
|
import type { HMR_Data_Register } from '@lwc/lwc-dev-server-types';
|
|
4
4
|
import type { ModuleInfo, ModuleMapEntry, WorkspaceScanner } from './workspaceScanner/scanner';
|
|
5
|
+
import type { BundleFiles } from '@lwc/sfdc-lwc-compiler/dist/compile.js';
|
|
5
6
|
export type Module = any;
|
|
6
7
|
export interface ModuleChangeCallbacks {
|
|
7
8
|
moduleUpdateHandler: (modulePath: string) => void;
|
|
@@ -13,12 +14,12 @@ export declare class ModuleGraph {
|
|
|
13
14
|
/**
|
|
14
15
|
* All LWC modules and their parts with absolute file paths, for the current workspace.
|
|
15
16
|
*/
|
|
16
|
-
moduleMap: ModuleMapEntry
|
|
17
|
+
moduleMap: Map<string, ModuleMapEntry>;
|
|
17
18
|
/**
|
|
18
19
|
* All modules paths that are being used by the various client connections
|
|
19
20
|
*/
|
|
20
21
|
activeModulePaths: string[];
|
|
21
|
-
|
|
22
|
+
fileToModulePathMap: {
|
|
22
23
|
[key: string]: string;
|
|
23
24
|
};
|
|
24
25
|
modulePathToModuleInfo: {
|
|
@@ -27,7 +28,7 @@ export declare class ModuleGraph {
|
|
|
27
28
|
moduleChangeCallbacks: ModuleChangeCallbacks;
|
|
28
29
|
constructor(config: ServerConfig, logger: Logger, watcher: FSWatcher, moduleChangeCallbacks: ModuleChangeCallbacks);
|
|
29
30
|
init(): void;
|
|
30
|
-
|
|
31
|
+
getModulePathByFile(path: string): string | undefined;
|
|
31
32
|
getFileByModulePath(modulePath: string): string | undefined;
|
|
32
33
|
/**
|
|
33
34
|
* Register the active paths that the client is interested in
|
|
@@ -36,4 +37,26 @@ export declare class ModuleGraph {
|
|
|
36
37
|
*/
|
|
37
38
|
registerActivePaths(moduleRegistration: HMR_Data_Register): string[];
|
|
38
39
|
fileChangeHandler(filePath: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Identify which modulePath that represents the boundary of the changed module.
|
|
42
|
+
* In the case of .html files, the module boundary is the template file itself. swapTemplate()
|
|
43
|
+
* is called and module swap is done.
|
|
44
|
+
* In the case of .css files, the module boundary is the css file itself, swapStyle() is called
|
|
45
|
+
* and module swap is done.
|
|
46
|
+
* In the case of .js files, the module boundary is the main entry file of the module, all the files
|
|
47
|
+
* reachable from the entry module are bundled and swapComponent invoked.
|
|
48
|
+
* Since JS hot swap is currently supporting components, this focused update of the main entry file
|
|
49
|
+
* is acceptable.
|
|
50
|
+
* @param modulePath The module that changed
|
|
51
|
+
* @return The modulePath of the boundary that needs to be updated.
|
|
52
|
+
*/
|
|
53
|
+
getModuleBoundary(modulePath: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Fetch files and source related to the modulePath that is being hot loaded.
|
|
56
|
+
* @param {string} name Name of the component being compiled
|
|
57
|
+
* @param {string} namespace The namespace of the component
|
|
58
|
+
* @param {string} modulePath The formatted path for the file being compiled.
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
getModuleFiles(name: string, namespace: string, modulePath: string): BundleFiles;
|
|
39
62
|
}
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { LogLevel } from '../../types/index.js';
|
|
4
|
-
import { getModuleHash } from '../util/fileUtil.js';
|
|
4
|
+
import { getModuleHash, readModule } from '../util/fileUtil.js';
|
|
5
5
|
import { getWorkspaceScanner } from './workspaceScanner/index.js';
|
|
6
6
|
export class ModuleGraph {
|
|
7
7
|
constructor(config, logger, watcher, moduleChangeCallbacks) {
|
|
8
8
|
/**
|
|
9
9
|
* All LWC modules and their parts with absolute file paths, for the current workspace.
|
|
10
10
|
*/
|
|
11
|
-
this.moduleMap =
|
|
11
|
+
this.moduleMap = new Map();
|
|
12
12
|
/**
|
|
13
13
|
* All modules paths that are being used by the various client connections
|
|
14
14
|
*/
|
|
15
15
|
this.activeModulePaths = [];
|
|
16
16
|
// Mapping from <absolute file path> => "<namespace>/<componentname>/component.js"
|
|
17
|
-
this.
|
|
17
|
+
this.fileToModulePathMap = Object.create(null);
|
|
18
18
|
// Mapping from "<namespace>/<componentname>/component.js" => { moduleFilePath, moduleSourceHash }
|
|
19
19
|
this.modulePathToModuleInfo = Object.create(null);
|
|
20
20
|
this.watcher = watcher;
|
|
21
21
|
this.logger = logger;
|
|
22
22
|
this.moduleChangeCallbacks = moduleChangeCallbacks;
|
|
23
23
|
this.workspaceScanner = getWorkspaceScanner(config.workspace, config.paths, logger);
|
|
24
|
+
// init() may be called multiple times in the future(when a directory is deleted or addeds)
|
|
24
25
|
this.init();
|
|
25
26
|
}
|
|
26
27
|
init() {
|
|
27
28
|
this.moduleMap = this.workspaceScanner.getModulesMap();
|
|
28
|
-
if (this.moduleMap.
|
|
29
|
-
this.logger.log(LogLevel.debug, `[Module Graph] Found ${this.moduleMap.
|
|
29
|
+
if (this.moduleMap.size) {
|
|
30
|
+
this.logger.log(LogLevel.debug, `[Module Graph] Found ${this.moduleMap.size} LWC components in the current workspace.`);
|
|
30
31
|
}
|
|
31
32
|
else {
|
|
32
33
|
this.logger.log(LogLevel.debug, `[Module Graph] Found no LWC components in the current workspace, check your settings in lwc.config.json.`);
|
|
@@ -34,14 +35,17 @@ export class ModuleGraph {
|
|
|
34
35
|
this.moduleMap.forEach(({ moduleParts }) => {
|
|
35
36
|
Object.assign(this.modulePathToModuleInfo, moduleParts);
|
|
36
37
|
for (const [modulePath, moduleInfo] of Object.entries(moduleParts)) {
|
|
37
|
-
this.
|
|
38
|
+
this.fileToModulePathMap[moduleInfo.moduleFilePath] = modulePath;
|
|
38
39
|
}
|
|
39
40
|
});
|
|
40
41
|
this.watcher.on('change', this.fileChangeHandler.bind(this));
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
// Given absolute file path, get the modulePath
|
|
44
|
+
// Mapping from <absolute file path> => "<namespace>/<componentname>/component.js"
|
|
45
|
+
getModulePathByFile(path) {
|
|
46
|
+
return this.fileToModulePathMap[path];
|
|
44
47
|
}
|
|
48
|
+
// Given the modulePath, get the absolute file path for that module
|
|
45
49
|
getFileByModulePath(modulePath) {
|
|
46
50
|
return this.modulePathToModuleInfo[modulePath]?.moduleFilePath;
|
|
47
51
|
}
|
|
@@ -73,12 +77,15 @@ export class ModuleGraph {
|
|
|
73
77
|
this.logger.log(LogLevel.debug, `[Module Graph] Following modules are unknown to dev server: \n\t ${unTrackedModules.join(',\n\t')}`);
|
|
74
78
|
staleModules.length &&
|
|
75
79
|
this.logger.log(LogLevel.debug, `[Module Graph] Following modules have a newer version: \n\t ${staleModules.join(',\n\t')}`);
|
|
80
|
+
// TODO: Before returning staleModules, the list can be trimmed based on module boundary
|
|
81
|
+
// For example ['c/mycomponent/mycomponent.js', 'c/mycomponent/mycomponent.html', 'c/mycomponent/mycomponent.css] -> ['c/mycomponent/mycomponent.js']
|
|
82
|
+
// because 'c/mycomponent/mycomponent.js' module update will contain full bundle
|
|
76
83
|
return staleModules;
|
|
77
84
|
}
|
|
78
85
|
fileChangeHandler(filePath) {
|
|
79
86
|
const changedFile = path.resolve(filePath);
|
|
80
87
|
if (fs.lstatSync(changedFile).isFile()) {
|
|
81
|
-
const modulePath = this.
|
|
88
|
+
const modulePath = this.getModulePathByFile(changedFile);
|
|
82
89
|
if (modulePath) {
|
|
83
90
|
const moduleInfo = this.modulePathToModuleInfo[modulePath];
|
|
84
91
|
const newModuleHash = getModuleHash(changedFile);
|
|
@@ -87,9 +94,78 @@ export class ModuleGraph {
|
|
|
87
94
|
}
|
|
88
95
|
this.logger.log(LogLevel.info, `[LWC Dev Server] File '${modulePath}' modified - updating.`);
|
|
89
96
|
moduleInfo.moduleSourceHash = newModuleHash;
|
|
90
|
-
|
|
97
|
+
// Find the nearest boundary for the file that changed
|
|
98
|
+
const moduleBoundary = this.getModuleBoundary(modulePath);
|
|
99
|
+
// Notify the clients that a module has been updated
|
|
100
|
+
this.moduleChangeCallbacks.moduleUpdateHandler(moduleBoundary);
|
|
91
101
|
}
|
|
92
102
|
}
|
|
93
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Identify which modulePath that represents the boundary of the changed module.
|
|
106
|
+
* In the case of .html files, the module boundary is the template file itself. swapTemplate()
|
|
107
|
+
* is called and module swap is done.
|
|
108
|
+
* In the case of .css files, the module boundary is the css file itself, swapStyle() is called
|
|
109
|
+
* and module swap is done.
|
|
110
|
+
* In the case of .js files, the module boundary is the main entry file of the module, all the files
|
|
111
|
+
* reachable from the entry module are bundled and swapComponent invoked.
|
|
112
|
+
* Since JS hot swap is currently supporting components, this focused update of the main entry file
|
|
113
|
+
* is acceptable.
|
|
114
|
+
* @param modulePath The module that changed
|
|
115
|
+
* @return The modulePath of the boundary that needs to be updated.
|
|
116
|
+
*/
|
|
117
|
+
getModuleBoundary(modulePath) {
|
|
118
|
+
const { ext } = path.parse(modulePath);
|
|
119
|
+
if (['.html', '.css'].includes(ext)) {
|
|
120
|
+
return modulePath;
|
|
121
|
+
}
|
|
122
|
+
else if (['.js', '.ts'].includes(ext)) {
|
|
123
|
+
const ownerModuleId = this.modulePathToModuleInfo[modulePath].ownerModuleId;
|
|
124
|
+
const moduleMapEntry = this.moduleMap.get(ownerModuleId);
|
|
125
|
+
if (moduleMapEntry) {
|
|
126
|
+
const [namespace, name] = ownerModuleId.split('/');
|
|
127
|
+
const { moduleParts } = moduleMapEntry;
|
|
128
|
+
const entryFile = [
|
|
129
|
+
`${namespace}/${name}/${name}.js`,
|
|
130
|
+
`${namespace}/${name}/${name}.ts`,
|
|
131
|
+
`${namespace}/${name}/${name}.css`,
|
|
132
|
+
].find((entry) => Object.hasOwnProperty.call(moduleParts, entry));
|
|
133
|
+
if (entryFile) {
|
|
134
|
+
return entryFile;
|
|
135
|
+
}
|
|
136
|
+
throw new Error(`[LWC Dev Server] Unable to determine entry file for path: ${modulePath}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
throw new Error(`[LWC Dev Server] Unrecognized file type or file not part of LWC module: ${modulePath}`);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Fetch files and source related to the modulePath that is being hot loaded.
|
|
143
|
+
* @param {string} name Name of the component being compiled
|
|
144
|
+
* @param {string} namespace The namespace of the component
|
|
145
|
+
* @param {string} modulePath The formatted path for the file being compiled.
|
|
146
|
+
* @returns
|
|
147
|
+
*/
|
|
148
|
+
getModuleFiles(name, namespace, modulePath) {
|
|
149
|
+
const { ext } = path.parse(modulePath);
|
|
150
|
+
const moduleDir = `${namespace}/${name}`;
|
|
151
|
+
if (['.html', '.css'].includes(ext)) {
|
|
152
|
+
const moduleFilePath = this.getFileByModulePath(modulePath);
|
|
153
|
+
const fileEntry = path.relative(moduleDir, modulePath);
|
|
154
|
+
// It can be assumed that the module file exists and the source can be read
|
|
155
|
+
const src = readModule(moduleFilePath);
|
|
156
|
+
return { [fileEntry]: src };
|
|
157
|
+
}
|
|
158
|
+
else if (['.js', '.ts'].includes(ext)) {
|
|
159
|
+
const ownerModuleId = this.modulePathToModuleInfo[modulePath].ownerModuleId;
|
|
160
|
+
const moduleMapEntry = this.moduleMap.get(ownerModuleId);
|
|
161
|
+
return Object.keys(moduleMapEntry.moduleParts).reduce((acc, key) => {
|
|
162
|
+
const part = path.relative(moduleDir, key);
|
|
163
|
+
const partSrc = readModule(moduleMapEntry.moduleParts[key].moduleFilePath);
|
|
164
|
+
acc[part] = partSrc;
|
|
165
|
+
return acc;
|
|
166
|
+
}, {});
|
|
167
|
+
}
|
|
168
|
+
throw new Error(`[LWC Dev Server] Unable to determine source for '${modulePath}'`);
|
|
169
|
+
}
|
|
94
170
|
}
|
|
95
171
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/moduleGraph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAA6B,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/moduleGraph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAA6B,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAYlE,MAAM,OAAO,WAAW;IAmBpB,YACI,MAAoB,EACpB,MAAc,EACd,OAAkB,EAClB,qBAA4C;QAnBhD;;WAEG;QACH,cAAS,GAAgC,IAAI,GAAG,EAAE,CAAC;QACnD;;WAEG;QACH,sBAAiB,GAAa,EAAE,CAAC;QAEjC,kFAAkF;QAClF,wBAAmB,GAA8B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACrE,kGAAkG;QAClG,2BAAsB,GAAkC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QASxE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QAEnD,IAAI,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAEpF,2FAA2F;QAC3F,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;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AAK,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,MAAM,aAAa,GAAG,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC,aAAa,CAAC;YAC5E,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YACzD,OAAO,MAAM,CAAC,IAAI,CAAC,cAAe,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;gBAChE,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;gBAC3C,MAAM,OAAO,GAAG,UAAU,CAAC,cAAe,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,CAAC;gBAC5E,GAAG,CAAC,IAAI,CAAC,GAAG,OAAQ,CAAC;gBACrB,OAAO,GAAG,CAAC;YACf,CAAC,EAAE,EAAiB,CAAC,CAAC;QAC1B,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,oDAAoD,UAAU,GAAG,CAAC,CAAC;IACvF,CAAC;CACJ"}
|
|
@@ -2,9 +2,11 @@ import type { ModuleInfo } from './scanner';
|
|
|
2
2
|
/**
|
|
3
3
|
* Get all parts of an LWC component.
|
|
4
4
|
* @param componentDir A directory representing an LWC Component.
|
|
5
|
+
* @param namespace String representing the namespace of the component
|
|
6
|
+
* @param ownerModuleId Owner module in format like <namespace>/<component-name>.
|
|
5
7
|
* @returns A map representing all valid parts of the LWC with the short path as the key and full
|
|
6
8
|
* canonical path as value.
|
|
7
9
|
*/
|
|
8
|
-
export declare function getComponentParts(componentDir: string, namespace: string): {
|
|
10
|
+
export declare function getComponentParts(componentDir: string, namespace: string, ownerModuleId: string): {
|
|
9
11
|
[key: string]: ModuleInfo;
|
|
10
12
|
} | undefined;
|
|
@@ -59,10 +59,12 @@ function isValidEntryPoint(entryPoint, componentName) {
|
|
|
59
59
|
/**
|
|
60
60
|
* Get all parts of an LWC component.
|
|
61
61
|
* @param componentDir A directory representing an LWC Component.
|
|
62
|
+
* @param namespace String representing the namespace of the component
|
|
63
|
+
* @param ownerModuleId Owner module in format like <namespace>/<component-name>.
|
|
62
64
|
* @returns A map representing all valid parts of the LWC with the short path as the key and full
|
|
63
65
|
* canonical path as value.
|
|
64
66
|
*/
|
|
65
|
-
export function getComponentParts(componentDir, namespace) {
|
|
67
|
+
export function getComponentParts(componentDir, namespace, ownerModuleId) {
|
|
66
68
|
if (!existsSync(componentDir)) {
|
|
67
69
|
throw new Error('The LWC component directory does not exist.');
|
|
68
70
|
}
|
|
@@ -81,6 +83,7 @@ export function getComponentParts(componentDir, namespace) {
|
|
|
81
83
|
{
|
|
82
84
|
moduleFilePath: file,
|
|
83
85
|
moduleSourceHash: getModuleHash(file),
|
|
86
|
+
ownerModuleId, // A back reference to the owner
|
|
84
87
|
},
|
|
85
88
|
];
|
|
86
89
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileReader.js","sourceRoot":"","sources":["../../../../src/server/moduleGraph/workspaceScanner/fileReader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD;;;;;GAKG;AACH,SAAS,cAAc,CAAC,IAAY,EAAE,aAAqB;IACvD,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/D,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;QAA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aAAa,GAAG,MAAM,CAAC,CAAC;IAC7E,OAAO,UAAU,CAAC,WAAW,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,IAAI,UAAU,CAAC,sBAAsB,CAAC,CAAC;AACpG,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC7B,YAAoB,EACpB,SAAiB,EACjB,aAAqB;IAErB,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC;QACzC,+BAA+B;QAC/B,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAC3C,OAAO,MAAM,CAAC,WAAW;IACrB,oEAAoE;IACpE,+EAA+E;IAC/E,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACf,OAAO;YACH,GAAG,SAAS,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE;YAC3D;gBACI,cAAc,EAAE,IAAI;gBACpB,gBAAgB,EAAE,aAAa,CAAC,IAAI,CAAC;gBACrC,aAAa,EAAE,gCAAgC;aAClD;SACJ,CAAC;IACN,CAAC,CAAC,CACL,CAAC;AACN,CAAC"}
|
|
@@ -2,6 +2,7 @@ import type { Logger, Workspace } from '../../../types/index';
|
|
|
2
2
|
export interface ModuleInfo {
|
|
3
3
|
moduleFilePath: string;
|
|
4
4
|
moduleSourceHash: string;
|
|
5
|
+
ownerModuleId: string;
|
|
5
6
|
}
|
|
6
7
|
/**
|
|
7
8
|
* Represents a Module entry per LWC component
|
|
@@ -44,7 +45,7 @@ export interface WorkspaceScanner {
|
|
|
44
45
|
/**
|
|
45
46
|
* Get information about LWC modules contained in the workspace.
|
|
46
47
|
*/
|
|
47
|
-
getModulesMap(): ModuleMapEntry
|
|
48
|
+
getModulesMap(): Map<string, ModuleMapEntry>;
|
|
48
49
|
}
|
|
49
50
|
export declare abstract class BaseWorkspaceScanner implements WorkspaceScanner {
|
|
50
51
|
workspace: Workspace;
|
|
@@ -54,7 +55,7 @@ export declare abstract class BaseWorkspaceScanner implements WorkspaceScanner {
|
|
|
54
55
|
/**
|
|
55
56
|
* Get information about LWC modules contained in the workspace.
|
|
56
57
|
*/
|
|
57
|
-
getModulesMap(): ModuleMapEntry
|
|
58
|
+
getModulesMap(): Map<string, ModuleMapEntry>;
|
|
58
59
|
abstract getNamespace(moduleDir: string): string;
|
|
59
60
|
abstract findModuleDirs(): string[];
|
|
60
61
|
scanAModule(moduleDir: string): ModuleMapEntry | undefined;
|
|
@@ -10,11 +10,11 @@ export class BaseWorkspaceScanner {
|
|
|
10
10
|
* Get information about LWC modules contained in the workspace.
|
|
11
11
|
*/
|
|
12
12
|
getModulesMap() {
|
|
13
|
-
const modulesMap =
|
|
13
|
+
const modulesMap = new Map();
|
|
14
14
|
this.findModuleDirs().forEach((dir) => {
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
modulesMap.
|
|
15
|
+
const moduleMapEntry = this.scanAModule(dir);
|
|
16
|
+
if (moduleMapEntry) {
|
|
17
|
+
modulesMap.set(moduleMapEntry.ownerModuleId, moduleMapEntry);
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
return modulesMap;
|
|
@@ -22,12 +22,13 @@ export class BaseWorkspaceScanner {
|
|
|
22
22
|
scanAModule(moduleDir) {
|
|
23
23
|
const { base } = path.parse(moduleDir);
|
|
24
24
|
const namespace = this.getNamespace(moduleDir);
|
|
25
|
-
const
|
|
25
|
+
const ownerModuleId = `${namespace}/${base}`;
|
|
26
|
+
const moduleParts = getComponentParts(moduleDir, namespace, ownerModuleId);
|
|
26
27
|
if (!moduleParts) {
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
30
|
const moduleMap = {
|
|
30
|
-
ownerModuleId
|
|
31
|
+
ownerModuleId,
|
|
31
32
|
moduleParts,
|
|
32
33
|
};
|
|
33
34
|
return moduleMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../../../src/server/moduleGraph/workspaceScanner/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../../../src/server/moduleGraph/workspaceScanner/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAsDpD,MAAM,OAAgB,oBAAoB;IAItC,YAAY,SAAoB,EAAE,YAAsB,EAAE,MAAc;QACpE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,aAAa;QACT,MAAM,UAAU,GAAG,IAAI,GAAG,EAA0B,CAAC;QACrD,IAAI,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAClC,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;YAC7C,IAAI,cAAc,EAAE,CAAC;gBACjB,UAAU,CAAC,GAAG,CAAC,cAAc,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;YACjE,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,UAAU,CAAC;IACtB,CAAC;IAKD,WAAW,CAAC,SAAiB;QACzB,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACvC,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAC/C,MAAM,aAAa,GAAG,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC;QAC7C,MAAM,WAAW,GAAG,iBAAiB,CAAC,SAAS,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;QAC3E,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,OAAO;QACX,CAAC;QAED,MAAM,SAAS,GAAmB;YAC9B,aAAa;YACb,WAAW;SACd,CAAC;QACF,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decrypt a Base64 encoded string using AES-GCM
|
|
3
|
+
* @param encryptedText - The Base64 encoded encrypted text
|
|
4
|
+
* @param base64Key - The Base64 encoded key
|
|
5
|
+
* @returns The decrypted text
|
|
6
|
+
*/
|
|
7
|
+
export declare function decrypt(encryptedText: string, base64Key: string): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as crypto from 'node:crypto';
|
|
2
|
+
const IV_LENGTH = 12; // 96 bit
|
|
3
|
+
const GCM_TAG_LENGTH = 16; // 128 bit
|
|
4
|
+
/**
|
|
5
|
+
* Decrypt a Base64 encoded string using AES-GCM
|
|
6
|
+
* @param encryptedText - The Base64 encoded encrypted text
|
|
7
|
+
* @param base64Key - The Base64 encoded key
|
|
8
|
+
* @returns The decrypted text
|
|
9
|
+
*/
|
|
10
|
+
export function decrypt(encryptedText, base64Key) {
|
|
11
|
+
const key = Buffer.from(base64Key, 'base64');
|
|
12
|
+
const encryptedData = Buffer.from(encryptedText, 'base64');
|
|
13
|
+
const iv = encryptedData.subarray(0, IV_LENGTH);
|
|
14
|
+
const ciphertext = encryptedData.subarray(IV_LENGTH, encryptedData.length - GCM_TAG_LENGTH);
|
|
15
|
+
const authTag = encryptedData.subarray(encryptedData.length - GCM_TAG_LENGTH);
|
|
16
|
+
const decipher = crypto.createDecipheriv('aes-256-gcm', key, iv);
|
|
17
|
+
decipher.setAuthTag(authTag);
|
|
18
|
+
let decrypted = decipher.update(ciphertext, undefined, 'utf8');
|
|
19
|
+
decrypted += decipher.final('utf8');
|
|
20
|
+
return decrypted;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=aes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aes.js","sourceRoot":"","sources":["../../../src/server/util/aes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,SAAS;AAC/B,MAAM,cAAc,GAAG,EAAE,CAAC,CAAC,UAAU;AACrC;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,aAAqB,EAAE,SAAiB;IAC5D,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7C,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAE3D,MAAM,EAAE,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,MAAM,GAAG,cAAc,CAAC,CAAC;IAC5F,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,GAAG,cAAc,CAAC,CAAC;IAE9E,MAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACjE,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAE7B,IAAI,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC/D,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAEpC,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { ClientTarget } from '@lwc/lwc-dev-server-types';
|
|
3
2
|
export declare const MAX_CLIENT_COUNT = 5;
|
|
4
3
|
/**
|
|
5
4
|
* Define the type of workspace.
|
|
@@ -48,17 +47,11 @@ export interface ServerConfig {
|
|
|
48
47
|
rootDir: string;
|
|
49
48
|
/** Port at which the web socket will communicating from. */
|
|
50
49
|
port: number;
|
|
51
|
-
/** Websocket protocol to use */
|
|
52
|
-
protocol: string;
|
|
53
|
-
/** Host where the dev server is running. Will be used to send information to the client. */
|
|
54
|
-
host: string;
|
|
55
50
|
/**
|
|
56
51
|
* Component paths to watch
|
|
57
52
|
* For SF CLI: force-app/main/default
|
|
58
53
|
*/
|
|
59
54
|
paths: string[];
|
|
60
|
-
/** Container targets to bundle modules for. */
|
|
61
|
-
targets: ClientTarget[];
|
|
62
55
|
workspace: Workspace;
|
|
63
56
|
logLevel: LogLevel;
|
|
64
57
|
https?: HttpsConfig;
|
|
@@ -68,4 +61,8 @@ export interface ServerConfig {
|
|
|
68
61
|
* default value is {@link MAX_CLIENT_COUNT}
|
|
69
62
|
*/
|
|
70
63
|
maxClientCount?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Identity token for the server to auth
|
|
66
|
+
*/
|
|
67
|
+
identityToken?: string;
|
|
71
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverConfig.js","sourceRoot":"","sources":["../../src/types/serverConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serverConfig.js","sourceRoot":"","sources":["../../src/types/serverConfig.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC;;;;GAIG;AACH,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACjB,kCAAqB,CAAA;IACrB,oCAAuB,CAAA;IACvB,wBAAW,CAAA;AACf,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,QAOX;AAPD,WAAY,QAAQ;IAChB,2CAAU,CAAA;IACV,yCAAS,CAAA;IACT,uCAAQ,CAAA;IACR,uCAAQ,CAAA;IACR,yCAAS,CAAA;IACT,6CAAW,CAAA;AACf,CAAC,EAPW,QAAQ,KAAR,QAAQ,QAOnB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lwc/lwc-dev-server",
|
|
3
3
|
"description": "A development server to get quick feedback on your LWC component development.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "9.0.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lwc dev server"
|
|
7
7
|
],
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"start": "node ./bin/dev-server.js start"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@lwc/sfdc-lwc-compiler": "
|
|
26
|
+
"@lwc/sfdc-lwc-compiler": "9.0.0",
|
|
27
27
|
"chalk": "~5.3.0",
|
|
28
28
|
"chokidar": "~3.6.0",
|
|
29
29
|
"commander": "~10.0.0",
|
|
30
30
|
"ws": "~8.16.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@lwc/lwc-dev-server-types": "
|
|
33
|
+
"@lwc/lwc-dev-server-types": "9.0.0",
|
|
34
34
|
"@types/ws": "^8.5.10"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|