@nx/vite 19.4.3 → 19.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vite",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.5.0-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for building and testing applications using Vite",
|
|
6
6
|
"repository": {
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"migrations": "./migrations.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@nx/devkit": "19.
|
|
33
|
+
"@nx/devkit": "19.5.0-beta.1",
|
|
34
34
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
35
35
|
"@swc/helpers": "~0.5.0",
|
|
36
36
|
"enquirer": "~2.3.6",
|
|
37
|
-
"@nx/js": "19.
|
|
37
|
+
"@nx/js": "19.5.0-beta.1",
|
|
38
38
|
"tsconfig-paths": "^4.1.2",
|
|
39
|
-
"@nrwl/vite": "19.
|
|
39
|
+
"@nrwl/vite": "19.5.0-beta.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"vite": "^5.0.0",
|
|
@@ -48,14 +48,22 @@ function nxViteBuildCoordinationPlugin(options) {
|
|
|
48
48
|
runner.enqueue(changedProjects, changedFiles);
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
+
let firstBuildStart = true;
|
|
51
52
|
return {
|
|
52
53
|
name: 'nx-vite-build-coordination-plugin',
|
|
53
54
|
async buildStart () {
|
|
54
|
-
if (
|
|
55
|
+
if (firstBuildStart) {
|
|
56
|
+
firstBuildStart = false;
|
|
55
57
|
await buildChangedProjects();
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
if (_client.daemonClient.enabled()) {
|
|
59
|
+
unregisterFileWatcher = await createFileWatcher();
|
|
60
|
+
process.on('exit', ()=>unregisterFileWatcher());
|
|
61
|
+
process.on('SIGINT', ()=>process.exit());
|
|
62
|
+
} else {
|
|
63
|
+
_output.output.warn({
|
|
64
|
+
title: 'Nx Daemon is not enabled. Projects will not be rebuilt when files change.'
|
|
65
|
+
});
|
|
66
|
+
}
|
|
59
67
|
}
|
|
60
68
|
}
|
|
61
69
|
};
|
|
@@ -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 return {\n name: 'nx-vite-build-coordination-plugin',\n async buildStart() {\n if (
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","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,IAAIQ,kBAAkB;IAEtB,OAAO;QACLC,MAAM;QACN,MAAMC;YACJ,IAAIF,iBAAiB;gBACnBA,kBAAkB;gBAClB,MAAM3B;gBACN,IAAIc,oBAAY,CAACgB,OAAO,IAAI;oBAC1B/B,wBAAwB,MAAMY;oBAC9BJ,QAAQE,EAAE,CAAC,QAAQ,IAAMV;oBACzBQ,QAAQE,EAAE,CAAC,UAAU,IAAMF,QAAQiB,IAAI;gBACzC,OAAO;oBACLJ,cAAM,CAACW,IAAI,CAAC;wBACVT,OACE;oBACJ;gBACF;YACF;QACF;IACF;AACF"}
|