@nx/vite 19.1.0-beta.1 → 19.1.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -6
- package/plugins/nx-tsconfig-paths.plugin.d.ts +8 -5
- package/plugins/nx-tsconfig-paths.plugin.js +40 -4
- package/plugins/nx-tsconfig-paths.plugin.js.map +1 -1
- package/plugins/nx-vite-build-coordination.plugin.d.ts +5 -0
- package/plugins/nx-vite-build-coordination.plugin.js +64 -0
- package/plugins/nx-vite-build-coordination.plugin.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vite",
|
|
3
|
-
"version": "19.1.0-beta.
|
|
3
|
+
"version": "19.1.0-beta.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for building and testing applications using Vite",
|
|
6
6
|
"repository": {
|
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
"Monorepo",
|
|
13
13
|
"Vite",
|
|
14
14
|
"Web",
|
|
15
|
-
"CLI"
|
|
15
|
+
"CLI",
|
|
16
|
+
"Front-end"
|
|
16
17
|
],
|
|
17
|
-
"main": "./index
|
|
18
|
+
"main": "./index",
|
|
18
19
|
"typings": "./index.d.ts",
|
|
19
20
|
"author": "Victor Savkin",
|
|
20
21
|
"license": "MIT",
|
|
@@ -29,13 +30,13 @@
|
|
|
29
30
|
"migrations": "./migrations.json"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
|
-
"@nx/devkit": "19.1.0-beta.
|
|
33
|
+
"@nx/devkit": "19.1.0-beta.2",
|
|
33
34
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
34
35
|
"@swc/helpers": "~0.5.0",
|
|
35
36
|
"enquirer": "~2.3.6",
|
|
36
|
-
"@nx/js": "19.1.0-beta.
|
|
37
|
+
"@nx/js": "19.1.0-beta.2",
|
|
37
38
|
"tsconfig-paths": "^4.1.2",
|
|
38
|
-
"@nrwl/vite": "19.1.0-beta.
|
|
39
|
+
"@nrwl/vite": "19.1.0-beta.2"
|
|
39
40
|
},
|
|
40
41
|
"peerDependencies": {
|
|
41
42
|
"vite": "^5.0.0",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
1
2
|
export interface nxViteTsPathsOptions {
|
|
2
3
|
/**
|
|
3
4
|
* Enable debug logging
|
|
@@ -16,9 +17,11 @@ export interface nxViteTsPathsOptions {
|
|
|
16
17
|
* @default ['.ts', '.tsx', '.js', '.jsx', '.json', '.mjs', '.cjs']
|
|
17
18
|
**/
|
|
18
19
|
extensions?: string[];
|
|
20
|
+
/**
|
|
21
|
+
* Inform Nx whether to use the raw source or to use the built output for buildable dependencies.
|
|
22
|
+
* Set to `false` to use incremental builds.
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
buildLibsFromSource?: boolean;
|
|
19
26
|
}
|
|
20
|
-
export declare function nxViteTsPaths(options?: nxViteTsPathsOptions):
|
|
21
|
-
name: string;
|
|
22
|
-
configResolved(config: any): void;
|
|
23
|
-
resolveId(importPath: string): string;
|
|
24
|
-
};
|
|
27
|
+
export declare function nxViteTsPaths(options?: nxViteTsPathsOptions): Plugin<any>;
|
|
@@ -9,8 +9,10 @@ const _devkit = require("@nx/devkit");
|
|
|
9
9
|
const _nodefs = require("node:fs");
|
|
10
10
|
const _nodepath = require("node:path");
|
|
11
11
|
const _tsconfigpaths = require("tsconfig-paths");
|
|
12
|
+
const _buildablelibsutils = require("@nx/js/src/utils/buildable-libs-utils");
|
|
13
|
+
const _nxvitebuildcoordinationplugin = require("./nx-vite-build-coordination.plugin");
|
|
12
14
|
function nxViteTsPaths(options = {}) {
|
|
13
|
-
var _options, _options1;
|
|
15
|
+
var _options, _options1, _options2;
|
|
14
16
|
let matchTsPathEsm;
|
|
15
17
|
let matchTsPathFallback;
|
|
16
18
|
let tsConfigPathsEsm;
|
|
@@ -35,17 +37,39 @@ function nxViteTsPaths(options = {}) {
|
|
|
35
37
|
'module',
|
|
36
38
|
'main'
|
|
37
39
|
];
|
|
40
|
+
var _buildLibsFromSource;
|
|
41
|
+
(_buildLibsFromSource = (_options2 = options).buildLibsFromSource) != null ? _buildLibsFromSource : _options2.buildLibsFromSource = true;
|
|
42
|
+
let projectRoot = '';
|
|
38
43
|
return {
|
|
39
44
|
name: 'nx-vite-ts-paths',
|
|
40
|
-
configResolved (config) {
|
|
41
|
-
|
|
45
|
+
async configResolved (config) {
|
|
46
|
+
projectRoot = config.root;
|
|
42
47
|
const projectRootFromWorkspaceRoot = (0, _nodepath.relative)(_devkit.workspaceRoot, projectRoot);
|
|
43
48
|
var _process_env_NX_TASK_TARGET_TARGET;
|
|
44
|
-
|
|
49
|
+
let foundTsConfigPath = getTsConfig((0, _nodepath.join)(_devkit.workspaceRoot, 'tmp', projectRootFromWorkspaceRoot, (_process_env_NX_TASK_TARGET_TARGET = process.env.NX_TASK_TARGET_TARGET) != null ? _process_env_NX_TASK_TARGET_TARGET : 'build', 'tsconfig.generated.json'));
|
|
45
50
|
if (!foundTsConfigPath) {
|
|
46
51
|
throw new Error((0, _devkit.stripIndents)`Unable to find a tsconfig in the workspace!
|
|
47
52
|
There should at least be a tsconfig.base.json or tsconfig.json in the root of the workspace ${_devkit.workspaceRoot}`);
|
|
48
53
|
}
|
|
54
|
+
if (!options.buildLibsFromSource && !global.NX_GRAPH_CREATION) {
|
|
55
|
+
const projectGraph = await (0, _devkit.createProjectGraphAsync)({
|
|
56
|
+
exitOnError: false,
|
|
57
|
+
resetDaemonClient: true
|
|
58
|
+
});
|
|
59
|
+
const { dependencies } = (0, _buildablelibsutils.calculateProjectBuildableDependencies)(undefined, projectGraph, _devkit.workspaceRoot, process.env.NX_TASK_TARGET_PROJECT, // When using incremental building and the serve target is called
|
|
60
|
+
// we need to get the deps for the 'build' target instead.
|
|
61
|
+
process.env.NX_TASK_TARGET_TARGET === 'serve' ? 'build' : process.env.NX_TASK_TARGET_TARGET, process.env.NX_TASK_TARGET_CONFIGURATION);
|
|
62
|
+
// This tsconfig is used via the Vite ts paths plugin.
|
|
63
|
+
// It can be also used by other user-defined Vite plugins (e.g. for creating type declaration files).
|
|
64
|
+
foundTsConfigPath = (0, _buildablelibsutils.createTmpTsConfig)(foundTsConfigPath, _devkit.workspaceRoot, (0, _nodepath.relative)(_devkit.workspaceRoot, projectRoot), dependencies);
|
|
65
|
+
if (config.command === 'serve') {
|
|
66
|
+
const buildableLibraryDependencies = dependencies.filter((dep)=>dep.node.type === 'lib').map((dep)=>dep.node.name).join(',');
|
|
67
|
+
const buildCommand = `npx nx run-many --target=${process.env.NX_TASK_TARGET_TARGET} --projects=${buildableLibraryDependencies}`;
|
|
68
|
+
config.plugins.push((0, _nxvitebuildcoordinationplugin.nxViteBuildCoordinationPlugin)({
|
|
69
|
+
buildCommand
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
49
73
|
const parsed = (0, _tsconfigpaths.loadConfig)(foundTsConfigPath);
|
|
50
74
|
logIt('first parsed tsconfig: ', parsed);
|
|
51
75
|
if (parsed.resultType === 'failed') {
|
|
@@ -84,6 +108,18 @@ There should at least be a tsconfig.base.json or tsconfig.json in the root of th
|
|
|
84
108
|
// Returning null defers to other resolveId functions and eventually the default resolution behavior
|
|
85
109
|
// https://rollupjs.org/plugin-development/#resolveid
|
|
86
110
|
return resolvedFile || null;
|
|
111
|
+
},
|
|
112
|
+
async writeBundle (options) {
|
|
113
|
+
const outDir = options.dir || 'dist';
|
|
114
|
+
const src = (0, _nodepath.resolve)(projectRoot, 'package.json');
|
|
115
|
+
if ((0, _nodefs.existsSync)(src)) {
|
|
116
|
+
const dest = (0, _nodepath.join)(outDir, 'package.json');
|
|
117
|
+
try {
|
|
118
|
+
(0, _nodefs.copyFileSync)(src, dest);
|
|
119
|
+
} catch (err) {
|
|
120
|
+
console.error('Error copying package.json:', err);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
87
123
|
}
|
|
88
124
|
};
|
|
89
125
|
function getTsConfig(preferredTsConfigPath) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../packages/vite/plugins/nx-tsconfig-paths.plugin.ts"],"sourcesContent":["import { joinPathFragments, stripIndents, workspaceRoot } from '@nx/devkit';\nimport { existsSync } from 'node:fs';\nimport { relative, join, resolve } from 'node:path';\nimport {\n loadConfig,\n createMatchPath,\n MatchPath,\n ConfigLoaderSuccessResult,\n} from 'tsconfig-paths';\n\nexport interface nxViteTsPathsOptions {\n /**\n * Enable debug logging\n * @default false\n **/\n debug?: boolean;\n /**\n * export fields in package.json to use for resolving\n * @default [['exports', '.', 'import'], 'module', 'main']\n *\n * fallback resolution will use ['main', 'module']\n **/\n mainFields?: (string | string[])[];\n /**\n * extensions to check when resolving files when package.json resolution fails\n * @default ['.ts', '.tsx', '.js', '.jsx', '.json', '.mjs', '.cjs']\n **/\n extensions?: string[];\n}\n\nexport function nxViteTsPaths(options: nxViteTsPathsOptions = {}) {\n let matchTsPathEsm: MatchPath;\n let matchTsPathFallback: MatchPath | undefined;\n let tsConfigPathsEsm: ConfigLoaderSuccessResult;\n let tsConfigPathsFallback: ConfigLoaderSuccessResult;\n\n options.extensions ??= [\n '.ts',\n '.tsx',\n '.js',\n '.jsx',\n '.json',\n '.mjs',\n '.cjs',\n ];\n options.mainFields ??= [['exports', '.', 'import'], 'module', 'main'];\n\n return {\n name: 'nx-vite-ts-paths',\n configResolved(config: any) {\n const projectRoot = config.root;\n const projectRootFromWorkspaceRoot = relative(workspaceRoot, projectRoot);\n\n const foundTsConfigPath = getTsConfig(\n join(\n workspaceRoot,\n 'tmp',\n projectRootFromWorkspaceRoot,\n process.env.NX_TASK_TARGET_TARGET ?? 'build',\n 'tsconfig.generated.json'\n )\n );\n if (!foundTsConfigPath) {\n throw new Error(stripIndents`Unable to find a tsconfig in the workspace! \nThere should at least be a tsconfig.base.json or tsconfig.json in the root of the workspace ${workspaceRoot}`);\n }\n const parsed = loadConfig(foundTsConfigPath);\n\n logIt('first parsed tsconfig: ', parsed);\n if (parsed.resultType === 'failed') {\n throw new Error(`Failed loading tsonfig at ${foundTsConfigPath}`);\n }\n tsConfigPathsEsm = parsed;\n\n matchTsPathEsm = createMatchPath(\n parsed.absoluteBaseUrl,\n parsed.paths,\n options.mainFields\n );\n\n const rootLevelTsConfig = getTsConfig(\n join(workspaceRoot, 'tsconfig.base.json')\n );\n const rootLevelParsed = loadConfig(rootLevelTsConfig);\n logIt('fallback parsed tsconfig: ', rootLevelParsed);\n if (rootLevelParsed.resultType === 'success') {\n tsConfigPathsFallback = rootLevelParsed;\n matchTsPathFallback = createMatchPath(\n rootLevelParsed.absoluteBaseUrl,\n rootLevelParsed.paths,\n ['main', 'module']\n );\n }\n },\n resolveId(importPath: string) {\n let resolvedFile: string;\n try {\n resolvedFile = matchTsPathEsm(importPath);\n } catch (e) {\n logIt('Using fallback path matching.');\n resolvedFile = matchTsPathFallback?.(importPath);\n }\n\n if (!resolvedFile) {\n if (tsConfigPathsEsm || tsConfigPathsFallback) {\n logIt(\n `Unable to resolve ${importPath} with tsconfig paths. Using fallback file matching.`\n );\n resolvedFile =\n loadFileFromPaths(tsConfigPathsEsm, importPath) ||\n loadFileFromPaths(tsConfigPathsFallback, importPath);\n } else {\n logIt(`Unable to resolve ${importPath} with tsconfig paths`);\n }\n }\n\n logIt(`Resolved ${importPath} to ${resolvedFile}`);\n // Returning null defers to other resolveId functions and eventually the default resolution behavior\n // https://rollupjs.org/plugin-development/#resolveid\n return resolvedFile || null;\n },\n };\n\n function getTsConfig(preferredTsConfigPath: string): string {\n return [\n resolve(preferredTsConfigPath),\n resolve(join(workspaceRoot, 'tsconfig.base.json')),\n resolve(join(workspaceRoot, 'tsconfig.json')),\n ].find((tsPath) => {\n if (existsSync(tsPath)) {\n logIt('Found tsconfig at', tsPath);\n return tsPath;\n }\n });\n }\n\n function logIt(...msg: any[]) {\n if (process.env.NX_VERBOSE_LOGGING === 'true' || options?.debug) {\n console.debug('\\n[Nx Vite TsPaths]', ...msg);\n }\n }\n\n function loadFileFromPaths(\n tsconfig: ConfigLoaderSuccessResult,\n importPath: string\n ) {\n logIt(\n `Trying to resolve file from config in ${tsconfig.configFileAbsolutePath}`\n );\n let resolvedFile: string;\n for (const alias in tsconfig.paths) {\n const paths = tsconfig.paths[alias];\n\n const normalizedImport = alias.replace(/\\/\\*$/, '');\n\n if (importPath.startsWith(normalizedImport)) {\n const joinedPath = joinPathFragments(\n tsconfig.absoluteBaseUrl,\n paths[0].replace(/\\/\\*$/, '')\n );\n\n resolvedFile = findFile(\n importPath.replace(normalizedImport, joinedPath)\n );\n }\n }\n\n return resolvedFile;\n }\n\n function findFile(path: string): string {\n for (const ext of options.extensions) {\n const resolvedPath = resolve(path + ext);\n if (existsSync(resolvedPath)) {\n return resolvedPath;\n }\n\n const resolvedIndexPath = resolve(path, `index${ext}`);\n if (existsSync(resolvedIndexPath)) {\n return resolvedIndexPath;\n }\n }\n }\n}\n"],"names":["nxViteTsPaths","options","matchTsPathEsm","matchTsPathFallback","tsConfigPathsEsm","tsConfigPathsFallback","extensions","mainFields","name","configResolved","config","projectRoot","root","projectRootFromWorkspaceRoot","relative","workspaceRoot","process","foundTsConfigPath","getTsConfig","join","env","NX_TASK_TARGET_TARGET","Error","stripIndents","parsed","loadConfig","logIt","resultType","createMatchPath","absoluteBaseUrl","paths","rootLevelTsConfig","rootLevelParsed","resolveId","importPath","resolvedFile","e","loadFileFromPaths","preferredTsConfigPath","resolve","find","tsPath","existsSync","msg","NX_VERBOSE_LOGGING","debug","console","tsconfig","configFileAbsolutePath","alias","normalizedImport","replace","startsWith","joinedPath","joinPathFragments","findFile","path","ext","resolvedPath","resolvedIndexPath"],"mappings":";+BA8BgBA;;;eAAAA;;;wBA9B+C;wBACpC;0BACa;+BAMjC;AAsBA,SAASA,cAAcC,UAAgC,CAAC,CAAC;QAM9DA,UASAA;IAdA,IAAIC;IACJ,IAAIC;IAC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,MAAM;YAEnC,MAAMC,mBAAmBD,MAAME,OAAO,CAAC,SAAS;YAEhD,IAAIjB,WAAWkB,UAAU,CAACF,mBAAmB;gBAC3C,MAAMG,aAAaC,IAAAA,yBAAiB,EAClCP,SAASlB,eAAe,EACxBC,KAAK,CAAC,EAAE,CAACqB,OAAO,CAAC,SAAS;gBAG5BhB,eAAeoB,SACbrB,WAAWiB,OAAO,CAACD,kBAAkBG;YAEzC;QACF;QAEA,OAAOlB;IACT;IAEA,SAASoB,SAASC,IAAY;QAC5B,KAAK,MAAMC,OAAOxD,QAAQK,UAAU,CAAE;YACpC,MAAMoD,eAAenB,IAAAA,iBAAO,EAACiB,OAAOC;YACpC,IAAIf,IAAAA,kBAAU,EAACgB,eAAe;gBAC5B,OAAOA;YACT;YAEA,MAAMC,oBAAoBpB,IAAAA,iBAAO,EAACiB,MAAM,CAAC,KAAK,EAAEC,IAAI,CAAC;YACrD,IAAIf,IAAAA,kBAAU,EAACiB,oBAAoB;gBACjC,OAAOA;YACT;QACF;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../packages/vite/plugins/nx-tsconfig-paths.plugin.ts"],"sourcesContent":["import {\n createProjectGraphAsync,\n joinPathFragments,\n stripIndents,\n workspaceRoot,\n} from '@nx/devkit';\nimport { copyFileSync, existsSync } from 'node:fs';\nimport { relative, join, resolve } from 'node:path';\nimport {\n loadConfig,\n createMatchPath,\n MatchPath,\n ConfigLoaderSuccessResult,\n} from 'tsconfig-paths';\nimport {\n calculateProjectBuildableDependencies,\n createTmpTsConfig,\n} from '@nx/js/src/utils/buildable-libs-utils';\nimport { Plugin } from 'vite';\nimport { nxViteBuildCoordinationPlugin } from './nx-vite-build-coordination.plugin';\n\nexport interface nxViteTsPathsOptions {\n /**\n * Enable debug logging\n * @default false\n **/\n debug?: boolean;\n /**\n * export fields in package.json to use for resolving\n * @default [['exports', '.', 'import'], 'module', 'main']\n *\n * fallback resolution will use ['main', 'module']\n **/\n mainFields?: (string | string[])[];\n /**\n * extensions to check when resolving files when package.json resolution fails\n * @default ['.ts', '.tsx', '.js', '.jsx', '.json', '.mjs', '.cjs']\n **/\n extensions?: string[];\n /**\n * Inform Nx whether to use the raw source or to use the built output for buildable dependencies.\n * Set to `false` to use incremental builds.\n * @default true\n */\n buildLibsFromSource?: boolean;\n}\n\nexport function nxViteTsPaths(options: nxViteTsPathsOptions = {}) {\n let matchTsPathEsm: MatchPath;\n let matchTsPathFallback: MatchPath | undefined;\n let tsConfigPathsEsm: ConfigLoaderSuccessResult;\n let tsConfigPathsFallback: ConfigLoaderSuccessResult;\n\n options.extensions ??= [\n '.ts',\n '.tsx',\n '.js',\n '.jsx',\n '.json',\n '.mjs',\n '.cjs',\n ];\n options.mainFields ??= [['exports', '.', 'import'], 'module', 'main'];\n options.buildLibsFromSource ??= true;\n let projectRoot = '';\n\n return {\n name: 'nx-vite-ts-paths',\n async configResolved(config: any) {\n projectRoot = config.root;\n const projectRootFromWorkspaceRoot = relative(workspaceRoot, projectRoot);\n let foundTsConfigPath = getTsConfig(\n join(\n workspaceRoot,\n 'tmp',\n projectRootFromWorkspaceRoot,\n process.env.NX_TASK_TARGET_TARGET ?? 'build',\n 'tsconfig.generated.json'\n )\n );\n if (!foundTsConfigPath) {\n throw new Error(stripIndents`Unable to find a tsconfig in the workspace! \nThere should at least be a tsconfig.base.json or tsconfig.json in the root of the workspace ${workspaceRoot}`);\n }\n\n if (!options.buildLibsFromSource && !global.NX_GRAPH_CREATION) {\n const projectGraph = await createProjectGraphAsync({\n exitOnError: false,\n resetDaemonClient: true,\n });\n const { dependencies } = calculateProjectBuildableDependencies(\n undefined,\n projectGraph,\n workspaceRoot,\n process.env.NX_TASK_TARGET_PROJECT,\n // When using incremental building and the serve target is called\n // we need to get the deps for the 'build' target instead.\n process.env.NX_TASK_TARGET_TARGET === 'serve'\n ? 'build'\n : process.env.NX_TASK_TARGET_TARGET,\n process.env.NX_TASK_TARGET_CONFIGURATION\n );\n // This tsconfig is used via the Vite ts paths plugin.\n // It can be also used by other user-defined Vite plugins (e.g. for creating type declaration files).\n foundTsConfigPath = createTmpTsConfig(\n foundTsConfigPath,\n workspaceRoot,\n relative(workspaceRoot, projectRoot),\n dependencies\n );\n\n if (config.command === 'serve') {\n const buildableLibraryDependencies = dependencies\n .filter((dep) => dep.node.type === 'lib')\n .map((dep) => dep.node.name)\n .join(',');\n const buildCommand = `npx nx run-many --target=${process.env.NX_TASK_TARGET_TARGET} --projects=${buildableLibraryDependencies}`;\n config.plugins.push(nxViteBuildCoordinationPlugin({ buildCommand }));\n }\n }\n\n const parsed = loadConfig(foundTsConfigPath);\n\n logIt('first parsed tsconfig: ', parsed);\n if (parsed.resultType === 'failed') {\n throw new Error(`Failed loading tsonfig at ${foundTsConfigPath}`);\n }\n tsConfigPathsEsm = parsed;\n\n matchTsPathEsm = createMatchPath(\n parsed.absoluteBaseUrl,\n parsed.paths,\n options.mainFields\n );\n\n const rootLevelTsConfig = getTsConfig(\n join(workspaceRoot, 'tsconfig.base.json')\n );\n const rootLevelParsed = loadConfig(rootLevelTsConfig);\n logIt('fallback parsed tsconfig: ', rootLevelParsed);\n if (rootLevelParsed.resultType === 'success') {\n tsConfigPathsFallback = rootLevelParsed;\n matchTsPathFallback = createMatchPath(\n rootLevelParsed.absoluteBaseUrl,\n rootLevelParsed.paths,\n ['main', 'module']\n );\n }\n },\n resolveId(importPath: string) {\n let resolvedFile: string;\n try {\n resolvedFile = matchTsPathEsm(importPath);\n } catch (e) {\n logIt('Using fallback path matching.');\n resolvedFile = matchTsPathFallback?.(importPath);\n }\n\n if (!resolvedFile) {\n if (tsConfigPathsEsm || tsConfigPathsFallback) {\n logIt(\n `Unable to resolve ${importPath} with tsconfig paths. Using fallback file matching.`\n );\n resolvedFile =\n loadFileFromPaths(tsConfigPathsEsm, importPath) ||\n loadFileFromPaths(tsConfigPathsFallback, importPath);\n } else {\n logIt(`Unable to resolve ${importPath} with tsconfig paths`);\n }\n }\n\n logIt(`Resolved ${importPath} to ${resolvedFile}`);\n // Returning null defers to other resolveId functions and eventually the default resolution behavior\n // https://rollupjs.org/plugin-development/#resolveid\n return resolvedFile || null;\n },\n async writeBundle(options) {\n const outDir = options.dir || 'dist';\n const src = resolve(projectRoot, 'package.json');\n if (existsSync(src)) {\n const dest = join(outDir, 'package.json');\n\n try {\n copyFileSync(src, dest);\n } catch (err) {\n console.error('Error copying package.json:', err);\n }\n }\n },\n } as Plugin;\n\n function getTsConfig(preferredTsConfigPath: string): string {\n return [\n resolve(preferredTsConfigPath),\n resolve(join(workspaceRoot, 'tsconfig.base.json')),\n resolve(join(workspaceRoot, 'tsconfig.json')),\n ].find((tsPath) => {\n if (existsSync(tsPath)) {\n logIt('Found tsconfig at', tsPath);\n return tsPath;\n }\n });\n }\n\n function logIt(...msg: any[]) {\n if (process.env.NX_VERBOSE_LOGGING === 'true' || options?.debug) {\n console.debug('\\n[Nx Vite TsPaths]', ...msg);\n }\n }\n\n function loadFileFromPaths(\n tsconfig: ConfigLoaderSuccessResult,\n importPath: string\n ) {\n logIt(\n `Trying to resolve file from config in ${tsconfig.configFileAbsolutePath}`\n );\n let resolvedFile: string;\n for (const alias in tsconfig.paths) {\n const paths = tsconfig.paths[alias];\n\n const normalizedImport = alias.replace(/\\/\\*$/, '');\n\n if (importPath.startsWith(normalizedImport)) {\n const joinedPath = joinPathFragments(\n tsconfig.absoluteBaseUrl,\n paths[0].replace(/\\/\\*$/, '')\n );\n\n resolvedFile = findFile(\n importPath.replace(normalizedImport, joinedPath)\n );\n }\n }\n\n return resolvedFile;\n }\n\n function findFile(path: string): string {\n for (const ext of options.extensions) {\n const resolvedPath = resolve(path + ext);\n if (existsSync(resolvedPath)) {\n return resolvedPath;\n }\n\n const resolvedIndexPath = resolve(path, `index${ext}`);\n if (existsSync(resolvedIndexPath)) {\n return resolvedIndexPath;\n }\n }\n }\n}\n"],"names":["nxViteTsPaths","options","matchTsPathEsm","matchTsPathFallback","tsConfigPathsEsm","tsConfigPathsFallback","extensions","mainFields","buildLibsFromSource","projectRoot","name","configResolved","config","root","projectRootFromWorkspaceRoot","relative","workspaceRoot","process","foundTsConfigPath","getTsConfig","join","env","NX_TASK_TARGET_TARGET","Error","stripIndents","global","NX_GRAPH_CREATION","projectGraph","createProjectGraphAsync","exitOnError","resetDaemonClient","dependencies","calculateProjectBuildableDependencies","undefined","NX_TASK_TARGET_PROJECT","NX_TASK_TARGET_CONFIGURATION","createTmpTsConfig","command","buildableLibraryDependencies","filter","dep","node","type","map","buildCommand","plugins","push","nxViteBuildCoordinationPlugin","parsed","loadConfig","logIt","resultType","createMatchPath","absoluteBaseUrl","paths","rootLevelTsConfig","rootLevelParsed","resolveId","importPath","resolvedFile","e","loadFileFromPaths","writeBundle","outDir","dir","src","resolve","existsSync","dest","copyFileSync","err","console","error","preferredTsConfigPath","find","tsPath","msg","NX_VERBOSE_LOGGING","debug","tsconfig","configFileAbsolutePath","alias","normalizedImport","replace","startsWith","joinedPath","joinPathFragments","findFile","path","ext","resolvedPath","resolvedIndexPath"],"mappings":";+BA+CgBA;;;eAAAA;;;wBA1CT;wBACkC;0BACD;+BAMjC;oCAIA;+CAEuC;AA4BvC,SAASA,cAAcC,UAAgC,CAAC,CAAC;QAM9DA,UASAA,WACAA;IAfA,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIC;;IAEJJ,gBAAAA,WAAAA,SAAQK,oCAARL,SAAQK,aAAe;QACrB;QACA;QACA;QACA;QACA;QACA;QACA;KACD;;IACDL,gBAAAA,YAAAA,SAAQM,oCAARN,UAAQM,aAAe;QAAC;YAAC;YAAW;YAAK;SAAS;QAAE;QAAU;KAAO;;IACrEN,yBAAAA,YAAAA,SAAQO,sDAARP,UAAQO,sBAAwB;IAChC,IAAIC,cAAc;IAElB,OAAO;QACLC,MAAM;QACN,MAAMC,gBAAeC,MAAW;YAC9BH,cAAcG,OAAOC,IAAI;YACzB,MAAMC,+BAA+BC,IAAAA,kBAAQ,EAACC,qBAAa,EAAEP;gBAMzDQ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,kBAAkBG;YAEzC;QACF;QAEA,OAAO1B;IACT;IAEA,SAAS4B,SAASC,IAAY;QAC5B,KAAK,MAAMC,OAAOxF,QAAQK,UAAU,CAAE;YACpC,MAAMoF,eAAexB,IAAAA,iBAAO,EAACsB,OAAOC;YACpC,IAAItB,IAAAA,kBAAU,EAACuB,eAAe;gBAC5B,OAAOA;YACT;YAEA,MAAMC,oBAAoBzB,IAAAA,iBAAO,EAACsB,MAAM,CAAC,KAAK,EAAEC,IAAI,CAAC;YACrD,IAAItB,IAAAA,kBAAU,EAACwB,oBAAoB;gBACjC,OAAOA;YACT;QACF;IACF;AACF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "nxViteBuildCoordinationPlugin", {
|
|
3
|
+
enumerable: true,
|
|
4
|
+
get: function() {
|
|
5
|
+
return nxViteBuildCoordinationPlugin;
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
const _watch = require("nx/src/command-line/watch/watch");
|
|
9
|
+
const _child_process = require("child_process");
|
|
10
|
+
const _client = require("nx/src/daemon/client/client");
|
|
11
|
+
const _output = require("nx/src/utils/output");
|
|
12
|
+
function nxViteBuildCoordinationPlugin(options) {
|
|
13
|
+
let activeBuildProcess;
|
|
14
|
+
let unregisterFileWatcher;
|
|
15
|
+
async function buildChangedProjects() {
|
|
16
|
+
await new Promise((res)=>{
|
|
17
|
+
activeBuildProcess = (0, _child_process.exec)(options.buildCommand);
|
|
18
|
+
activeBuildProcess.stdout.pipe(process.stdout);
|
|
19
|
+
activeBuildProcess.stderr.pipe(process.stderr);
|
|
20
|
+
activeBuildProcess.on('exit', ()=>{
|
|
21
|
+
res();
|
|
22
|
+
});
|
|
23
|
+
activeBuildProcess.on('error', ()=>{
|
|
24
|
+
res();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
activeBuildProcess = undefined;
|
|
28
|
+
}
|
|
29
|
+
function createFileWatcher() {
|
|
30
|
+
const runner = new _watch.BatchFunctionRunner(()=>buildChangedProjects());
|
|
31
|
+
return _client.daemonClient.registerFileWatcher({
|
|
32
|
+
watchProjects: 'all'
|
|
33
|
+
}, (err, { changedProjects, changedFiles })=>{
|
|
34
|
+
if (err === 'closed') {
|
|
35
|
+
_output.output.error({
|
|
36
|
+
title: 'Watch connection closed',
|
|
37
|
+
bodyLines: [
|
|
38
|
+
'The daemon had closed the connection to this watch process.',
|
|
39
|
+
'Please restart your watch command.'
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
if (activeBuildProcess) {
|
|
45
|
+
activeBuildProcess.kill(2);
|
|
46
|
+
activeBuildProcess = undefined;
|
|
47
|
+
}
|
|
48
|
+
runner.enqueue(changedProjects, changedFiles);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
name: 'nx-vite-build-coordination-plugin',
|
|
53
|
+
async buildStart () {
|
|
54
|
+
if (!unregisterFileWatcher) {
|
|
55
|
+
await buildChangedProjects();
|
|
56
|
+
unregisterFileWatcher = await createFileWatcher();
|
|
57
|
+
process.on('exit', ()=>unregisterFileWatcher());
|
|
58
|
+
process.on('SIGINT', ()=>process.exit());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=nx-vite-build-coordination.plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../packages/vite/plugins/nx-vite-build-coordination.plugin.ts"],"sourcesContent":["import { type Plugin } from 'vite';\nimport { BatchFunctionRunner } from 'nx/src/command-line/watch/watch';\nimport { exec, type ChildProcess } from 'child_process';\nimport {\n daemonClient,\n type UnregisterCallback,\n} from 'nx/src/daemon/client/client';\nimport { output } from 'nx/src/utils/output';\n\nexport interface NxViteBuildCoordinationPluginOptions {\n buildCommand: string;\n}\nexport function nxViteBuildCoordinationPlugin(\n options: NxViteBuildCoordinationPluginOptions\n): Plugin {\n let activeBuildProcess: ChildProcess | undefined;\n let unregisterFileWatcher: UnregisterCallback | undefined;\n\n async function buildChangedProjects() {\n await new Promise<void>((res) => {\n activeBuildProcess = exec(options.buildCommand);\n activeBuildProcess.stdout.pipe(process.stdout);\n activeBuildProcess.stderr.pipe(process.stderr);\n activeBuildProcess.on('exit', () => {\n res();\n });\n activeBuildProcess.on('error', () => {\n res();\n });\n });\n activeBuildProcess = undefined;\n }\n\n function createFileWatcher() {\n const runner = new BatchFunctionRunner(() => buildChangedProjects());\n return daemonClient.registerFileWatcher(\n { watchProjects: 'all' },\n (err, { changedProjects, changedFiles }) => {\n if (err === 'closed') {\n output.error({\n title: 'Watch connection closed',\n bodyLines: [\n 'The daemon had closed the connection to this watch process.',\n 'Please restart your watch command.',\n ],\n });\n process.exit(1);\n }\n\n if (activeBuildProcess) {\n activeBuildProcess.kill(2);\n activeBuildProcess = undefined;\n }\n\n runner.enqueue(changedProjects, changedFiles);\n }\n );\n }\n\n return {\n name: 'nx-vite-build-coordination-plugin',\n async buildStart() {\n if (!unregisterFileWatcher) {\n await buildChangedProjects();\n unregisterFileWatcher = await createFileWatcher();\n process.on('exit', () => unregisterFileWatcher());\n process.on('SIGINT', () => process.exit());\n }\n },\n };\n}\n"],"names":["nxViteBuildCoordinationPlugin","options","activeBuildProcess","unregisterFileWatcher","buildChangedProjects","Promise","res","exec","buildCommand","stdout","pipe","process","stderr","on","undefined","createFileWatcher","runner","BatchFunctionRunner","daemonClient","registerFileWatcher","watchProjects","err","changedProjects","changedFiles","output","error","title","bodyLines","exit","kill","enqueue","name","buildStart"],"mappings":";+BAYgBA;;;eAAAA;;;uBAXoB;+BACI;wBAIjC;wBACgB;AAKhB,SAASA,8BACdC,OAA6C;IAE7C,IAAIC;IACJ,IAAIC;IAEJ,eAAeC;QACb,MAAM,IAAIC,QAAc,CAACC;YACvBJ,qBAAqBK,IAAAA,mBAAI,EAACN,QAAQO,YAAY;YAC9CN,mBAAmBO,MAAM,CAACC,IAAI,CAACC,QAAQF,MAAM;YAC7CP,mBAAmBU,MAAM,CAACF,IAAI,CAACC,QAAQC,MAAM;YAC7CV,mBAAmBW,EAAE,CAAC,QAAQ;gBAC5BP;YACF;YACAJ,mBAAmBW,EAAE,CAAC,SAAS;gBAC7BP;YACF;QACF;QACAJ,qBAAqBY;IACvB;IAEA,SAASC;QACP,MAAMC,SAAS,IAAIC,0BAAmB,CAAC,IAAMb;QAC7C,OAAOc,oBAAY,CAACC,mBAAmB,CACrC;YAAEC,eAAe;QAAM,GACvB,CAACC,KAAK,EAAEC,eAAe,EAAEC,YAAY,EAAE;YACrC,IAAIF,QAAQ,UAAU;gBACpBG,cAAM,CAACC,KAAK,CAAC;oBACXC,OAAO;oBACPC,WAAW;wBACT;wBACA;qBACD;gBACH;gBACAhB,QAAQiB,IAAI,CAAC;YACf;YAEA,IAAI1B,oBAAoB;gBACtBA,mBAAmB2B,IAAI,CAAC;gBACxB3B,qBAAqBY;YACvB;YAEAE,OAAOc,OAAO,CAACR,iBAAiBC;QAClC;IAEJ;IAEA,OAAO;QACLQ,MAAM;QACN,MAAMC;YACJ,IAAI,CAAC7B,uBAAuB;gBAC1B,MAAMC;gBACND,wBAAwB,MAAMY;gBAC9BJ,QAAQE,EAAE,CAAC,QAAQ,IAAMV;gBACzBQ,QAAQE,EAAE,CAAC,UAAU,IAAMF,QAAQiB,IAAI;YACzC;QACF;IACF;AACF"}
|