@nx/vite 22.4.0-canary.20260113-246d4fd → 22.4.0-canary.20260114-45f2ae3
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 +6 -6
- package/src/generators/convert-to-inferred/lib/build-post-target-transformer.d.ts.map +1 -1
- package/src/generators/convert-to-inferred/lib/build-post-target-transformer.js +7 -11
- package/src/generators/convert-to-inferred/lib/utils.d.ts.map +1 -1
- package/src/generators/convert-to-inferred/lib/utils.js +2 -4
- package/src/migrations/update-20-5-0/update-resolve-conditions.d.ts.map +1 -1
- package/src/migrations/update-20-5-0/update-resolve-conditions.js +5 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/vite",
|
|
3
|
-
"version": "22.4.0-canary.
|
|
3
|
+
"version": "22.4.0-canary.20260114-45f2ae3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for building and testing applications using Vite",
|
|
6
6
|
"repository": {
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"migrations": "./migrations.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@nx/devkit": "22.4.0-canary.
|
|
34
|
-
"@phenomnomnominal/tsquery": "~
|
|
33
|
+
"@nx/devkit": "22.4.0-canary.20260114-45f2ae3",
|
|
34
|
+
"@phenomnomnominal/tsquery": "~6.1.4",
|
|
35
35
|
"enquirer": "~2.3.6",
|
|
36
|
-
"@nx/js": "22.4.0-canary.
|
|
37
|
-
"@nx/vitest": "22.4.0-canary.
|
|
36
|
+
"@nx/js": "22.4.0-canary.20260114-45f2ae3",
|
|
37
|
+
"@nx/vitest": "22.4.0-canary.20260114-45f2ae3",
|
|
38
38
|
"picomatch": "4.0.2",
|
|
39
39
|
"tsconfig-paths": "^4.1.2",
|
|
40
40
|
"semver": "^7.6.3",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"ajv": "^8.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"nx": "22.4.0-canary.
|
|
45
|
+
"nx": "22.4.0-canary.20260114-45f2ae3"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/vite/src/generators/convert-to-inferred/lib/build-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAUpB,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,IAAI,EACV,cAAc,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,2BAA2B,EAAE,mBAAmB,4BAmGjD;AA+CD,wBAAgB,mCAAmC,CACjD,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"build-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/vite/src/generators/convert-to-inferred/lib/build-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAUpB,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,IAAI,EACV,cAAc,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,2BAA2B,EAAE,mBAAmB,4BAmGjD;AA+CD,wBAAgB,mCAAmC,CACjD,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,QA0FnB"}
|
|
@@ -104,21 +104,17 @@ function moveBuildLibsFromSourceToViteConfig(tree, configPath) {
|
|
|
104
104
|
const plugin = `nxViteTsPaths({ buildLibsFromSource: options.buildLibsFromSource }),`;
|
|
105
105
|
const viteConfigContents = tree.read(configPath, 'utf-8');
|
|
106
106
|
let newViteConfigContents = viteConfigContents;
|
|
107
|
-
const
|
|
108
|
-
const buildLibsFromSourceNodes = (0, tsquery_1.
|
|
107
|
+
const sourceFile = (0, tsquery_1.ast)(viteConfigContents);
|
|
108
|
+
const buildLibsFromSourceNodes = (0, tsquery_1.query)(sourceFile, BUILD_LIBS_FROM_SOURCE_SELECTOR);
|
|
109
109
|
if (buildLibsFromSourceNodes.length > 0) {
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
-
const nxViteTsPathsNodes = (0, tsquery_1.
|
|
113
|
-
visitAllChildren: true,
|
|
114
|
-
});
|
|
112
|
+
const nxViteTsPathsNodes = (0, tsquery_1.query)(sourceFile, PLUGINS_NX_VITE_TS_PATHS_SELECTOR);
|
|
115
113
|
if (nxViteTsPathsNodes.length === 0) {
|
|
116
|
-
const pluginsNodes = (0, tsquery_1.
|
|
117
|
-
visitAllChildren: true,
|
|
118
|
-
});
|
|
114
|
+
const pluginsNodes = (0, tsquery_1.query)(sourceFile, PLUGINS_PROPERTY_SELECTOR);
|
|
119
115
|
if (pluginsNodes.length === 0) {
|
|
120
116
|
// Add plugin property
|
|
121
|
-
const configNodes = (0, tsquery_1.
|
|
117
|
+
const configNodes = (0, tsquery_1.query)(sourceFile, 'CallExpression:has(Identifier[name=defineConfig]) > ObjectLiteralExpression');
|
|
122
118
|
if (configNodes.length === 0) {
|
|
123
119
|
return;
|
|
124
120
|
}
|
|
@@ -126,7 +122,7 @@ function moveBuildLibsFromSourceToViteConfig(tree, configPath) {
|
|
|
126
122
|
}
|
|
127
123
|
else {
|
|
128
124
|
// Add nxViteTsPaths plugin
|
|
129
|
-
const pluginsArrayNodes = (0, tsquery_1.
|
|
125
|
+
const pluginsArrayNodes = (0, tsquery_1.query)(pluginsNodes[0], 'ArrayLiteralExpression');
|
|
130
126
|
if (pluginsArrayNodes.length === 0) {
|
|
131
127
|
return;
|
|
132
128
|
}
|
|
@@ -134,7 +130,7 @@ function moveBuildLibsFromSourceToViteConfig(tree, configPath) {
|
|
|
134
130
|
}
|
|
135
131
|
}
|
|
136
132
|
else {
|
|
137
|
-
const pluginOptionsNodes = (0, tsquery_1.
|
|
133
|
+
const pluginOptionsNodes = (0, tsquery_1.query)(nxViteTsPathsNodes[0], 'ObjectLiteralExpression');
|
|
138
134
|
if (pluginOptionsNodes.length === 0) {
|
|
139
135
|
// Add the options
|
|
140
136
|
newViteConfigContents = `${viteConfigContents.slice(0, nxViteTsPathsNodes[0].getStart())}${plugin}${viteConfigContents.slice(nxViteTsPathsNodes[0].getEnd())}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/vite/src/generators/convert-to-inferred/lib/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,IAAI,EAAqB,MAAM,YAAY,CAAC;AAGzE,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,MAAM,CAaR;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UASzD;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/vite/src/generators/convert-to-inferred/lib/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,IAAI,EAAqB,MAAM,YAAY,CAAC;AAGzE,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,MAAM,CAaR;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UASzD;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,QA+BtD"}
|
|
@@ -28,11 +28,9 @@ function getViteConfigPath(tree, root) {
|
|
|
28
28
|
function addConfigValuesToViteConfig(tree, configFile, configValues) {
|
|
29
29
|
const IMPORT_PROPERTY_SELECTOR = 'ImportDeclaration';
|
|
30
30
|
const viteConfigContents = tree.read(configFile, 'utf-8');
|
|
31
|
-
const
|
|
31
|
+
const sourceFile = (0, tsquery_1.ast)(viteConfigContents);
|
|
32
32
|
// AST TO GET SECTION TO APPEND TO
|
|
33
|
-
const importNodes = (0, tsquery_1.
|
|
34
|
-
visitAllChildren: true,
|
|
35
|
-
});
|
|
33
|
+
const importNodes = (0, tsquery_1.query)(sourceFile, IMPORT_PROPERTY_SELECTOR);
|
|
36
34
|
if (importNodes.length === 0) {
|
|
37
35
|
return;
|
|
38
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-resolve-conditions.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/migrations/update-20-5-0/update-resolve-conditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAsB1E,yBAA+B,IAAI,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"update-resolve-conditions.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/migrations/update-20-5-0/update-resolve-conditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAsB1E,yBAA+B,IAAI,EAAE,IAAI,iBAgExC"}
|
|
@@ -26,28 +26,26 @@ async function default_1(tree) {
|
|
|
26
26
|
});
|
|
27
27
|
for (const file of viteFiles) {
|
|
28
28
|
const contents = tree.read(file, 'utf-8');
|
|
29
|
-
const
|
|
30
|
-
const remixImportNodes = (0, tsquery_1.
|
|
31
|
-
visitAllChildren: true,
|
|
32
|
-
});
|
|
29
|
+
const sourceFile = (0, tsquery_1.ast)(contents);
|
|
30
|
+
const remixImportNodes = (0, tsquery_1.query)(sourceFile, REMIX_IMPORT_SELECTOR);
|
|
33
31
|
if (remixImportNodes.length > 0) {
|
|
34
32
|
continue;
|
|
35
33
|
}
|
|
36
|
-
const defineConfigObjectNodes = (0, tsquery_1.
|
|
34
|
+
const defineConfigObjectNodes = (0, tsquery_1.query)(sourceFile, DEFINE_CONFIG_OBJECT_SELECTOR);
|
|
37
35
|
if (defineConfigObjectNodes.length === 0) {
|
|
38
36
|
console.warn(`Could not migrate vite config at ${file}. No "defineConfig" object found. Apply "resolve.conditions: ['module', 'browser', 'development|production']" manually to your vite config.`);
|
|
39
37
|
continue;
|
|
40
38
|
}
|
|
41
39
|
let newContents = contents;
|
|
42
40
|
const defineConfigObjectNode = defineConfigObjectNodes[0];
|
|
43
|
-
const resolvePropertyNodes = (0, tsquery_1.
|
|
41
|
+
const resolvePropertyNodes = (0, tsquery_1.query)(defineConfigObjectNode, RESOLVE_PROPERTY_SELECTOR);
|
|
44
42
|
if (resolvePropertyNodes.length === 0) {
|
|
45
43
|
// Do not add resolve property if it does not already exist
|
|
46
44
|
continue;
|
|
47
45
|
}
|
|
48
46
|
else {
|
|
49
47
|
const resolvePropertyNode = resolvePropertyNodes[0];
|
|
50
|
-
const conditionsPropertyNodes = (0, tsquery_1.
|
|
48
|
+
const conditionsPropertyNodes = (0, tsquery_1.query)(resolvePropertyNode, CONDITIONS_PROPERTY_SELECTOR);
|
|
51
49
|
if (conditionsPropertyNodes.length === 0) {
|
|
52
50
|
// do not add conditions property if it does not already exist
|
|
53
51
|
continue;
|