@lwrjs/lwc-module-provider 0.9.0-alpha.12 → 0.9.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.cjs +3 -2
- package/build/cjs/utils.cjs +2 -2
- package/build/es/index.d.ts +1 -1
- package/build/es/index.js +5 -2
- package/build/es/utils.d.ts +2 -2
- package/build/es/utils.js +3 -3
- package/package.json +4 -4
package/build/cjs/index.cjs
CHANGED
|
@@ -38,7 +38,8 @@ var LwcModuleProvider = class {
|
|
|
38
38
|
constructor(options = {}, {
|
|
39
39
|
appEmitter,
|
|
40
40
|
config: {modules, rootDir, cacheDir, environment},
|
|
41
|
-
runtimeEnvironment: {watchFiles}
|
|
41
|
+
runtimeEnvironment: {watchFiles},
|
|
42
|
+
watcherFactory
|
|
42
43
|
}) {
|
|
43
44
|
this.name = "lwc-module-provider";
|
|
44
45
|
this.moduleSourceCache = new Map();
|
|
@@ -52,7 +53,7 @@ var LwcModuleProvider = class {
|
|
|
52
53
|
this.emitter = appEmitter;
|
|
53
54
|
this.modules = modules;
|
|
54
55
|
this.rootDir = rootDir;
|
|
55
|
-
this.watcher = watchFiles ? (0, import_utils.setUpWatcher)(this.onModuleChange.bind(this)) : void 0;
|
|
56
|
+
this.watcher = watchFiles && watcherFactory ? (0, import_utils.setUpWatcher)(watcherFactory, this.onModuleChange.bind(this)) : void 0;
|
|
56
57
|
this.moduleFsCacheEnabled = disableCaching !== void 0 ? !disableCaching : true;
|
|
57
58
|
this.interchangeableModulesEnabled = !!environment?.default;
|
|
58
59
|
if (this.moduleFsCacheEnabled) {
|
package/build/cjs/utils.cjs
CHANGED
|
@@ -79,8 +79,8 @@ function isImplicitLwcImport(entry, specifier) {
|
|
|
79
79
|
}
|
|
80
80
|
return true;
|
|
81
81
|
}
|
|
82
|
-
function setUpWatcher(onModuleChange) {
|
|
83
|
-
const watcher =
|
|
82
|
+
function setUpWatcher(watcherFactory, onModuleChange) {
|
|
83
|
+
const watcher = watcherFactory.createFileWatcher();
|
|
84
84
|
watcher.on("change", (0, import_shared_utils.debounce)((file) => onModuleChange(file), 500));
|
|
85
85
|
watcher.on("unlink", (0, import_shared_utils.debounce)((file) => onModuleChange(file), 500));
|
|
86
86
|
watcher.on("add", (file) => import_shared_utils.logger.info(`Watching: ${file}`));
|
package/build/es/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export default class LwcModuleProvider implements ModuleProvider {
|
|
|
19
19
|
private lwcCompiler;
|
|
20
20
|
private inflightGetModuleJobs;
|
|
21
21
|
private inflightGetModuleEntryJobs;
|
|
22
|
-
constructor(options: LwcModuleProviderOptions | undefined, { appEmitter, config: { modules, rootDir, cacheDir, environment }, runtimeEnvironment: { watchFiles }, }: ProviderContext);
|
|
22
|
+
constructor(options: LwcModuleProviderOptions | undefined, { appEmitter, config: { modules, rootDir, cacheDir, environment }, runtimeEnvironment: { watchFiles }, watcherFactory, }: ProviderContext);
|
|
23
23
|
onModuleChange(fileChanged: string): Promise<void>;
|
|
24
24
|
getModule(moduleId: AbstractModuleId): Promise<ModuleCompiled | undefined>;
|
|
25
25
|
/**
|
package/build/es/index.js
CHANGED
|
@@ -7,7 +7,7 @@ function getModuleEntryCacheKey(specifier, version) {
|
|
|
7
7
|
return `${specifier}@${version}`;
|
|
8
8
|
}
|
|
9
9
|
export default class LwcModuleProvider {
|
|
10
|
-
constructor(options = {}, { appEmitter, config: { modules, rootDir, cacheDir, environment }, runtimeEnvironment: { watchFiles }, }) {
|
|
10
|
+
constructor(options = {}, { appEmitter, config: { modules, rootDir, cacheDir, environment }, runtimeEnvironment: { watchFiles }, watcherFactory, }) {
|
|
11
11
|
this.name = 'lwc-module-provider';
|
|
12
12
|
this.moduleSourceCache = new Map();
|
|
13
13
|
this.packageVersionCache = new Map();
|
|
@@ -20,7 +20,10 @@ export default class LwcModuleProvider {
|
|
|
20
20
|
this.emitter = appEmitter;
|
|
21
21
|
this.modules = modules;
|
|
22
22
|
this.rootDir = rootDir;
|
|
23
|
-
this.watcher =
|
|
23
|
+
this.watcher =
|
|
24
|
+
watchFiles && watcherFactory
|
|
25
|
+
? setUpWatcher(watcherFactory, this.onModuleChange.bind(this))
|
|
26
|
+
: undefined;
|
|
24
27
|
this.moduleFsCacheEnabled = disableCaching !== undefined ? !disableCaching : true;
|
|
25
28
|
this.interchangeableModulesEnabled = !!environment?.default;
|
|
26
29
|
// Module Cache setup
|
package/build/es/utils.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ResolverModuleRecord, Watcher } from '@lwrjs/types';
|
|
1
|
+
import type { ResolverModuleRecord, Watcher, WatcherFactory } from '@lwrjs/types';
|
|
2
2
|
import { RegistryEntry } from '@lwc/module-resolver';
|
|
3
3
|
export declare const EXPLICIT_CONSTANT = "/* _implicit_dependency_ */";
|
|
4
4
|
export declare const DEFAULT_IMPLICIT_DEP: string;
|
|
5
5
|
export declare function resolveModuleSpecifier(specifier: string, importer: string, modules: ResolverModuleRecord[] | undefined, packageVersionCache: Map<string, string>): Required<RegistryEntry>;
|
|
6
6
|
export declare function isImplicitLwcImport(entry: string, specifier: string): boolean;
|
|
7
|
-
export declare function setUpWatcher(onModuleChange: Function): Watcher;
|
|
7
|
+
export declare function setUpWatcher(watcherFactory: WatcherFactory, onModuleChange: Function): Watcher;
|
|
8
8
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/es/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { readFile, debounce,
|
|
3
|
+
import { readFile, debounce, logger } from '@lwrjs/shared-utils';
|
|
4
4
|
import { resolveModule } from '@lwc/module-resolver';
|
|
5
5
|
export const EXPLICIT_CONSTANT = '/* _implicit_dependency_ */';
|
|
6
6
|
export const DEFAULT_IMPLICIT_DEP = `${EXPLICIT_CONSTANT} export default void 0`;
|
|
@@ -61,8 +61,8 @@ export function isImplicitLwcImport(entry, specifier) {
|
|
|
61
61
|
}
|
|
62
62
|
return true;
|
|
63
63
|
}
|
|
64
|
-
export function setUpWatcher(onModuleChange) {
|
|
65
|
-
const watcher = createFileWatcher();
|
|
64
|
+
export function setUpWatcher(watcherFactory, onModuleChange) {
|
|
65
|
+
const watcher = watcherFactory.createFileWatcher();
|
|
66
66
|
watcher.on('change', debounce((file) => onModuleChange(file), 500));
|
|
67
67
|
watcher.on('unlink', debounce((file) => onModuleChange(file), 500));
|
|
68
68
|
watcher.on('add', (file) => logger.info(`Watching: ${file}`));
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.9.0-alpha.
|
|
7
|
+
"version": "0.9.0-alpha.13",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/preset-typescript": "^7.9.0",
|
|
34
34
|
"@lwc/module-resolver": "2.33.0",
|
|
35
|
-
"@lwrjs/shared-utils": "0.9.0-alpha.
|
|
35
|
+
"@lwrjs/shared-utils": "0.9.0-alpha.13",
|
|
36
36
|
"es-module-lexer": "^0.3.18"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@lwrjs/types": "0.9.0-alpha.
|
|
39
|
+
"@lwrjs/types": "0.9.0-alpha.13"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|
|
42
42
|
"node": ">=14.15.4 <19"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "fa30915a685f6e8c5c2895d0c053d59145780123"
|
|
45
45
|
}
|