@lwrjs/module-registry 0.4.6 → 0.4.7

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.
@@ -90,7 +90,8 @@ var LwrModuleRegistry = class {
90
90
  async getModule(moduleId, runtimeParams) {
91
91
  const {locker} = this.globalConfig;
92
92
  const moduleEntry = await this.getModuleEntry(moduleId, runtimeParams);
93
- if (this.moduleDefCache.has(moduleEntry.id)) {
93
+ const cacheDisabled = process.env.NOCACHE === "true";
94
+ if (cacheDisabled === false && this.moduleDefCache.has(moduleEntry.id)) {
94
95
  return this.moduleDefCache.get(moduleEntry.id);
95
96
  }
96
97
  const moduleCompiled = await this.delegateGetModuleOnProviders(moduleId, runtimeParams);
@@ -102,7 +103,9 @@ var LwrModuleRegistry = class {
102
103
  }
103
104
  const moduleRecord = await (0, import_module_record.getModuleRecord)(moduleCompiled, this, this.context.compiler);
104
105
  const moduleDef = {...moduleCompiled, moduleRecord};
105
- this.moduleDefCache.set(moduleDef.id, moduleDef);
106
+ if (cacheDisabled === false) {
107
+ this.moduleDefCache.set(moduleDef.id, moduleDef);
108
+ }
106
109
  return moduleDef;
107
110
  }
108
111
  async getLinkedModule(moduleId, runtimeEnvironment, runtimeParams) {
@@ -114,7 +117,8 @@ var LwrModuleRegistry = class {
114
117
  const {
115
118
  locker: {enabled: lockerEnabled}
116
119
  } = this.globalConfig;
117
- if (this.moduleLinkedCache.has(id)) {
120
+ const cacheDisabled = process.env.NOCACHE === "true";
121
+ if (cacheDisabled === false && this.moduleLinkedCache.has(id)) {
118
122
  const moduleLinks = this.moduleLinkedCache.get(id);
119
123
  const runtimeEnvKey = (0, import_shared_utils.getCacheKeyFromJson)({
120
124
  format,
@@ -132,9 +136,11 @@ var LwrModuleRegistry = class {
132
136
  }
133
137
  const moduleDef = await this.getModule(moduleId, runtimeParams);
134
138
  const moduleLinked = await this.createLinkedModuleDefinition(moduleDef, runtimeEnvironment, runtimeParams);
135
- const linkedMap = this.moduleLinkedCache.get(id) || new Map();
136
- linkedMap.set((0, import_shared_utils.getCacheKeyFromJson)({format, compat, debug, minify, lockerEnabled, locale, environment}), moduleLinked);
137
- this.moduleLinkedCache.set(id, linkedMap);
139
+ if (cacheDisabled === false) {
140
+ const linkedMap = this.moduleLinkedCache.get(id) || new Map();
141
+ linkedMap.set((0, import_shared_utils.getCacheKeyFromJson)({format, compat, debug, minify, lockerEnabled, locale, environment}), moduleLinked);
142
+ this.moduleLinkedCache.set(id, linkedMap);
143
+ }
138
144
  return moduleLinked;
139
145
  }
140
146
  async createLinkedModuleDefinition(moduleDef, runtimeEnvironment, runtimeParams) {
package/build/es/index.js CHANGED
@@ -73,7 +73,8 @@ export class LwrModuleRegistry {
73
73
  async getModule(moduleId, runtimeParams) {
74
74
  const { locker } = this.globalConfig;
75
75
  const moduleEntry = await this.getModuleEntry(moduleId, runtimeParams);
76
- if (this.moduleDefCache.has(moduleEntry.id)) {
76
+ const cacheDisabled = process.env.NOCACHE === 'true';
77
+ if (cacheDisabled === false && this.moduleDefCache.has(moduleEntry.id)) {
77
78
  return this.moduleDefCache.get(moduleEntry.id);
78
79
  }
79
80
  const moduleCompiled = await this.delegateGetModuleOnProviders(moduleId, runtimeParams); // provider source + hash
@@ -86,7 +87,9 @@ export class LwrModuleRegistry {
86
87
  }
87
88
  const moduleRecord = await getModuleRecord(moduleCompiled, this, this.context.compiler);
88
89
  const moduleDef = { ...moduleCompiled, moduleRecord };
89
- this.moduleDefCache.set(moduleDef.id, moduleDef);
90
+ if (cacheDisabled === false) {
91
+ this.moduleDefCache.set(moduleDef.id, moduleDef);
92
+ }
90
93
  return moduleDef;
91
94
  }
92
95
  async getLinkedModule(moduleId, runtimeEnvironment, runtimeParams) {
@@ -97,7 +100,8 @@ export class LwrModuleRegistry {
97
100
  const locale = runtimeParams?.['locale'];
98
101
  const environment = runtimeParams?.['environment'];
99
102
  const { locker: { enabled: lockerEnabled }, } = this.globalConfig;
100
- if (this.moduleLinkedCache.has(id)) {
103
+ const cacheDisabled = process.env.NOCACHE === 'true';
104
+ if (cacheDisabled === false && this.moduleLinkedCache.has(id)) {
101
105
  const moduleLinks = this.moduleLinkedCache.get(id);
102
106
  const runtimeEnvKey = getCacheKeyFromJson({
103
107
  format,
@@ -116,9 +120,11 @@ export class LwrModuleRegistry {
116
120
  const moduleDef = await this.getModule(moduleId, runtimeParams);
117
121
  const moduleLinked = await this.createLinkedModuleDefinition(moduleDef, runtimeEnvironment, runtimeParams);
118
122
  // Add to cache
119
- const linkedMap = this.moduleLinkedCache.get(id) || new Map();
120
- linkedMap.set(getCacheKeyFromJson({ format, compat, debug, minify, lockerEnabled, locale, environment }), moduleLinked);
121
- this.moduleLinkedCache.set(id, linkedMap);
123
+ if (cacheDisabled === false) {
124
+ const linkedMap = this.moduleLinkedCache.get(id) || new Map();
125
+ linkedMap.set(getCacheKeyFromJson({ format, compat, debug, minify, lockerEnabled, locale, environment }), moduleLinked);
126
+ this.moduleLinkedCache.set(id, linkedMap);
127
+ }
122
128
  return moduleLinked;
123
129
  }
124
130
  async createLinkedModuleDefinition(moduleDef, runtimeEnvironment, runtimeParams) {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.4.6",
7
+ "version": "0.4.7",
8
8
  "homepage": "https://lwr.dev/",
9
9
  "repository": {
10
10
  "type": "git",
@@ -30,19 +30,19 @@
30
30
  "build/**/*.d.ts"
31
31
  ],
32
32
  "dependencies": {
33
- "@lwrjs/diagnostics": "0.4.6",
34
- "@lwrjs/shared-utils": "0.4.6",
33
+ "@lwrjs/diagnostics": "0.4.7",
34
+ "@lwrjs/shared-utils": "0.4.7",
35
35
  "es-module-lexer": "^0.3.18",
36
36
  "magic-string": "^0.25.7",
37
37
  "ws": "^7.2.5"
38
38
  },
39
39
  "devDependencies": {
40
- "@lwrjs/types": "0.4.6",
40
+ "@lwrjs/types": "0.4.7",
41
41
  "@types/es-module-lexer": "^0.3.0",
42
42
  "@types/ws": "^7.2.4"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=14.15.4 <15"
46
46
  },
47
- "gitHead": "71f599b20c35d612e55312e94804a97e7cc778e1"
47
+ "gitHead": "4f4bec34d0cec407147cad01cc452e6f3058b9fe"
48
48
  }