@lwrjs/module-registry 0.7.0-alpha.4 → 0.7.0-alpha.8

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.
@@ -163,7 +163,12 @@ var LwrModuleRegistry = class {
163
163
  return moduleLinked;
164
164
  }
165
165
  async createLinkedModuleDefinition(moduleDef, runtimeEnvironment, runtimeParams) {
166
- const {format, minify, debug} = runtimeEnvironment;
166
+ const {
167
+ format,
168
+ minify,
169
+ debug,
170
+ env: {NODE_ENV: envMode}
171
+ } = runtimeEnvironment;
167
172
  const minified = !!minify && !debug;
168
173
  const {amdLoader, esmLoader} = this.globalConfig;
169
174
  if (format === "amd") {
@@ -182,6 +187,11 @@ var LwrModuleRegistry = class {
182
187
  if (minified) {
183
188
  const {code: minifiedCode} = await this.context.compiler.minifyJavascript(amdSource);
184
189
  linkedAmdSource = minifiedCode;
190
+ } else {
191
+ const {code: minifiedCode} = await this.context.compiler.parseJavascript(amdSource, {
192
+ envMode
193
+ });
194
+ linkedAmdSource = minifiedCode;
185
195
  }
186
196
  linkedModuleRecord.dynamicImports = linkedModuleRecord.dynamicImports?.filter((imp) => imp.moduleNameType !== import_shared_utils.ModuleNameType.unresolved);
187
197
  return {
@@ -206,6 +216,11 @@ var LwrModuleRegistry = class {
206
216
  if (minified) {
207
217
  const {code: minifiedEsm} = await this.context.compiler.minifyJavascript(transformedEsmCode);
208
218
  transformedEsmCode = minifiedEsm;
219
+ } else {
220
+ const {code: parsedEsm} = await this.context.compiler.parseJavascript(transformedEsmCode, {
221
+ envMode
222
+ });
223
+ transformedEsmCode = parsedEsm;
209
224
  }
210
225
  linkedModuleRecord.dynamicImports = linkedModuleRecord.dynamicImports?.filter((imp) => imp.moduleNameType !== import_shared_utils.ModuleNameType.unresolved);
211
226
  return {
package/build/es/index.js CHANGED
@@ -152,7 +152,7 @@ export class LwrModuleRegistry {
152
152
  return moduleLinked;
153
153
  }
154
154
  async createLinkedModuleDefinition(moduleDef, runtimeEnvironment, runtimeParams) {
155
- const { format, minify, debug } = runtimeEnvironment;
155
+ const { format, minify, debug, env: { NODE_ENV: envMode }, } = runtimeEnvironment;
156
156
  const minified = !!minify && !debug;
157
157
  const { amdLoader, esmLoader } = this.globalConfig;
158
158
  // TODO: compat transformation based on runtimeEnvironment.compat
@@ -172,6 +172,12 @@ export class LwrModuleRegistry {
172
172
  const { code: minifiedCode } = await this.context.compiler.minifyJavascript(amdSource);
173
173
  linkedAmdSource = minifiedCode;
174
174
  }
175
+ else {
176
+ const { code: minifiedCode } = await this.context.compiler.parseJavascript(amdSource, {
177
+ envMode,
178
+ });
179
+ linkedAmdSource = minifiedCode;
180
+ }
175
181
  // Filter out variable dynamic imports
176
182
  linkedModuleRecord.dynamicImports = linkedModuleRecord.dynamicImports?.filter((imp) => imp.moduleNameType !== ModuleNameType.unresolved);
177
183
  return {
@@ -201,6 +207,12 @@ export class LwrModuleRegistry {
201
207
  const { code: minifiedEsm } = await this.context.compiler.minifyJavascript(transformedEsmCode);
202
208
  transformedEsmCode = minifiedEsm;
203
209
  }
210
+ else {
211
+ const { code: parsedEsm } = await this.context.compiler.parseJavascript(transformedEsmCode, {
212
+ envMode,
213
+ });
214
+ transformedEsmCode = parsedEsm;
215
+ }
204
216
  // Filter out variable dynamic imports
205
217
  linkedModuleRecord.dynamicImports = linkedModuleRecord.dynamicImports?.filter((imp) => imp.moduleNameType !== ModuleNameType.unresolved);
206
218
  return {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.7.0-alpha.4",
7
+ "version": "0.7.0-alpha.8",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -30,18 +30,18 @@
30
30
  "build/**/*.d.ts"
31
31
  ],
32
32
  "dependencies": {
33
- "@lwrjs/diagnostics": "0.7.0-alpha.4",
34
- "@lwrjs/shared-utils": "0.7.0-alpha.4",
33
+ "@lwrjs/diagnostics": "0.7.0-alpha.8",
34
+ "@lwrjs/shared-utils": "0.7.0-alpha.8",
35
35
  "es-module-lexer": "^0.3.18",
36
36
  "ws": "^7.2.5"
37
37
  },
38
38
  "devDependencies": {
39
- "@lwrjs/types": "0.7.0-alpha.4",
39
+ "@lwrjs/types": "0.7.0-alpha.8",
40
40
  "@types/es-module-lexer": "^0.3.0",
41
41
  "@types/ws": "^7.2.4"
42
42
  },
43
43
  "engines": {
44
44
  "node": ">=14.15.4 <17"
45
45
  },
46
- "gitHead": "611f98b00c050ddb2f0aca529c5d9a0d6e55cc3d"
46
+ "gitHead": "fbe1daed908cf07eaf9fc8821f2ba2947f5d919f"
47
47
  }