@lwrjs/lwc-module-provider 0.17.2-alpha.3 → 0.17.2-alpha.31
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/compiler.cjs +7 -1
- package/build/cjs/index.cjs +1 -1
- package/build/cjs/utils.cjs +5 -2
- package/build/es/cache.js +3 -0
- package/build/es/compiler.js +11 -2
- package/build/es/index.d.ts +1 -1
- package/build/es/index.js +18 -9
- package/build/es/utils.d.ts +1 -1
- package/build/es/utils.js +5 -2
- package/package.json +9 -8
package/build/cjs/compiler.cjs
CHANGED
|
@@ -39,6 +39,12 @@ var DEFAULT_BABEL_CONFIG = {
|
|
|
39
39
|
plugins: [["decorators", {decoratorsBeforeExport: true}]]
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
+
function skipCompilation(namespace, theName) {
|
|
43
|
+
if (!namespace && theName === "lwc" || namespace === "@lwc" || namespace === "lwr" && theName === "hmr") {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
42
48
|
var LwcCompiler = class {
|
|
43
49
|
constructor(compiler) {
|
|
44
50
|
this.compiler = compiler;
|
|
@@ -89,7 +95,7 @@ var LwcCompiler = class {
|
|
|
89
95
|
}
|
|
90
96
|
source = result.code;
|
|
91
97
|
}
|
|
92
|
-
if (namespace
|
|
98
|
+
if (skipCompilation(namespace, name)) {
|
|
93
99
|
return {
|
|
94
100
|
code: source,
|
|
95
101
|
map: null,
|
package/build/cjs/index.cjs
CHANGED
|
@@ -228,7 +228,7 @@ var LwcModuleProvider = class {
|
|
|
228
228
|
rootDir: this.rootDir
|
|
229
229
|
}
|
|
230
230
|
});
|
|
231
|
-
const registryEntry = (0, import_utils.resolveModuleSpecifier)(baseSpecifier,
|
|
231
|
+
const registryEntry = (0, import_utils.resolveModuleSpecifier)(baseSpecifier, this.rootDir, this.modules, this.packageVersionCache, importer);
|
|
232
232
|
import_diagnostics.logger.debug({
|
|
233
233
|
label: `${this.name}`,
|
|
234
234
|
message: "createModuleEntry:registryEntry",
|
package/build/cjs/utils.cjs
CHANGED
|
@@ -37,7 +37,7 @@ var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
|
|
|
37
37
|
var import_module_resolver = __toModule(require("@lwc/module-resolver"));
|
|
38
38
|
var EXPLICIT_CONSTANT = "/* _implicit_dependency_ */";
|
|
39
39
|
var DEFAULT_IMPLICIT_DEP = `${EXPLICIT_CONSTANT} export default void 0`;
|
|
40
|
-
function resolveModuleSpecifier(specifier,
|
|
40
|
+
function resolveModuleSpecifier(specifier, rootDir, modules = [], packageVersionCache, importer) {
|
|
41
41
|
import_diagnostics.logger.debug({
|
|
42
42
|
label: `lwc-module-provider`,
|
|
43
43
|
message: "resolveModuleSpecifier",
|
|
@@ -45,7 +45,10 @@ function resolveModuleSpecifier(specifier, importer, modules = [], packageVersio
|
|
|
45
45
|
});
|
|
46
46
|
let resolvedModule;
|
|
47
47
|
try {
|
|
48
|
-
resolvedModule = (0, import_module_resolver.resolveModule)(specifier, process.env.SF_CLI_ROOT_DIR || importer, {
|
|
48
|
+
resolvedModule = (0, import_module_resolver.resolveModule)(specifier, process.env.SF_CLI_ROOT_DIR || importer || rootDir, {
|
|
49
|
+
modules,
|
|
50
|
+
rootDir
|
|
51
|
+
});
|
|
49
52
|
} catch (error) {
|
|
50
53
|
if (import_diagnostics.logger.isDebugEnabled()) {
|
|
51
54
|
import_diagnostics.logger.debug({
|
package/build/es/cache.js
CHANGED
package/build/es/compiler.js
CHANGED
|
@@ -11,7 +11,17 @@ const DEFAULT_BABEL_CONFIG = {
|
|
|
11
11
|
plugins: [['decorators', { decoratorsBeforeExport: true }]],
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
|
+
function skipCompilation(namespace, theName) {
|
|
15
|
+
if ((!namespace && theName === 'lwc') || // LWC framework
|
|
16
|
+
namespace === '@lwc' || // other LWC framework packages
|
|
17
|
+
(namespace === 'lwr' && theName === 'hmr') // HMR module (until we dont allow swap methods)
|
|
18
|
+
) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
14
23
|
export class LwcCompiler {
|
|
24
|
+
compiler;
|
|
15
25
|
constructor(compiler) {
|
|
16
26
|
// Allow callers to pass in their own version of the LWC compiler
|
|
17
27
|
this.compiler = compiler;
|
|
@@ -64,8 +74,7 @@ export class LwcCompiler {
|
|
|
64
74
|
}
|
|
65
75
|
source = result.code;
|
|
66
76
|
}
|
|
67
|
-
|
|
68
|
-
if (namespace === 'lwr' && name === 'hmr') {
|
|
77
|
+
if (skipCompilation(namespace, name)) {
|
|
69
78
|
return {
|
|
70
79
|
code: source,
|
|
71
80
|
map: null,
|
package/build/es/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface LwcModuleProviderOptions {
|
|
|
6
6
|
}
|
|
7
7
|
export default class LwcModuleProvider implements ModuleProvider {
|
|
8
8
|
name: string;
|
|
9
|
-
|
|
9
|
+
protected rootDir: string;
|
|
10
10
|
private moduleFsCacheEnabled;
|
|
11
11
|
private interchangeableModulesEnabled;
|
|
12
12
|
private lwcCacheDir?;
|
package/build/es/index.js
CHANGED
|
@@ -8,15 +8,24 @@ function getModuleEntryCacheKey(specifier, version, targetSSR) {
|
|
|
8
8
|
return `${specifier}@${version}|${targetSSR ? 'server' : 'client'}`;
|
|
9
9
|
}
|
|
10
10
|
export default class LwcModuleProvider {
|
|
11
|
+
name = 'lwc-module-provider';
|
|
12
|
+
rootDir;
|
|
13
|
+
moduleFsCacheEnabled;
|
|
14
|
+
interchangeableModulesEnabled;
|
|
15
|
+
lwcCacheDir;
|
|
16
|
+
lwcCacheIndex;
|
|
17
|
+
moduleSourceCache = new Map(); // key = filepath
|
|
18
|
+
packageVersionCache = new Map();
|
|
19
|
+
modules;
|
|
20
|
+
emitter;
|
|
21
|
+
watcher;
|
|
22
|
+
watchedModuleContextMap = new Map(); // key = filepath
|
|
23
|
+
moduleEntryVersionCache = new Map(); // key = moduleEntry.id
|
|
24
|
+
importerMappingCache = new Map();
|
|
25
|
+
lwcCompiler;
|
|
26
|
+
inflightGetModuleJobs = new InflightTasks();
|
|
27
|
+
inflightGetModuleEntryJobs = new InflightTasks();
|
|
11
28
|
constructor(options = {}, { appEmitter, config: { modules, rootDir, cacheDir, environment }, runtimeEnvironment: { watchFiles }, watcherFactory, }) {
|
|
12
|
-
this.name = 'lwc-module-provider';
|
|
13
|
-
this.moduleSourceCache = new Map(); // key = filepath
|
|
14
|
-
this.packageVersionCache = new Map();
|
|
15
|
-
this.watchedModuleContextMap = new Map(); // key = filepath
|
|
16
|
-
this.moduleEntryVersionCache = new Map(); // key = moduleEntry.id
|
|
17
|
-
this.importerMappingCache = new Map();
|
|
18
|
-
this.inflightGetModuleJobs = new InflightTasks();
|
|
19
|
-
this.inflightGetModuleEntryJobs = new InflightTasks();
|
|
20
29
|
const { disableCaching } = options;
|
|
21
30
|
this.emitter = appEmitter;
|
|
22
31
|
this.modules = modules;
|
|
@@ -217,7 +226,7 @@ export default class LwcModuleProvider {
|
|
|
217
226
|
rootDir: this.rootDir,
|
|
218
227
|
},
|
|
219
228
|
});
|
|
220
|
-
const registryEntry = resolveModuleSpecifier(baseSpecifier,
|
|
229
|
+
const registryEntry = resolveModuleSpecifier(baseSpecifier, this.rootDir, this.modules, this.packageVersionCache, importer);
|
|
221
230
|
logger.debug({
|
|
222
231
|
label: `${this.name}`,
|
|
223
232
|
message: 'createModuleEntry:registryEntry',
|
package/build/es/utils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ 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
|
-
export declare function resolveModuleSpecifier(specifier: string,
|
|
5
|
+
export declare function resolveModuleSpecifier(specifier: string, rootDir: string, modules: ResolverModuleRecord[] | undefined, packageVersionCache: Map<string, string>, importer?: string): Required<RegistryEntry>;
|
|
6
6
|
export declare function isImplicitLwcImport(entry: string, specifier: string): boolean;
|
|
7
7
|
export declare function setUpWatcher(watcherFactory: WatcherFactory, onModuleChange: Function): Watcher;
|
|
8
8
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/es/utils.js
CHANGED
|
@@ -5,7 +5,7 @@ import { readFile, debounce } from '@lwrjs/shared-utils';
|
|
|
5
5
|
import { resolveModule } from '@lwc/module-resolver';
|
|
6
6
|
export const EXPLICIT_CONSTANT = '/* _implicit_dependency_ */';
|
|
7
7
|
export const DEFAULT_IMPLICIT_DEP = `${EXPLICIT_CONSTANT} export default void 0`;
|
|
8
|
-
export function resolveModuleSpecifier(specifier,
|
|
8
|
+
export function resolveModuleSpecifier(specifier, rootDir, modules = [], packageVersionCache, importer) {
|
|
9
9
|
logger.debug({
|
|
10
10
|
label: `lwc-module-provider`,
|
|
11
11
|
message: 'resolveModuleSpecifier',
|
|
@@ -13,7 +13,10 @@ export function resolveModuleSpecifier(specifier, importer, modules = [], packag
|
|
|
13
13
|
});
|
|
14
14
|
let resolvedModule;
|
|
15
15
|
try {
|
|
16
|
-
resolvedModule = resolveModule(specifier, process.env.SF_CLI_ROOT_DIR || importer, {
|
|
16
|
+
resolvedModule = resolveModule(specifier, process.env.SF_CLI_ROOT_DIR || importer || rootDir, {
|
|
17
|
+
modules,
|
|
18
|
+
rootDir,
|
|
19
|
+
});
|
|
17
20
|
}
|
|
18
21
|
catch (error) {
|
|
19
22
|
if (logger.isDebugEnabled()) {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.17.2-alpha.
|
|
7
|
+
"version": "0.17.2-alpha.31",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,14 +33,15 @@
|
|
|
33
33
|
"build": "tsc -b"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@babel/
|
|
37
|
-
"@
|
|
38
|
-
"@lwrjs/
|
|
39
|
-
"@lwrjs/
|
|
36
|
+
"@babel/core": "^7.26.10",
|
|
37
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
38
|
+
"@lwrjs/diagnostics": "0.17.2-alpha.31",
|
|
39
|
+
"@lwrjs/fs-watch": "0.17.2-alpha.31",
|
|
40
|
+
"@lwrjs/shared-utils": "0.17.2-alpha.31",
|
|
40
41
|
"fs-extra": "^11.2.0"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@lwrjs/types": "0.17.2-alpha.
|
|
44
|
+
"@lwrjs/types": "0.17.2-alpha.31",
|
|
44
45
|
"memfs": "^4.13.0",
|
|
45
46
|
"typescript": "^4.9.5"
|
|
46
47
|
},
|
|
@@ -49,10 +50,10 @@
|
|
|
49
50
|
"@lwc/module-resolver": ">= 2.x"
|
|
50
51
|
},
|
|
51
52
|
"engines": {
|
|
52
|
-
"node": ">=
|
|
53
|
+
"node": ">=20.0.0"
|
|
53
54
|
},
|
|
54
55
|
"volta": {
|
|
55
56
|
"extends": "../../../package.json"
|
|
56
57
|
},
|
|
57
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "bbb087ab080321047b10bbcda40e88e69b6a69a5"
|
|
58
59
|
}
|