@lwc/lwc-dev-server 10.6.0 → 10.7.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.
- package/dist/bin.js +1 -2
- package/dist/bin.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/server/bundler/lexBundler.d.ts +4 -4
- package/dist/server/bundler/lexBundler.js +14 -16
- package/dist/server/bundler/lexBundler.js.map +1 -1
- package/dist/server/bundler/lexBundler.spec.js +90 -48
- package/dist/server/bundler/lexBundler.spec.js.map +1 -1
- package/dist/server/connection/client.d.ts +5 -7
- package/dist/server/connection/client.js +24 -41
- package/dist/server/connection/client.js.map +1 -1
- package/dist/server/connection/client.spec.js +96 -59
- package/dist/server/connection/client.spec.js.map +1 -1
- package/dist/server/connection/connection.d.ts +4 -4
- package/dist/server/connection/connection.js +9 -3
- package/dist/server/connection/connection.js.map +1 -1
- package/dist/server/connection/connection.spec.js +7 -9
- package/dist/server/connection/connection.spec.js.map +1 -1
- package/dist/server/connection/web-socket-server.d.ts +2 -1
- package/dist/server/connection/web-socket-server.js +5 -6
- package/dist/server/connection/web-socket-server.js.map +1 -1
- package/dist/server/connection/web-socket-server.spec.js +2 -6
- package/dist/server/connection/web-socket-server.spec.js.map +1 -1
- package/dist/server/index.d.ts +5 -4
- package/dist/server/index.js +13 -13
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.spec.js +45 -32
- package/dist/server/index.spec.js.map +1 -1
- package/dist/server/moduleGraph/index.d.ts +18 -42
- package/dist/server/moduleGraph/index.js +72 -119
- package/dist/server/moduleGraph/index.js.map +1 -1
- package/dist/server/moduleGraph/index.spec.js +106 -52
- package/dist/server/moduleGraph/index.spec.js.map +1 -1
- package/dist/server/moduleGraph/module.d.ts +78 -0
- package/dist/server/moduleGraph/module.js +126 -0
- package/dist/server/moduleGraph/module.js.map +1 -0
- package/dist/server/moduleGraph/module.spec.d.ts +1 -0
- package/dist/server/moduleGraph/module.spec.js +70 -0
- package/dist/server/moduleGraph/module.spec.js.map +1 -0
- package/dist/server/moduleGraph/workspaceScanner/__tests__/fileReader.spec.js +3 -3
- package/dist/server/moduleGraph/workspaceScanner/__tests__/fileReader.spec.js.map +1 -1
- package/dist/server/moduleGraph/workspaceScanner/__tests__/internal.spec.js +8 -9
- package/dist/server/moduleGraph/workspaceScanner/__tests__/internal.spec.js.map +1 -1
- package/dist/server/moduleGraph/workspaceScanner/__tests__/mrt.spec.js +1 -6
- package/dist/server/moduleGraph/workspaceScanner/__tests__/mrt.spec.js.map +1 -1
- package/dist/server/moduleGraph/workspaceScanner/__tests__/sfcli.spec.js +1 -6
- package/dist/server/moduleGraph/workspaceScanner/__tests__/sfcli.spec.js.map +1 -1
- package/dist/server/moduleGraph/workspaceScanner/fileReader.d.ts +8 -2
- package/dist/server/moduleGraph/workspaceScanner/fileReader.js +16 -17
- package/dist/server/moduleGraph/workspaceScanner/fileReader.js.map +1 -1
- package/dist/server/moduleGraph/workspaceScanner/index.d.ts +2 -1
- package/dist/server/moduleGraph/workspaceScanner/index.js.map +1 -1
- package/dist/server/moduleGraph/workspaceScanner/salesforceCli.js +2 -14
- package/dist/server/moduleGraph/workspaceScanner/salesforceCli.js.map +1 -1
- package/dist/server/moduleGraph/workspaceScanner/scanner.d.ts +8 -34
- package/dist/server/moduleGraph/workspaceScanner/scanner.js +9 -18
- package/dist/server/moduleGraph/workspaceScanner/scanner.js.map +1 -1
- package/dist/server/util/module-util.d.ts +10 -0
- package/dist/server/util/module-util.js +10 -0
- package/dist/server/util/module-util.js.map +1 -0
- package/dist/server/watcher/index.js +1 -2
- package/dist/server/watcher/index.js.map +1 -1
- package/dist/server/watcher/index.spec.js +1 -1
- package/dist/server/watcher/index.spec.js.map +1 -1
- package/dist/types/devServer.d.ts +2 -4
- package/dist/types/serverConfig.d.ts +0 -12
- package/dist/types/serverConfig.js +0 -12
- package/dist/types/serverConfig.js.map +1 -1
- package/package.json +5 -5
- package/dist/server/consoleLogger.d.ts +0 -6
- package/dist/server/consoleLogger.js +0 -33
- package/dist/server/consoleLogger.js.map +0 -1
|
@@ -1,68 +1,122 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { watch } from 'chokidar';
|
|
4
|
-
import { LogLevel, Workspace } from '../../types/index.js';
|
|
5
|
-
import { getModuleHash } from '../util/fileUtil.js';
|
|
1
|
+
import { FSWatcher } from 'chokidar';
|
|
2
|
+
import { startWatch } from '../watcher/index.js';
|
|
6
3
|
import { ModuleGraph } from './index.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
vi.mock('path', async (importOriginal) => {
|
|
10
|
-
return {
|
|
11
|
-
...(await importOriginal()),
|
|
12
|
-
resolve: vi.fn(),
|
|
13
|
-
};
|
|
14
|
-
});
|
|
4
|
+
import { getWorkspaceScanner } from './workspaceScanner/index.js';
|
|
5
|
+
import { InvalidModuleError } from './module.js';
|
|
15
6
|
vi.mock('chokidar', () => ({
|
|
16
|
-
|
|
7
|
+
FSWatcher: vi.fn().mockImplementation(() => ({
|
|
17
8
|
on: vi.fn(),
|
|
18
9
|
close: vi.fn(),
|
|
19
|
-
}),
|
|
10
|
+
})),
|
|
11
|
+
}));
|
|
12
|
+
vi.mock('../watcher/index.js', () => ({
|
|
13
|
+
startWatch: vi.fn(),
|
|
14
|
+
}));
|
|
15
|
+
vi.mock('./workspaceScanner/index.js', () => ({
|
|
16
|
+
getWorkspaceScanner: vi.fn(),
|
|
20
17
|
}));
|
|
21
|
-
vi.mock('../util/fileUtil.js', async (importOriginal) => {
|
|
22
|
-
return {
|
|
23
|
-
...(await importOriginal()),
|
|
24
|
-
getModuleHash: vi.fn(),
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
18
|
describe('ModuleGraph', () => {
|
|
19
|
+
let config;
|
|
20
|
+
let workspaceScanner;
|
|
28
21
|
let moduleGraph;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const moduleUpdateHandler = vi.fn();
|
|
22
|
+
let watcher;
|
|
23
|
+
let modules;
|
|
24
|
+
let logger;
|
|
33
25
|
beforeEach(() => {
|
|
34
|
-
moduleGraph = new ModuleGraph({
|
|
35
|
-
logLevel: LogLevel.debug,
|
|
36
|
-
paths: [modulesPath],
|
|
37
|
-
port: 50182,
|
|
38
|
-
rootDir: __dirname,
|
|
39
|
-
workspace: Workspace.Mrt,
|
|
40
|
-
}, mockLogger);
|
|
41
|
-
moduleGraph.on('update', moduleUpdateHandler);
|
|
42
|
-
});
|
|
43
|
-
afterEach(() => {
|
|
44
26
|
vi.clearAllMocks();
|
|
27
|
+
modules = [
|
|
28
|
+
{
|
|
29
|
+
baseDir: '/tmp/ns/name',
|
|
30
|
+
id: vi.fn().mockReturnValue('ns/name'),
|
|
31
|
+
addOrUpdatePart: vi.fn().mockReturnValue(true),
|
|
32
|
+
deletePart: vi.fn(),
|
|
33
|
+
getModuleBoundary: vi.fn().mockReturnValue('boundary'),
|
|
34
|
+
getEntryFile: vi.fn().mockReturnValue('name.js'),
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
config = { paths: ['src'] };
|
|
38
|
+
logger = {
|
|
39
|
+
error: vi.fn(),
|
|
40
|
+
debug: vi.fn(),
|
|
41
|
+
info: vi.fn(),
|
|
42
|
+
};
|
|
43
|
+
workspaceScanner = {
|
|
44
|
+
getModules: vi.fn().mockReturnValue(modules),
|
|
45
|
+
};
|
|
46
|
+
watcher = new FSWatcher();
|
|
47
|
+
vi.mocked(startWatch).mockReturnValue(watcher);
|
|
48
|
+
vi.mocked(getWorkspaceScanner).mockReturnValue(workspaceScanner);
|
|
49
|
+
moduleGraph = new ModuleGraph(config, logger);
|
|
50
|
+
});
|
|
51
|
+
it('should initialize correctly', () => {
|
|
52
|
+
expect(startWatch).toHaveBeenCalledWith(config.paths);
|
|
53
|
+
expect(getWorkspaceScanner).toHaveBeenCalledWith(config, logger);
|
|
54
|
+
expect(logger.debug).toHaveBeenCalledWith('[Module Graph] Found 1 LWC components in the current workspace.');
|
|
55
|
+
});
|
|
56
|
+
it('should handle file change events through watcher', () => {
|
|
57
|
+
const filePath = '/tmp/ns/name/cmp.js';
|
|
58
|
+
const updateListener = vi.fn();
|
|
59
|
+
moduleGraph.addListener('update', updateListener);
|
|
60
|
+
vi.mocked(watcher).on.mock.calls.find((c) => c[0] === 'change')[1](filePath);
|
|
61
|
+
expect(modules[0].addOrUpdatePart).toHaveBeenCalledWith('cmp.js');
|
|
62
|
+
expect(logger.info).toHaveBeenCalledWith(`[LWC Dev Server] File 'cmp.js' modified - updating.`);
|
|
63
|
+
expect(updateListener).toHaveBeenCalledWith('boundary');
|
|
64
|
+
});
|
|
65
|
+
it('should handle file add events through watcher', () => {
|
|
66
|
+
const filePath = '/tmp/ns/name/cmp1.js';
|
|
67
|
+
const addListener = vi.fn();
|
|
68
|
+
moduleGraph.addListener('update', addListener);
|
|
69
|
+
vi.mocked(watcher).on.mock.calls.find((c) => c[0] === 'add')[1](filePath);
|
|
70
|
+
expect(modules[0].addOrUpdatePart).toHaveBeenCalledWith('cmp1.js');
|
|
71
|
+
expect(logger.info).toHaveBeenCalledWith(`[LWC Dev Server] File 'cmp1.js' added - updating.`);
|
|
72
|
+
expect(addListener).toHaveBeenCalledWith('name.js');
|
|
45
73
|
});
|
|
46
|
-
it('should
|
|
47
|
-
const
|
|
48
|
-
|
|
74
|
+
it('should handle file delete events through watcher', () => {
|
|
75
|
+
const filePath = '/tmp/ns/name/cmp.js';
|
|
76
|
+
const addListener = vi.fn();
|
|
77
|
+
moduleGraph.addListener('update', addListener);
|
|
78
|
+
vi.mocked(watcher).on.mock.calls.find((c) => c[0] === 'unlink')[1](filePath);
|
|
79
|
+
expect(modules[0].deletePart).toHaveBeenCalledWith('cmp.js');
|
|
80
|
+
expect(logger.info).toHaveBeenCalledWith(`[LWC Dev Server] File '/tmp/ns/name/cmp.js' deleted - updating.`);
|
|
81
|
+
expect(addListener).toHaveBeenCalledWith('name.js');
|
|
49
82
|
});
|
|
50
|
-
it('should handle file
|
|
51
|
-
const
|
|
52
|
-
vi.
|
|
53
|
-
|
|
54
|
-
vi.mocked(
|
|
55
|
-
|
|
83
|
+
it('should handle file delete events when entry file is deleted', () => {
|
|
84
|
+
const filePath = '/tmp/ns/name/name.js';
|
|
85
|
+
const deleteModule = vi.fn();
|
|
86
|
+
moduleGraph.addListener('delete-module', deleteModule);
|
|
87
|
+
vi.mocked(modules[0].getEntryFile).mockImplementation(() => {
|
|
88
|
+
throw new InvalidModuleError();
|
|
89
|
+
});
|
|
90
|
+
vi.mocked(watcher).on.mock.calls.find((c) => c[0] === 'unlink')[1](filePath);
|
|
91
|
+
expect(modules[0].deletePart).toHaveBeenCalledWith('name.js');
|
|
92
|
+
expect(logger.info).toHaveBeenCalledWith(`[LWC Dev Server] File '/tmp/ns/name/name.js' deleted - updating.`);
|
|
93
|
+
expect(moduleGraph.modules.has('ns/name')).toBe(false);
|
|
94
|
+
expect(deleteModule).toHaveBeenCalledWith('ns/name');
|
|
56
95
|
});
|
|
57
|
-
it('should
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
96
|
+
it('should identify stale modules', () => {
|
|
97
|
+
const modules = [
|
|
98
|
+
{ id: 'ns/name', part: 'cmp.js', hash: 'hash1' },
|
|
99
|
+
{ id: 'ns/other', part: 'cmp.js', hash: 'hash2' },
|
|
100
|
+
];
|
|
101
|
+
const module1 = {
|
|
102
|
+
id: vi.fn().mockReturnValue('ns/name'),
|
|
103
|
+
getPart: vi.fn().mockReturnValue({ moduleSourceHash: 'hash1' }),
|
|
104
|
+
getEntryFile: vi.fn().mockReturnValue('entryFile1'),
|
|
105
|
+
};
|
|
106
|
+
const module2 = {
|
|
107
|
+
id: vi.fn().mockReturnValue('ns/other'),
|
|
108
|
+
getPart: vi.fn().mockReturnValue({ moduleSourceHash: 'differentHash' }),
|
|
109
|
+
getEntryFile: vi.fn().mockReturnValue('entryFile2'),
|
|
110
|
+
};
|
|
111
|
+
moduleGraph.modules.set('ns/name', module1);
|
|
112
|
+
moduleGraph.modules.set('ns/other', module2);
|
|
113
|
+
const staleModules = moduleGraph.getStaleModules(modules);
|
|
114
|
+
expect(logger.debug).toHaveBeenCalledWith(`[Module Graph] Following modules have a different version: \n\t ns/other`);
|
|
115
|
+
expect(staleModules).toEqual(new Set(['entryFile2']));
|
|
61
116
|
});
|
|
62
|
-
it('should
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
expect(result).toBe('ns/comp/comp.js');
|
|
117
|
+
it('should close the watcher', () => {
|
|
118
|
+
moduleGraph.close();
|
|
119
|
+
expect(moduleGraph.watcher.close).toHaveBeenCalled();
|
|
66
120
|
});
|
|
67
121
|
});
|
|
68
122
|
//# sourceMappingURL=index.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../src/server/moduleGraph/index.spec.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../src/server/moduleGraph/index.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAU,MAAM,aAAa,CAAC;AAEzD,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;IACvB,SAAS,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;QACzC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;QACX,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE;KACjB,CAAC,CAAC;CACN,CAAC,CAAC,CAAC;AACJ,EAA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G,EAAE;QAChC,WAAW,CAAC,KAAK,EAAE,CAAC;QACpB,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export interface ModuleInfo {
|
|
2
|
+
moduleSourceHash: string;
|
|
3
|
+
}
|
|
4
|
+
export type ModulePart = {
|
|
5
|
+
module: Module;
|
|
6
|
+
part: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Represents a Module entry per LWC component
|
|
10
|
+
*/
|
|
11
|
+
export declare class Module {
|
|
12
|
+
baseDir: string;
|
|
13
|
+
namespace: string;
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* Various parts of the module.
|
|
17
|
+
* For example:
|
|
18
|
+
* {
|
|
19
|
+
* "myComponent.js": { moduleHash: "xxx" },
|
|
20
|
+
* "myComponent.html": { moduleHash: "xxy" },
|
|
21
|
+
* "util/util.js": { moduleHash: "xxz" },
|
|
22
|
+
* }
|
|
23
|
+
*/
|
|
24
|
+
private moduleParts;
|
|
25
|
+
constructor(baseDir: string, namespace: string, name: string,
|
|
26
|
+
/**
|
|
27
|
+
* Various parts of the module.
|
|
28
|
+
* For example:
|
|
29
|
+
* {
|
|
30
|
+
* "myComponent.js": { moduleHash: "xxx" },
|
|
31
|
+
* "myComponent.html": { moduleHash: "xxy" },
|
|
32
|
+
* "util/util.js": { moduleHash: "xxz" },
|
|
33
|
+
* }
|
|
34
|
+
*/
|
|
35
|
+
moduleParts: {
|
|
36
|
+
[key: string]: ModuleInfo;
|
|
37
|
+
});
|
|
38
|
+
id(part?: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Returns the entry file of this module. Not cached because it can change overtime.
|
|
41
|
+
* @returns entry file of the module
|
|
42
|
+
*/
|
|
43
|
+
getEntryFile(): string;
|
|
44
|
+
/**
|
|
45
|
+
* Identify which modulePath that represents the boundary of the changed module.
|
|
46
|
+
* In the case of .html files, the module boundary is the template file itself. swapTemplate()
|
|
47
|
+
* is called and module swap is done.
|
|
48
|
+
* In the case of .css files, the module boundary is the css file itself, swapStyle() is called
|
|
49
|
+
* and module swap is done.
|
|
50
|
+
* In the case of .js files, the module boundary is the main entry file of the module, all the files
|
|
51
|
+
* reachable from the entry module are bundled and swapComponent invoked.
|
|
52
|
+
* Since JS hot swap is currently supporting components, this focused update of the main entry file
|
|
53
|
+
* is acceptable.
|
|
54
|
+
* @param modulePart The module that changed
|
|
55
|
+
* @return The modulePath of the boundary that needs to be updated.
|
|
56
|
+
*/
|
|
57
|
+
getModuleBoundary(modulePart: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Fetch files and source related to the modulePath that is being hot loaded.
|
|
60
|
+
* @param {string} modulePart The formatted path for the file being compiled.
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
getSources(modulePart: string): Promise<any>;
|
|
64
|
+
/**
|
|
65
|
+
* Delets the part and returns the entry file of the module
|
|
66
|
+
* @param part part of the module to be deleted
|
|
67
|
+
*/
|
|
68
|
+
deletePart(part: string): void;
|
|
69
|
+
getPart(part: string): ModuleInfo;
|
|
70
|
+
/**
|
|
71
|
+
* Updates the part of this module by recomputing its hash
|
|
72
|
+
* @param part part of the module to update
|
|
73
|
+
* @returns true if successful or false if it wasn't needed
|
|
74
|
+
*/
|
|
75
|
+
addOrUpdatePart(part: string): boolean;
|
|
76
|
+
}
|
|
77
|
+
export declare class InvalidModuleError extends Error {
|
|
78
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import * as fs from 'fs/promises';
|
|
3
|
+
import { getModuleHash } from '../util/fileUtil.js';
|
|
4
|
+
import { isFileInValidLwcFolder } from './workspaceScanner/fileReader.js';
|
|
5
|
+
/**
|
|
6
|
+
* Represents a Module entry per LWC component
|
|
7
|
+
*/
|
|
8
|
+
export class Module {
|
|
9
|
+
constructor(baseDir, namespace, name,
|
|
10
|
+
/**
|
|
11
|
+
* Various parts of the module.
|
|
12
|
+
* For example:
|
|
13
|
+
* {
|
|
14
|
+
* "myComponent.js": { moduleHash: "xxx" },
|
|
15
|
+
* "myComponent.html": { moduleHash: "xxy" },
|
|
16
|
+
* "util/util.js": { moduleHash: "xxz" },
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
moduleParts) {
|
|
20
|
+
this.baseDir = baseDir;
|
|
21
|
+
this.namespace = namespace;
|
|
22
|
+
this.name = name;
|
|
23
|
+
this.moduleParts = moduleParts;
|
|
24
|
+
}
|
|
25
|
+
id(part) {
|
|
26
|
+
const id = `${this.namespace}/${this.name}`;
|
|
27
|
+
return part ? path.join(id, part) : id;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Returns the entry file of this module. Not cached because it can change overtime.
|
|
31
|
+
* @returns entry file of the module
|
|
32
|
+
*/
|
|
33
|
+
getEntryFile() {
|
|
34
|
+
const potentialEntryFiles = ['js', 'ts', 'css'].map((ext) => `${this.name}.${ext}`);
|
|
35
|
+
const entryFile = potentialEntryFiles.find((entry) => this.moduleParts[entry]);
|
|
36
|
+
if (!entryFile) {
|
|
37
|
+
throw new InvalidModuleError();
|
|
38
|
+
}
|
|
39
|
+
return this.id(entryFile);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Identify which modulePath that represents the boundary of the changed module.
|
|
43
|
+
* In the case of .html files, the module boundary is the template file itself. swapTemplate()
|
|
44
|
+
* is called and module swap is done.
|
|
45
|
+
* In the case of .css files, the module boundary is the css file itself, swapStyle() is called
|
|
46
|
+
* and module swap is done.
|
|
47
|
+
* In the case of .js files, the module boundary is the main entry file of the module, all the files
|
|
48
|
+
* reachable from the entry module are bundled and swapComponent invoked.
|
|
49
|
+
* Since JS hot swap is currently supporting components, this focused update of the main entry file
|
|
50
|
+
* is acceptable.
|
|
51
|
+
* @param modulePart The module that changed
|
|
52
|
+
* @return The modulePath of the boundary that needs to be updated.
|
|
53
|
+
*/
|
|
54
|
+
getModuleBoundary(modulePart) {
|
|
55
|
+
const { ext } = path.parse(modulePart);
|
|
56
|
+
if (['.html', '.css'].includes(ext)) {
|
|
57
|
+
return this.id(modulePart);
|
|
58
|
+
}
|
|
59
|
+
return this.getEntryFile();
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Fetch files and source related to the modulePath that is being hot loaded.
|
|
63
|
+
* @param {string} modulePart The formatted path for the file being compiled.
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
async getSources(modulePart) {
|
|
67
|
+
const { ext } = path.parse(modulePart);
|
|
68
|
+
const modulePaths = [];
|
|
69
|
+
// HTML and CSS can be hot-swapped independently, so we compile only those.
|
|
70
|
+
const canCompileIndependently = ['.html', '.css'].includes(ext);
|
|
71
|
+
if (canCompileIndependently) {
|
|
72
|
+
modulePaths.push(modulePart);
|
|
73
|
+
}
|
|
74
|
+
else if (['.js', '.ts'].includes(ext)) {
|
|
75
|
+
// but if JS changes, we recompile the entire module
|
|
76
|
+
modulePaths.push(...Object.keys(this.moduleParts));
|
|
77
|
+
}
|
|
78
|
+
const sources = await Promise.all(modulePaths.map(async (modulePath) => [
|
|
79
|
+
modulePath,
|
|
80
|
+
await fs.readFile(path.join(this.baseDir, modulePath), 'utf-8'),
|
|
81
|
+
]));
|
|
82
|
+
// In cases where we compile HTML and CSS independently,
|
|
83
|
+
// Rollup needs an entry file matching the component name.
|
|
84
|
+
// We can't pass the actual entry file because it'll consume the above
|
|
85
|
+
// HTML and CSS and export just the component. We need the actuall CSS/HTML to
|
|
86
|
+
// be exported so we can hot-swap.
|
|
87
|
+
// Here, we pass a dummy entry file that just re-exports everything
|
|
88
|
+
// This satisfies rollup and gives us the exported CSS and HTML
|
|
89
|
+
// One caveat though: we don't want HMR transformations to run on this dummy entry file
|
|
90
|
+
// which is why we have this __LWC_HMR_DUMMY_IMPORTER marker
|
|
91
|
+
if (canCompileIndependently) {
|
|
92
|
+
sources.push([
|
|
93
|
+
this.name + '.js',
|
|
94
|
+
`/* __LWC_HMR_DUMMY_IMPORTER */ export * from './${modulePaths[0]}'; import Default from './${modulePaths[0]}'; export default Default;`,
|
|
95
|
+
]);
|
|
96
|
+
}
|
|
97
|
+
return Object.fromEntries(sources);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Delets the part and returns the entry file of the module
|
|
101
|
+
* @param part part of the module to be deleted
|
|
102
|
+
*/
|
|
103
|
+
deletePart(part) {
|
|
104
|
+
delete this.moduleParts[part];
|
|
105
|
+
}
|
|
106
|
+
getPart(part) {
|
|
107
|
+
return this.moduleParts[part];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Updates the part of this module by recomputing its hash
|
|
111
|
+
* @param part part of the module to update
|
|
112
|
+
* @returns true if successful or false if it wasn't needed
|
|
113
|
+
*/
|
|
114
|
+
addOrUpdatePart(part) {
|
|
115
|
+
if (!isFileInValidLwcFolder(part))
|
|
116
|
+
return false;
|
|
117
|
+
const newModuleHash = getModuleHash(path.join(this.baseDir, part));
|
|
118
|
+
if (this.moduleParts[part] && this.moduleParts[part].moduleSourceHash === newModuleHash)
|
|
119
|
+
return false;
|
|
120
|
+
this.moduleParts[part] = { moduleSourceHash: newModuleHash };
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export class InvalidModuleError extends Error {
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/server/moduleGraph/module.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;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,CAAC,CAAC;QACP,CAAC;QACD,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,IAAY;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,CAAC,IAAY;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IACD;;;;OAIG;IACH,eAAe,CAAC,IAAY;QACxB,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QAChD,MAAM,aAAa,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QACnE,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,gBAAgB,KAAK,aAAa;YACnF,OAAO,KAAK,CAAC;QACjB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,EAAE,aAAa,EAAE,CAAC;QAC7D,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,MAAM,OAAO,kBAAmB,SAAQ,KAAK;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as fs from 'fs/promises';
|
|
2
|
+
import { getModuleHash } from '../util/fileUtil';
|
|
3
|
+
import { Module, InvalidModuleError } from './module';
|
|
4
|
+
vi.mock('fs/promises');
|
|
5
|
+
vi.mock('../util/fileUtil');
|
|
6
|
+
describe('Module', () => {
|
|
7
|
+
let module;
|
|
8
|
+
const baseDir = '/base/dir';
|
|
9
|
+
const namespace = 'namespace';
|
|
10
|
+
const name = 'name';
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
const moduleParts = {
|
|
13
|
+
'name.js': { moduleSourceHash: 'hash1' },
|
|
14
|
+
'name.html': { moduleSourceHash: 'hash2' },
|
|
15
|
+
'util/util.js': { moduleSourceHash: 'hash3' },
|
|
16
|
+
};
|
|
17
|
+
module = new Module(baseDir, namespace, name, moduleParts);
|
|
18
|
+
vi.resetAllMocks();
|
|
19
|
+
});
|
|
20
|
+
it('should return the correct id', () => {
|
|
21
|
+
expect(module.id()).toBe('namespace/name');
|
|
22
|
+
expect(module.id('part')).toBe('namespace/name/part');
|
|
23
|
+
});
|
|
24
|
+
it('should return the entry file', () => {
|
|
25
|
+
expect(module.getEntryFile()).toBe('namespace/name/name.js');
|
|
26
|
+
});
|
|
27
|
+
it('should throw InvalidModuleError if no entry file is found', () => {
|
|
28
|
+
const emptyModule = new Module(baseDir, namespace, name, {});
|
|
29
|
+
expect(() => emptyModule.getEntryFile()).toThrow(InvalidModuleError);
|
|
30
|
+
});
|
|
31
|
+
it('should return the correct module boundary for .html and .css files', () => {
|
|
32
|
+
expect(module.getModuleBoundary('name.html')).toBe('namespace/name/name.html');
|
|
33
|
+
expect(module.getModuleBoundary('name.css')).toBe('namespace/name/name.css');
|
|
34
|
+
});
|
|
35
|
+
it('should return the entry file as module boundary for .js and .ts files', () => {
|
|
36
|
+
expect(module.getModuleBoundary('name.js')).toBe('namespace/name/name.js');
|
|
37
|
+
expect(module.getModuleBoundary('name.ts')).toBe('namespace/name/name.js');
|
|
38
|
+
});
|
|
39
|
+
it('should fetch sources correctly', async () => {
|
|
40
|
+
vi.mocked(fs.readFile).mockResolvedValue('file content');
|
|
41
|
+
const sources = await module.getSources('name.js');
|
|
42
|
+
expect(sources).toEqual({
|
|
43
|
+
'name.js': 'file content',
|
|
44
|
+
'name.html': 'file content',
|
|
45
|
+
'util/util.js': 'file content',
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
it('should fetch individual sources correctly', async () => {
|
|
49
|
+
vi.mocked(fs.readFile).mockResolvedValue('file content');
|
|
50
|
+
const sources = await module.getSources('name.html');
|
|
51
|
+
expect(sources).toEqual({
|
|
52
|
+
'name.js': `/* __LWC_HMR_DUMMY_IMPORTER */ export * from './name.html'; import Default from './name.html'; export default Default;`,
|
|
53
|
+
'name.html': 'file content',
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
it('should delete a part', () => {
|
|
57
|
+
module.deletePart('name.html');
|
|
58
|
+
expect(module.getPart('name.html')).toBeUndefined();
|
|
59
|
+
});
|
|
60
|
+
it('should add or update a part', () => {
|
|
61
|
+
vi.mocked(getModuleHash).mockReturnValue('newHash');
|
|
62
|
+
expect(module.addOrUpdatePart('name.js')).toBe(true);
|
|
63
|
+
expect(module.getPart('name.js')).toEqual({ moduleSourceHash: 'newHash' });
|
|
64
|
+
});
|
|
65
|
+
it('should not update a part if the hash is the same', () => {
|
|
66
|
+
vi.mocked(getModuleHash).mockReturnValue('hash1');
|
|
67
|
+
expect(module.addOrUpdatePart('name.js')).toBe(false);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=module.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.spec.js","sourceRoot":"","sources":["../../../src/server/moduleGraph/module.spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAc,MAAM,UAAU,CAAC;AAElE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACvB,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;AAC5B,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACpB,IAAI,MAAc,CAAC;IACnB,MAAM,OAAO,GAAG,WAAW,CAAC;IAC5B,MAAM,SAAS,GAAG,WAAW,CAAC;IAC9B,MAAM,IAAI,GAAG,MAAM,CAAC;IACpB,UAAU,CAAC,GAAG,EAAE;QACZ,MAAM,WAA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IACxD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACnC,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;QACpD,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,gBAAgB,EAAE,SAAS,EAAE,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QACxD,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -2,19 +2,19 @@ import path from 'node:path';
|
|
|
2
2
|
import { getComponentParts } from '../fileReader';
|
|
3
3
|
function formatPaths(input) {
|
|
4
4
|
return Object.fromEntries(Object.keys(input).map((k) => {
|
|
5
|
-
return [k, input[k].
|
|
5
|
+
return [k, input[k].moduleSourceHash];
|
|
6
6
|
}));
|
|
7
7
|
}
|
|
8
8
|
describe('internal workspace type', () => {
|
|
9
9
|
it('gets modules parts of an internal component', () => {
|
|
10
|
-
const moduleParts = getComponentParts(path.join(__dirname, './data/internal/ui-force-components/modules/ns/sample')
|
|
10
|
+
const moduleParts = getComponentParts(path.join(__dirname, './data/internal/ui-force-components/modules/ns/sample'));
|
|
11
11
|
expect(moduleParts).not.toBeUndefined();
|
|
12
12
|
expect(formatPaths(moduleParts)).toMatchSnapshot();
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
15
|
describe('salesforce cli workspace type', () => {
|
|
16
16
|
it('gets modules parts of an external component', () => {
|
|
17
|
-
const moduleParts = getComponentParts(path.join(__dirname, './data/sfdx/force-app/main/default/lwc/myComponent')
|
|
17
|
+
const moduleParts = getComponentParts(path.join(__dirname, './data/sfdx/force-app/main/default/lwc/myComponent'));
|
|
18
18
|
expect(moduleParts).not.toBeUndefined();
|
|
19
19
|
expect(formatPaths(moduleParts)).toMatchSnapshot();
|
|
20
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileReader.spec.js","sourceRoot":"","sources":["../../../../../src/server/moduleGraph/workspaceScanner/__tests__/fileReader.spec.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD,SAAS,WAAW,CAAC,KAAoC;IACrD,OAAO,MAAM,CAAC,WAAW,CACrB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACzB,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"fileReader.spec.js","sourceRoot":"","sources":["../../../../../src/server/moduleGraph/workspaceScanner/__tests__/fileReader.spec.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD,SAAS,WAAW,CAAC,KAAoC;IACrD,OAAO,MAAM,CAAC,WAAW,CACrB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACzB,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAC1C,CAAC,CAAC,CACL,CAAC;AACN,CAAC;AAED,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACrC,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACnD,MAAM,WAAW,GAAG,iBAAiB,CACjC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uDAAuD,CAAC,CAChF,CAAC;QACF,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QACxC,MAAM,CAAC,WAAW,CAAC,WAAY,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC3C,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACnD,MAAM,WAAW,GAAG,iBAAiB,CACjC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oDAAoD,CAAC,CAC7E,CAAC;QACF,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QACxC,MAAM,CAAC,WAAW,CAAC,WAAY,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
import path from 'node:path';
|
|
2
3
|
import { Workspace } from '../../../../types/serverConfig.js';
|
|
3
4
|
import InternalWorkspaceScanner from '../internal.js';
|
|
4
|
-
class MockLogger {
|
|
5
|
-
log(_level, _message) {
|
|
6
|
-
// do nothing;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
5
|
describe('Internal Workspace Scanner', () => {
|
|
10
6
|
it('should add all modules to module map when no exclude paths are provided', () => {
|
|
11
7
|
const workspaceScanner = new InternalWorkspaceScanner(Workspace.Internal, [
|
|
12
8
|
path.resolve(__dirname, './data/internal/ui-force-components'),
|
|
13
9
|
path.resolve(__dirname, './data/internal/ui'),
|
|
14
|
-
],
|
|
10
|
+
], {});
|
|
15
11
|
const dirs = workspaceScanner.findModuleDirs();
|
|
16
12
|
expect(dirs).toEqual([
|
|
17
13
|
path.resolve(__dirname, 'data/internal/ui-force-components/modules/ns/sample'),
|
|
@@ -19,7 +15,7 @@ describe('Internal Workspace Scanner', () => {
|
|
|
19
15
|
path.resolve(__dirname, 'data/internal/ui/components/modules/uins/sample'),
|
|
20
16
|
path.resolve(__dirname, 'data/internal/ui/components/modules/uins/exclude'),
|
|
21
17
|
]);
|
|
22
|
-
expect(
|
|
18
|
+
expect(workspaceScanner.getModules().map((m) => m.id())).toEqual([
|
|
23
19
|
'ns/sample',
|
|
24
20
|
'ns/exclude',
|
|
25
21
|
'uins/sample',
|
|
@@ -30,7 +26,7 @@ describe('Internal Workspace Scanner', () => {
|
|
|
30
26
|
const workspaceScanner = new InternalWorkspaceScanner(Workspace.Internal, [
|
|
31
27
|
path.resolve(__dirname, './data/internal/ui-force-components'),
|
|
32
28
|
path.resolve(__dirname, './data/internal/ui'),
|
|
33
|
-
],
|
|
29
|
+
], {}, [
|
|
34
30
|
path.resolve(__dirname, './data/internal/ui-force-components/modules/ns/exclude'),
|
|
35
31
|
path.resolve(__dirname, './data/internal/ui/components/modules/uins/exclude'),
|
|
36
32
|
]);
|
|
@@ -39,7 +35,10 @@ describe('Internal Workspace Scanner', () => {
|
|
|
39
35
|
path.resolve(__dirname, 'data/internal/ui-force-components/modules/ns/sample'),
|
|
40
36
|
path.resolve(__dirname, 'data/internal/ui/components/modules/uins/sample'),
|
|
41
37
|
]);
|
|
42
|
-
expect(
|
|
38
|
+
expect(workspaceScanner.getModules().map((m) => m.id())).toEqual([
|
|
39
|
+
'ns/sample',
|
|
40
|
+
'uins/sample',
|
|
41
|
+
]);
|
|
43
42
|
});
|
|
44
43
|
});
|
|
45
44
|
//# sourceMappingURL=internal.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.spec.js","sourceRoot":"","sources":["../../../../../src/server/moduleGraph/workspaceScanner/__tests__/internal.spec.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.spec.js","sourceRoot":"","sources":["../../../../../src/server/moduleGraph/workspaceScanner/__tests__/internal.spec.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,wBAAwB,MAAM,gBAAgB,CAAC;AAEtD,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,yEAAyE,EAAE,GAAG,EAAE;QAC/E,MAAM,gBAAgB,GAAG,IAAI,wBAAwB,CACjD,SAAS,CAAC,QAAQ,EAClB;YACI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,qCAAqC,CAAC;YAC9D,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,oBAAoB,CAAC;SAChD,EACD,EAAuB,CAC1B,CAAC;QACF,MAAM,IAAI,GAAG,gBAAgB,CAAC,cAAc,EAAE,CAAC;QAE/C,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;YACjB,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,qDAAqD,CAAC;YAC9E,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,sDAAsD,CAAC;YAC/E,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,iDAAiD,CAAC;YAC1E,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,kDAAkD,CAAC;SAC9E,CAAC,CAAC;QACH,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YAC7D,WAAW;YACX,YAAY;YACZ,aAAa;YACb,cAAc;SACjB,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACrD,MAAM,gBAAgB,GAAG,IAAI,wBAAwB,CACjD,SAAS,CAAC,QAAQ,EAClB;YACI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,qCAAqC,CAAC;YAC9D,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,oBAAoB,CAAC;SAChD,EACD,EAAuB,EACvB;YACI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,wDAAwD,CAAC;YACjF,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,oDAAoD,CAAC;SAChF,CACJ,CAAC;QACF,MAAM,IAAI,GAAG,gBAAgB,CAAC,cAAc,EAAE,CAAC;QAC/C,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;YACjB,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,qDAAqD,CAAC;YAC9E,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,iDAAiD,CAAC;SAC7E,CAAC,CAAC;QAEH,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YAC7D,WAAW;YACX,aAAa;SAChB,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { Workspace } from '../../../../types/serverConfig';
|
|
3
3
|
import MrtWorkspaceScanner from '../mrt';
|
|
4
|
-
class MockLogger {
|
|
5
|
-
log(_level, _message) {
|
|
6
|
-
// do nothing;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
4
|
describe('MRT Workspace Scanner', () => {
|
|
10
5
|
let workspaceScanner;
|
|
11
6
|
beforeAll(() => {
|
|
12
|
-
workspaceScanner = new MrtWorkspaceScanner(Workspace.Mrt, [path.resolve(__dirname, './data/mrt/some-path')],
|
|
7
|
+
workspaceScanner = new MrtWorkspaceScanner(Workspace.Mrt, [path.resolve(__dirname, './data/mrt/some-path')], {});
|
|
13
8
|
});
|
|
14
9
|
it('should return correct namespace', () => {
|
|
15
10
|
const dirs = workspaceScanner.findModuleDirs();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mrt.spec.js","sourceRoot":"","sources":["../../../../../src/server/moduleGraph/workspaceScanner/__tests__/mrt.spec.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"mrt.spec.js","sourceRoot":"","sources":["../../../../../src/server/moduleGraph/workspaceScanner/__tests__/mrt.spec.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,mBAAmB,MAAM,QAAQ,CAAC;AAEzC,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACnC,IAAI,gBAAqC,CAAC;IAC1C,SAAS,CAAC,GAAG,EAAE;QACX,gBAAgB,GAAG,IAAI,mBAAmB,CACtC,SAAS,CAAC,GAAG,EACb,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC,EACjD,EAAuB,CAC1B,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACvC,MAAM,IAAI,GAAG,gBAAgB,CAAC,cAAc,EAAE,CAAC;QAE/C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5B,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACjB,MAAM,CAAC,gBAAgB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|