@nx/vite 17.2.0-beta.1 → 17.2.0-beta.10
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/migrations.json +35 -15
- package/package.json +8 -7
- package/plugins/rollup-replace-files.plugin.d.ts +2 -2
- package/plugins/rollup-replace-files.plugin.js +1 -1
- package/plugins/rollup-replace-files.plugin.js.map +1 -1
- package/src/executors/build/build.impl.d.ts +1 -1
- package/src/executors/build/build.impl.js +80 -18
- package/src/executors/build/build.impl.js.map +1 -1
- package/src/executors/build/schema.d.ts +3 -15
- package/src/executors/build/schema.json +0 -86
- package/src/executors/dev-server/dev-server.impl.js +31 -8
- package/src/executors/dev-server/dev-server.impl.js.map +1 -1
- package/src/executors/dev-server/schema.d.ts +0 -10
- package/src/executors/dev-server/schema.json +0 -63
- package/src/executors/preview-server/preview-server.impl.js +47 -14
- package/src/executors/preview-server/preview-server.impl.js.map +1 -1
- package/src/executors/preview-server/schema.d.ts +0 -7
- package/src/executors/preview-server/schema.json +0 -50
- package/src/executors/test/lib/nx-reporter.d.ts +14 -0
- package/src/executors/test/lib/nx-reporter.js +40 -0
- package/src/executors/test/lib/nx-reporter.js.map +1 -0
- package/src/executors/test/lib/utils.d.ts +4 -0
- package/src/executors/test/lib/utils.js +69 -0
- package/src/executors/test/lib/utils.js.map +1 -0
- package/src/executors/test/schema.d.ts +2 -8
- package/src/executors/test/schema.json +7 -43
- package/src/executors/test/vitest.impl.js +17 -113
- package/src/executors/test/vitest.impl.js.map +1 -1
- package/src/generators/configuration/configuration.js +4 -4
- package/src/generators/configuration/configuration.js.map +1 -1
- package/src/generators/init/init.d.ts +1 -1
- package/src/generators/init/init.js +23 -15
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/vitest/files/tsconfig.spec.json__tmpl__ +1 -0
- package/src/generators/vitest/vitest-generator.js +2 -1
- package/src/generators/vitest/vitest-generator.js.map +1 -1
- package/src/migrations/update-17-2-0/lib/add-file-replacements.d.ts +2 -0
- package/src/migrations/update-17-2-0/lib/add-file-replacements.js +61 -0
- package/src/migrations/update-17-2-0/lib/add-file-replacements.js.map +1 -0
- package/src/migrations/update-17-2-0/lib/edit-build-config.d.ts +2 -0
- package/src/migrations/update-17-2-0/lib/edit-build-config.js +88 -0
- package/src/migrations/update-17-2-0/lib/edit-build-config.js.map +1 -0
- package/src/migrations/update-17-2-0/lib/edit-test-config.d.ts +2 -0
- package/src/migrations/update-17-2-0/lib/edit-test-config.js +71 -0
- package/src/migrations/update-17-2-0/lib/edit-test-config.js.map +1 -0
- package/src/migrations/update-17-2-0/lib/find-vite-config.d.ts +2 -0
- package/src/migrations/update-17-2-0/lib/find-vite-config.js +25 -0
- package/src/migrations/update-17-2-0/lib/find-vite-config.js.map +1 -0
- package/src/migrations/update-17-2-0/update-vite-config.d.ts +2 -0
- package/src/migrations/update-17-2-0/update-vite-config.js +48 -0
- package/src/migrations/update-17-2-0/update-vite-config.js.map +1 -0
- package/src/utils/executor-utils.js +4 -4
- package/src/utils/executor-utils.js.map +1 -1
- package/src/utils/generator-utils.d.ts +2 -1
- package/src/utils/generator-utils.js +38 -27
- package/src/utils/generator-utils.js.map +1 -1
- package/src/utils/options-utils.d.ts +3 -15
- package/src/utils/options-utils.js +17 -61
- package/src/utils/options-utils.js.map +1 -1
- package/src/utils/test-files/react-lib-non-buildable-jest.json +1 -4
- package/src/utils/test-files/react-lib-non-buildable-vitest.json +1 -4
- package/src/utils/test-files/react-mixed-project.config.json +1 -6
- package/src/utils/test-files/react-project.config.json +1 -4
- package/src/utils/test-files/react-vite-project.config.json +1 -4
- package/src/utils/test-files/unknown-project.config.json +1 -4
- package/src/utils/test-files/web-project.config.json +1 -4
- package/src/utils/versions.d.ts +3 -3
- package/src/utils/versions.js +3 -3
- package/src/utils/versions.js.map +1 -1
- package/src/utils/vite-config-edit-utils.js +1 -1
- package/src/utils/vite-config-edit-utils.js.map +1 -1
package/migrations.json
CHANGED
|
@@ -40,25 +40,45 @@
|
|
|
40
40
|
"version": "17.1.0-beta.2",
|
|
41
41
|
"description": "Move target defaults",
|
|
42
42
|
"implementation": "./src/migrations/update-17-1-0/move-target-defaults"
|
|
43
|
+
},
|
|
44
|
+
"update-vite-config": {
|
|
45
|
+
"version": "17.2.0-beta.10",
|
|
46
|
+
"description": "Update vite config.",
|
|
47
|
+
"implementation": "./src/migrations/update-17-2-0/update-vite-config"
|
|
43
48
|
}
|
|
44
49
|
},
|
|
45
50
|
"packageJsonUpdates": {
|
|
46
51
|
"17.2.0": {
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
52
|
+
"version": "17.2.0-beta.2",
|
|
53
|
+
"packages": {
|
|
54
|
+
"vite": {
|
|
55
|
+
"version": "^5.0.0",
|
|
56
|
+
"alwaysAddToPackageJson": false
|
|
57
|
+
},
|
|
58
|
+
"@vitejs/plugin-react": {
|
|
59
|
+
"version": "^4.2.0",
|
|
60
|
+
"alwaysAddToPackageJson": false
|
|
61
|
+
},
|
|
62
|
+
"@vitejs/plugin-react-swc": {
|
|
63
|
+
"version": "^3.5.0",
|
|
64
|
+
"alwaysAddToPackageJson": false
|
|
65
|
+
},
|
|
66
|
+
"vitest": {
|
|
67
|
+
"version": "~0.34.6",
|
|
68
|
+
"alwaysAddToPackageJson": false
|
|
69
|
+
},
|
|
70
|
+
"@vitest/coverage-v8": {
|
|
71
|
+
"version": "~0.34.6",
|
|
72
|
+
"alwaysAddToPackageJson": false
|
|
73
|
+
},
|
|
74
|
+
"@vitest/ui": {
|
|
75
|
+
"version": "~0.34.6",
|
|
76
|
+
"alwaysAddToPackageJson": false
|
|
77
|
+
},
|
|
78
|
+
"@vitest/coverage-istanbul": {
|
|
79
|
+
"version": "~0.34.6",
|
|
80
|
+
"alwaysAddToPackageJson": false
|
|
81
|
+
}
|
|
62
82
|
}
|
|
63
83
|
},
|
|
64
84
|
"16.4.0-beta.7": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vite",
|
|
3
|
-
"version": "17.2.0-beta.
|
|
3
|
+
"version": "17.2.0-beta.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for building and testing applications using Vite",
|
|
6
6
|
"repository": {
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
33
33
|
"@swc/helpers": "~0.5.0",
|
|
34
34
|
"enquirer": "~2.3.6",
|
|
35
|
-
"@nx/devkit": "17.2.0-beta.
|
|
36
|
-
"@nx/js": "17.2.0-beta.
|
|
35
|
+
"@nx/devkit": "17.2.0-beta.10",
|
|
36
|
+
"@nx/js": "17.2.0-beta.10",
|
|
37
37
|
"tsconfig-paths": "^4.1.2",
|
|
38
|
-
"@nrwl/vite": "17.2.0-beta.
|
|
38
|
+
"@nrwl/vite": "17.2.0-beta.10"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"vite": "^
|
|
42
|
-
"vitest": ">=0.
|
|
41
|
+
"vite": "^5.0.0",
|
|
42
|
+
"vitest": ">=0.34.6 <1.0.0"
|
|
43
43
|
},
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
"./src/executors/*/schema.json": "./src/executors/*/schema.json",
|
|
55
55
|
"./src/executors/*.impl": "./src/executors/*.impl.js",
|
|
56
56
|
"./src/executors/*/compat": "./src/executors/*/compat.js",
|
|
57
|
-
"./plugins/nx-tsconfig-paths.plugin": "./plugins/nx-tsconfig-paths.plugin.js"
|
|
57
|
+
"./plugins/nx-tsconfig-paths.plugin": "./plugins/nx-tsconfig-paths.plugin.js",
|
|
58
|
+
"./plugins/rollup-replace-files.plugin": "./plugins/rollup-replace-files.plugin.js"
|
|
58
59
|
},
|
|
59
60
|
"type": "commonjs"
|
|
60
61
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @function replaceFiles
|
|
3
3
|
* @param {FileReplacement[]} replacements
|
|
4
|
-
* @return {({name: "rollup-plugin-replace-files", enforce: "pre", Promise<resolveId>})}
|
|
4
|
+
* @return {({name: "rollup-plugin-replace-files", enforce: "pre" | "post" | undefined, Promise<resolveId>})}
|
|
5
5
|
*/
|
|
6
6
|
export default function replaceFiles(replacements: FileReplacement[]): {
|
|
7
7
|
name: string;
|
|
8
|
-
enforce:
|
|
8
|
+
enforce: 'pre' | 'post' | undefined;
|
|
9
9
|
resolveId(source: any, importer: any, options: any): Promise<{
|
|
10
10
|
id: string;
|
|
11
11
|
}>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @function replaceFiles
|
|
4
4
|
* @param {FileReplacement[]} replacements
|
|
5
|
-
* @return {({name: "rollup-plugin-replace-files", enforce: "pre", Promise<resolveId>})}
|
|
5
|
+
* @return {({name: "rollup-plugin-replace-files", enforce: "pre" | "post" | undefined, Promise<resolveId>})}
|
|
6
6
|
*/ "use strict";
|
|
7
7
|
Object.defineProperty(exports, "default", {
|
|
8
8
|
enumerable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../packages/vite/plugins/rollup-replace-files.plugin.ts"],"sourcesContent":["// source: https://github.com/Myrmod/vitejs-theming/blob/master/build-plugins/rollup/replace-files.js\n\n/**\n * @function replaceFiles\n * @param {FileReplacement[]} replacements\n * @return {({name: \"rollup-plugin-replace-files\", enforce: \"pre\", Promise<resolveId>})}\n */\nexport default function replaceFiles(replacements: FileReplacement[]) {\n if (!replacements?.length) {\n return null;\n }\n return {\n name: 'rollup-plugin-replace-files',\n enforce: 'pre',\n async resolveId(source, importer, options) {\n const resolved = await this.resolve(source, importer, {\n ...options,\n skipSelf: true,\n });\n /**\n * The reason we're using endsWith here is because the resolved id\n * will be the absolute path to the file. We want to check if the\n * file ends with the file we're trying to replace, which will be essentially\n * the path from the root of our workspace.\n */\n\n const foundReplace = replacements.find((replacement) =>\n resolved?.id?.endsWith(replacement.replace)\n );\n if (foundReplace) {\n console.info(\n `replace \"${foundReplace.replace}\" with \"${foundReplace.with}\"`\n );\n try {\n // return new file content\n return {\n id: foundReplace.with,\n };\n } catch (err) {\n console.error(err);\n return null;\n }\n }\n return null;\n },\n };\n}\n\nexport interface FileReplacement {\n replace: string;\n with: string;\n}\n"],"names":["replaceFiles","replacements","length","name","enforce","resolveId","source","importer","options","resolved","resolve","skipSelf","foundReplace","find","replacement","id","endsWith","replace","console","info","with","err","error"],"mappings":"AAAA,qGAAqG;AAErG;;;;CAIC;+BACD;;;eAAwBA;;;;AAAT,SAASA,aAAaC,YAA+B;
|
|
1
|
+
{"version":3,"sources":["../../../../packages/vite/plugins/rollup-replace-files.plugin.ts"],"sourcesContent":["// source: https://github.com/Myrmod/vitejs-theming/blob/master/build-plugins/rollup/replace-files.js\n\n/**\n * @function replaceFiles\n * @param {FileReplacement[]} replacements\n * @return {({name: \"rollup-plugin-replace-files\", enforce: \"pre\" | \"post\" | undefined, Promise<resolveId>})}\n */\nexport default function replaceFiles(replacements: FileReplacement[]): {\n name: string;\n enforce: 'pre' | 'post' | undefined;\n resolveId(\n source: any,\n importer: any,\n options: any\n ): Promise<{\n id: string;\n }>;\n} {\n if (!replacements?.length) {\n return null;\n }\n return {\n name: 'rollup-plugin-replace-files',\n enforce: 'pre',\n async resolveId(source, importer, options) {\n const resolved = await this.resolve(source, importer, {\n ...options,\n skipSelf: true,\n });\n /**\n * The reason we're using endsWith here is because the resolved id\n * will be the absolute path to the file. We want to check if the\n * file ends with the file we're trying to replace, which will be essentially\n * the path from the root of our workspace.\n */\n\n const foundReplace = replacements.find((replacement) =>\n resolved?.id?.endsWith(replacement.replace)\n );\n if (foundReplace) {\n console.info(\n `replace \"${foundReplace.replace}\" with \"${foundReplace.with}\"`\n );\n try {\n // return new file content\n return {\n id: foundReplace.with,\n };\n } catch (err) {\n console.error(err);\n return null;\n }\n }\n return null;\n },\n };\n}\n\nexport interface FileReplacement {\n replace: string;\n with: string;\n}\n"],"names":["replaceFiles","replacements","length","name","enforce","resolveId","source","importer","options","resolved","resolve","skipSelf","foundReplace","find","replacement","id","endsWith","replace","console","info","with","err","error"],"mappings":"AAAA,qGAAqG;AAErG;;;;CAIC;+BACD;;;eAAwBA;;;;AAAT,SAASA,aAAaC,YAA+B;IAWlE,IAAI,EAACA,gCAAAA,aAAcC,MAAM,GAAE;QACzB,OAAO;IACT;IACA,OAAO;QACLC,MAAM;QACNC,SAAS;QACT,MAAMC,WAAUC,MAAM,EAAEC,QAAQ,EAAEC,OAAO;YACvC,MAAMC,WAAW,MAAM,IAAI,CAACC,OAAO,CAACJ,QAAQC,UAAU,eACjDC;gBACHG,UAAU;;YAEZ;;;;;OAKC,GAED,MAAMC,eAAeX,aAAaY,IAAI,CAAC,CAACC;oBACtCL;uBAAAA,6BAAAA,eAAAA,SAAUM,EAAE,qBAAZN,aAAcO,QAAQ,CAACF,YAAYG,OAAO;;YAE5C,IAAIL,cAAc;gBAChBM,QAAQC,IAAI,CACV,CAAC,SAAS,EAAEP,aAAaK,OAAO,CAAC,QAAQ,EAAEL,aAAaQ,IAAI,CAAC,CAAC,CAAC;gBAEjE,IAAI;oBACF,0BAA0B;oBAC1B,OAAO;wBACLL,IAAIH,aAAaQ,IAAI;oBACvB;gBACF,EAAE,OAAOC,KAAK;oBACZH,QAAQI,KAAK,CAACD;oBACd,OAAO;gBACT;YACF;YACA,OAAO;QACT;IACF;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExecutorContext } from '@nx/devkit';
|
|
2
2
|
import { ViteBuildExecutorOptions } from './schema';
|
|
3
|
-
export declare function viteBuildExecutor(options: ViteBuildExecutorOptions, context: ExecutorContext): AsyncGenerator<{
|
|
3
|
+
export declare function viteBuildExecutor(options: Record<string, any> & ViteBuildExecutorOptions, context: ExecutorContext): AsyncGenerator<{
|
|
4
4
|
success: boolean;
|
|
5
5
|
} | {
|
|
6
6
|
success: boolean;
|
|
@@ -22,14 +22,32 @@ const _path = require("path");
|
|
|
22
22
|
const _asynciterable = require("@nx/devkit/src/utils/async-iterable");
|
|
23
23
|
const _executorutils = require("../../utils/executor-utils");
|
|
24
24
|
async function* viteBuildExecutor(options, context) {
|
|
25
|
+
var _resolved_config_build, _resolved_config;
|
|
25
26
|
// Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.
|
|
26
|
-
const { mergeConfig, build } = await Function('return import("vite")')();
|
|
27
|
+
const { mergeConfig, build, loadConfigFromFile } = await Function('return import("vite")')();
|
|
27
28
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
28
29
|
(0, _executorutils.createBuildableTsConfig)(projectRoot, options, context);
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const viteConfigPath = (0, _optionsutils.normalizeViteConfigFilePath)(context.root, projectRoot, options.configFile);
|
|
31
|
+
const root = projectRoot === '.' ? process.cwd() : (0, _path.relative)(context.cwd, (0, _devkit.joinPathFragments)(context.root, projectRoot));
|
|
32
|
+
const { buildOptions, otherOptions } = await getExtraArgs(options);
|
|
33
|
+
var _otherOptions_mode;
|
|
34
|
+
const resolved = await loadConfigFromFile({
|
|
35
|
+
mode: (_otherOptions_mode = otherOptions == null ? void 0 : otherOptions.mode) != null ? _otherOptions_mode : 'production',
|
|
36
|
+
command: 'build'
|
|
37
|
+
}, viteConfigPath);
|
|
38
|
+
var _joinPathFragments;
|
|
39
|
+
const outDir = (_joinPathFragments = (0, _devkit.joinPathFragments)((0, _devkit.offsetFromRoot)(projectRoot), options.outputPath)) != null ? _joinPathFragments : resolved == null ? void 0 : (_resolved_config = resolved.config) == null ? void 0 : (_resolved_config_build = _resolved_config.build) == null ? void 0 : _resolved_config_build.outDir;
|
|
40
|
+
var _resolved_config_root;
|
|
41
|
+
const buildConfig = mergeConfig({
|
|
42
|
+
// This should not be needed as it's going to be set in vite.config.ts
|
|
43
|
+
// but leaving it here in case someone did not migrate correctly
|
|
44
|
+
root: (_resolved_config_root = resolved.config.root) != null ? _resolved_config_root : root,
|
|
45
|
+
configFile: viteConfigPath
|
|
46
|
+
}, _extends._({
|
|
47
|
+
build: _extends._({
|
|
48
|
+
outDir
|
|
49
|
+
}, buildOptions)
|
|
50
|
+
}, otherOptions));
|
|
33
51
|
if (!options.skipTypeCheck) {
|
|
34
52
|
await (0, _executorutils.validateTypes)({
|
|
35
53
|
workspaceRoot: context.root,
|
|
@@ -40,7 +58,10 @@ async function* viteBuildExecutor(options, context) {
|
|
|
40
58
|
const watcherOrOutput = await build(buildConfig);
|
|
41
59
|
const libraryPackageJson = (0, _path.resolve)(projectRoot, 'package.json');
|
|
42
60
|
const rootPackageJson = (0, _path.resolve)(context.root, 'package.json');
|
|
43
|
-
|
|
61
|
+
// Here, we want the outdir relative to the workspace root.
|
|
62
|
+
// So, we calculate the relative path from the workspace root to the outdir.
|
|
63
|
+
const outDirRelativeToWorkspaceRoot = outDir.replaceAll('../', '');
|
|
64
|
+
const distPackageJson = (0, _path.resolve)(outDirRelativeToWorkspaceRoot, 'package.json');
|
|
44
65
|
// Generate a package.json if option has been set.
|
|
45
66
|
if (options.generatePackageJson) {
|
|
46
67
|
if (context.projectGraph.nodes[context.projectName].type !== 'app') {
|
|
@@ -53,15 +74,15 @@ async function* viteBuildExecutor(options, context) {
|
|
|
53
74
|
isProduction: !options.includeDevDependenciesInPackageJson
|
|
54
75
|
});
|
|
55
76
|
builtPackageJson.type = 'module';
|
|
56
|
-
(0, _devkit.writeJsonFile)(`${
|
|
77
|
+
(0, _devkit.writeJsonFile)(`${outDirRelativeToWorkspaceRoot}/package.json`, builtPackageJson);
|
|
57
78
|
const packageManager = (0, _devkit.detectPackageManager)(context.root);
|
|
58
79
|
const lockFile = (0, _js.createLockFile)(builtPackageJson, context.projectGraph, packageManager);
|
|
59
|
-
(0, _fs.writeFileSync)(`${
|
|
80
|
+
(0, _fs.writeFileSync)(`${outDirRelativeToWorkspaceRoot}/${(0, _js.getLockFileName)(packageManager)}`, lockFile, {
|
|
60
81
|
encoding: 'utf-8'
|
|
61
82
|
});
|
|
62
83
|
} else if (!(0, _fs.existsSync)(distPackageJson) && (0, _fs.existsSync)(libraryPackageJson) && rootPackageJson !== libraryPackageJson) {
|
|
63
84
|
await (0, _js.copyAssets)({
|
|
64
|
-
outputPath:
|
|
85
|
+
outputPath: outDirRelativeToWorkspaceRoot,
|
|
65
86
|
assets: [
|
|
66
87
|
{
|
|
67
88
|
input: projectRoot,
|
|
@@ -96,22 +117,63 @@ async function* viteBuildExecutor(options, context) {
|
|
|
96
117
|
var _watcherOrOutput_, _output_;
|
|
97
118
|
const output = (watcherOrOutput == null ? void 0 : watcherOrOutput['output']) || (watcherOrOutput == null ? void 0 : (_watcherOrOutput_ = watcherOrOutput[0]) == null ? void 0 : _watcherOrOutput_.output);
|
|
98
119
|
const fileName = (output == null ? void 0 : (_output_ = output[0]) == null ? void 0 : _output_.fileName) || 'main.cjs';
|
|
99
|
-
const outfile = (0, _path.resolve)(
|
|
120
|
+
const outfile = (0, _path.resolve)(outDirRelativeToWorkspaceRoot, fileName);
|
|
100
121
|
yield {
|
|
101
122
|
success: true,
|
|
102
123
|
outfile
|
|
103
124
|
};
|
|
104
125
|
}
|
|
105
126
|
}
|
|
106
|
-
function
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
127
|
+
async function getExtraArgs(options) {
|
|
128
|
+
// support passing extra args to vite cli
|
|
129
|
+
const schema = await Promise.resolve().then(()=>require("./schema.json"));
|
|
130
|
+
const extraArgs = {};
|
|
131
|
+
for (const key of Object.keys(options)){
|
|
132
|
+
if (!schema.properties[key]) {
|
|
133
|
+
extraArgs[key] = options[key];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const buildOptions = {};
|
|
137
|
+
const buildSchemaKeys = [
|
|
138
|
+
'target',
|
|
139
|
+
'polyfillModulePreload',
|
|
140
|
+
'modulePreload',
|
|
141
|
+
'outDir',
|
|
142
|
+
'assetsDir',
|
|
143
|
+
'assetsInlineLimit',
|
|
144
|
+
'cssCodeSplit',
|
|
145
|
+
'cssTarget',
|
|
146
|
+
'cssMinify',
|
|
147
|
+
'sourcemap',
|
|
148
|
+
'minify',
|
|
149
|
+
'terserOptions',
|
|
150
|
+
'rollupOptions',
|
|
151
|
+
'commonjsOptions',
|
|
152
|
+
'dynamicImportVarsOptions',
|
|
153
|
+
'write',
|
|
154
|
+
'emptyOutDir',
|
|
155
|
+
'copyPublicDir',
|
|
156
|
+
'manifest',
|
|
157
|
+
'lib',
|
|
158
|
+
'ssr',
|
|
159
|
+
'ssrManifest',
|
|
160
|
+
'ssrEmitAssets',
|
|
161
|
+
'reportCompressedSize',
|
|
162
|
+
'chunkSizeWarningLimit',
|
|
163
|
+
'watch'
|
|
164
|
+
];
|
|
165
|
+
const otherOptions = {};
|
|
166
|
+
for (const key of Object.keys(extraArgs)){
|
|
167
|
+
if (buildSchemaKeys.includes(key)) {
|
|
168
|
+
buildOptions[key] = extraArgs[key];
|
|
169
|
+
} else {
|
|
170
|
+
otherOptions[key] = extraArgs[key];
|
|
171
|
+
}
|
|
113
172
|
}
|
|
114
|
-
return
|
|
173
|
+
return {
|
|
174
|
+
buildOptions,
|
|
175
|
+
otherOptions
|
|
176
|
+
};
|
|
115
177
|
}
|
|
116
178
|
const _default = viteBuildExecutor;
|
|
117
179
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/vite/src/executors/build/build.impl.ts"],"sourcesContent":["import {\n detectPackageManager,\n ExecutorContext,\n logger,\n stripIndents,\n writeJsonFile,\n} from '@nx/devkit';\nimport {\n getProjectTsConfigPath,\n getViteBuildOptions,\n getViteSharedConfig,\n} from '../../utils/options-utils';\nimport { ViteBuildExecutorOptions } from './schema';\nimport {\n copyAssets,\n createLockFile,\n createPackageJson,\n getLockFileName,\n} from '@nx/js';\nimport { existsSync, writeFileSync } from 'fs';\nimport { resolve } from 'path';\nimport { createAsyncIterable } from '@nx/devkit/src/utils/async-iterable';\nimport {\n createBuildableTsConfig,\n validateTypes,\n} from '../../utils/executor-utils';\n\nexport async function* viteBuildExecutor(\n options: ViteBuildExecutorOptions,\n context: ExecutorContext\n) {\n // Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.\n const { mergeConfig, build } = await (Function(\n 'return import(\"vite\")'\n )() as Promise<typeof import('vite')>);\n\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n\n createBuildableTsConfig(projectRoot, options, context);\n\n const normalizedOptions = normalizeOptions(options);\n\n const buildConfig = mergeConfig(\n getViteSharedConfig(normalizedOptions, false, context),\n {\n build: getViteBuildOptions(normalizedOptions, context),\n }\n );\n\n if (!options.skipTypeCheck) {\n await validateTypes({\n workspaceRoot: context.root,\n projectRoot: projectRoot,\n tsconfig: getProjectTsConfigPath(projectRoot),\n });\n }\n\n const watcherOrOutput = await build(buildConfig);\n\n const libraryPackageJson = resolve(projectRoot, 'package.json');\n const rootPackageJson = resolve(context.root, 'package.json');\n const distPackageJson = resolve(normalizedOptions.outputPath, 'package.json');\n\n // Generate a package.json if option has been set.\n if (options.generatePackageJson) {\n if (context.projectGraph.nodes[context.projectName].type !== 'app') {\n logger.warn(\n stripIndents`The project ${context.projectName} is using the 'generatePackageJson' option which is deprecated for library projects. It should only be used for applications.\n For libraries, configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks).`\n );\n }\n\n const builtPackageJson = createPackageJson(\n context.projectName,\n context.projectGraph,\n {\n target: context.targetName,\n root: context.root,\n isProduction: !options.includeDevDependenciesInPackageJson, // By default we remove devDependencies since this is a production build.\n }\n );\n\n builtPackageJson.type = 'module';\n\n writeJsonFile(`${options.outputPath}/package.json`, builtPackageJson);\n const packageManager = detectPackageManager(context.root);\n\n const lockFile = createLockFile(\n builtPackageJson,\n context.projectGraph,\n packageManager\n );\n writeFileSync(\n `${options.outputPath}/${getLockFileName(packageManager)}`,\n lockFile,\n {\n encoding: 'utf-8',\n }\n );\n }\n // For buildable libs, copy package.json if it exists.\n else if (\n !existsSync(distPackageJson) &&\n existsSync(libraryPackageJson) &&\n rootPackageJson !== libraryPackageJson\n ) {\n await copyAssets(\n {\n outputPath: normalizedOptions.outputPath,\n assets: [\n {\n input: projectRoot,\n output: '.',\n glob: 'package.json',\n },\n ],\n },\n context\n );\n }\n\n if ('on' in watcherOrOutput) {\n const iterable = createAsyncIterable<{ success: boolean }>(({ next }) => {\n let success = true;\n watcherOrOutput.on('event', (event) => {\n if (event.code === 'START') {\n success = true;\n } else if (event.code === 'ERROR') {\n success = false;\n } else if (event.code === 'END') {\n next({ success });\n }\n // result must be closed when present.\n // see https://rollupjs.org/guide/en/#rollupwatch\n if ('result' in event) {\n event.result.close();\n }\n });\n });\n yield* iterable;\n } else {\n const output = watcherOrOutput?.['output'] || watcherOrOutput?.[0]?.output;\n const fileName = output?.[0]?.fileName || 'main.cjs';\n const outfile = resolve(normalizedOptions.outputPath, fileName);\n yield { success: true, outfile };\n }\n}\n\nfunction normalizeOptions(options: ViteBuildExecutorOptions) {\n const normalizedOptions = { ...options };\n\n // coerce watch to null or {} to match with Vite's watch config\n if (options.watch === false) {\n normalizedOptions.watch = null;\n } else if (options.watch === true) {\n normalizedOptions.watch = {};\n }\n\n return normalizedOptions;\n}\n\nexport default viteBuildExecutor;\n"],"names":["viteBuildExecutor","options","context","mergeConfig","build","Function","projectRoot","projectsConfigurations","projects","projectName","root","createBuildableTsConfig","normalizedOptions","normalizeOptions","buildConfig","getViteSharedConfig","getViteBuildOptions","skipTypeCheck","validateTypes","workspaceRoot","tsconfig","getProjectTsConfigPath","watcherOrOutput","libraryPackageJson","resolve","rootPackageJson","distPackageJson","outputPath","generatePackageJson","projectGraph","nodes","type","logger","warn","stripIndents","builtPackageJson","createPackageJson","target","targetName","isProduction","includeDevDependenciesInPackageJson","writeJsonFile","packageManager","detectPackageManager","lockFile","createLockFile","writeFileSync","getLockFileName","encoding","existsSync","copyAssets","assets","input","output","glob","iterable","createAsyncIterable","next","success","on","event","code","result","close","fileName","outfile","watch"],"mappings":";;;;;;;;IA2BuBA,iBAAiB;eAAjBA;;IAuIvB,OAAiC;eAAjC;;;;wBA5JO;8BAKA;oBAOA;oBACmC;sBAClB;+BACY;+BAI7B;AAEA,gBAAgBA,kBACrBC,OAAiC,EACjCC,OAAwB;IAExB,yFAAyF;IACzF,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAE,GAAG,MAAOC,SACpC;IAGF,MAAMC,cACJJ,QAAQK,sBAAsB,CAACC,QAAQ,CAACN,QAAQO,WAAW,CAAC,CAACC,IAAI;IAEnEC,IAAAA,sCAAuB,EAACL,aAAaL,SAASC;IAE9C,MAAMU,oBAAoBC,iBAAiBZ;IAE3C,MAAMa,cAAcX,YAClBY,IAAAA,iCAAmB,EAACH,mBAAmB,OAAOV,UAC9C;QACEE,OAAOY,IAAAA,iCAAmB,EAACJ,mBAAmBV;IAChD;IAGF,IAAI,CAACD,QAAQgB,aAAa,EAAE;QAC1B,MAAMC,IAAAA,4BAAa,EAAC;YAClBC,eAAejB,QAAQQ,IAAI;YAC3BJ,aAAaA;YACbc,UAAUC,IAAAA,oCAAsB,EAACf;QACnC;IACF;IAEA,MAAMgB,kBAAkB,MAAMlB,MAAMU;IAEpC,MAAMS,qBAAqBC,IAAAA,aAAO,EAAClB,aAAa;IAChD,MAAMmB,kBAAkBD,IAAAA,aAAO,EAACtB,QAAQQ,IAAI,EAAE;IAC9C,MAAMgB,kBAAkBF,IAAAA,aAAO,EAACZ,kBAAkBe,UAAU,EAAE;IAE9D,kDAAkD;IAClD,IAAI1B,QAAQ2B,mBAAmB,EAAE;QAC/B,IA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AAK,SAAS;oBAC1BH,UAAU;gBACZ,OAAO,IAAIE,MAAMC,IAAI,KAAK,SAAS;oBACjCH,UAAU;gBACZ,OAAO,IAAIE,MAAMC,IAAI,KAAK,OAAO;oBAC/BJ,KAAK;wBAAEC;oBAAQ;gBACjB;gBACA,sCAAsC;gBACtC,iDAAiD;gBACjD,IAAI,YAAYE,OAAO;oBACrBA,MAAME,MAAM,CAACC,KAAK;gBACpB;YACF;QACF;QACA,OAAOR;IACT,OAAO;YACyCjC,mBAC7B+B;QADjB,MAAMA,SAAS/B,CAAAA,mCAAAA,eAAiB,CAAC,SAAS,MAAIA,oCAAAA,oBAAAA,eAAiB,CAAC,EAAE,qBAApBA,kBAAsB+B,MAAM;QAC1E,MAAMW,WAAWX,CAAAA,2BAAAA,WAAAA,MAAQ,CAAC,EAAE,qBAAXA,SAAaW,QAAQ,KAAI;QAC1C,MAAMC,UAAUzC,IAAAA,aAAO,EAACZ,kBAAkBe,UAAU,EAAEqC;QACtD,MAAM;YAAEN,SAAS;YAAMO;QAAQ;IACjC;AACF;AAEA,SAASpD,iBAAiBZ,OAAiC;IACzD,MAAMW,oBAAoB,eAAKX;IAE/B,+DAA+D;IAC/D,IAAIA,QAAQiE,KAAK,KAAK,OAAO;QAC3BtD,kBAAkBsD,KAAK,GAAG;IAC5B,OAAO,IAAIjE,QAAQiE,KAAK,KAAK,MAAM;QACjCtD,kBAAkBsD,KAAK,GAAG,CAAC;IAC7B;IAEA,OAAOtD;AACT;MAEA,WAAeZ"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/vite/src/executors/build/build.impl.ts"],"sourcesContent":["import {\n detectPackageManager,\n ExecutorContext,\n joinPathFragments,\n logger,\n offsetFromRoot,\n stripIndents,\n writeJsonFile,\n} from '@nx/devkit';\nimport {\n getProjectTsConfigPath,\n normalizeViteConfigFilePath,\n} from '../../utils/options-utils';\nimport { ViteBuildExecutorOptions } from './schema';\nimport {\n copyAssets,\n createLockFile,\n createPackageJson,\n getLockFileName,\n} from '@nx/js';\nimport { existsSync, writeFileSync } from 'fs';\nimport { relative, resolve } from 'path';\nimport { createAsyncIterable } from '@nx/devkit/src/utils/async-iterable';\nimport {\n createBuildableTsConfig,\n validateTypes,\n} from '../../utils/executor-utils';\nimport { BuildOptions } from 'vite';\n\nexport async function* viteBuildExecutor(\n options: Record<string, any> & ViteBuildExecutorOptions,\n context: ExecutorContext\n) {\n // Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.\n const { mergeConfig, build, loadConfigFromFile } = await (Function(\n 'return import(\"vite\")'\n )() as Promise<typeof import('vite')>);\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n createBuildableTsConfig(projectRoot, options, context);\n\n const viteConfigPath = normalizeViteConfigFilePath(\n context.root,\n projectRoot,\n options.configFile\n );\n const root =\n projectRoot === '.'\n ? process.cwd()\n : relative(context.cwd, joinPathFragments(context.root, projectRoot));\n\n const { buildOptions, otherOptions } = await getExtraArgs(options);\n\n const resolved = await loadConfigFromFile(\n {\n mode: otherOptions?.mode ?? 'production',\n command: 'build',\n },\n viteConfigPath\n );\n\n const outDir =\n joinPathFragments(offsetFromRoot(projectRoot), options.outputPath) ??\n resolved?.config?.build?.outDir;\n\n const buildConfig = mergeConfig(\n {\n // This should not be needed as it's going to be set in vite.config.ts\n // but leaving it here in case someone did not migrate correctly\n root: resolved.config.root ?? root,\n configFile: viteConfigPath,\n },\n {\n build: {\n outDir,\n ...buildOptions,\n },\n ...otherOptions,\n }\n );\n\n if (!options.skipTypeCheck) {\n await validateTypes({\n workspaceRoot: context.root,\n projectRoot: projectRoot,\n tsconfig: getProjectTsConfigPath(projectRoot),\n });\n }\n\n const watcherOrOutput = await build(buildConfig);\n\n const libraryPackageJson = resolve(projectRoot, 'package.json');\n const rootPackageJson = resolve(context.root, 'package.json');\n\n // Here, we want the outdir relative to the workspace root.\n // So, we calculate the relative path from the workspace root to the outdir.\n const outDirRelativeToWorkspaceRoot = outDir.replaceAll('../', '');\n const distPackageJson = resolve(\n outDirRelativeToWorkspaceRoot,\n 'package.json'\n );\n\n // Generate a package.json if option has been set.\n if (options.generatePackageJson) {\n if (context.projectGraph.nodes[context.projectName].type !== 'app') {\n logger.warn(\n stripIndents`The project ${context.projectName} is using the 'generatePackageJson' option which is deprecated for library projects. It should only be used for applications.\n For libraries, configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks).`\n );\n }\n\n const builtPackageJson = createPackageJson(\n context.projectName,\n context.projectGraph,\n {\n target: context.targetName,\n root: context.root,\n isProduction: !options.includeDevDependenciesInPackageJson, // By default we remove devDependencies since this is a production build.\n }\n );\n\n builtPackageJson.type = 'module';\n\n writeJsonFile(\n `${outDirRelativeToWorkspaceRoot}/package.json`,\n builtPackageJson\n );\n const packageManager = detectPackageManager(context.root);\n\n const lockFile = createLockFile(\n builtPackageJson,\n context.projectGraph,\n packageManager\n );\n writeFileSync(\n `${outDirRelativeToWorkspaceRoot}/${getLockFileName(packageManager)}`,\n lockFile,\n {\n encoding: 'utf-8',\n }\n );\n }\n // For buildable libs, copy package.json if it exists.\n else if (\n !existsSync(distPackageJson) &&\n existsSync(libraryPackageJson) &&\n rootPackageJson !== libraryPackageJson\n ) {\n await copyAssets(\n {\n outputPath: outDirRelativeToWorkspaceRoot,\n assets: [\n {\n input: projectRoot,\n output: '.',\n glob: 'package.json',\n },\n ],\n },\n context\n );\n }\n\n if ('on' in watcherOrOutput) {\n const iterable = createAsyncIterable<{ success: boolean }>(({ next }) => {\n let success = true;\n watcherOrOutput.on('event', (event) => {\n if (event.code === 'START') {\n success = true;\n } else if (event.code === 'ERROR') {\n success = false;\n } else if (event.code === 'END') {\n next({ success });\n }\n // result must be closed when present.\n // see https://rollupjs.org/guide/en/#rollupwatch\n if ('result' in event) {\n event.result.close();\n }\n });\n });\n yield* iterable;\n } else {\n const output = watcherOrOutput?.['output'] || watcherOrOutput?.[0]?.output;\n const fileName = output?.[0]?.fileName || 'main.cjs';\n const outfile = resolve(outDirRelativeToWorkspaceRoot, fileName);\n yield { success: true, outfile };\n }\n}\n\nasync function getExtraArgs(options: ViteBuildExecutorOptions): Promise<{\n buildOptions: BuildOptions;\n otherOptions: Record<string, any>;\n}> {\n // support passing extra args to vite cli\n const schema = await import('./schema.json');\n const extraArgs = {};\n for (const key of Object.keys(options)) {\n if (!schema.properties[key]) {\n extraArgs[key] = options[key];\n }\n }\n\n const buildOptions = {} as BuildOptions;\n const buildSchemaKeys = [\n 'target',\n 'polyfillModulePreload',\n 'modulePreload',\n 'outDir',\n 'assetsDir',\n 'assetsInlineLimit',\n 'cssCodeSplit',\n 'cssTarget',\n 'cssMinify',\n 'sourcemap',\n 'minify',\n 'terserOptions',\n 'rollupOptions',\n 'commonjsOptions',\n 'dynamicImportVarsOptions',\n 'write',\n 'emptyOutDir',\n 'copyPublicDir',\n 'manifest',\n 'lib',\n 'ssr',\n 'ssrManifest',\n 'ssrEmitAssets',\n 'reportCompressedSize',\n 'chunkSizeWarningLimit',\n 'watch',\n ];\n const otherOptions = {};\n for (const key of Object.keys(extraArgs)) {\n if (buildSchemaKeys.includes(key)) {\n buildOptions[key] = extraArgs[key];\n } else {\n otherOptions[key] = extraArgs[key];\n }\n }\n\n return {\n buildOptions,\n otherOptions,\n };\n}\n\nexport default viteBuildExecutor;\n"],"names":["viteBuildExecutor","options","context","resolved","mergeConfig","build","loadConfigFromFile","Function","projectRoot","projectsConfigurations","projects","projectName","root","createBuildableTsConfig","viteConfigPath","normalizeViteConfigFilePath","configFile","process","cwd","relative","joinPathFragments","buildOptions","otherOptions","getExtraArgs","mode","command","outDir","offsetFromRoot","outputPath","config","buildConfig","skipTypeCheck","validateTypes","workspaceRoot","tsconfig","getProjectTsConfigPath","watcherOrOutput","libraryPackageJson","resolve","rootPackageJson","outDirRelativeToWorkspaceRoot","replaceAll","distPackageJson","generatePackageJson","projectGraph","nodes","type","logger","warn","stripIndents","builtPackageJson","createPackageJson","target","targetName","isProduction","includeDevDependenciesInPackageJson","writeJsonFile","packageManager","detectPackageManager","lockFile","createLockFile","writeFileSync","getLockFileName","encoding","existsSync","copyAssets","assets","input","output","glob","iterable","createAsyncIterable","next","success","on","event","code","result","close","fileName","outfile","schema","extraArgs","key","Object","keys","properties","buildSchemaKeys","includes"],"mappings":";;;;;;;;IA6BuBA,iBAAiB;eAAjBA;;IA0NvB,OAAiC;eAAjC;;;;wBA/OO;8BAIA;oBAOA;oBACmC;sBACR;+BACE;+BAI7B;AAGA,gBAAgBA,kBACrBC,OAAuD,EACvDC,OAAwB;QAgCtBC,wBAAAA;IA9BF,yFAAyF;IACzF,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAEC,kBAAkB,EAAE,GAAG,MAAOC,SACxD;IAEF,MAAMC,cACJN,QAAQO,sBAAsB,CAACC,QAAQ,CAACR,QAAQS,WAAW,CAAC,CAACC,IAAI;IACnEC,IAAAA,sCAAuB,EAACL,aAAaP,SAASC;IAE9C,MAAMY,iBAAiBC,IAAAA,yCAA2B,EAChDb,QAAQU,IAAI,EACZJ,aACAP,QAAQe,UAAU;IAEpB,MAAMJ,OACJJ,gBAAgB,MACZS,QAAQC,GAAG,KACXC,IAAAA,cAAQ,EAACjB,QAAQgB,GAAG,EAAEE,IAAAA,yBAAiB,EAAClB,QAAQU,IAAI,EAAEJ;IAE5D,MAAM,EAAEa,YAAY,EAAEC,YAAY,EAAE,GAAG,MAAMC,aAAatB;QAIhDqB;IAFV,MAAMnB,WAAW,MAAMG,mBACrB;QACEkB,MAAMF,CAAAA,qBAAAA,gCAAAA,aAAcE,IAAI,YAAlBF,qBAAsB;QAC5BG,SAAS;IACX,GACAX;QAIAM;IADF,MAAMM,SACJN,CAAAA,qBAAAA,IAAAA,yBAAiB,EAACO,IAAAA,sBAAc,EAACnB,cAAcP,QAAQ2B,UAAU,aAAjER,qBACAjB,6BAAAA,mBAAAA,SAAU0B,MAAM,sBAAhB1B,yBAAAA,iBAAkBE,KAAK,qBAAvBF,uBAAyBuB,MAA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AU1C,IAAAA,aAAO,EAACE,+BAA+BuC;QACvD,MAAM;YAAEN,SAAS;YAAMO;QAAQ;IACjC;AACF;AAEA,eAAezD,aAAatB,OAAiC;IAI3D,yCAAyC;IACzC,MAAMgF,SAAS,MAAM,2BAAA,QAAO;IAC5B,MAAMC,YAAY,CAAC;IACnB,KAAK,MAAMC,OAAOC,OAAOC,IAAI,CAACpF,SAAU;QACtC,IAAI,CAACgF,OAAOK,UAAU,CAACH,IAAI,EAAE;YAC3BD,SAAS,CAACC,IAAI,GAAGlF,OAAO,CAACkF,IAAI;QAC/B;IACF;IAEA,MAAM9D,eAAe,CAAC;IACtB,MAAMkE,kBAAkB;QACtB;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD;IACD,MAAMjE,eAAe,CAAC;IACtB,KAAK,MAAM6D,OAAOC,OAAOC,IAAI,CAACH,WAAY;QACxC,IAAIK,gBAAgBC,QAAQ,CAACL,MAAM;YACjC9D,YAAY,CAAC8D,IAAI,GAAGD,SAAS,CAACC,IAAI;QACpC,OAAO;YACL7D,YAAY,CAAC6D,IAAI,GAAGD,SAAS,CAACC,IAAI;QACpC;IACF;IAEA,OAAO;QACL9D;QACAC;IACF;AACF;MAEA,WAAetB"}
|
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
import type { FileReplacement } from '../../plugins/rollup-replace-files.plugin';
|
|
2
2
|
export interface ViteBuildExecutorOptions {
|
|
3
|
-
outputPath
|
|
4
|
-
|
|
5
|
-
base?: string;
|
|
3
|
+
outputPath?: string;
|
|
4
|
+
skipTypeCheck?: boolean;
|
|
6
5
|
configFile?: string;
|
|
7
6
|
fileReplacements?: FileReplacement[];
|
|
8
|
-
|
|
9
|
-
sourcemap?: boolean | 'inline' | 'hidden';
|
|
10
|
-
minify?: boolean | 'esbuild' | 'terser';
|
|
11
|
-
manifest?: boolean | string;
|
|
12
|
-
ssrManifest?: boolean | string;
|
|
13
|
-
logLevel?: 'info' | 'warn' | 'error' | 'silent';
|
|
14
|
-
mode?: string;
|
|
15
|
-
ssr?: boolean | string;
|
|
16
|
-
watch?: object | boolean;
|
|
17
|
-
target?: string | string[];
|
|
7
|
+
watch?: boolean;
|
|
18
8
|
generatePackageJson?: boolean;
|
|
19
9
|
includeDevDependenciesInPackageJson?: boolean;
|
|
20
|
-
cssCodeSplit?: boolean;
|
|
21
10
|
buildLibsFromSource?: boolean;
|
|
22
|
-
skipTypeCheck?: boolean;
|
|
23
11
|
}
|
|
@@ -28,11 +28,6 @@
|
|
|
28
28
|
"description": "Skip type-checking via TypeScript. Skipping type-checking speeds up the build but type errors are not caught.",
|
|
29
29
|
"default": false
|
|
30
30
|
},
|
|
31
|
-
"base": {
|
|
32
|
-
"type": "string",
|
|
33
|
-
"description": "Base public path when served in development or production.",
|
|
34
|
-
"alias": "baseHref"
|
|
35
|
-
},
|
|
36
31
|
"configFile": {
|
|
37
32
|
"type": "string",
|
|
38
33
|
"description": "The name of the Vite.js configuration file.",
|
|
@@ -61,87 +56,6 @@
|
|
|
61
56
|
},
|
|
62
57
|
"default": []
|
|
63
58
|
},
|
|
64
|
-
"emptyOutDir": {
|
|
65
|
-
"description": "When set to false, outputPath will not be emptied during the build process.",
|
|
66
|
-
"type": "boolean",
|
|
67
|
-
"default": true
|
|
68
|
-
},
|
|
69
|
-
"sourcemap": {
|
|
70
|
-
"description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.",
|
|
71
|
-
"oneOf": [
|
|
72
|
-
{
|
|
73
|
-
"type": "boolean"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"type": "string"
|
|
77
|
-
}
|
|
78
|
-
]
|
|
79
|
-
},
|
|
80
|
-
"target": {
|
|
81
|
-
"description": "Browser compatibility target for the final bundle. For more info: https://vitejs.dev/config/build-options.html#build-target",
|
|
82
|
-
"type": "string"
|
|
83
|
-
},
|
|
84
|
-
"minify": {
|
|
85
|
-
"description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.",
|
|
86
|
-
"oneOf": [
|
|
87
|
-
{
|
|
88
|
-
"type": "boolean"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"type": "string"
|
|
92
|
-
}
|
|
93
|
-
]
|
|
94
|
-
},
|
|
95
|
-
"manifest": {
|
|
96
|
-
"description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.",
|
|
97
|
-
"oneOf": [
|
|
98
|
-
{
|
|
99
|
-
"type": "boolean"
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
"type": "string"
|
|
103
|
-
}
|
|
104
|
-
]
|
|
105
|
-
},
|
|
106
|
-
"ssrManifest": {
|
|
107
|
-
"description": "When set to true, the build will also generate an SSR manifest for determining style links and asset preload directives in production. When the value is a string, it will be used as the manifest file name.",
|
|
108
|
-
"oneOf": [
|
|
109
|
-
{
|
|
110
|
-
"type": "boolean"
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"type": "string"
|
|
114
|
-
}
|
|
115
|
-
]
|
|
116
|
-
},
|
|
117
|
-
"ssr": {
|
|
118
|
-
"description": "Produce SSR-oriented build. The value can be a string to directly specify the SSR entry, or true, which requires specifying the SSR entry via rollupOptions.input.",
|
|
119
|
-
"oneOf": [
|
|
120
|
-
{
|
|
121
|
-
"type": "boolean"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"type": "string"
|
|
125
|
-
}
|
|
126
|
-
]
|
|
127
|
-
},
|
|
128
|
-
"logLevel": {
|
|
129
|
-
"type": "string",
|
|
130
|
-
"description": "Adjust console output verbosity.",
|
|
131
|
-
"enum": ["info", "warn", "error", "silent"]
|
|
132
|
-
},
|
|
133
|
-
"mode": {
|
|
134
|
-
"type": "string",
|
|
135
|
-
"description": "Mode to run the build in."
|
|
136
|
-
},
|
|
137
|
-
"force": {
|
|
138
|
-
"description": "Force the optimizer to ignore the cache and re-bundle",
|
|
139
|
-
"type": "boolean"
|
|
140
|
-
},
|
|
141
|
-
"cssCodeSplit": {
|
|
142
|
-
"description": "Enable/disable CSS code splitting. When enabled, CSS imported in async chunks will be inlined into the async chunk itself and inserted when the chunk is loaded.",
|
|
143
|
-
"type": "boolean"
|
|
144
|
-
},
|
|
145
59
|
"watch": {
|
|
146
60
|
"description": "Enable re-building when files change.",
|
|
147
61
|
"oneOf": [
|
|
@@ -14,23 +14,35 @@ _export(exports, {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
const _extends = require("@swc/helpers/_/_extends");
|
|
17
|
+
const _devkit = require("@nx/devkit");
|
|
18
|
+
const _vite = require("vite");
|
|
17
19
|
const _optionsutils = require("../../utils/options-utils");
|
|
18
20
|
const _executorutils = require("../../utils/executor-utils");
|
|
21
|
+
const _path = require("path");
|
|
19
22
|
async function* viteDevServerExecutor(options, context) {
|
|
20
23
|
// Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.
|
|
21
24
|
const { mergeConfig, createServer } = await Function('return import("vite")')();
|
|
22
25
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
26
|
+
const root = projectRoot === '.' ? process.cwd() : (0, _path.relative)(context.cwd, (0, _devkit.joinPathFragments)(context.root, projectRoot));
|
|
23
27
|
(0, _executorutils.createBuildableTsConfig)(projectRoot, options, context);
|
|
24
28
|
// Retrieve the option for the configured buildTarget.
|
|
25
29
|
const buildTargetOptions = (0, _optionsutils.getNxTargetOptions)(options.buildTarget, context);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
const viteConfigPath = (0, _optionsutils.normalizeViteConfigFilePath)(context.root, projectRoot, buildTargetOptions.configFile);
|
|
31
|
+
const extraArgs = await getExtraArgs(options);
|
|
32
|
+
var _extraArgs_mode;
|
|
33
|
+
const resolved = await (0, _vite.loadConfigFromFile)({
|
|
34
|
+
mode: (_extraArgs_mode = extraArgs == null ? void 0 : extraArgs.mode) != null ? _extraArgs_mode : 'production',
|
|
35
|
+
command: 'build'
|
|
36
|
+
}, viteConfigPath);
|
|
37
|
+
var _resolved_config_root;
|
|
38
|
+
const serverConfig = mergeConfig({
|
|
39
|
+
// This should not be needed as it's going to be set in vite.config.ts
|
|
40
|
+
// but leaving it here in case someone did not migrate correctly
|
|
41
|
+
root: (_resolved_config_root = resolved.config.root) != null ? _resolved_config_root : root,
|
|
42
|
+
configFile: viteConfigPath
|
|
43
|
+
}, _extends._({
|
|
44
|
+
server: _extends._({}, await (0, _optionsutils.getViteServerOptions)(options, context), extraArgs)
|
|
45
|
+
}, extraArgs));
|
|
34
46
|
try {
|
|
35
47
|
const server = await createServer(serverConfig);
|
|
36
48
|
await runViteDevServer(server);
|
|
@@ -67,5 +79,16 @@ async function runViteDevServer(server) {
|
|
|
67
79
|
process.once('exit', processOnExit);
|
|
68
80
|
}
|
|
69
81
|
const _default = viteDevServerExecutor;
|
|
82
|
+
async function getExtraArgs(options) {
|
|
83
|
+
// support passing extra args to vite cli
|
|
84
|
+
const schema = await Promise.resolve().then(()=>require("./schema.json"));
|
|
85
|
+
const extraArgs = {};
|
|
86
|
+
for (const key of Object.keys(options)){
|
|
87
|
+
if (!schema.properties[key]) {
|
|
88
|
+
extraArgs[key] = options[key];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return extraArgs;
|
|
92
|
+
}
|
|
70
93
|
|
|
71
94
|
//# sourceMappingURL=dev-server.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/vite/src/executors/dev-server/dev-server.impl.ts"],"sourcesContent":["import { ExecutorContext } from '@nx/devkit';\nimport type
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/vite/src/executors/dev-server/dev-server.impl.ts"],"sourcesContent":["import { ExecutorContext, joinPathFragments } from '@nx/devkit';\nimport {\n loadConfigFromFile,\n type InlineConfig,\n type ViteDevServer,\n} from 'vite';\n\nimport {\n getNxTargetOptions,\n getViteServerOptions,\n normalizeViteConfigFilePath,\n} from '../../utils/options-utils';\n\nimport { ViteDevServerExecutorOptions } from './schema';\nimport { ViteBuildExecutorOptions } from '../build/schema';\nimport { createBuildableTsConfig } from '../../utils/executor-utils';\nimport { relative } from 'path';\n\nexport async function* viteDevServerExecutor(\n options: ViteDevServerExecutorOptions,\n context: ExecutorContext\n): AsyncGenerator<{ success: boolean; baseUrl: string }> {\n // Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.\n const { mergeConfig, createServer } = await (Function(\n 'return import(\"vite\")'\n )() as Promise<typeof import('vite')>);\n\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n const root =\n projectRoot === '.'\n ? process.cwd()\n : relative(context.cwd, joinPathFragments(context.root, projectRoot));\n createBuildableTsConfig(projectRoot, options, context);\n\n // Retrieve the option for the configured buildTarget.\n const buildTargetOptions: ViteBuildExecutorOptions = getNxTargetOptions(\n options.buildTarget,\n context\n );\n const viteConfigPath = normalizeViteConfigFilePath(\n context.root,\n projectRoot,\n buildTargetOptions.configFile\n );\n const extraArgs = await getExtraArgs(options);\n const resolved = await loadConfigFromFile(\n {\n mode: extraArgs?.mode ?? 'production',\n command: 'build',\n },\n viteConfigPath\n );\n\n const serverConfig: InlineConfig = mergeConfig(\n {\n // This should not be needed as it's going to be set in vite.config.ts\n // but leaving it here in case someone did not migrate correctly\n root: resolved.config.root ?? root,\n configFile: viteConfigPath,\n },\n {\n server: {\n ...(await getViteServerOptions(options, context)),\n ...extraArgs,\n },\n ...extraArgs,\n }\n );\n\n try {\n const server = await createServer(serverConfig);\n await runViteDevServer(server);\n const resolvedUrls = [\n ...server.resolvedUrls.local,\n ...server.resolvedUrls.network,\n ];\n\n yield {\n success: true,\n baseUrl: resolvedUrls[0] ?? '',\n };\n } catch (e) {\n console.error(e);\n yield {\n success: false,\n baseUrl: '',\n };\n }\n\n await new Promise<void>((resolve) => {\n process.once('SIGINT', () => resolve());\n process.once('SIGTERM', () => resolve());\n process.once('exit', () => resolve());\n });\n}\n\nasync function runViteDevServer(server: ViteDevServer): Promise<void> {\n await server.listen();\n\n server.printUrls();\n\n const processOnExit = async () => {\n await server.close();\n };\n\n process.once('SIGINT', processOnExit);\n process.once('SIGTERM', processOnExit);\n process.once('exit', processOnExit);\n}\n\nexport default viteDevServerExecutor;\n\nasync function getExtraArgs(\n options: ViteDevServerExecutorOptions\n): Promise<InlineConfig> {\n // support passing extra args to vite cli\n const schema = await import('./schema.json');\n const extraArgs = {};\n for (const key of Object.keys(options)) {\n if (!schema.properties[key]) {\n extraArgs[key] = options[key];\n }\n }\n\n return extraArgs as InlineConfig;\n}\n"],"names":["viteDevServerExecutor","options","context","mergeConfig","createServer","Function","projectRoot","projectsConfigurations","projects","projectName","root","process","cwd","relative","joinPathFragments","createBuildableTsConfig","buildTargetOptions","getNxTargetOptions","buildTarget","viteConfigPath","normalizeViteConfigFilePath","configFile","extraArgs","getExtraArgs","resolved","loadConfigFromFile","mode","command","serverConfig","config","server","getViteServerOptions","runViteDevServer","resolvedUrls","local","network","success","baseUrl","e","console","error","Promise","resolve","once","listen","printUrls","processOnExit","close","schema","key","Object","keys","properties"],"mappings":";;;;;;;;IAkBuBA,qBAAqB;eAArBA;;IA6FvB,OAAqC;eAArC;;;;wBA/GmD;sBAK5C;8BAMA;+BAIiC;sBACf;AAElB,gBAAgBA,sBACrBC,OAAqC,EACrCC,OAAwB;IAExB,yFAAyF;IACzF,MAAM,EAAEC,WAAW,EAAEC,YAAY,EAAE,GAAG,MAAOC,SAC3C;IAGF,MAAMC,cACJJ,QAAQK,sBAAsB,CAACC,QAAQ,CAACN,QAAQO,WAAW,CAAC,CAACC,IAAI;IACnE,MAAMA,OACJJ,gBAAgB,MACZK,QAAQC,GAAG,KACXC,IAAAA,cAAQ,EAACX,QAAQU,GAAG,EAAEE,IAAAA,yBAAiB,EAACZ,QAAQQ,IAAI,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AEnBd,OAAOe,SAAS;IAEhB,MAAMC,gBAAgB;QACpB,MAAMhB,OAAOiB,KAAK;IACpB;IAEApC,QAAQgC,IAAI,CAAC,UAAUG;IACvBnC,QAAQgC,IAAI,CAAC,WAAWG;IACxBnC,QAAQgC,IAAI,CAAC,QAAQG;AACvB;MAEA,WAAe9C;AAEf,eAAeuB,aACbtB,OAAqC;IAErC,yCAAyC;IACzC,MAAM+C,SAAS,MAAM,2BAAA,QAAO;IAC5B,MAAM1B,YAAY,CAAC;IACnB,KAAK,MAAM2B,OAAOC,OAAOC,IAAI,CAAClD,SAAU;QACtC,IAAI,CAAC+C,OAAOI,UAAU,CAACH,IAAI,EAAE;YAC3B3B,SAAS,CAAC2B,IAAI,GAAGhD,OAAO,CAACgD,IAAI;QAC/B;IACF;IAEA,OAAO3B;AACT"}
|
|
@@ -2,14 +2,4 @@ export interface ViteDevServerExecutorOptions {
|
|
|
2
2
|
buildTarget: string;
|
|
3
3
|
buildLibsFromSource?: boolean;
|
|
4
4
|
proxyConfig?: string;
|
|
5
|
-
port?: number;
|
|
6
|
-
host?: string | boolean;
|
|
7
|
-
https?: boolean | Json;
|
|
8
|
-
hmr?: boolean;
|
|
9
|
-
open?: string | boolean;
|
|
10
|
-
cors?: boolean;
|
|
11
|
-
logLevel?: 'info' | 'warn' | 'error' | 'silent';
|
|
12
|
-
mode?: string;
|
|
13
|
-
clearScreen?: boolean;
|
|
14
|
-
force?: boolean;
|
|
15
5
|
}
|