@nx/vite 17.0.3 → 17.0.5
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/LICENSE +1 -1
- package/README.md +9 -4
- package/generators.json +3 -3
- package/migrations.json +90 -0
- package/package.json +9 -7
- package/plugin.d.ts +1 -0
- package/plugin.js +21 -0
- package/plugin.js.map +1 -0
- package/plugins/nx-tsconfig-paths.plugin.js +9 -5
- package/plugins/nx-tsconfig-paths.plugin.js.map +1 -1
- package/plugins/rollup-replace-files.plugin.d.ts +3 -3
- package/plugins/rollup-replace-files.plugin.js +2 -2
- package/plugins/rollup-replace-files.plugin.js.map +1 -1
- package/src/executors/build/build.impl.d.ts +5 -1
- package/src/executors/build/build.impl.js +90 -21
- package/src/executors/build/build.impl.js.map +1 -1
- package/src/executors/build/schema.d.ts +5 -18
- package/src/executors/build/schema.json +4 -106
- package/src/executors/dev-server/dev-server.impl.js +74 -9
- 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.d.ts +1 -1
- package/src/executors/preview-server/preview-server.impl.js +79 -15
- 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 +1 -51
- 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 +77 -0
- package/src/executors/test/lib/utils.js.map +1 -0
- package/src/executors/test/schema.d.ts +3 -8
- package/src/executors/test/schema.json +11 -43
- package/src/executors/test/vitest.impl.js +20 -112
- package/src/executors/test/vitest.impl.js.map +1 -1
- package/src/generators/configuration/configuration.d.ts +2 -1
- package/src/generators/configuration/configuration.js +49 -87
- package/src/generators/configuration/configuration.js.map +1 -1
- package/src/generators/configuration/lib/convert-non-vite.d.ts +5 -0
- package/src/generators/configuration/lib/convert-non-vite.js +62 -0
- package/src/generators/configuration/lib/convert-non-vite.js.map +1 -0
- package/src/generators/configuration/schema.d.ts +1 -3
- package/src/generators/configuration/schema.json +0 -12
- package/src/generators/init/init.d.ts +4 -3
- package/src/generators/init/init.js +50 -67
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/init/lib/utils.d.ts +6 -0
- package/src/generators/init/lib/utils.js +80 -0
- package/src/generators/init/lib/utils.js.map +1 -0
- package/src/generators/init/schema.d.ts +5 -5
- package/src/generators/init/schema.json +17 -20
- package/src/generators/vitest/files/tsconfig.spec.json__tmpl__ +2 -1
- package/src/generators/vitest/schema.d.ts +2 -1
- package/src/generators/vitest/schema.json +2 -2
- package/src/generators/vitest/vitest-generator.d.ts +2 -1
- package/src/generators/vitest/vitest-generator.js +34 -10
- package/src/generators/vitest/vitest-generator.js.map +1 -1
- package/src/migrations/update-15-3-1/update-vite-tsconfig-paths.js.map +1 -1
- package/src/migrations/update-16-6-0-change-ts-paths-plugin/change-ts-paths-plugin.js +3 -17
- package/src/migrations/update-16-6-0-change-ts-paths-plugin/change-ts-paths-plugin.js.map +1 -1
- package/src/migrations/update-17-1-0/move-target-defaults.d.ts +2 -0
- package/src/migrations/update-17-1-0/move-target-defaults.js +77 -0
- package/src/migrations/update-17-1-0/move-target-defaults.js.map +1 -0
- 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 +67 -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 +121 -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 +83 -0
- package/src/migrations/update-17-2-0/lib/edit-test-config.js.map +1 -0
- package/src/migrations/update-17-2-0/update-vite-config.d.ts +5 -0
- package/src/migrations/update-17-2-0/update-vite-config.js +68 -0
- package/src/migrations/update-17-2-0/update-vite-config.js.map +1 -0
- package/src/migrations/update-17-3-0/lib/fix-coverage-and-reporters.d.ts +3 -0
- package/src/migrations/update-17-3-0/lib/fix-coverage-and-reporters.js +117 -0
- package/src/migrations/update-17-3-0/lib/fix-coverage-and-reporters.js.map +1 -0
- package/src/migrations/update-17-3-0/vitest-coverage-and-reporters.d.ts +2 -0
- package/src/migrations/update-17-3-0/vitest-coverage-and-reporters.js +45 -0
- package/src/migrations/update-17-3-0/vitest-coverage-and-reporters.js.map +1 -0
- package/src/plugins/plugin.d.ts +10 -0
- package/src/plugins/plugin.js +226 -0
- package/src/plugins/plugin.js.map +1 -0
- package/src/utils/ensure-dependencies.d.ts +8 -0
- package/src/utils/ensure-dependencies.js +34 -0
- package/src/utils/ensure-dependencies.js.map +1 -0
- package/src/utils/executor-utils.d.ts +2 -0
- package/src/utils/executor-utils.js +22 -7
- package/src/utils/executor-utils.js.map +1 -1
- package/src/utils/find-vite-config.d.ts +3 -0
- package/src/utils/find-vite-config.js +46 -0
- package/src/utils/find-vite-config.js.map +1 -0
- package/src/utils/generator-utils.d.ts +10 -12
- package/src/utils/generator-utils.js +134 -213
- package/src/utils/generator-utils.js.map +1 -1
- package/src/utils/options-utils.d.ts +3 -19
- package/src/utils/options-utils.js +25 -68
- 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-vite-project.config.json +1 -4
- package/src/utils/test-files/unknown-project.config.json +1 -4
- package/src/utils/test-utils.d.ts +1 -1
- package/src/utils/test-utils.js +10 -18
- package/src/utils/test-utils.js.map +1 -1
- package/src/utils/versions.d.ts +7 -9
- package/src/utils/versions.js +7 -15
- 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/src/utils/test-files/react-project.config.json +0 -85
- package/src/utils/test-files/web-project.config.json +0 -72
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
import type { FileReplacement } from '../../plugins/rollup-replace-files.plugin';
|
|
2
1
|
export interface ViteBuildExecutorOptions {
|
|
3
|
-
outputPath
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
outputPath?: string;
|
|
3
|
+
buildLibsFromSource?: boolean;
|
|
4
|
+
skipTypeCheck?: boolean;
|
|
6
5
|
configFile?: string;
|
|
7
|
-
|
|
8
|
-
force?: boolean;
|
|
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[];
|
|
6
|
+
watch?: boolean;
|
|
18
7
|
generatePackageJson?: boolean;
|
|
19
8
|
includeDevDependenciesInPackageJson?: boolean;
|
|
20
|
-
|
|
21
|
-
buildLibsFromSource?: boolean;
|
|
22
|
-
skipTypeCheck?: boolean;
|
|
9
|
+
tsConfig?: string;
|
|
23
10
|
}
|
|
@@ -28,10 +28,11 @@
|
|
|
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
|
-
"
|
|
31
|
+
"tsConfig": {
|
|
32
32
|
"type": "string",
|
|
33
|
-
"description": "
|
|
34
|
-
"
|
|
33
|
+
"description": "The path to custom tsconfig file for type-checking when skipTypeCheck is false. Required when tsconfig file is not at the projectRoot level.",
|
|
34
|
+
"x-completion-type": "file",
|
|
35
|
+
"x-completion-glob": "tsconfig.*.json"
|
|
35
36
|
},
|
|
36
37
|
"configFile": {
|
|
37
38
|
"type": "string",
|
|
@@ -39,109 +40,6 @@
|
|
|
39
40
|
"x-completion-type": "file",
|
|
40
41
|
"x-completion-glob": "vite.config.@(js|ts)"
|
|
41
42
|
},
|
|
42
|
-
"fileReplacements": {
|
|
43
|
-
"description": "Replace files with other files in the build.",
|
|
44
|
-
"type": "array",
|
|
45
|
-
"items": {
|
|
46
|
-
"type": "object",
|
|
47
|
-
"properties": {
|
|
48
|
-
"replace": {
|
|
49
|
-
"type": "string",
|
|
50
|
-
"description": "The file to be replaced.",
|
|
51
|
-
"x-completion-type": "file"
|
|
52
|
-
},
|
|
53
|
-
"with": {
|
|
54
|
-
"type": "string",
|
|
55
|
-
"description": "The file to replace with.",
|
|
56
|
-
"x-completion-type": "file"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"additionalProperties": false,
|
|
60
|
-
"required": ["replace", "with"]
|
|
61
|
-
},
|
|
62
|
-
"default": []
|
|
63
|
-
},
|
|
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
43
|
"watch": {
|
|
146
44
|
"description": "Enable re-building when files change.",
|
|
147
45
|
"oneOf": [
|
|
@@ -14,23 +14,39 @@ _export(exports, {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
const _extends = require("@swc/helpers/_/_extends");
|
|
17
|
+
const _devkit = require("@nx/devkit");
|
|
17
18
|
const _optionsutils = require("../../utils/options-utils");
|
|
18
19
|
const _executorutils = require("../../utils/executor-utils");
|
|
20
|
+
const _path = require("path");
|
|
21
|
+
const _buildimpl = require("../build/build.impl");
|
|
19
22
|
async function* viteDevServerExecutor(options, context) {
|
|
23
|
+
process.env.VITE_CJS_IGNORE_WARNING = 'true';
|
|
20
24
|
// Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.
|
|
21
|
-
const { mergeConfig, createServer } = await
|
|
25
|
+
const { mergeConfig, createServer, loadConfigFromFile } = await (0, _executorutils.loadViteDynamicImport)();
|
|
22
26
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
27
|
+
const root = projectRoot === '.' ? process.cwd() : (0, _path.relative)(context.cwd, (0, _devkit.joinPathFragments)(context.root, projectRoot));
|
|
23
28
|
(0, _executorutils.createBuildableTsConfig)(projectRoot, options, context);
|
|
24
29
|
// Retrieve the option for the configured buildTarget.
|
|
25
30
|
const buildTargetOptions = (0, _optionsutils.getNxTargetOptions)(options.buildTarget, context);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const { configuration } = (0, _devkit.parseTargetString)(options.buildTarget, context);
|
|
32
|
+
const { buildOptions, otherOptions: otherOptionsFromBuild } = await (0, _buildimpl.getBuildExtraArgs)(buildTargetOptions);
|
|
33
|
+
const viteConfigPath = (0, _optionsutils.normalizeViteConfigFilePath)(context.root, projectRoot, buildTargetOptions.configFile);
|
|
34
|
+
const { serverOptions, otherOptions } = await getServerExtraArgs(options, configuration, buildOptions, otherOptionsFromBuild);
|
|
35
|
+
var _otherOptions_mode, _ref;
|
|
36
|
+
const resolved = await loadConfigFromFile({
|
|
37
|
+
mode: (_ref = (_otherOptions_mode = otherOptions == null ? void 0 : otherOptions.mode) != null ? _otherOptions_mode : buildTargetOptions == null ? void 0 : buildTargetOptions['mode']) != null ? _ref : 'development',
|
|
38
|
+
command: 'serve'
|
|
39
|
+
}, viteConfigPath);
|
|
40
|
+
var _resolved_config_root;
|
|
41
|
+
// vite InlineConfig
|
|
42
|
+
const serverConfig = mergeConfig({
|
|
43
|
+
// This should not be needed as it's going to be set in vite.config.ts
|
|
44
|
+
// but leaving it here in case someone did not migrate correctly
|
|
45
|
+
root: (_resolved_config_root = resolved.config.root) != null ? _resolved_config_root : root,
|
|
46
|
+
configFile: viteConfigPath
|
|
47
|
+
}, _extends._({
|
|
48
|
+
server: _extends._({}, await (0, _optionsutils.getViteServerOptions)(options, context), serverOptions)
|
|
49
|
+
}, otherOptions));
|
|
34
50
|
try {
|
|
35
51
|
const server = await createServer(serverConfig);
|
|
36
52
|
await runViteDevServer(server);
|
|
@@ -56,6 +72,7 @@ async function* viteDevServerExecutor(options, context) {
|
|
|
56
72
|
process.once('exit', ()=>resolve());
|
|
57
73
|
});
|
|
58
74
|
}
|
|
75
|
+
// vite ViteDevServer
|
|
59
76
|
async function runViteDevServer(server) {
|
|
60
77
|
await server.listen();
|
|
61
78
|
server.printUrls();
|
|
@@ -67,5 +84,53 @@ async function runViteDevServer(server) {
|
|
|
67
84
|
process.once('exit', processOnExit);
|
|
68
85
|
}
|
|
69
86
|
const _default = viteDevServerExecutor;
|
|
87
|
+
async function getServerExtraArgs(options, configuration, buildOptionsFromBuildTarget, otherOptionsFromBuildTarget) {
|
|
88
|
+
// support passing extra args to vite cli
|
|
89
|
+
const schema = await Promise.resolve().then(()=>require("./schema.json"));
|
|
90
|
+
const extraArgs = {};
|
|
91
|
+
for (const key of Object.keys(options)){
|
|
92
|
+
if (!schema.properties[key]) {
|
|
93
|
+
extraArgs[key] = options[key];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
let serverOptions = {};
|
|
97
|
+
const serverSchemaKeys = [
|
|
98
|
+
'hmr',
|
|
99
|
+
'warmup',
|
|
100
|
+
'watch',
|
|
101
|
+
'middlewareMode',
|
|
102
|
+
'fs',
|
|
103
|
+
'origin',
|
|
104
|
+
'preTransformRequests',
|
|
105
|
+
'sourcemapIgnoreList',
|
|
106
|
+
'port',
|
|
107
|
+
'strictPort',
|
|
108
|
+
'host',
|
|
109
|
+
'https',
|
|
110
|
+
'open',
|
|
111
|
+
'proxy',
|
|
112
|
+
'cors',
|
|
113
|
+
'headers'
|
|
114
|
+
];
|
|
115
|
+
let otherOptions = {};
|
|
116
|
+
for (const key of Object.keys(extraArgs)){
|
|
117
|
+
if (serverSchemaKeys.includes(key)) {
|
|
118
|
+
serverOptions[key] = extraArgs[key];
|
|
119
|
+
} else {
|
|
120
|
+
otherOptions[key] = extraArgs[key];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (configuration) {
|
|
124
|
+
var _buildOptionsFromBuildTarget_watch;
|
|
125
|
+
serverOptions = _extends._({}, serverOptions, {
|
|
126
|
+
watch: (_buildOptionsFromBuildTarget_watch = buildOptionsFromBuildTarget == null ? void 0 : buildOptionsFromBuildTarget.watch) != null ? _buildOptionsFromBuildTarget_watch : serverOptions == null ? void 0 : serverOptions.watch
|
|
127
|
+
});
|
|
128
|
+
otherOptions = _extends._({}, otherOptions, otherOptionsFromBuildTarget != null ? otherOptionsFromBuildTarget : {});
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
serverOptions,
|
|
132
|
+
otherOptions
|
|
133
|
+
};
|
|
134
|
+
}
|
|
70
135
|
|
|
71
136
|
//# sourceMappingURL=dev-server.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/vite/src/executors/dev-server/dev-server.impl.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/vite/src/executors/dev-server/dev-server.impl.ts"],"sourcesContent":["import {\n ExecutorContext,\n joinPathFragments,\n parseTargetString,\n} from '@nx/devkit';\nimport {\n getNxTargetOptions,\n getViteServerOptions,\n normalizeViteConfigFilePath,\n} from '../../utils/options-utils';\nimport { ViteDevServerExecutorOptions } from './schema';\nimport { ViteBuildExecutorOptions } from '../build/schema';\nimport {\n createBuildableTsConfig,\n loadViteDynamicImport,\n} from '../../utils/executor-utils';\nimport { relative } from 'path';\nimport { getBuildExtraArgs } from '../build/build.impl';\n\nexport async function* viteDevServerExecutor(\n options: ViteDevServerExecutorOptions,\n context: ExecutorContext\n): AsyncGenerator<{ success: boolean; baseUrl: string }> {\n process.env.VITE_CJS_IGNORE_WARNING = 'true';\n // Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.\n const { mergeConfig, createServer, loadConfigFromFile } =\n await loadViteDynamicImport();\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\n const { configuration } = parseTargetString(options.buildTarget, context);\n\n const { buildOptions, otherOptions: otherOptionsFromBuild } =\n await getBuildExtraArgs(buildTargetOptions);\n\n const viteConfigPath = normalizeViteConfigFilePath(\n context.root,\n projectRoot,\n buildTargetOptions.configFile\n );\n const { serverOptions, otherOptions } = await getServerExtraArgs(\n options,\n configuration,\n buildOptions,\n otherOptionsFromBuild\n );\n const resolved = await loadConfigFromFile(\n {\n mode: otherOptions?.mode ?? buildTargetOptions?.['mode'] ?? 'development',\n command: 'serve',\n },\n viteConfigPath\n );\n\n // vite InlineConfig\n const serverConfig = 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 ...serverOptions,\n },\n ...otherOptions,\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// vite ViteDevServer\nasync function runViteDevServer(server: Record<string, any>): 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 getServerExtraArgs(\n options: ViteDevServerExecutorOptions,\n configuration: string | undefined,\n buildOptionsFromBuildTarget: Record<string, unknown> | undefined,\n otherOptionsFromBuildTarget: Record<string, unknown> | undefined\n): Promise<{\n // vite ServerOptions\n serverOptions: Record<string, unknown>;\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 let serverOptions: Record<string, unknown> = {};\n const serverSchemaKeys = [\n 'hmr',\n 'warmup',\n 'watch',\n 'middlewareMode',\n 'fs',\n 'origin',\n 'preTransformRequests',\n 'sourcemapIgnoreList',\n 'port',\n 'strictPort',\n 'host',\n 'https',\n 'open',\n 'proxy',\n 'cors',\n 'headers',\n ];\n\n let otherOptions = {};\n for (const key of Object.keys(extraArgs)) {\n if (serverSchemaKeys.includes(key)) {\n serverOptions[key] = extraArgs[key];\n } else {\n otherOptions[key] = extraArgs[key];\n }\n }\n\n if (configuration) {\n serverOptions = {\n ...serverOptions,\n watch: buildOptionsFromBuildTarget?.watch ?? serverOptions?.watch,\n };\n otherOptions = {\n ...otherOptions,\n ...(otherOptionsFromBuildTarget ?? {}),\n };\n }\n\n return {\n serverOptions,\n otherOptions,\n };\n}\n"],"names":["viteDevServerExecutor","options","context","process","env","VITE_CJS_IGNORE_WARNING","mergeConfig","createServer","loadConfigFromFile","loadViteDynamicImport","projectRoot","projectsConfigurations","projects","projectName","root","cwd","relative","joinPathFragments","createBuildableTsConfig","buildTargetOptions","getNxTargetOptions","buildTarget","configuration","parseTargetString","buildOptions","otherOptions","otherOptionsFromBuild","getBuildExtraArgs","viteConfigPath","normalizeViteConfigFilePath","configFile","serverOptions","getServerExtraArgs","resolved","mode","command","serverConfig","config","server","getViteServerOptions","runViteDevServer","resolvedUrls","local","network","success","baseUrl","e","console","error","Promise","resolve","once","listen","printUrls","processOnExit","close","buildOptionsFromBuildTarget","otherOptionsFromBuildTarget","schema","extraArgs","key","Object","keys","properties","serverSchemaKeys","includes","watch"],"mappings":";;;;;;;;IAmBuBA,qBAAqB;eAArBA;;IAyGvB,OAAqC;eAArC;;;;wBAxHO;8BAKA;+BAMA;sBACkB;2BACS;AAE3B,gBAAgBA,sBACrBC,OAAqC,EACrCC,OAAwB;IAExBC,QAAQC,GAAG,CAACC,uBAAuB,GAAG;IACtC,yFAAyF;IACzF,MAAM,EAAEC,WAAW,EAAEC,YAAY,EAAEC,kBAAkB,EAAE,GACrD,MAAMC,IAAAA,oCAAqB;IAE7B,MAAMC,cACJR,QAAQS,sBAAsB,CAACC,QAAQ,CAACV,QAAQW,WAAW,CAAC,CAACC,IAAI;IACnE,MAAMA,OACJ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AAa,CAAC6B,IAAI,GAAGD,SAAS,CAACC,IAAI;QACrC,OAAO;YACLnC,YAAY,CAACmC,IAAI,GAAGD,SAAS,CAACC,IAAI;QACpC;IACF;IAEA,IAAItC,eAAe;YAGRkC;QAFTzB,gBAAgB,eACXA;YACHmC,OAAOV,CAAAA,qCAAAA,+CAAAA,4BAA6BU,KAAK,YAAlCV,qCAAsCzB,iCAAAA,cAAemC,KAAK;;QAEnEzC,eAAe,eACVA,cACCgC,sCAAAA,8BAA+B,CAAC;IAExC;IAEA,OAAO;QACL1B;QACAN;IACF;AACF"}
|
|
@@ -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
|
}
|
|
@@ -30,69 +30,6 @@
|
|
|
30
30
|
"type": "string",
|
|
31
31
|
"description": "Path to the proxy configuration file.",
|
|
32
32
|
"x-completion-type": "file"
|
|
33
|
-
},
|
|
34
|
-
"port": {
|
|
35
|
-
"type": "number",
|
|
36
|
-
"description": "Port to listen on.",
|
|
37
|
-
"x-priority": "important"
|
|
38
|
-
},
|
|
39
|
-
"host": {
|
|
40
|
-
"description": "Specify which IP addresses the server should listen on.",
|
|
41
|
-
"oneOf": [
|
|
42
|
-
{
|
|
43
|
-
"type": "boolean"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"type": "string"
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
},
|
|
50
|
-
"https": {
|
|
51
|
-
"oneOf": [
|
|
52
|
-
{
|
|
53
|
-
"type": "boolean"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"type": "object"
|
|
57
|
-
}
|
|
58
|
-
],
|
|
59
|
-
"description": "Serve using HTTPS. https://vitejs.dev/config/server-options.html#server-https"
|
|
60
|
-
},
|
|
61
|
-
"hmr": {
|
|
62
|
-
"description": "Enable hot module replacement. For more options, use the 'hmr' option in the Vite configuration file.",
|
|
63
|
-
"type": "boolean"
|
|
64
|
-
},
|
|
65
|
-
"open": {
|
|
66
|
-
"description": "Automatically open the app in the browser on server start. When the value is a string, it will be used as the URL's pathname.",
|
|
67
|
-
"oneOf": [
|
|
68
|
-
{
|
|
69
|
-
"type": "boolean"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"type": "string"
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
"cors": {
|
|
77
|
-
"description": "Configure CORS for the dev server.",
|
|
78
|
-
"type": "boolean"
|
|
79
|
-
},
|
|
80
|
-
"logLevel": {
|
|
81
|
-
"type": "string",
|
|
82
|
-
"description": "Adjust console output verbosity.",
|
|
83
|
-
"enum": ["info", "warn", "error", "silent"]
|
|
84
|
-
},
|
|
85
|
-
"mode": {
|
|
86
|
-
"type": "string",
|
|
87
|
-
"description": "Mode to run the server in."
|
|
88
|
-
},
|
|
89
|
-
"clearScreen": {
|
|
90
|
-
"description": "Set to false to prevent Vite from clearing the terminal screen when logging certain messages.",
|
|
91
|
-
"type": "boolean"
|
|
92
|
-
},
|
|
93
|
-
"force": {
|
|
94
|
-
"description": "Force the optimizer to ignore the cache and re-bundle",
|
|
95
|
-
"type": "boolean"
|
|
96
33
|
}
|
|
97
34
|
},
|
|
98
35
|
"definitions": {},
|
|
@@ -2,6 +2,6 @@ import { ExecutorContext } from '@nx/devkit';
|
|
|
2
2
|
import { VitePreviewServerExecutorOptions } from './schema';
|
|
3
3
|
export declare function vitePreviewServerExecutor(options: VitePreviewServerExecutorOptions, context: ExecutorContext): AsyncGenerator<{
|
|
4
4
|
success: boolean;
|
|
5
|
-
baseUrl:
|
|
5
|
+
baseUrl: any;
|
|
6
6
|
}, void, unknown>;
|
|
7
7
|
export default vitePreviewServerExecutor;
|
|
@@ -16,10 +16,15 @@ _export(exports, {
|
|
|
16
16
|
const _extends = require("@swc/helpers/_/_extends");
|
|
17
17
|
const _devkit = require("@nx/devkit");
|
|
18
18
|
const _optionsutils = require("../../utils/options-utils");
|
|
19
|
+
const _path = require("path");
|
|
20
|
+
const _buildimpl = require("../build/build.impl");
|
|
21
|
+
const _executorutils = require("../../utils/executor-utils");
|
|
19
22
|
async function* vitePreviewServerExecutor(options, context) {
|
|
20
|
-
var _context_projectsConfigurations_projects_target_project;
|
|
23
|
+
var _context_projectsConfigurations_projects_target_project, _resolved_config_build, _resolved_config;
|
|
24
|
+
process.env.VITE_CJS_IGNORE_WARNING = 'true';
|
|
21
25
|
// Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.
|
|
22
|
-
const { mergeConfig, preview } = await
|
|
26
|
+
const { mergeConfig, preview, loadConfigFromFile } = await (0, _executorutils.loadViteDynamicImport)();
|
|
27
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
23
28
|
const target = (0, _devkit.parseTargetString)(options.buildTarget, context);
|
|
24
29
|
const targetConfiguration = (_context_projectsConfigurations_projects_target_project = context.projectsConfigurations.projects[target.project]) == null ? void 0 : _context_projectsConfigurations_projects_target_project.targets[target.target];
|
|
25
30
|
if (!targetConfiguration) {
|
|
@@ -28,26 +33,44 @@ async function* vitePreviewServerExecutor(options, context) {
|
|
|
28
33
|
const isCustomBuildTarget = targetConfiguration.executor !== '@nx/vite:build' && targetConfiguration.executor !== '@nrwl/vite:build';
|
|
29
34
|
// Retrieve the option for the configured buildTarget.
|
|
30
35
|
const buildTargetOptions = (0, _optionsutils.getNxTargetOptions)(options.buildTarget, context);
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
const { configuration } = (0, _devkit.parseTargetString)(options.buildTarget, context);
|
|
37
|
+
const viteConfigPath = (0, _optionsutils.normalizeViteConfigFilePath)(context.root, projectRoot, buildTargetOptions.configFile);
|
|
38
|
+
const { buildOptions, otherOptions: otherOptionsFromBuild } = await (0, _buildimpl.getBuildExtraArgs)(buildTargetOptions);
|
|
39
|
+
const { previewOptions, otherOptions } = await getExtraArgs(options, configuration, otherOptionsFromBuild);
|
|
40
|
+
var _otherOptions_mode, _ref;
|
|
41
|
+
const resolved = await loadConfigFromFile({
|
|
42
|
+
mode: (_ref = (_otherOptions_mode = otherOptions == null ? void 0 : otherOptions.mode) != null ? _otherOptions_mode : otherOptionsFromBuild == null ? void 0 : otherOptionsFromBuild.mode) != null ? _ref : 'production',
|
|
43
|
+
command: 'build'
|
|
44
|
+
}, viteConfigPath);
|
|
45
|
+
var _options_staticFilePath, _ref1;
|
|
46
|
+
const outDir = (_ref1 = (_options_staticFilePath = options.staticFilePath) != null ? _options_staticFilePath : (0, _devkit.joinPathFragments)((0, _devkit.offsetFromRoot)(projectRoot), buildTargetOptions.outputPath)) != null ? _ref1 : resolved == null ? void 0 : (_resolved_config = resolved.config) == null ? void 0 : (_resolved_config_build = _resolved_config.build) == null ? void 0 : _resolved_config_build.outDir;
|
|
47
|
+
if (!outDir) {
|
|
48
|
+
throw new Error(`Could not infer the "outputPath" or "outDir". It should be set in your vite.config.ts, or as a property of the "${options.buildTarget}" buildTarget or provided explicitly as a "staticFilePath" option.`);
|
|
35
49
|
}
|
|
50
|
+
const root = projectRoot === '.' ? process.cwd() : (0, _path.relative)(context.cwd, (0, _devkit.joinPathFragments)(context.root, projectRoot));
|
|
36
51
|
// Merge the options from the build and preview-serve targets.
|
|
37
52
|
// The latter takes precedence.
|
|
38
53
|
const mergedOptions = _extends._({}, {
|
|
39
54
|
watch: {}
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
preview: (0, _optionsutils.getVitePreviewOptions)(mergedOptions, context)
|
|
55
|
+
}, {
|
|
56
|
+
build: _extends._({
|
|
57
|
+
outDir
|
|
58
|
+
}, isCustomBuildTarget ? {} : buildOptions)
|
|
59
|
+
}, isCustomBuildTarget ? {} : otherOptionsFromBuild, otherOptions, {
|
|
60
|
+
preview: _extends._({}, (0, _optionsutils.getProxyConfig)(context, otherOptions.proxyConfig), previewOptions)
|
|
47
61
|
});
|
|
62
|
+
var _resolved_config_root;
|
|
63
|
+
// vite InlineConfig
|
|
64
|
+
const serverConfig = mergeConfig({
|
|
65
|
+
// This should not be needed as it's going to be set in vite.config.ts
|
|
66
|
+
// but leaving it here in case someone did not migrate correctly
|
|
67
|
+
root: (_resolved_config_root = resolved.config.root) != null ? _resolved_config_root : root,
|
|
68
|
+
configFile: viteConfigPath
|
|
69
|
+
}, _extends._({}, mergedOptions));
|
|
48
70
|
if (serverConfig.mode === 'production') {
|
|
49
71
|
console.warn('WARNING: preview is not meant to be run in production!');
|
|
50
72
|
}
|
|
73
|
+
// vite PreviewServer
|
|
51
74
|
let server;
|
|
52
75
|
const processOnExit = async ()=>{
|
|
53
76
|
await closeServer(server);
|
|
@@ -101,12 +124,53 @@ function closeServer(server) {
|
|
|
101
124
|
resolve();
|
|
102
125
|
} else {
|
|
103
126
|
const { httpServer } = server;
|
|
104
|
-
|
|
105
|
-
|
|
127
|
+
if (httpServer['closeAllConnections']) {
|
|
128
|
+
// https://github.com/vitejs/vite/pull/14834
|
|
129
|
+
// closeAllConnections was added in Node v18.2.0
|
|
130
|
+
// typically is "as http.Server" but no reason
|
|
131
|
+
// to import http just for this
|
|
132
|
+
httpServer.closeAllConnections();
|
|
133
|
+
}
|
|
106
134
|
httpServer.close(()=>resolve());
|
|
107
135
|
}
|
|
108
136
|
});
|
|
109
137
|
}
|
|
110
138
|
const _default = vitePreviewServerExecutor;
|
|
139
|
+
async function getExtraArgs(options, configuration, otherOptionsFromBuildTarget) {
|
|
140
|
+
// support passing extra args to vite cli
|
|
141
|
+
const schema = await Promise.resolve().then(()=>require("./schema.json"));
|
|
142
|
+
const extraArgs = {};
|
|
143
|
+
for (const key of Object.keys(options)){
|
|
144
|
+
if (!schema.properties[key]) {
|
|
145
|
+
extraArgs[key] = options[key];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const previewOptions = {};
|
|
149
|
+
const previewSchemaKeys = [
|
|
150
|
+
'port',
|
|
151
|
+
'strictPort',
|
|
152
|
+
'host',
|
|
153
|
+
'https',
|
|
154
|
+
'open',
|
|
155
|
+
'proxy',
|
|
156
|
+
'cors',
|
|
157
|
+
'headers'
|
|
158
|
+
];
|
|
159
|
+
let otherOptions = {};
|
|
160
|
+
for (const key of Object.keys(extraArgs)){
|
|
161
|
+
if (previewSchemaKeys.includes(key)) {
|
|
162
|
+
previewOptions[key] = extraArgs[key];
|
|
163
|
+
} else {
|
|
164
|
+
otherOptions[key] = extraArgs[key];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (configuration) {
|
|
168
|
+
otherOptions = _extends._({}, otherOptions, otherOptionsFromBuildTarget != null ? otherOptionsFromBuildTarget : {});
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
previewOptions,
|
|
172
|
+
otherOptions
|
|
173
|
+
};
|
|
174
|
+
}
|
|
111
175
|
|
|
112
176
|
//# sourceMappingURL=preview-server.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/vite/src/executors/preview-server/preview-server.impl.ts"],"sourcesContent":["import { ExecutorContext, parseTargetString, runExecutor } from '@nx/devkit';\nimport type { InlineConfig, PreviewServer } from 'vite';\nimport {\n getNxTargetOptions,\n getViteBuildOptions,\n getVitePreviewOptions,\n getViteSharedConfig,\n} from '../../utils/options-utils';\nimport { ViteBuildExecutorOptions } from '../build/schema';\nimport { VitePreviewServerExecutorOptions } from './schema';\n\ninterface CustomBuildTargetOptions {\n outputPath: string;\n}\n\nexport async function* vitePreviewServerExecutor(\n options: VitePreviewServerExecutorOptions,\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, preview } = await (Function(\n 'return import(\"vite\")'\n )() as Promise<typeof import('vite')>);\n\n const target = parseTargetString(options.buildTarget, context);\n const targetConfiguration =\n context.projectsConfigurations.projects[target.project]?.targets[\n target.target\n ];\n if (!targetConfiguration) {\n throw new Error(`Invalid buildTarget: ${options.buildTarget}`);\n }\n\n const isCustomBuildTarget =\n targetConfiguration.executor !== '@nx/vite:build' &&\n targetConfiguration.executor !== '@nrwl/vite:build';\n\n // Retrieve the option for the configured buildTarget.\n const buildTargetOptions:\n | ViteBuildExecutorOptions\n | CustomBuildTargetOptions = getNxTargetOptions(\n options.buildTarget,\n context\n );\n\n const outputPath = options.staticFilePath ?? buildTargetOptions.outputPath;\n\n if (!outputPath) {\n throw new Error(\n `Could not infer the \"outputPath\". It should either be a property of the \"${options.buildTarget}\" buildTarget or provided explicitly as a \"staticFilePath\" option.`\n );\n }\n\n // Merge the options from the build and preview-serve targets.\n // The latter takes precedence.\n const mergedOptions = {\n ...{ watch: {} },\n ...(isCustomBuildTarget ? {} : buildTargetOptions),\n ...options,\n outputPath,\n };\n\n // Retrieve the server configuration.\n const serverConfig: InlineConfig = mergeConfig(\n getViteSharedConfig(mergedOptions, options.clearScreen, context),\n {\n build: getViteBuildOptions(mergedOptions, context),\n preview: getVitePreviewOptions(mergedOptions, context),\n }\n );\n\n if (serverConfig.mode === 'production') {\n console.warn('WARNING: preview is not meant to be run in production!');\n }\n\n let server: PreviewServer | undefined;\n\n const processOnExit = async () => {\n await closeServer(server);\n };\n\n process.once('SIGINT', processOnExit);\n process.once('SIGTERM', processOnExit);\n process.once('exit', processOnExit);\n\n // Launch the build target.\n // If customBuildTarget is set to true, do not provide any overrides to it\n const buildTargetOverrides = isCustomBuildTarget ? {} : mergedOptions;\n const build = await runExecutor(target, buildTargetOverrides, context);\n\n for await (const result of build) {\n if (result.success) {\n try {\n if (!server) {\n server = await preview(serverConfig);\n }\n server.printUrls();\n\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 } else {\n yield {\n success: false,\n baseUrl: '',\n };\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\nfunction closeServer(server?: PreviewServer): Promise<void> {\n return new Promise((resolve) => {\n if (!server) {\n resolve();\n } else {\n const { httpServer } = server;\n // closeAllConnections was added in Node v18.2.0\n httpServer.closeAllConnections && httpServer.closeAllConnections();\n httpServer.close(() => resolve());\n }\n });\n}\n\nexport default vitePreviewServerExecutor;\n"],"names":["vitePreviewServerExecutor","options","context","mergeConfig","preview","Function","target","parseTargetString","buildTarget","targetConfiguration","projectsConfigurations","projects","project","targets","Error","isCustomBuildTarget","executor","buildTargetOptions","getNxTargetOptions","outputPath","staticFilePath","mergedOptions","watch","serverConfig","getViteSharedConfig","clearScreen","build","getViteBuildOptions","getVitePreviewOptions","mode","console","warn","server","processOnExit","closeServer","process","once","buildTargetOverrides","runExecutor","result","success","printUrls","resolvedUrls","local","network","baseUrl","e","error","Promise","resolve","httpServer","closeAllConnections","close"],"mappings":";;;;;;;;IAeuBA,yBAAyB;eAAzBA;;IA+HvB,OAAyC;eAAzC;;;;wBA9IgE;8BAOzD;AAQA,gBAAgBA,0BACrBC,OAAyC,EACzCC,OAAwB;QAStBA;IAPF,yFAAyF;IACzF,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAE,GAAG,MAAOC,SACtC;IAGF,MAAMC,SAASC,IAAAA,yBAAiB,EAACN,QAAQO,WAAW,EAAEN;IACtD,MAAMO,uBACJP,0DAAAA,QAAQQ,sBAAsB,CAACC,QAAQ,CA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ChC,QAAQ+B,sBAAsBnC;IAE9D,WAAW,MAAMqC,UAAUb,MAAO;QAChC,IAAIa,OAAOC,OAAO,EAAE;YAClB,IAAI;gBACF,IAAI,CAACR,QAAQ;oBACXA,SAAS,MAAM5B,QAAQmB;gBACzB;gBACAS,OAAOS,SAAS;gBAEhB,MAAMC,eAAe;uBAChBV,OAAOU,YAAY,CAACC,KAAK;uBACzBX,OAAOU,YAAY,CAACE,OAAO;iBAC/B;oBAIUF;gBAFX,MAAM;oBACJF,SAAS;oBACTK,SAASH,CAAAA,iBAAAA,YAAY,CAAC,EAAE,YAAfA,iBAAmB;gBAC9B;YACF,EAAE,OAAOI,GAAG;gBACVhB,QAAQiB,KAAK,CAACD;gBACd,MAAM;oBACJN,SAAS;oBACTK,SAAS;gBACX;YACF;QACF,OAAO;YACL,MAAM;gBACJL,SAAS;gBACTK,SAAS;YACX;QACF;IACF;IAEA,MAAM,IAAIG,QAAc,CAACC;QACvBd,QAAQC,IAAI,CAAC,UAAU,IAAMa;QAC7Bd,QAAQC,IAAI,CAAC,WAAW,IAAMa;QAC9Bd,QAAQC,IAAI,CAAC,QAAQ,IAAMa;IAC7B;AACF;AAEA,SAASf,YAAYF,MAAsB;IACzC,OAAO,IAAIgB,QAAQ,CAACC;QAClB,IAAI,CAACjB,QAAQ;YACXiB;QACF,OAAO;YACL,MAAM,EAAEC,UAAU,EAAE,GAAGlB;YACvB,gDAAgD;YAChDkB,WAAWC,mBAAmB,IAAID,WAAWC,mBAAmB;YAChED,WAAWE,KAAK,CAAC,IAAMH;QACzB;IACF;AACF;MAEA,WAAejD"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/vite/src/executors/preview-server/preview-server.impl.ts"],"sourcesContent":["import {\n ExecutorContext,\n joinPathFragments,\n offsetFromRoot,\n parseTargetString,\n runExecutor,\n} from '@nx/devkit';\nimport {\n getNxTargetOptions,\n getProxyConfig,\n normalizeViteConfigFilePath,\n} from '../../utils/options-utils';\nimport { ViteBuildExecutorOptions } from '../build/schema';\nimport { VitePreviewServerExecutorOptions } from './schema';\nimport { relative } from 'path';\nimport { getBuildExtraArgs } from '../build/build.impl';\nimport { loadViteDynamicImport } from '../../utils/executor-utils';\n\nexport async function* vitePreviewServerExecutor(\n options: VitePreviewServerExecutorOptions,\n context: ExecutorContext\n) {\n process.env.VITE_CJS_IGNORE_WARNING = 'true';\n // Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.\n const { mergeConfig, preview, loadConfigFromFile } =\n await loadViteDynamicImport();\n const projectRoot =\n context.projectsConfigurations.projects[context.projectName].root;\n const target = parseTargetString(options.buildTarget, context);\n const targetConfiguration =\n context.projectsConfigurations.projects[target.project]?.targets[\n target.target\n ];\n if (!targetConfiguration) {\n throw new Error(`Invalid buildTarget: ${options.buildTarget}`);\n }\n\n const isCustomBuildTarget =\n targetConfiguration.executor !== '@nx/vite:build' &&\n targetConfiguration.executor !== '@nrwl/vite:build';\n\n // Retrieve the option for the configured buildTarget.\n const buildTargetOptions: ViteBuildExecutorOptions = getNxTargetOptions(\n options.buildTarget,\n context\n );\n\n const { configuration } = parseTargetString(options.buildTarget, context);\n\n const viteConfigPath = normalizeViteConfigFilePath(\n context.root,\n projectRoot,\n buildTargetOptions.configFile\n );\n\n const { buildOptions, otherOptions: otherOptionsFromBuild } =\n await getBuildExtraArgs(buildTargetOptions);\n\n const { previewOptions, otherOptions } = await getExtraArgs(\n options,\n configuration,\n otherOptionsFromBuild\n );\n const resolved = await loadConfigFromFile(\n {\n mode: otherOptions?.mode ?? otherOptionsFromBuild?.mode ?? 'production',\n command: 'build',\n },\n viteConfigPath\n );\n\n const outDir =\n options.staticFilePath ??\n joinPathFragments(\n offsetFromRoot(projectRoot),\n buildTargetOptions.outputPath\n ) ??\n resolved?.config?.build?.outDir;\n\n if (!outDir) {\n throw new Error(\n `Could not infer the \"outputPath\" or \"outDir\". It should be set in your vite.config.ts, or as a property of the \"${options.buildTarget}\" buildTarget or provided explicitly as a \"staticFilePath\" option.`\n );\n }\n const root =\n projectRoot === '.'\n ? process.cwd()\n : relative(context.cwd, joinPathFragments(context.root, projectRoot));\n\n // Merge the options from the build and preview-serve targets.\n // The latter takes precedence.\n const mergedOptions = {\n ...{ watch: {} },\n build: {\n outDir,\n ...(isCustomBuildTarget ? {} : buildOptions),\n },\n ...(isCustomBuildTarget ? {} : otherOptionsFromBuild),\n ...otherOptions,\n preview: {\n ...getProxyConfig(context, otherOptions.proxyConfig),\n ...previewOptions,\n },\n };\n\n // vite InlineConfig\n const serverConfig = 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 ...mergedOptions,\n }\n );\n\n if (serverConfig.mode === 'production') {\n console.warn('WARNING: preview is not meant to be run in production!');\n }\n\n // vite PreviewServer\n let server: Record<string, any> | undefined;\n\n const processOnExit = async () => {\n await closeServer(server);\n };\n\n process.once('SIGINT', processOnExit);\n process.once('SIGTERM', processOnExit);\n process.once('exit', processOnExit);\n\n // Launch the build target.\n // If customBuildTarget is set to true, do not provide any overrides to it\n const buildTargetOverrides = isCustomBuildTarget ? {} : mergedOptions;\n const build = await runExecutor(target, buildTargetOverrides, context);\n\n for await (const result of build) {\n if (result.success) {\n try {\n if (!server) {\n server = await preview(serverConfig);\n }\n server.printUrls();\n\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 } else {\n yield {\n success: false,\n baseUrl: '',\n };\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\nfunction closeServer(server?: Record<string, any>): Promise<void> {\n return new Promise((resolve) => {\n if (!server) {\n resolve();\n } else {\n const { httpServer } = server;\n if (httpServer['closeAllConnections']) {\n // https://github.com/vitejs/vite/pull/14834\n // closeAllConnections was added in Node v18.2.0\n // typically is \"as http.Server\" but no reason\n // to import http just for this\n (httpServer as any).closeAllConnections();\n }\n httpServer.close(() => resolve());\n }\n });\n}\n\nexport default vitePreviewServerExecutor;\n\nasync function getExtraArgs(\n options: VitePreviewServerExecutorOptions,\n configuration: string | undefined,\n otherOptionsFromBuildTarget: Record<string, unknown> | undefined\n): Promise<{\n // vite PreviewOptions\n previewOptions: Record<string, any>;\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 previewOptions = {};\n const previewSchemaKeys = [\n 'port',\n 'strictPort',\n 'host',\n 'https',\n 'open',\n 'proxy',\n 'cors',\n 'headers',\n ];\n\n let otherOptions = {};\n for (const key of Object.keys(extraArgs)) {\n if (previewSchemaKeys.includes(key)) {\n previewOptions[key] = extraArgs[key];\n } else {\n otherOptions[key] = extraArgs[key];\n }\n }\n\n if (configuration) {\n otherOptions = {\n ...otherOptions,\n ...(otherOptionsFromBuildTarget ?? {}),\n };\n }\n\n return {\n previewOptions,\n otherOptions,\n };\n}\n"],"names":["vitePreviewServerExecutor","options","context","resolved","process","env","VITE_CJS_IGNORE_WARNING","mergeConfig","preview","loadConfigFromFile","loadViteDynamicImport","projectRoot","projectsConfigurations","projects","projectName","root","target","parseTargetString","buildTarget","targetConfiguration","project","targets","Error","isCustomBuildTarget","executor","buildTargetOptions","getNxTargetOptions","configuration","viteConfigPath","normalizeViteConfigFilePath","configFile","buildOptions","otherOptions","otherOptionsFromBuild","getBuildExtraArgs","previewOptions","getExtraArgs","mode","command","outDir","staticFilePath","joinPathFragments","offsetFromRoot","outputPath","config","build","cwd","relative","mergedOptions","watch","getProxyConfig","proxyConfig","serverConfig","console","warn","server","processOnExit","closeServer","once","buildTargetOverrides","runExecutor","result","success","printUrls","resolvedUrls","local","network","baseUrl","e","error","Promise","resolve","httpServer","closeAllConnections","close","otherOptionsFromBuildTarget","schema","extraArgs","key","Object","keys","properties","previewSchemaKeys","includes"],"mappings":";;;;;;;;IAkBuBA,yBAAyB;eAAzBA;;IAiLvB,OAAyC;eAAzC;;;;wBA7LO;8BAKA;sBAGkB;2BACS;+BACI;AAE/B,gBAAgBA,0BACrBC,OAAyC,EACzCC,OAAwB;QAUtBA,yDA+CAC,wBAAAA;IAvDFC,QAAQC,GAAG,CAACC,uBAAuB,GAAG;IACtC,yFAAyF;IACzF,MAAM,EAAEC,WAAW,EAAEC,OAAO,EAAEC,kBAAkB,EAAE,GAChD,MAAMC,IAAAA,oCAAqB;IAC7B,MAAMC,cACJT,QAAQU,sBAAsB,CAACC,QAAQ,CAACX,QAAQY,WAAW,CAAC,CAACC,IAAI;IACnE,MAAMC,SAASC,IAAAA,yBAAiB,EAAChB,QAAQiB,WAAW,EAAEhB;IACtD,MAAMiB,uBACJjB,0DAAAA,QAAQU,sBAAsB,CAACC,QAAQ,CAACG,OAAOI,OAAO,CAAC,qBAAvDlB,wDAAyDmB,OAAO,CAC9DL,OAAOA,MAAM,CACd;IACH,IAAI,CAACG,qBAAqB;QACxB,MAAM,IAAIG,MAAM,CAAC,qBAAqB,EAAErB,QAAQiB,WAAW,CAAC,CAAC;IAC/D;IAEA,MAAMK,sBACJJ,oBAAoBK,QAAQ,KAAK,oBACjCL,oBAAoBK,QAAQ,KAAK;IAEnC,sDAAsD;IACtD,MAAMC,qBAA+CC,IAAAA,gCAAkB,EACrEzB,QAAQiB,WAAW,EACnBhB;IAGF,MAAM,EAAEyB,aAAa,EAAE,GAAGV,IAAAA,yBAAiB,EAAChB,QAAQiB,WAAW,EAAEhB;IAEjE,MAAM0B,iBAAiBC,IAAAA,yCAA2B,EAChD3B,QAAQa,IAAI,EACZJ,aACAc,mBAAmBK,UAAU;IAG/B,MAAM,EAAEC,YAAY,EAAEC,cAAcC,qBAAqB,EAAE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;QAClB,IAAI,CAAChB,QAAQ;YACXgB;QACF,OAAO;YACL,MAAM,EAAEC,UAAU,EAAE,GAAGjB;YACvB,IAAIiB,UAAU,CAAC,sBAAsB,EAAE;gBACrC,4CAA4C;gBAC5C,gDAAgD;gBAChD,8CAA8C;gBAC9C,+BAA+B;gBAC9BA,WAAmBC,mBAAmB;YACzC;YACAD,WAAWE,KAAK,CAAC,IAAMH;QACzB;IACF;AACF;MAEA,WAAevE;AAEf,eAAeoC,aACbnC,OAAyC,EACzC0B,aAAiC,EACjCgD,2BAAgE;IAMhE,yCAAyC;IACzC,MAAMC,SAAS,MAAM,2BAAA,QAAO;IAC5B,MAAMC,YAAY,CAAC;IACnB,KAAK,MAAMC,OAAOC,OAAOC,IAAI,CAAC/E,SAAU;QACtC,IAAI,CAAC2E,OAAOK,UAAU,CAACH,IAAI,EAAE;YAC3BD,SAAS,CAACC,IAAI,GAAG7E,OAAO,CAAC6E,IAAI;QAC/B;IACF;IAEA,MAAM3C,iBAAiB,CAAC;IACxB,MAAM+C,oBAAoB;QACxB;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD;IAED,IAAIlD,eAAe,CAAC;IACpB,KAAK,MAAM8C,OAAOC,OAAOC,IAAI,CAACH,WAAY;QACxC,IAAIK,kBAAkBC,QAAQ,CAACL,MAAM;YACnC3C,cAAc,CAAC2C,IAAI,GAAGD,SAAS,CAACC,IAAI;QACtC,OAAO;YACL9C,YAAY,CAAC8C,IAAI,GAAGD,SAAS,CAACC,IAAI;QACpC;IACF;IAEA,IAAInD,eAAe;QACjBK,eAAe,eACVA,cACC2C,sCAAAA,8BAA+B,CAAC;IAExC;IAEA,OAAO;QACLxC;QACAH;IACF;AACF"}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
export interface VitePreviewServerExecutorOptions {
|
|
2
2
|
buildTarget: string;
|
|
3
3
|
proxyConfig?: string;
|
|
4
|
-
port?: number;
|
|
5
|
-
host?: string | boolean;
|
|
6
|
-
https?: boolean | Json;
|
|
7
|
-
open?: string | boolean;
|
|
8
|
-
logLevel?: 'info' | 'warn' | 'error' | 'silent';
|
|
9
|
-
mode?: string;
|
|
10
|
-
clearScreen?: boolean;
|
|
11
4
|
staticFilePath?: string;
|
|
12
5
|
}
|