@nx/esbuild 19.5.2 → 19.5.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/esbuild",
3
- "version": "19.5.2",
3
+ "version": "19.5.3",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for esbuild contains executors and generators that support building applications using esbuild",
6
6
  "repository": {
@@ -36,9 +36,9 @@
36
36
  "fs-extra": "^11.1.0",
37
37
  "tslib": "^2.3.0",
38
38
  "tsconfig-paths": "^4.1.2",
39
- "@nx/devkit": "19.5.2",
40
- "@nx/js": "19.5.2",
41
- "@nrwl/esbuild": "19.5.2"
39
+ "@nx/devkit": "19.5.3",
40
+ "@nx/js": "19.5.3",
41
+ "@nrwl/esbuild": "19.5.3"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "esbuild": "~0.19.2"
@@ -125,7 +125,8 @@ function writeTmpEntryWithRequireOverrides(paths, outExtension, options, context
125
125
  (0, fs_1.mkdirSync)(tmpPath, { recursive: true });
126
126
  const { name: mainFileName, dir: mainPathRelativeToDist } = path.parse(options.main);
127
127
  const mainWithRequireOverridesInPath = path.join(tmpPath, `main-with-require-overrides.js`);
128
- (0, fs_1.writeFileSync)(mainWithRequireOverridesInPath, getRegisterFileContent(project, paths, `./${path.join(mainPathRelativeToDist, `${mainFileName}${outExtension}`)}`, outExtension));
128
+ const mainFile = `./${path.join(mainPathRelativeToDist, `${mainFileName}${outExtension}`)}`;
129
+ (0, fs_1.writeFileSync)(mainWithRequireOverridesInPath, getRegisterFileContent(project, paths, mainFile, outExtension));
129
130
  let mainWithRequireOverridesOutPath;
130
131
  if (options.outputFileName) {
131
132
  mainWithRequireOverridesOutPath = path.parse(options.outputFileName).name;
@@ -215,11 +216,17 @@ function isFile(s) {
215
216
  }
216
217
 
217
218
  // Call the user-defined main.
218
- require('${mainFile}');
219
+ module.exports = require('${mainFile}');
219
220
  `;
220
221
  }
221
222
  function getPrefixLength(pattern) {
222
- return pattern.substring(0, pattern.indexOf('*')).length;
223
+ const prefixIfWildcard = pattern.substring(0, pattern.indexOf('*')).length;
224
+ const prefixWithoutWildcard = pattern.substring(0, pattern.lastIndexOf('/')).length;
225
+ // if the pattern doesn't contain '*', then the length is always 0
226
+ // This causes issues when there are sub packages such as
227
+ // @nx/core
228
+ // @nx/core/testing
229
+ return prefixIfWildcard || prefixWithoutWildcard;
223
230
  }
224
231
  function getTsConfigCompilerPaths(context) {
225
232
  const tsconfigPaths = require('tsconfig-paths');