@nx/esbuild 16.0.0-beta.1
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/CHANGELOG.md +8 -0
- package/LICENSE +22 -0
- package/README.md +63 -0
- package/executors.json +16 -0
- package/generators.json +33 -0
- package/index.d.ts +3 -0
- package/index.js +7 -0
- package/index.js.map +1 -0
- package/migrations.json +27 -0
- package/package.json +55 -0
- package/src/executors/esbuild/compat.d.ts +2 -0
- package/src/executors/esbuild/compat.js +6 -0
- package/src/executors/esbuild/compat.js.map +1 -0
- package/src/executors/esbuild/esbuild.impl.d.ts +8 -0
- package/src/executors/esbuild/esbuild.impl.js +268 -0
- package/src/executors/esbuild/esbuild.impl.js.map +1 -0
- package/src/executors/esbuild/lib/build-esbuild-options.d.ts +7 -0
- package/src/executors/esbuild/lib/build-esbuild-options.js +232 -0
- package/src/executors/esbuild/lib/build-esbuild-options.js.map +1 -0
- package/src/executors/esbuild/lib/get-extra-dependencies.d.ts +3 -0
- package/src/executors/esbuild/lib/get-extra-dependencies.js +35 -0
- package/src/executors/esbuild/lib/get-extra-dependencies.js.map +1 -0
- package/src/executors/esbuild/lib/normalize.d.ts +3 -0
- package/src/executors/esbuild/lib/normalize.js +56 -0
- package/src/executors/esbuild/lib/normalize.js.map +1 -0
- package/src/executors/esbuild/schema.d.ts +38 -0
- package/src/executors/esbuild/schema.json +189 -0
- package/src/generators/esbuild-project/esbuild-project.d.ts +5 -0
- package/src/generators/esbuild-project/esbuild-project.js +100 -0
- package/src/generators/esbuild-project/esbuild-project.js.map +1 -0
- package/src/generators/esbuild-project/schema.d.ts +12 -0
- package/src/generators/esbuild-project/schema.json +62 -0
- package/src/generators/init/init.d.ts +5 -0
- package/src/generators/init/init.js +21 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/schema.d.ts +4 -0
- package/src/generators/init/schema.json +22 -0
- package/src/migrations/update-15-8-7/set-generate-package-json.d.ts +2 -0
- package/src/migrations/update-15-8-7/set-generate-package-json.js +27 -0
- package/src/migrations/update-15-8-7/set-generate-package-json.js.map +1 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
- package/src/utils/environment-variables.d.ts +1 -0
- package/src/utils/environment-variables.js +14 -0
- package/src/utils/environment-variables.js.map +1 -0
- package/src/utils/fs.d.ts +4 -0
- package/src/utils/fs.js +17 -0
- package/src/utils/fs.js.map +1 -0
- package/src/utils/get-entry-points.d.ts +8 -0
- package/src/utils/get-entry-points.js +62 -0
- package/src/utils/get-entry-points.js.map +1 -0
- package/src/utils/versions.d.ts +2 -0
- package/src/utils/versions.js +6 -0
- package/src/utils/versions.js.map +1 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRegisterFileContent = exports.getOutfile = exports.getOutExtension = exports.buildEsbuildOptions = void 0;
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const environment_variables_1 = require("../../../utils/environment-variables");
|
|
8
|
+
const get_entry_points_1 = require("../../../utils/get-entry-points");
|
|
9
|
+
const ESM_FILE_EXTENSION = '.js';
|
|
10
|
+
const CJS_FILE_EXTENSION = '.cjs';
|
|
11
|
+
function buildEsbuildOptions(format, options, context) {
|
|
12
|
+
var _a, _b, _c, _d;
|
|
13
|
+
const outExtension = getOutExtension(format, options);
|
|
14
|
+
const esbuildOptions = Object.assign(Object.assign({}, options.userDefinedBuildOptions), { entryNames: options.outputHashing === 'all' ? '[dir]/[name].[hash]' : '[dir]/[name]', bundle: options.bundle,
|
|
15
|
+
// Cannot use external with bundle option
|
|
16
|
+
external: options.bundle
|
|
17
|
+
? [
|
|
18
|
+
...((_b = (_a = options.userDefinedBuildOptions) === null || _a === void 0 ? void 0 : _a.external) !== null && _b !== void 0 ? _b : []),
|
|
19
|
+
...options.external,
|
|
20
|
+
]
|
|
21
|
+
: undefined, minify: options.minify, platform: options.platform, target: options.target, metafile: options.metafile, tsconfig: options.tsConfig, sourcemap: ((_c = options.sourcemap) !== null && _c !== void 0 ? _c : (_d = options.userDefinedBuildOptions) === null || _d === void 0 ? void 0 : _d.sourcemap) ||
|
|
22
|
+
false, format, outExtension: {
|
|
23
|
+
'.js': outExtension,
|
|
24
|
+
} });
|
|
25
|
+
if (options.platform === 'browser') {
|
|
26
|
+
esbuildOptions.define = (0, environment_variables_1.getClientEnvironment)();
|
|
27
|
+
}
|
|
28
|
+
if (!esbuildOptions.outfile && !esbuildOptions.outdir) {
|
|
29
|
+
if (options.singleEntry && options.bundle && !esbuildOptions.splitting) {
|
|
30
|
+
esbuildOptions.outfile = getOutfile(format, options, context);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
esbuildOptions.outdir = options.outputPath;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const entryPoints = options.additionalEntryPoints
|
|
37
|
+
? [options.main, ...options.additionalEntryPoints]
|
|
38
|
+
: [options.main];
|
|
39
|
+
if (options.bundle) {
|
|
40
|
+
esbuildOptions.entryPoints = entryPoints;
|
|
41
|
+
}
|
|
42
|
+
else if (options.platform === 'node' && format === 'cjs') {
|
|
43
|
+
// When target platform Node and target format is CJS, then also transpile workspace libs used by the app.
|
|
44
|
+
// Provide a `require` override in the main entry file so workspace libs can be loaded when running the app.
|
|
45
|
+
const paths = getTsConfigCompilerPaths(context);
|
|
46
|
+
const entryPointsFromProjects = (0, get_entry_points_1.getEntryPoints)(context.projectName, context, {
|
|
47
|
+
initialTsConfigFileName: options.tsConfig,
|
|
48
|
+
initialEntryPoints: entryPoints,
|
|
49
|
+
recursive: true,
|
|
50
|
+
});
|
|
51
|
+
esbuildOptions.entryPoints = [
|
|
52
|
+
// Write a main entry file that registers workspace libs and then calls the user-defined main.
|
|
53
|
+
writeTmpEntryWithRequireOverrides(paths, outExtension, options, context),
|
|
54
|
+
...entryPointsFromProjects.map((f) => {
|
|
55
|
+
/**
|
|
56
|
+
* Maintain same directory structure as the workspace, so that other workspace libs may be used by the project.
|
|
57
|
+
* dist
|
|
58
|
+
* └── apps
|
|
59
|
+
* └── demo
|
|
60
|
+
* ├── apps
|
|
61
|
+
* │ └── demo
|
|
62
|
+
* │ └── src
|
|
63
|
+
* │ └── main.js (requires '@acme/utils' which is mapped to libs/utils/src/index.js)
|
|
64
|
+
* ├── libs
|
|
65
|
+
* │ └── utils
|
|
66
|
+
* │ └── src
|
|
67
|
+
* │ └── index.js
|
|
68
|
+
* └── main.js (entry with require overrides)
|
|
69
|
+
*/
|
|
70
|
+
const { dir, name } = path.parse(f);
|
|
71
|
+
return {
|
|
72
|
+
in: f,
|
|
73
|
+
out: path.join(dir, name),
|
|
74
|
+
};
|
|
75
|
+
}),
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// Otherwise, just transpile the project source files. Any workspace lib will need to be published separately.
|
|
80
|
+
esbuildOptions.entryPoints = (0, get_entry_points_1.getEntryPoints)(context.projectName, context, {
|
|
81
|
+
initialTsConfigFileName: options.tsConfig,
|
|
82
|
+
initialEntryPoints: entryPoints,
|
|
83
|
+
recursive: false,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return esbuildOptions;
|
|
87
|
+
}
|
|
88
|
+
exports.buildEsbuildOptions = buildEsbuildOptions;
|
|
89
|
+
function getOutExtension(format, options) {
|
|
90
|
+
var _a, _b;
|
|
91
|
+
const userDefinedExt = (_b = (_a = options.userDefinedBuildOptions) === null || _a === void 0 ? void 0 : _a.outExtension) === null || _b === void 0 ? void 0 : _b['.js'];
|
|
92
|
+
// Allow users to change the output extensions from default CJS and ESM extensions.
|
|
93
|
+
// CJS -> .js
|
|
94
|
+
// ESM -> .mjs
|
|
95
|
+
return userDefinedExt === '.js' && format === 'cjs'
|
|
96
|
+
? '.js'
|
|
97
|
+
: userDefinedExt === '.mjs' && format === 'esm'
|
|
98
|
+
? '.mjs'
|
|
99
|
+
: format === 'esm'
|
|
100
|
+
? ESM_FILE_EXTENSION
|
|
101
|
+
: CJS_FILE_EXTENSION;
|
|
102
|
+
}
|
|
103
|
+
exports.getOutExtension = getOutExtension;
|
|
104
|
+
function getOutfile(format, options, context) {
|
|
105
|
+
const ext = getOutExtension(format, options);
|
|
106
|
+
const candidate = (0, devkit_1.joinPathFragments)(context.target.options.outputPath, options.outputFileName);
|
|
107
|
+
const { dir, name } = path.parse(candidate);
|
|
108
|
+
return `${dir}/${name}${ext}`;
|
|
109
|
+
}
|
|
110
|
+
exports.getOutfile = getOutfile;
|
|
111
|
+
function writeTmpEntryWithRequireOverrides(paths, outExtension, options, context) {
|
|
112
|
+
var _a;
|
|
113
|
+
const project = (_a = context.projectGraph) === null || _a === void 0 ? void 0 : _a.nodes[context.projectName];
|
|
114
|
+
// Write a temp main entry source that registers workspace libs.
|
|
115
|
+
const tmpPath = path.join(context.root, 'tmp', project.name);
|
|
116
|
+
(0, fs_1.mkdirSync)(tmpPath, { recursive: true });
|
|
117
|
+
const { name: mainFileName, dir: mainPathRelativeToDist } = path.parse(options.main);
|
|
118
|
+
const mainWithRequireOverridesInPath = path.join(tmpPath, `main-with-require-overrides.js`);
|
|
119
|
+
(0, fs_1.writeFileSync)(mainWithRequireOverridesInPath, getRegisterFileContent(project, paths, `./${path.join(mainPathRelativeToDist, `${mainFileName}${outExtension}`)}`, outExtension));
|
|
120
|
+
let mainWithRequireOverridesOutPath;
|
|
121
|
+
if (options.outputFileName) {
|
|
122
|
+
mainWithRequireOverridesOutPath = path.parse(options.outputFileName).name;
|
|
123
|
+
}
|
|
124
|
+
else if (mainPathRelativeToDist === '' || mainPathRelativeToDist === '.') {
|
|
125
|
+
// If the user customized their entry such that it is not inside `src/` folder
|
|
126
|
+
// then they have to provide the outputFileName
|
|
127
|
+
throw new Error(`There is a conflict between Nx-generated main file and the project's main file. Set --outputFileName=nx-main.js to fix this error.`);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
mainWithRequireOverridesOutPath = path.parse(mainFileName).name;
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
in: mainWithRequireOverridesInPath,
|
|
134
|
+
out: mainWithRequireOverridesOutPath,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function getRegisterFileContent(project, paths, mainFile, outExtension = '.js') {
|
|
138
|
+
mainFile = (0, devkit_1.normalizePath)(mainFile);
|
|
139
|
+
// Sort by longest prefix so imports match the most specific path.
|
|
140
|
+
const sortedKeys = Object.keys(paths).sort((a, b) => getPrefixLength(b) - getPrefixLength(a));
|
|
141
|
+
const manifest = sortedKeys.reduce((acc, k) => {
|
|
142
|
+
let exactMatch;
|
|
143
|
+
// Nx generates a single path entry.
|
|
144
|
+
// If more sophisticated setup is needed, we can consider tsconfig-paths.
|
|
145
|
+
const pattern = paths[k][0];
|
|
146
|
+
if (/.[cm]?ts$/.test(pattern)) {
|
|
147
|
+
// Path specifies a single entry point e.g. "a/b/src/index.ts".
|
|
148
|
+
// This is the default setup.
|
|
149
|
+
const { dir, name } = path.parse(pattern);
|
|
150
|
+
exactMatch = path.join(dir, `${name}${outExtension}`);
|
|
151
|
+
}
|
|
152
|
+
acc.push({ module: k, exactMatch, pattern });
|
|
153
|
+
return acc;
|
|
154
|
+
}, []);
|
|
155
|
+
return `
|
|
156
|
+
/**
|
|
157
|
+
* IMPORTANT: Do not modify this file.
|
|
158
|
+
* This file allows the app to run without bundling in workspace libraries.
|
|
159
|
+
* Must be contained in the ".nx" folder inside the output path.
|
|
160
|
+
*/
|
|
161
|
+
const Module = require('module');
|
|
162
|
+
const path = require('path');
|
|
163
|
+
const fs = require('fs');
|
|
164
|
+
const originalResolveFilename = Module._resolveFilename;
|
|
165
|
+
const distPath = __dirname;
|
|
166
|
+
const manifest = ${JSON.stringify(manifest)};
|
|
167
|
+
|
|
168
|
+
Module._resolveFilename = function(request, parent) {
|
|
169
|
+
let found;
|
|
170
|
+
for (const entry of manifest) {
|
|
171
|
+
if (request === entry.module && entry.exactMatch) {
|
|
172
|
+
const entry = manifest.find((x) => request === x.module || request.startsWith(x.module + "/"));
|
|
173
|
+
const candidate = path.join(distPath, entry.exactMatch);
|
|
174
|
+
if (isFile(candidate)) {
|
|
175
|
+
found = candidate;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
const re = new RegExp(entry.module.replace(/\\*$/, "(?<rest>.*)"));
|
|
180
|
+
const match = request.match(re);
|
|
181
|
+
|
|
182
|
+
if (match?.groups) {
|
|
183
|
+
const candidate = path.join(distPath, entry.pattern.replace("*", ""), match.groups.rest + ".js");
|
|
184
|
+
if (isFile(candidate)) {
|
|
185
|
+
found = candidate;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (found) {
|
|
192
|
+
const modifiedArguments = [found, ...[].slice.call(arguments, 1)];
|
|
193
|
+
return originalResolveFilename.apply(this, modifiedArguments);
|
|
194
|
+
} else {
|
|
195
|
+
return originalResolveFilename.apply(this, arguments);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
function isFile(s) {
|
|
200
|
+
try {
|
|
201
|
+
return fs.statSync(s).isFile();
|
|
202
|
+
} catch (_e) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Call the user-defined main.
|
|
208
|
+
require('${mainFile}');
|
|
209
|
+
`;
|
|
210
|
+
}
|
|
211
|
+
exports.getRegisterFileContent = getRegisterFileContent;
|
|
212
|
+
function getPrefixLength(pattern) {
|
|
213
|
+
return pattern.substring(0, pattern.indexOf('*')).length;
|
|
214
|
+
}
|
|
215
|
+
function getTsConfigCompilerPaths(context) {
|
|
216
|
+
const tsconfigPaths = require('tsconfig-paths');
|
|
217
|
+
const tsConfigResult = tsconfigPaths.loadConfig(getRootTsConfigPath(context));
|
|
218
|
+
if (tsConfigResult.resultType !== 'success') {
|
|
219
|
+
throw new Error('Cannot load tsconfig file');
|
|
220
|
+
}
|
|
221
|
+
return tsConfigResult.paths;
|
|
222
|
+
}
|
|
223
|
+
function getRootTsConfigPath(context) {
|
|
224
|
+
for (const tsConfigName of ['tsconfig.base.json', 'tsconfig.json']) {
|
|
225
|
+
const tsConfigPath = path.join(context.root, tsConfigName);
|
|
226
|
+
if ((0, fs_1.existsSync)(tsConfigPath)) {
|
|
227
|
+
return tsConfigPath;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
throw new Error('Could not find a root tsconfig.json or tsconfig.base.json file.');
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=build-esbuild-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-esbuild-options.js","sourceRoot":"","sources":["../../../../../../../packages/esbuild/src/executors/esbuild/lib/build-esbuild-options.ts"],"names":[],"mappings":";;;AACA,6BAA6B;AAC7B,2BAA0D;AAC1D,uCAKoB;AAEpB,gFAA4E;AAE5E,sEAAiE;AAEjE,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,SAAgB,mBAAmB,CACjC,MAAqB,EACrB,OAAyC,EACzC,OAAwB;;IAExB,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEtD,MAAM,cAAc,mCACf,OAAO,CAAC,uBAAuB,KAClC,UAAU,EACR,OAAO,CAAC,aAAa,KAAK,KAAK,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,cAAc,EAC1E,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,yCAAyC;QACzC,QAAQ,EAAE,OAAO,CAAC,M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,YAAY,IAAI,CAAC,oBAAoB,EAAE,eAAe,CAAC,EAAE;QAClE,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC3D,IAAI,IAAA,eAAU,EAAC,YAAY,CAAC,EAAE;YAC5B,OAAO,YAAY,CAAC;SACrB;KACF;IAED,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExtraDependencies = void 0;
|
|
4
|
+
function getExtraDependencies(projectName, graph) {
|
|
5
|
+
const deps = new Map();
|
|
6
|
+
recur(projectName);
|
|
7
|
+
function recur(currProjectName) {
|
|
8
|
+
const allDeps = graph.dependencies[currProjectName];
|
|
9
|
+
const externalDeps = allDeps.reduce((acc, node) => {
|
|
10
|
+
const found = graph.externalNodes[node.target];
|
|
11
|
+
if (found)
|
|
12
|
+
acc.push(found);
|
|
13
|
+
return acc;
|
|
14
|
+
}, []);
|
|
15
|
+
const internalDeps = allDeps.reduce((acc, node) => {
|
|
16
|
+
const found = graph.nodes[node.target];
|
|
17
|
+
if (found)
|
|
18
|
+
acc.push(found);
|
|
19
|
+
return acc;
|
|
20
|
+
}, []);
|
|
21
|
+
for (const externalDep of externalDeps) {
|
|
22
|
+
deps.set(externalDep.name, {
|
|
23
|
+
name: externalDep.name,
|
|
24
|
+
outputs: [],
|
|
25
|
+
node: externalDep,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
for (const internalDep of internalDeps) {
|
|
29
|
+
recur(internalDep.name);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return Array.from(deps.values());
|
|
33
|
+
}
|
|
34
|
+
exports.getExtraDependencies = getExtraDependencies;
|
|
35
|
+
//# sourceMappingURL=get-extra-dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-extra-dependencies.js","sourceRoot":"","sources":["../../../../../../../packages/esbuild/src/executors/esbuild/lib/get-extra-dependencies.ts"],"names":[],"mappings":";;;AAGA,SAAgB,oBAAoB,CAClC,WAAmB,EACnB,KAAmB;IAEnB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAyC,CAAC;IAC9D,KAAK,CAAC,WAAW,CAAC,CAAC;IAEnB,SAAS,KAAK,CAAC,eAAe;QAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;QACpD,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YAChD,MAAM,KAAK,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/C,IAAI,KAAK;gBAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3B,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YAChD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvC,IAAI,KAAK;gBAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3B,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;YACtC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE;gBACzB,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,OAAO,EAAE,EAAE;gBACX,IAAI,EAAE,WAAW;aAClB,CAAC,CAAC;SACJ;QAED,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;YACtC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;SACzB;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;AACnC,CAAC;AAlCD,oDAkCC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeOptions = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const devkit_1 = require("@nx/devkit");
|
|
8
|
+
const chalk = require("chalk");
|
|
9
|
+
function normalizeOptions(options, context) {
|
|
10
|
+
var _a, _b, _c, _d;
|
|
11
|
+
// If we're not generating package.json file, then copy it as-is as an asset.
|
|
12
|
+
const assets = options.generatePackageJson
|
|
13
|
+
? options.assets
|
|
14
|
+
: [
|
|
15
|
+
...options.assets,
|
|
16
|
+
(0, devkit_1.joinPathFragments)(context.projectGraph.nodes[context.projectName].data.root, 'package.json'),
|
|
17
|
+
];
|
|
18
|
+
if (!options.bundle && options.thirdParty) {
|
|
19
|
+
devkit_1.logger.info(chalk.yellow(`Your build has conflicting options, ${chalk.bold('bundle:false')} and ${chalk.bold('thirdParty:true')}. Your package.json depedencies might not be generated correctly so we added an update ${chalk.bold('thirdParty:false')}`));
|
|
20
|
+
}
|
|
21
|
+
const thirdParty = !options.bundle ? false : options.thirdParty;
|
|
22
|
+
let userDefinedBuildOptions;
|
|
23
|
+
if (options.esbuildConfig) {
|
|
24
|
+
const userDefinedConfig = path.resolve(context.root, options.esbuildConfig);
|
|
25
|
+
if (options.esbuildOptions)
|
|
26
|
+
throw new Error(`Cannot use both esbuildOptions and esbuildConfig options. Remove one of them and try again.`);
|
|
27
|
+
if (!fs.existsSync(userDefinedConfig))
|
|
28
|
+
throw new Error(`Path of esbuildConfig does not exist: ${userDefinedConfig}`);
|
|
29
|
+
userDefinedBuildOptions = require(userDefinedConfig);
|
|
30
|
+
}
|
|
31
|
+
else if (options.esbuildOptions) {
|
|
32
|
+
userDefinedBuildOptions = options.esbuildOptions;
|
|
33
|
+
}
|
|
34
|
+
if (((_a = options.additionalEntryPoints) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
35
|
+
const { outputFileName } = options, rest = tslib_1.__rest(options, ["outputFileName"]);
|
|
36
|
+
if (outputFileName) {
|
|
37
|
+
throw new Error(`Cannot use outputFileName and additionalEntry points together. Please remove outputFileName and try again.`);
|
|
38
|
+
}
|
|
39
|
+
return Object.assign(Object.assign({}, rest), { thirdParty,
|
|
40
|
+
assets,
|
|
41
|
+
userDefinedBuildOptions, external: (_b = options.external) !== null && _b !== void 0 ? _b : [], singleEntry: false,
|
|
42
|
+
// Use the `main` file name as the output file name.
|
|
43
|
+
// This is needed for `@nrwl/js:node` to know the main file to execute.
|
|
44
|
+
// NOTE: The .js default extension may be replaced later in getOutfile() call.
|
|
45
|
+
outputFileName: `${path.parse(options.main).name}.js` });
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
return Object.assign(Object.assign({}, options), { thirdParty,
|
|
49
|
+
assets,
|
|
50
|
+
userDefinedBuildOptions, external: (_c = options.external) !== null && _c !== void 0 ? _c : [], singleEntry: true, outputFileName:
|
|
51
|
+
// NOTE: The .js default extension may be replaced later in getOutfile() call.
|
|
52
|
+
(_d = options.outputFileName) !== null && _d !== void 0 ? _d : `${path.parse(options.main).name}.js` });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.normalizeOptions = normalizeOptions;
|
|
56
|
+
//# sourceMappingURL=normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../../../../../packages/esbuild/src/executors/esbuild/lib/normalize.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,6BAA6B;AAK7B,uCAAwE;AACxE,+BAAgC;AAGhC,SAAgB,gBAAgB,CAC9B,OAA+B,EAC/B,OAAwB;;IAExB,6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AAE,MAAM,IAAG,CAAC,EAAE;QAC7C,MAAM,EAAE,cAAc,KAAc,OAAO,EAAhB,IAAI,kBAAK,OAAO,EAArC,kBAA2B,CAAU,CAAC;QAC5C,IAAI,cAAc,EAAE;YAClB,MAAM,IAAI,KAAK,CACb,4GAA4G,CAC7G,CAAC;SACH;QACD,uCACK,IAAI,KACP,UAAU;YACV,MAAM;YACN,uBAAuB,EACvB,QAAQ,EAAE,MAAA,OAAO,CAAC,QAAQ,mCAAI,EAAE,EAChC,WAAW,EAAE,KAAK;YAClB,oDAAoD;YACpD,uEAAuE;YACvE,8EAA8E;YAC9E,cAAc,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IACrD;KACH;SAAM;QACL,uCACK,OAAO,KACV,UAAU;YACV,MAAM;YACN,uBAAuB,EACvB,QAAQ,EAAE,MAAA,OAAO,CAAC,QAAQ,mCAAI,EAAE,EAChC,WAAW,EAAE,IAAI,EACjB,cAAc;YACZ,8EAA8E;YAC9E,MAAA,OAAO,CAAC,cAAc,mCAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IACjE;KACH;AACH,CAAC;AAhFD,4CAgFC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AssetGlob } from '@nx/js/src/utils/assets/assets';
|
|
2
|
+
import * as esbuild from 'esbuild';
|
|
3
|
+
|
|
4
|
+
type Compiler = 'babel' | 'swc';
|
|
5
|
+
|
|
6
|
+
export interface EsBuildExecutorOptions {
|
|
7
|
+
additionalEntryPoints?: string[];
|
|
8
|
+
assets: (AssetGlob | string)[];
|
|
9
|
+
buildableProjectDepsInPackageJsonType?: 'dependencies' | 'peerDependencies';
|
|
10
|
+
bundle?: boolean;
|
|
11
|
+
deleteOutputPath?: boolean;
|
|
12
|
+
dependenciesFieldType?: boolean;
|
|
13
|
+
esbuildOptions?: Record<string, any>;
|
|
14
|
+
esbuildConfig?: string;
|
|
15
|
+
external?: string[];
|
|
16
|
+
format?: Array<'esm' | 'cjs'>;
|
|
17
|
+
generatePackageJson?: boolean;
|
|
18
|
+
main: string;
|
|
19
|
+
metafile?: boolean;
|
|
20
|
+
minify?: boolean;
|
|
21
|
+
outputFileName?: string;
|
|
22
|
+
outputHashing?: 'none' | 'all';
|
|
23
|
+
outputPath: string;
|
|
24
|
+
platform?: 'node' | 'browser' | 'neutral';
|
|
25
|
+
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both';
|
|
26
|
+
skipTypeCheck?: boolean;
|
|
27
|
+
target?: string;
|
|
28
|
+
thirdParty?: boolean;
|
|
29
|
+
tsConfig: string;
|
|
30
|
+
watch?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface NormalizedEsBuildExecutorOptions
|
|
34
|
+
extends Omit<EsBuildExecutorOptions, 'esbuildOptions' | 'esbuildConfig'> {
|
|
35
|
+
singleEntry: boolean;
|
|
36
|
+
external: string[];
|
|
37
|
+
userDefinedBuildOptions: esbuild.BuildOptions;
|
|
38
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"outputCapture": "direct-nodejs",
|
|
4
|
+
"title": "esbuild (experimental)",
|
|
5
|
+
"description": "Bundle a package for different platforms. Note: declaration (*.d.ts) file are not currently generated.",
|
|
6
|
+
"cli": "nx",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"main": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "The path to the entry file, relative to project.",
|
|
12
|
+
"alias": "entryFile",
|
|
13
|
+
"x-completion-type": "file",
|
|
14
|
+
"x-completion-glob": "**/*@(.js|.ts)",
|
|
15
|
+
"x-priority": "important"
|
|
16
|
+
},
|
|
17
|
+
"outputPath": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "The output path of the generated files.",
|
|
20
|
+
"x-completion-type": "directory",
|
|
21
|
+
"x-priority": "important"
|
|
22
|
+
},
|
|
23
|
+
"outputFileName": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "Name of the main output file. Defaults same basename as 'main' file."
|
|
26
|
+
},
|
|
27
|
+
"tsConfig": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "The path to tsconfig file.",
|
|
30
|
+
"x-completion-type": "file",
|
|
31
|
+
"x-completion-glob": "tsconfig.*.json",
|
|
32
|
+
"x-priority": "important"
|
|
33
|
+
},
|
|
34
|
+
"additionalEntryPoints": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"description": "List of additional entry points.",
|
|
37
|
+
"items": {
|
|
38
|
+
"type": "string"
|
|
39
|
+
},
|
|
40
|
+
"default": []
|
|
41
|
+
},
|
|
42
|
+
"bundle": {
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"description": "Whether to bundle the main entry point and additional entry points. Set to false to keep individual output files.",
|
|
45
|
+
"default": true
|
|
46
|
+
},
|
|
47
|
+
"format": {
|
|
48
|
+
"type": "array",
|
|
49
|
+
"description": "List of module formats to output. Defaults to matching format from tsconfig (e.g. CJS for CommonJS, and ESM otherwise).",
|
|
50
|
+
"alias": "f",
|
|
51
|
+
"items": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"enum": ["esm", "cjs"]
|
|
54
|
+
},
|
|
55
|
+
"default": ["esm"]
|
|
56
|
+
},
|
|
57
|
+
"watch": {
|
|
58
|
+
"type": "boolean",
|
|
59
|
+
"description": "Enable re-building when files change.",
|
|
60
|
+
"default": false
|
|
61
|
+
},
|
|
62
|
+
"assets": {
|
|
63
|
+
"type": "array",
|
|
64
|
+
"description": "List of static assets.",
|
|
65
|
+
"default": [],
|
|
66
|
+
"items": {
|
|
67
|
+
"$ref": "#/definitions/assetPattern"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"deleteOutputPath": {
|
|
71
|
+
"type": "boolean",
|
|
72
|
+
"description": "Remove previous output before build.",
|
|
73
|
+
"alias": "clean",
|
|
74
|
+
"default": true
|
|
75
|
+
},
|
|
76
|
+
"external": {
|
|
77
|
+
"type": "array",
|
|
78
|
+
"description": "Mark one or more module as external. Can use * wildcards, such as '*.png'.",
|
|
79
|
+
"items": {
|
|
80
|
+
"type": "string"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"outputHashing": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"description": "Define the output filename cache-busting hashing mode.",
|
|
86
|
+
"default": "none",
|
|
87
|
+
"enum": ["none", "all"]
|
|
88
|
+
},
|
|
89
|
+
"metafile": {
|
|
90
|
+
"type": "boolean",
|
|
91
|
+
"description": "Generate a meta.json file in the output folder that includes metadata about the build. This file can be analyzed by other tools.",
|
|
92
|
+
"default": false
|
|
93
|
+
},
|
|
94
|
+
"sourcemap": {
|
|
95
|
+
"oneOf": [
|
|
96
|
+
{ "type": "string", "enum": ["linked", "inline", "external", "both"] },
|
|
97
|
+
{ "type": "boolean" }
|
|
98
|
+
],
|
|
99
|
+
"alias": "sourceMap",
|
|
100
|
+
"description": "Generate sourcemap."
|
|
101
|
+
},
|
|
102
|
+
"minify": {
|
|
103
|
+
"type": "boolean",
|
|
104
|
+
"description": "Minifies outputs.",
|
|
105
|
+
"default": false
|
|
106
|
+
},
|
|
107
|
+
"platform": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"description": "Platform target for outputs.",
|
|
110
|
+
"enum": ["browser", "node", "neutral"],
|
|
111
|
+
"default": "node"
|
|
112
|
+
},
|
|
113
|
+
"target": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"description": "The environment target for outputs.",
|
|
116
|
+
"default": "esnext"
|
|
117
|
+
},
|
|
118
|
+
"skipTypeCheck": {
|
|
119
|
+
"type": "boolean",
|
|
120
|
+
"description": "Skip type-checking via TypeScript. Skipping type-checking speeds up the build but type errors are not caught.",
|
|
121
|
+
"default": false,
|
|
122
|
+
"x-priority": "internal"
|
|
123
|
+
},
|
|
124
|
+
"generatePackageJson": {
|
|
125
|
+
"type": "boolean",
|
|
126
|
+
"description": "Generates a `package.json` and pruned lock file with the project's `node_module` dependencies populated for installing in a container. If a `package.json` exists in the project's directory, it will be reused with dependencies populated.",
|
|
127
|
+
"default": false
|
|
128
|
+
},
|
|
129
|
+
"thirdParty": {
|
|
130
|
+
"type": "boolean",
|
|
131
|
+
"description": "Includes third-party packages in the bundle (i.e. npm packages)."
|
|
132
|
+
},
|
|
133
|
+
"dependenciesFieldType": {
|
|
134
|
+
"type": "string",
|
|
135
|
+
"description": "When `bundleInternalProjectsOnly` is true, this option determines whether external packages should be in 'dependencies' or 'peerDependencies' field in the generated package.json file.",
|
|
136
|
+
"enum": ["dependencies", "peerDependencies"],
|
|
137
|
+
"default": "dependencies"
|
|
138
|
+
},
|
|
139
|
+
"esbuildOptions": {
|
|
140
|
+
"type": "object",
|
|
141
|
+
"description": "Additional options to pass to esbuild. See https://esbuild.github.io/api/. Cannot be used with 'esbuildConfig' option.",
|
|
142
|
+
"additionalProperties": true,
|
|
143
|
+
"x-priority": "important"
|
|
144
|
+
},
|
|
145
|
+
"esbuildConfig": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"description": "Path to a esbuild configuration file. See https://esbuild.github.io/api/. Cannot be used with 'esbuildOptions' option.",
|
|
148
|
+
"x-priority": "important"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"required": ["tsConfig", "main", "outputPath"],
|
|
152
|
+
"definitions": {
|
|
153
|
+
"assetPattern": {
|
|
154
|
+
"oneOf": [
|
|
155
|
+
{
|
|
156
|
+
"type": "object",
|
|
157
|
+
"properties": {
|
|
158
|
+
"glob": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"description": "The pattern to match."
|
|
161
|
+
},
|
|
162
|
+
"input": {
|
|
163
|
+
"type": "string",
|
|
164
|
+
"description": "The input directory path in which to apply `glob`. Defaults to the project root."
|
|
165
|
+
},
|
|
166
|
+
"output": {
|
|
167
|
+
"type": "string",
|
|
168
|
+
"description": "Relative path within the output folder."
|
|
169
|
+
},
|
|
170
|
+
"ignore": {
|
|
171
|
+
"description": "An array of globs to ignore.",
|
|
172
|
+
"type": "array",
|
|
173
|
+
"items": {
|
|
174
|
+
"type": "string"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"additionalProperties": false,
|
|
179
|
+
"required": ["glob", "input", "output"]
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"type": "string"
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"additionalProperties": true,
|
|
188
|
+
"examplesFile": "../../../docs/esbuild-examples.md"
|
|
189
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Tree } from '@nx/devkit';
|
|
2
|
+
import { EsBuildProjectSchema } from './schema';
|
|
3
|
+
export declare function esbuildProjectGenerator(tree: Tree, options: EsBuildProjectSchema): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
4
|
+
export declare const esbuildProjectSchematic: (generatorOptions: EsBuildProjectSchema) => (tree: any, context: any) => Promise<any>;
|
|
5
|
+
export default esbuildProjectGenerator;
|