@lwrjs/lwc-module-provider 0.17.2-alpha.3 → 0.17.2-alpha.30

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.
@@ -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 === "lwr" && name === "hmr") {
98
+ if (skipCompilation(namespace, name)) {
93
99
  return {
94
100
  code: source,
95
101
  map: null,
@@ -228,7 +228,7 @@ var LwcModuleProvider = class {
228
228
  rootDir: this.rootDir
229
229
  }
230
230
  });
231
- const registryEntry = (0, import_utils.resolveModuleSpecifier)(baseSpecifier, importer || this.rootDir, this.modules, this.packageVersionCache);
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",
@@ -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, importer, modules = [], packageVersionCache) {
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, {modules});
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({
@@ -11,6 +11,15 @@ 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 {
15
24
  constructor(compiler) {
16
25
  // Allow callers to pass in their own version of the LWC compiler
@@ -64,8 +73,7 @@ export class LwcCompiler {
64
73
  }
65
74
  source = result.code;
66
75
  }
67
- // HACK: This is to avoid running the LWC compiler on the HMR module until we dont allow swap methods
68
- if (namespace === 'lwr' && name === 'hmr') {
76
+ if (skipCompilation(namespace, name)) {
69
77
  return {
70
78
  code: source,
71
79
  map: null,
@@ -6,7 +6,7 @@ export interface LwcModuleProviderOptions {
6
6
  }
7
7
  export default class LwcModuleProvider implements ModuleProvider {
8
8
  name: string;
9
- private rootDir;
9
+ protected rootDir: string;
10
10
  private moduleFsCacheEnabled;
11
11
  private interchangeableModulesEnabled;
12
12
  private lwcCacheDir?;
package/build/es/index.js CHANGED
@@ -217,7 +217,7 @@ export default class LwcModuleProvider {
217
217
  rootDir: this.rootDir,
218
218
  },
219
219
  });
220
- const registryEntry = resolveModuleSpecifier(baseSpecifier, importer || this.rootDir, this.modules, this.packageVersionCache);
220
+ const registryEntry = resolveModuleSpecifier(baseSpecifier, this.rootDir, this.modules, this.packageVersionCache, importer);
221
221
  logger.debug({
222
222
  label: `${this.name}`,
223
223
  message: 'createModuleEntry:registryEntry',
@@ -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, importer: string, modules: ResolverModuleRecord[] | undefined, packageVersionCache: Map<string, string>): Required<RegistryEntry>;
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, importer, modules = [], packageVersionCache) {
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, { modules });
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.3",
7
+ "version": "0.17.2-alpha.30",
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/preset-typescript": "^7.24.7",
37
- "@lwrjs/diagnostics": "0.17.2-alpha.3",
38
- "@lwrjs/fs-watch": "0.17.2-alpha.3",
39
- "@lwrjs/shared-utils": "0.17.2-alpha.3",
36
+ "@babel/core": "^7.26.10",
37
+ "@babel/preset-typescript": "^7.26.0",
38
+ "@lwrjs/diagnostics": "0.17.2-alpha.30",
39
+ "@lwrjs/fs-watch": "0.17.2-alpha.30",
40
+ "@lwrjs/shared-utils": "0.17.2-alpha.30",
40
41
  "fs-extra": "^11.2.0"
41
42
  },
42
43
  "devDependencies": {
43
- "@lwrjs/types": "0.17.2-alpha.3",
44
+ "@lwrjs/types": "0.17.2-alpha.30",
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": ">=18.0.0"
53
+ "node": ">=20.0.0"
53
54
  },
54
55
  "volta": {
55
56
  "extends": "../../../package.json"
56
57
  },
57
- "gitHead": "43757693dfca356cff105d4896a7a3cbf11ac017"
58
+ "gitHead": "818bbb13d2d4b14d128c4c4f23229c9ce7458a23"
58
59
  }