@lwrjs/lwc-module-provider 0.11.0-alpha.9 → 0.11.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/build/cjs/compiler.cjs +7 -7
- package/build/cjs/index.cjs +11 -10
- package/build/cjs/utils.cjs +7 -6
- package/build/es/compiler.js +1 -1
- package/build/es/index.js +2 -1
- package/build/es/utils.js +2 -1
- package/package.json +10 -7
package/build/cjs/compiler.cjs
CHANGED
|
@@ -29,7 +29,7 @@ __export(exports, {
|
|
|
29
29
|
var import_core = __toModule(require("@babel/core"));
|
|
30
30
|
var import_compiler = __toModule(require("@lwc/compiler"));
|
|
31
31
|
var import_utils = __toModule(require("./utils.cjs"));
|
|
32
|
-
var
|
|
32
|
+
var import_diagnostics = __toModule(require("@lwrjs/diagnostics"));
|
|
33
33
|
var DEFAULT_BABEL_CONFIG = {
|
|
34
34
|
babelrc: false,
|
|
35
35
|
configFile: false,
|
|
@@ -54,17 +54,17 @@ var LwcCompiler = class {
|
|
|
54
54
|
presets: [["@babel/preset-typescript", {onlyRemoveTypeImports: false}]],
|
|
55
55
|
filename
|
|
56
56
|
};
|
|
57
|
-
|
|
57
|
+
import_diagnostics.logger.debug("babelTransform", {babelConfig});
|
|
58
58
|
let result;
|
|
59
59
|
try {
|
|
60
60
|
result = (0, import_core.transformSync)(source, babelConfig);
|
|
61
61
|
} catch (error) {
|
|
62
|
-
|
|
62
|
+
import_diagnostics.logger.debug("babelTransform error", error);
|
|
63
63
|
throw error;
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
import_diagnostics.logger.verbose("babelTransform result", {result});
|
|
66
66
|
if (!result || !result.code) {
|
|
67
|
-
|
|
67
|
+
import_diagnostics.logger.debug("babelTransform invalid result", {result});
|
|
68
68
|
throw new Error(`Error TS compiling ${filename}`);
|
|
69
69
|
}
|
|
70
70
|
source = result.code;
|
|
@@ -87,9 +87,9 @@ var LwcCompiler = class {
|
|
|
87
87
|
enableLightningWebSecurityTransforms,
|
|
88
88
|
enableScopedSlots: true
|
|
89
89
|
};
|
|
90
|
-
|
|
90
|
+
import_diagnostics.logger.debug("transformSync", {filename, transformConfig});
|
|
91
91
|
const compilerResult = (0, import_compiler.transformSync)(source, filename, transformConfig);
|
|
92
|
-
|
|
92
|
+
import_diagnostics.logger.verbose("transformSync result", {compilerResult});
|
|
93
93
|
return {
|
|
94
94
|
code: compilerResult.code,
|
|
95
95
|
map: null,
|
package/build/cjs/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ __export(exports, {
|
|
|
28
28
|
});
|
|
29
29
|
var import_path = __toModule(require("path"));
|
|
30
30
|
var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
|
|
31
|
+
var import_diagnostics = __toModule(require("@lwrjs/diagnostics"));
|
|
31
32
|
var import_utils = __toModule(require("./utils.cjs"));
|
|
32
33
|
var import_cache = __toModule(require("./cache.cjs"));
|
|
33
34
|
var import_compiler = __toModule(require("./compiler.cjs"));
|
|
@@ -77,14 +78,14 @@ var LwcModuleProvider = class {
|
|
|
77
78
|
}
|
|
78
79
|
async getModule(moduleId) {
|
|
79
80
|
const id = (0, import_shared_utils.getSpecifier)(moduleId);
|
|
80
|
-
|
|
81
|
+
import_diagnostics.logger.debug(`[lwc-module-provider ] getModule ${id}`);
|
|
81
82
|
return this.inflightGetModuleJobs.execute(id, () => {
|
|
82
83
|
return this.createGetModuleJob(moduleId);
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
86
|
async createGetModuleJob(moduleId) {
|
|
86
87
|
const {watcher, watchedModuleContextMap, lwcCacheDir, lwcCacheIndex, moduleFsCacheEnabled} = this;
|
|
87
|
-
|
|
88
|
+
import_diagnostics.logger.debug("[lwc-module-provider ] fetch module", {moduleId, moduleFsCacheEnabled});
|
|
88
89
|
const moduleEntry = await this.getModuleEntry(moduleId);
|
|
89
90
|
if (!moduleEntry) {
|
|
90
91
|
return;
|
|
@@ -93,7 +94,7 @@ var LwcModuleProvider = class {
|
|
|
93
94
|
const {id, namespace, name: rawName, originalSource} = moduleSource;
|
|
94
95
|
const cacheConfig = {lwcCacheDir, lwcCacheIndex};
|
|
95
96
|
let compiledModule = moduleFsCacheEnabled && (0, import_cache.getCompiledModuleCacheEntry)(moduleSource, cacheConfig);
|
|
96
|
-
|
|
97
|
+
import_diagnostics.logger.debug("[lwc-module-provider ] module source ", {
|
|
97
98
|
moduleId,
|
|
98
99
|
isPreCompiled: compiledModule != void 0
|
|
99
100
|
});
|
|
@@ -101,7 +102,7 @@ var LwcModuleProvider = class {
|
|
|
101
102
|
const [name] = rawName.split("#");
|
|
102
103
|
const enableLightningWebSecurityTransforms = !!this.locker?.enabled && !this.locker?.clientOnly;
|
|
103
104
|
const scopedStyles = moduleEntry.entry.endsWith(".css") && moduleEntry.specifier.endsWith("?scoped=true");
|
|
104
|
-
|
|
105
|
+
import_diagnostics.logger.debug("[lwc-module-provider] compile", {
|
|
105
106
|
namespace,
|
|
106
107
|
name,
|
|
107
108
|
filename: moduleEntry.entry,
|
|
@@ -114,7 +115,7 @@ var LwcModuleProvider = class {
|
|
|
114
115
|
enableLightningWebSecurityTransforms,
|
|
115
116
|
scopedStyles
|
|
116
117
|
});
|
|
117
|
-
|
|
118
|
+
import_diagnostics.logger.verbose("[lwc-module-provider] createGetModuleJob:compile compiledModule", {
|
|
118
119
|
namespace,
|
|
119
120
|
name,
|
|
120
121
|
filename: moduleEntry.entry,
|
|
@@ -161,7 +162,7 @@ var LwcModuleProvider = class {
|
|
|
161
162
|
importer,
|
|
162
163
|
version
|
|
163
164
|
}) {
|
|
164
|
-
|
|
165
|
+
import_diagnostics.logger.debug(`[lwc-module-provider] getModuleEntry ${specifier}@${version}@${importer}`);
|
|
165
166
|
const versionId = version || importer;
|
|
166
167
|
if (versionId) {
|
|
167
168
|
const cacheKey2 = getModuleEntryCacheKey(specifier, versionId);
|
|
@@ -179,7 +180,7 @@ var LwcModuleProvider = class {
|
|
|
179
180
|
importer,
|
|
180
181
|
version
|
|
181
182
|
}) {
|
|
182
|
-
|
|
183
|
+
import_diagnostics.logger.debug("[lwc-module-provider] createModuleEntry", {
|
|
183
184
|
specifier,
|
|
184
185
|
importer,
|
|
185
186
|
rootDir: this.rootDir,
|
|
@@ -194,14 +195,14 @@ var LwcModuleProvider = class {
|
|
|
194
195
|
}
|
|
195
196
|
if (!moduleEntry) {
|
|
196
197
|
try {
|
|
197
|
-
|
|
198
|
+
import_diagnostics.logger.debug("[lwc-module-provider] createModuleEntry:resolveModuleSpecifier", {
|
|
198
199
|
baseSpecifier,
|
|
199
200
|
importer,
|
|
200
201
|
rootDir: this.rootDir,
|
|
201
202
|
modules: this.modules
|
|
202
203
|
});
|
|
203
204
|
const registryEntry = (0, import_utils.resolveModuleSpecifier)(baseSpecifier, importer || this.rootDir, this.modules, this.packageVersionCache);
|
|
204
|
-
|
|
205
|
+
import_diagnostics.logger.debug("[lwc-module-provider] createModuleEntry:registryEntry", {registryEntry});
|
|
205
206
|
moduleEntry = {
|
|
206
207
|
id: getModuleEntryCacheKey(registryEntry.specifier, registryEntry.version),
|
|
207
208
|
...registryEntry
|
|
@@ -216,7 +217,7 @@ var LwcModuleProvider = class {
|
|
|
216
217
|
if (e.code !== "NO_LWC_MODULE_FOUND") {
|
|
217
218
|
throw e;
|
|
218
219
|
} else {
|
|
219
|
-
|
|
220
|
+
import_diagnostics.logger.verbose(`LWC provider could not find the module ${specifier}`);
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
223
|
}
|
package/build/cjs/utils.cjs
CHANGED
|
@@ -32,23 +32,24 @@ __export(exports, {
|
|
|
32
32
|
});
|
|
33
33
|
var import_fs = __toModule(require("fs"));
|
|
34
34
|
var import_path = __toModule(require("path"));
|
|
35
|
+
var import_diagnostics = __toModule(require("@lwrjs/diagnostics"));
|
|
35
36
|
var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
|
|
36
37
|
var import_module_resolver = __toModule(require("@lwc/module-resolver"));
|
|
37
38
|
var EXPLICIT_CONSTANT = "/* _implicit_dependency_ */";
|
|
38
39
|
var DEFAULT_IMPLICIT_DEP = `${EXPLICIT_CONSTANT} export default void 0`;
|
|
39
40
|
function resolveModuleSpecifier(specifier, importer, modules = [], packageVersionCache) {
|
|
40
|
-
|
|
41
|
+
import_diagnostics.logger.debug("[lwc-module-provider] resolveModuleSpecifier", {specifier, importer, modules});
|
|
41
42
|
let resolvedModule;
|
|
42
43
|
try {
|
|
43
44
|
resolvedModule = (0, import_module_resolver.resolveModule)(specifier, importer, {modules});
|
|
44
45
|
} catch (error) {
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
if (import_diagnostics.logger.currentLevel == import_diagnostics.DEBUG || import_diagnostics.logger.currentLevel == import_diagnostics.VERBOSE) {
|
|
47
|
+
import_diagnostics.logger.debug(`[lwc-module-provider] @lwc/module-resolver/resolveModule ${specifier}`);
|
|
48
|
+
import_diagnostics.logger.error(error);
|
|
48
49
|
}
|
|
49
50
|
throw error;
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
+
import_diagnostics.logger.debug("[lwc-module-provider] resolveModuleSpecifier:resolvedModule", {resolvedModule});
|
|
52
53
|
const moduleScope = resolvedModule.scope;
|
|
53
54
|
let version;
|
|
54
55
|
if (packageVersionCache.has(moduleScope)) {
|
|
@@ -92,6 +93,6 @@ function setUpWatcher(watcherFactory, onModuleChange) {
|
|
|
92
93
|
const watcher = watcherFactory.createFileWatcher();
|
|
93
94
|
watcher.on("change", (0, import_shared_utils.debounce)((file) => onModuleChange(file), 500));
|
|
94
95
|
watcher.on("unlink", (0, import_shared_utils.debounce)((file) => onModuleChange(file), 500));
|
|
95
|
-
watcher.on("add", (file) =>
|
|
96
|
+
watcher.on("add", (file) => import_diagnostics.logger.info(`Watching: ${file}`));
|
|
96
97
|
return watcher;
|
|
97
98
|
}
|
package/build/es/compiler.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { transformSync as babelTransform } from '@babel/core';
|
|
2
2
|
import { transformSync } from '@lwc/compiler';
|
|
3
3
|
import { EXPLICIT_CONSTANT } from './utils.js';
|
|
4
|
-
import { logger } from '@lwrjs/
|
|
4
|
+
import { logger } from '@lwrjs/diagnostics';
|
|
5
5
|
const DEFAULT_BABEL_CONFIG = {
|
|
6
6
|
babelrc: false,
|
|
7
7
|
configFile: false,
|
package/build/es/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { dirname, join } from 'path';
|
|
2
|
-
import { explodeSpecifier, getSpecifier, hashContent, InflightTasks,
|
|
2
|
+
import { explodeSpecifier, getSpecifier, hashContent, InflightTasks, readFile, resolveFileExtension, resolveCustomLWCMetadata, } from '@lwrjs/shared-utils';
|
|
3
|
+
import { logger } from '@lwrjs/diagnostics';
|
|
3
4
|
import { DEFAULT_IMPLICIT_DEP, isImplicitLwcImport, resolveModuleSpecifier, setUpWatcher } from './utils.js';
|
|
4
5
|
import { addCompiledModuleCacheEntry, getCompiledModuleCacheEntry, setupModuleCache, } from './cache.js';
|
|
5
6
|
import { LwcCompiler } from './compiler.js';
|
package/build/es/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import {
|
|
3
|
+
import { logger, DEBUG, VERBOSE } from '@lwrjs/diagnostics';
|
|
4
|
+
import { readFile, debounce } from '@lwrjs/shared-utils';
|
|
4
5
|
import { resolveModule } from '@lwc/module-resolver';
|
|
5
6
|
export const EXPLICIT_CONSTANT = '/* _implicit_dependency_ */';
|
|
6
7
|
export const DEFAULT_IMPLICIT_DEP = `${EXPLICIT_CONSTANT} export default void 0`;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.11.
|
|
7
|
+
"version": "0.11.1",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -30,18 +30,21 @@
|
|
|
30
30
|
"build/**/*.d.ts"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@babel/preset-typescript": "^7.23.
|
|
34
|
-
"@lwrjs/
|
|
33
|
+
"@babel/preset-typescript": "^7.23.2",
|
|
34
|
+
"@lwrjs/diagnostics": "0.11.1",
|
|
35
|
+
"@lwrjs/fs-watch": "0.11.1",
|
|
36
|
+
"@lwrjs/shared-utils": "0.11.1"
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
37
|
-
"@lwrjs/types": "0.11.
|
|
39
|
+
"@lwrjs/types": "0.11.1",
|
|
40
|
+
"typescript": "^4.9.5"
|
|
38
41
|
},
|
|
39
42
|
"peerDependencies": {
|
|
40
|
-
"@lwc/compiler": "2.x || 3.x",
|
|
41
|
-
"@lwc/module-resolver": "2.x || 3.x"
|
|
43
|
+
"@lwc/compiler": "2.x || 3.x || 4.x",
|
|
44
|
+
"@lwc/module-resolver": "2.x || 3.x || 4.x"
|
|
42
45
|
},
|
|
43
46
|
"engines": {
|
|
44
47
|
"node": ">=16.0.0"
|
|
45
48
|
},
|
|
46
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "b7c40fdcd86635dd4e368c0a2e91c5d3374c0fcf"
|
|
47
50
|
}
|