@nx/vite 19.8.0 → 19.8.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vite",
|
|
3
|
-
"version": "19.8.
|
|
3
|
+
"version": "19.8.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for building and testing applications using Vite",
|
|
6
6
|
"repository": {
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"migrations": "./migrations.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@nx/devkit": "19.8.
|
|
33
|
+
"@nx/devkit": "19.8.2",
|
|
34
34
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
35
35
|
"@swc/helpers": "~0.5.0",
|
|
36
36
|
"enquirer": "~2.3.6",
|
|
37
|
-
"@nx/js": "19.8.
|
|
37
|
+
"@nx/js": "19.8.2",
|
|
38
38
|
"tsconfig-paths": "^4.1.2",
|
|
39
39
|
"minimatch": "9.0.3",
|
|
40
|
-
"@nrwl/vite": "19.8.
|
|
40
|
+
"@nrwl/vite": "19.8.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"vite": "^5.0.0",
|
|
@@ -14,7 +14,9 @@ function nxViteBuildCoordinationPlugin(options) {
|
|
|
14
14
|
let unregisterFileWatcher;
|
|
15
15
|
async function buildChangedProjects() {
|
|
16
16
|
await new Promise((res)=>{
|
|
17
|
-
activeBuildProcess = (0, _child_process.exec)(options.buildCommand
|
|
17
|
+
activeBuildProcess = (0, _child_process.exec)(options.buildCommand, {
|
|
18
|
+
windowsHide: true
|
|
19
|
+
});
|
|
18
20
|
activeBuildProcess.stdout.pipe(process.stdout);
|
|
19
21
|
activeBuildProcess.stderr.pipe(process.stderr);
|
|
20
22
|
activeBuildProcess.on('exit', ()=>{
|
|
@@ -1 +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 let firstBuildStart = true;\n\n return {\n name: 'nx-vite-build-coordination-plugin',\n async buildStart() {\n if (firstBuildStart) {\n firstBuildStart = false;\n await buildChangedProjects();\n if (daemonClient.enabled()) {\n unregisterFileWatcher = await createFileWatcher();\n process.on('exit', () => unregisterFileWatcher());\n process.on('SIGINT', () => process.exit());\n } else {\n output.warn({\n title:\n 'Nx Daemon is not enabled. Projects will not be rebuilt when files change.',\n });\n }\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","firstBuildStart","name","buildStart","enabled","warn"],"rangeMappings":"
|
|
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 windowsHide: true,\n });\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 let firstBuildStart = true;\n\n return {\n name: 'nx-vite-build-coordination-plugin',\n async buildStart() {\n if (firstBuildStart) {\n firstBuildStart = false;\n await buildChangedProjects();\n if (daemonClient.enabled()) {\n unregisterFileWatcher = await createFileWatcher();\n process.on('exit', () => unregisterFileWatcher());\n process.on('SIGINT', () => process.exit());\n } else {\n output.warn({\n title:\n 'Nx Daemon is not enabled. Projects will not be rebuilt when files change.',\n });\n }\n }\n },\n };\n}\n"],"names":["nxViteBuildCoordinationPlugin","options","activeBuildProcess","unregisterFileWatcher","buildChangedProjects","Promise","res","exec","buildCommand","windowsHide","stdout","pipe","process","stderr","on","undefined","createFileWatcher","runner","BatchFunctionRunner","daemonClient","registerFileWatcher","watchProjects","err","changedProjects","changedFiles","output","error","title","bodyLines","exit","kill","enqueue","firstBuildStart","name","buildStart","enabled","warn"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","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,EAAE;gBAC9CC,aAAa;YACf;YACAP,mBAAmBQ,MAAM,CAACC,IAAI,CAACC,QAAQF,MAAM;YAC7CR,mBAAmBW,MAAM,CAACF,IAAI,CAACC,QAAQC,MAAM;YAC7CX,mBAAmBY,EAAE,CAAC,QAAQ;gBAC5BR;YACF;YACAJ,mBAAmBY,EAAE,CAAC,SAAS;gBAC7BR;YACF;QACF;QACAJ,qBAAqBa;IACvB;IAEA,SAASC;QACP,MAAMC,SAAS,IAAIC,0BAAmB,CAAC,IAAMd;QAC7C,OAAOe,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,IAAI3B,oBAAoB;gBACtBA,mBAAmB4B,IAAI,CAAC;gBACxB5B,qBAAqBa;YACvB;YAEAE,OAAOc,OAAO,CAACR,iBAAiBC;QAClC;IAEJ;IAEA,IAAIQ,kBAAkB;IAEtB,OAAO;QACLC,MAAM;QACN,MAAMC;YACJ,IAAIF,iBAAiB;gBACnBA,kBAAkB;gBAClB,MAAM5B;gBACN,IAAIe,oBAAY,CAACgB,OAAO,IAAI;oBAC1BhC,wBAAwB,MAAMa;oBAC9BJ,QAAQE,EAAE,CAAC,QAAQ,IAAMX;oBACzBS,QAAQE,EAAE,CAAC,UAAU,IAAMF,QAAQiB,IAAI;gBACzC,OAAO;oBACLJ,cAAM,CAACW,IAAI,CAAC;wBACVT,OACE;oBACJ;gBACF;YACF;QACF;IACF;AACF"}
|
|
@@ -40,7 +40,8 @@ async function validateTypes(opts) {
|
|
|
40
40
|
const pm = (0, _devkit.getPackageManagerCommand)();
|
|
41
41
|
const cp = (0, _nodechild_process.execSync)(`${pm.exec} vue-tsc --noEmit -p ${opts.tsconfig} --composite false`, {
|
|
42
42
|
cwd: opts.workspaceRoot,
|
|
43
|
-
stdio: 'inherit'
|
|
43
|
+
stdio: 'inherit',
|
|
44
|
+
windowsHide: true
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/vite/src/utils/executor-utils.ts"],"sourcesContent":["import { ViteBuildExecutorOptions } from '../executors/build/schema';\nimport { ExecutorContext, getPackageManagerCommand } from '@nx/devkit';\nimport { ViteDevServerExecutorOptions } from '../executors/dev-server/schema';\nimport {\n calculateProjectBuildableDependencies,\n createTmpTsConfig,\n} from '@nx/js/src/utils/buildable-libs-utils';\nimport { getProjectTsConfigPath } from './options-utils';\nimport { execSync } from 'node:child_process';\nimport { printDiagnostics, runTypeCheck } from '@nx/js';\nimport { join } from 'path';\n\nexport async function validateTypes(opts: {\n workspaceRoot: string;\n tsconfig: string;\n isVueProject?: boolean;\n}): Promise<void> {\n if (!opts.isVueProject) {\n const result = await runTypeCheck({\n workspaceRoot: opts.workspaceRoot,\n tsConfigPath: opts.tsconfig.startsWith(opts.workspaceRoot)\n ? opts.tsconfig\n : join(opts.workspaceRoot, opts.tsconfig),\n mode: 'noEmit',\n });\n\n await printDiagnostics(result.errors, result.warnings);\n\n if (result.errors.length > 0) {\n throw new Error('Found type errors. See above.');\n }\n } else {\n const pm = getPackageManagerCommand();\n const cp = execSync(\n `${pm.exec} vue-tsc --noEmit -p ${opts.tsconfig} --composite false`,\n {\n cwd: opts.workspaceRoot,\n stdio: 'inherit',\n }\n );\n }\n}\n\nexport function createBuildableTsConfig(\n projectRoot: string,\n options: { tsConfig?: string; buildLibsFromSource?: boolean },\n context: ExecutorContext\n) {\n const tsConfig = options.tsConfig ?? getProjectTsConfigPath(projectRoot);\n options['buildLibsFromSource'] ??= true;\n\n if (!options['buildLibsFromSource']) {\n const { dependencies } = calculateProjectBuildableDependencies(\n context.taskGraph,\n context.projectGraph,\n context.root,\n context.projectName,\n // When using incremental building and the serve target is called\n // we need to get the deps for the 'build' target instead.\n context.targetName === 'serve' ? 'build' : context.targetName,\n context.configurationName\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 const tmpTsConfigPath = createTmpTsConfig(\n tsConfig,\n context.root,\n projectRoot,\n dependencies\n );\n process.env.NX_TSCONFIG_PATH = tmpTsConfigPath;\n return tmpTsConfigPath;\n }\n return tsConfig;\n}\n\nexport function loadViteDynamicImport() {\n return Function('return import(\"vite\")')() as Promise<typeof import('vite')>;\n}\n\nexport function loadVitestDynamicImport() {\n return Function('return import(\"vitest/node\")')() as Promise<\n typeof import('vitest/node')\n >;\n}\n"],"names":["createBuildableTsConfig","loadViteDynamicImport","loadVitestDynamicImport","validateTypes","opts","isVueProject","result","runTypeCheck","workspaceRoot","tsConfigPath","tsconfig","startsWith","join","mode","printDiagnostics","errors","warnings","length","Error","pm","getPackageManagerCommand","cp","execSync","exec","cwd","stdio","projectRoot","options","context","tsConfig","getProjectTsConfigPath","dependencies","calculateProjectBuildableDependencies","taskGraph","projectGraph","root","projectName","targetName","configurationName","tmpTsConfigPath","createTmpTsConfig","process","env","NX_TSCONFIG_PATH","Function"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/vite/src/utils/executor-utils.ts"],"sourcesContent":["import { ViteBuildExecutorOptions } from '../executors/build/schema';\nimport { ExecutorContext, getPackageManagerCommand } from '@nx/devkit';\nimport { ViteDevServerExecutorOptions } from '../executors/dev-server/schema';\nimport {\n calculateProjectBuildableDependencies,\n createTmpTsConfig,\n} from '@nx/js/src/utils/buildable-libs-utils';\nimport { getProjectTsConfigPath } from './options-utils';\nimport { execSync } from 'node:child_process';\nimport { printDiagnostics, runTypeCheck } from '@nx/js';\nimport { join } from 'path';\n\nexport async function validateTypes(opts: {\n workspaceRoot: string;\n tsconfig: string;\n isVueProject?: boolean;\n}): Promise<void> {\n if (!opts.isVueProject) {\n const result = await runTypeCheck({\n workspaceRoot: opts.workspaceRoot,\n tsConfigPath: opts.tsconfig.startsWith(opts.workspaceRoot)\n ? opts.tsconfig\n : join(opts.workspaceRoot, opts.tsconfig),\n mode: 'noEmit',\n });\n\n await printDiagnostics(result.errors, result.warnings);\n\n if (result.errors.length > 0) {\n throw new Error('Found type errors. See above.');\n }\n } else {\n const pm = getPackageManagerCommand();\n const cp = execSync(\n `${pm.exec} vue-tsc --noEmit -p ${opts.tsconfig} --composite false`,\n {\n cwd: opts.workspaceRoot,\n stdio: 'inherit',\n windowsHide: true,\n }\n );\n }\n}\n\nexport function createBuildableTsConfig(\n projectRoot: string,\n options: { tsConfig?: string; buildLibsFromSource?: boolean },\n context: ExecutorContext\n) {\n const tsConfig = options.tsConfig ?? getProjectTsConfigPath(projectRoot);\n options['buildLibsFromSource'] ??= true;\n\n if (!options['buildLibsFromSource']) {\n const { dependencies } = calculateProjectBuildableDependencies(\n context.taskGraph,\n context.projectGraph,\n context.root,\n context.projectName,\n // When using incremental building and the serve target is called\n // we need to get the deps for the 'build' target instead.\n context.targetName === 'serve' ? 'build' : context.targetName,\n context.configurationName\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 const tmpTsConfigPath = createTmpTsConfig(\n tsConfig,\n context.root,\n projectRoot,\n dependencies\n );\n process.env.NX_TSCONFIG_PATH = tmpTsConfigPath;\n return tmpTsConfigPath;\n }\n return tsConfig;\n}\n\nexport function loadViteDynamicImport() {\n return Function('return import(\"vite\")')() as Promise<typeof import('vite')>;\n}\n\nexport function loadVitestDynamicImport() {\n return Function('return import(\"vitest/node\")')() as Promise<\n typeof import('vitest/node')\n >;\n}\n"],"names":["createBuildableTsConfig","loadViteDynamicImport","loadVitestDynamicImport","validateTypes","opts","isVueProject","result","runTypeCheck","workspaceRoot","tsConfigPath","tsconfig","startsWith","join","mode","printDiagnostics","errors","warnings","length","Error","pm","getPackageManagerCommand","cp","execSync","exec","cwd","stdio","windowsHide","projectRoot","options","context","tsConfig","getProjectTsConfigPath","dependencies","calculateProjectBuildableDependencies","taskGraph","projectGraph","root","projectName","targetName","configurationName","tmpTsConfigPath","createTmpTsConfig","process","env","NX_TSCONFIG_PATH","Function"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;IA4CgBA,uBAAuB;eAAvBA;;IAiCAC,qBAAqB;eAArBA;;IAIAC,uBAAuB;eAAvBA;;IArEMC,aAAa;eAAbA;;;wBAXoC;oCAKnD;8BACgC;mCACd;oBAC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