@nx/esbuild 23.2.0-beta.10 → 23.2.0-beta.12
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/README.md
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
<div style="text-align: center;">
|
|
9
9
|
|
|
10
|
-
[]()
|
|
10
|
+
[](<>)
|
|
11
11
|
[](https://www.npmjs.com/package/nx)
|
|
12
|
-
[]()
|
|
12
|
+
[](<>)
|
|
13
13
|
[](http://commitizen.github.io/cz-cli/)
|
|
14
14
|
[](https://go.nx.dev/community)
|
|
15
15
|
[](https://nx.dev/docs/features/ci-features/sandboxing)
|
|
@@ -10,7 +10,7 @@ const esbuild = tslib_1.__importStar(require("esbuild"));
|
|
|
10
10
|
const normalize_1 = require("./lib/normalize");
|
|
11
11
|
const build_esbuild_options_1 = require("./lib/build-esbuild-options");
|
|
12
12
|
const get_extra_dependencies_1 = require("./lib/get-extra-dependencies");
|
|
13
|
-
const
|
|
13
|
+
const fs_1 = require("../../utils/fs");
|
|
14
14
|
const path_1 = require("path");
|
|
15
15
|
const BUILD_WATCH_FAILED = `[ ${pc.red('watch')} ] build finished with errors (see above), watching for changes...`;
|
|
16
16
|
const BUILD_WATCH_SUCCEEDED = `[ ${pc.green('watch')} ] build succeeded, watching for changes...`;
|
|
@@ -18,7 +18,7 @@ async function* esbuildExecutor(_options, context) {
|
|
|
18
18
|
process.env.NODE_ENV ??= context.configurationName ?? 'production';
|
|
19
19
|
const options = await (0, normalize_1.normalizeOptions)(_options, context);
|
|
20
20
|
if (options.deleteOutputPath)
|
|
21
|
-
(0,
|
|
21
|
+
(0, fs_1.deleteOutputDir)(context.root, options.outputPath);
|
|
22
22
|
const assetsResult = await (0, js_1.copyAssets)(options, context);
|
|
23
23
|
const externalDependencies = options.external.reduce((acc, name) => {
|
|
24
24
|
const externalNode = context.projectGraph.externalNodes[`npm:${name}`];
|
|
@@ -140,7 +140,7 @@ async function* esbuildExecutor(_options, context) {
|
|
|
140
140
|
const filename = options.format.length === 1
|
|
141
141
|
? 'meta.json'
|
|
142
142
|
: `meta.${options.format[i]}.json`;
|
|
143
|
-
(0, devkit_1.writeJsonFile)((0,
|
|
143
|
+
(0, devkit_1.writeJsonFile)((0, path_1.join)(context.root, options.outputPath, filename), buildResult.metafile);
|
|
144
144
|
}
|
|
145
145
|
yield {
|
|
146
146
|
success: buildResult.errors.length === 0,
|
|
@@ -24,6 +24,8 @@ function buildEsbuildOptions(format, options, context) {
|
|
|
24
24
|
: undefined;
|
|
25
25
|
const esbuildOptions = {
|
|
26
26
|
...options.userDefinedBuildOptions,
|
|
27
|
+
// Nx-computed paths are workspace-root-relative, not cwd-relative.
|
|
28
|
+
absWorkingDir: context.root,
|
|
27
29
|
entryNames: options.outputHashing === 'all' ? '[dir]/[name].[hash]' : '[dir]/[name]',
|
|
28
30
|
bundle: options.bundle,
|
|
29
31
|
// Cannot use external with bundle option
|
|
@@ -32,7 +34,7 @@ function buildEsbuildOptions(format, options, context) {
|
|
|
32
34
|
platform: options.platform,
|
|
33
35
|
target: options.target,
|
|
34
36
|
metafile: options.metafile,
|
|
35
|
-
tsconfig: (0, path_1.
|
|
37
|
+
tsconfig: (0, path_1.join)(context.root, options.tsConfig),
|
|
36
38
|
sourcemap: (options.sourcemap ?? options.userDefinedBuildOptions?.sourcemap) ||
|
|
37
39
|
false,
|
|
38
40
|
format,
|
|
@@ -31,8 +31,10 @@ export interface EsBuildExecutorOptions {
|
|
|
31
31
|
watch?: boolean;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export interface NormalizedEsBuildExecutorOptions
|
|
35
|
-
|
|
34
|
+
export interface NormalizedEsBuildExecutorOptions extends Omit<
|
|
35
|
+
EsBuildExecutorOptions,
|
|
36
|
+
'esbuildOptions' | 'esbuildConfig'
|
|
37
|
+
> {
|
|
36
38
|
assets: (AssetGlob | string)[];
|
|
37
39
|
singleEntry: boolean;
|
|
38
40
|
external: string[];
|
|
@@ -18,6 +18,8 @@ function getEntryPoints(projectName, context, options = {}) {
|
|
|
18
18
|
const project = context.projectGraph?.nodes[projectName];
|
|
19
19
|
if (!project)
|
|
20
20
|
return;
|
|
21
|
+
// Anchor to the workspace root so results do not depend on the invoking cwd.
|
|
22
|
+
const absProjectRoot = path.join(context.root, project.data.root);
|
|
21
23
|
// Known files we generate from our generators. Only one of these should be used to build the project.
|
|
22
24
|
const tsconfigCandidates = [
|
|
23
25
|
'tsconfig.app.json',
|
|
@@ -28,7 +30,7 @@ function getEntryPoints(projectName, context, options = {}) {
|
|
|
28
30
|
tsconfigCandidates.unshift(tsConfigFileName);
|
|
29
31
|
const foundTsConfig = tsconfigCandidates.find((f) => {
|
|
30
32
|
try {
|
|
31
|
-
return fs.statSync(path.join(
|
|
33
|
+
return fs.statSync(path.join(absProjectRoot, f)).isFile();
|
|
32
34
|
}
|
|
33
35
|
catch {
|
|
34
36
|
return false;
|
|
@@ -36,9 +38,9 @@ function getEntryPoints(projectName, context, options = {}) {
|
|
|
36
38
|
});
|
|
37
39
|
// Workspace projects may not be a TS project, so skip reading source files if tsconfig is not found.
|
|
38
40
|
if (foundTsConfig) {
|
|
39
|
-
const tsconfig = (0, devkit_1.readJsonFile)(path.join(
|
|
41
|
+
const tsconfig = (0, devkit_1.readJsonFile)(path.join(absProjectRoot, foundTsConfig));
|
|
40
42
|
const projectFiles = (0, tinyglobby_1.globSync)(tsconfig.include ?? [], {
|
|
41
|
-
cwd:
|
|
43
|
+
cwd: absProjectRoot,
|
|
42
44
|
ignore: tsconfig.exclude ?? [],
|
|
43
45
|
expandDirectories: false,
|
|
44
46
|
}).map((f) => path.join(project.data.root, f));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/esbuild",
|
|
3
|
-
"version": "23.2.0-beta.
|
|
3
|
+
"version": "23.2.0-beta.12",
|
|
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": {
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"picocolors": "^1.1.0",
|
|
45
45
|
"tsconfig-paths": "^4.1.2",
|
|
46
46
|
"tslib": "^2.3.0",
|
|
47
|
-
"@nx/devkit": "23.2.0-beta.
|
|
48
|
-
"@nx/js": "23.2.0-beta.
|
|
47
|
+
"@nx/devkit": "23.2.0-beta.12",
|
|
48
|
+
"@nx/js": "23.2.0-beta.12"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"nx": "23.2.0-beta.
|
|
51
|
+
"nx": "23.2.0-beta.12"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"esbuild": ">=0.19.2 <1.0.0"
|