@nx/vite 21.3.7 → 21.4.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/executors.d.ts +1 -0
- package/executors.d.ts.map +1 -0
- package/executors.js +10 -26
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -0
- package/index.js +12 -26
- package/package.json +7 -4
- package/plugin.d.ts +1 -0
- package/plugin.d.ts.map +1 -0
- package/plugin.js +6 -23
- package/plugins/nx-copy-assets.plugin.d.ts +1 -0
- package/plugins/nx-copy-assets.plugin.d.ts.map +1 -0
- package/plugins/nx-copy-assets.plugin.js +28 -30
- package/plugins/nx-tsconfig-paths.plugin.d.ts +1 -0
- package/plugins/nx-tsconfig-paths.plugin.d.ts.map +1 -0
- package/plugins/nx-tsconfig-paths.plugin.js +86 -88
- package/plugins/nx-vite-build-coordination.plugin.d.ts +1 -0
- package/plugins/nx-vite-build-coordination.plugin.d.ts.map +1 -0
- package/plugins/nx-vite-build-coordination.plugin.js +25 -32
- package/plugins/rollup-replace-files.plugin.d.ts +1 -0
- package/plugins/rollup-replace-files.plugin.d.ts.map +1 -0
- package/plugins/rollup-replace-files.plugin.js +20 -26
- package/project.json +52 -0
- package/src/executors/build/build.impl.d.ts +1 -0
- package/src/executors/build/build.impl.d.ts.map +1 -0
- package/src/executors/build/build.impl.js +98 -112
- package/src/executors/build/compat.d.ts +1 -0
- package/src/executors/build/compat.d.ts.map +1 -0
- package/src/executors/build/compat.js +4 -11
- package/src/executors/dev-server/compat.d.ts +1 -0
- package/src/executors/dev-server/compat.d.ts.map +1 -0
- package/src/executors/dev-server/compat.js +4 -11
- package/src/executors/dev-server/dev-server.impl.d.ts +1 -0
- package/src/executors/dev-server/dev-server.impl.d.ts.map +1 -0
- package/src/executors/dev-server/dev-server.impl.js +54 -62
- package/src/executors/preview-server/compat.d.ts +1 -0
- package/src/executors/preview-server/compat.d.ts.map +1 -0
- package/src/executors/preview-server/compat.js +4 -11
- package/src/executors/preview-server/preview-server.impl.d.ts +1 -0
- package/src/executors/preview-server/preview-server.impl.d.ts.map +1 -0
- package/src/executors/preview-server/preview-server.impl.js +74 -77
- package/src/executors/test/compat.d.ts +1 -0
- package/src/executors/test/compat.d.ts.map +1 -0
- package/src/executors/test/compat.js +4 -11
- package/src/executors/test/lib/nx-reporter.d.ts +1 -0
- package/src/executors/test/lib/nx-reporter.d.ts.map +1 -0
- package/src/executors/test/lib/nx-reporter.js +17 -25
- package/src/executors/test/lib/utils.d.ts +1 -0
- package/src/executors/test/lib/utils.d.ts.map +1 -0
- package/src/executors/test/lib/utils.js +36 -59
- package/src/executors/test/vitest.impl.d.ts +1 -0
- package/src/executors/test/vitest.impl.d.ts.map +1 -0
- package/src/executors/test/vitest.impl.js +29 -43
- package/src/generators/configuration/configuration.d.ts +1 -0
- package/src/generators/configuration/configuration.d.ts.map +1 -0
- package/src/generators/configuration/configuration.js +82 -102
- package/src/generators/configuration/lib/convert-non-vite.d.ts +1 -0
- package/src/generators/configuration/lib/convert-non-vite.d.ts.map +1 -0
- package/src/generators/configuration/lib/convert-non-vite.js +33 -32
- package/src/generators/convert-to-inferred/convert-to-inferred.d.ts +1 -0
- package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +1 -0
- package/src/generators/convert-to-inferred/convert-to-inferred.js +31 -61
- package/src/generators/convert-to-inferred/lib/build-post-target-transformer.d.ts +1 -0
- package/src/generators/convert-to-inferred/lib/build-post-target-transformer.d.ts.map +1 -0
- package/src/generators/convert-to-inferred/lib/build-post-target-transformer.js +46 -58
- package/src/generators/convert-to-inferred/lib/preview-post-target-transformer.d.ts +1 -0
- package/src/generators/convert-to-inferred/lib/preview-post-target-transformer.d.ts.map +1 -0
- package/src/generators/convert-to-inferred/lib/preview-post-target-transformer.js +9 -14
- package/src/generators/convert-to-inferred/lib/serve-post-target-transformer.d.ts +1 -0
- package/src/generators/convert-to-inferred/lib/serve-post-target-transformer.d.ts.map +1 -0
- package/src/generators/convert-to-inferred/lib/serve-post-target-transformer.js +10 -15
- package/src/generators/convert-to-inferred/lib/test-post-target-transformer.d.ts +1 -0
- package/src/generators/convert-to-inferred/lib/test-post-target-transformer.d.ts.map +1 -0
- package/src/generators/convert-to-inferred/lib/test-post-target-transformer.js +16 -23
- package/src/generators/convert-to-inferred/lib/utils.d.ts +1 -0
- package/src/generators/convert-to-inferred/lib/utils.d.ts.map +1 -0
- package/src/generators/convert-to-inferred/lib/utils.js +18 -33
- package/src/generators/init/init.d.ts +1 -0
- package/src/generators/init/init.d.ts.map +1 -0
- package/src/generators/init/init.js +44 -96
- package/src/generators/init/lib/utils.d.ts +1 -0
- package/src/generators/init/lib/utils.d.ts.map +1 -0
- package/src/generators/init/lib/utils.js +20 -35
- package/src/generators/setup-paths-plugin/lib/utils.d.ts +1 -0
- package/src/generators/setup-paths-plugin/lib/utils.d.ts.map +1 -0
- package/src/generators/setup-paths-plugin/lib/utils.js +0 -3
- package/src/generators/setup-paths-plugin/setup-paths-plugin.d.ts +1 -0
- package/src/generators/setup-paths-plugin/setup-paths-plugin.d.ts.map +1 -0
- package/src/generators/setup-paths-plugin/setup-paths-plugin.js +45 -54
- package/src/generators/vitest/vitest-generator.d.ts +1 -0
- package/src/generators/vitest/vitest-generator.d.ts.map +1 -0
- package/src/generators/vitest/vitest-generator.js +134 -174
- package/src/migrations/update-19-6-0/add-depends-on-for-preview.d.ts +1 -0
- package/src/migrations/update-19-6-0/add-depends-on-for-preview.d.ts.map +1 -0
- package/src/migrations/update-19-6-0/add-depends-on-for-preview.js +10 -18
- package/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore.d.ts +1 -0
- package/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore.d.ts.map +1 -0
- package/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore.js +4 -10
- package/src/migrations/update-20-3-0/add-vitest-temp-files-to-git-ignore.d.ts +1 -0
- package/src/migrations/update-20-3-0/add-vitest-temp-files-to-git-ignore.d.ts.map +1 -0
- package/src/migrations/update-20-3-0/add-vitest-temp-files-to-git-ignore.js +4 -10
- package/src/migrations/update-20-5-0/eslint-ignore-vite-temp-files.d.ts +1 -0
- package/src/migrations/update-20-5-0/eslint-ignore-vite-temp-files.d.ts.map +1 -0
- package/src/migrations/update-20-5-0/eslint-ignore-vite-temp-files.js +20 -24
- package/src/migrations/update-20-5-0/install-jiti.d.ts +1 -0
- package/src/migrations/update-20-5-0/install-jiti.d.ts.map +1 -0
- package/src/migrations/update-20-5-0/install-jiti.js +6 -12
- package/src/migrations/update-20-5-0/update-resolve-conditions.d.ts +1 -0
- package/src/migrations/update-20-5-0/update-resolve-conditions.d.ts.map +1 -0
- package/src/migrations/update-20-5-0/update-resolve-conditions.js +26 -28
- package/src/plugins/plugin.d.ts +1 -0
- package/src/plugins/plugin.d.ts.map +1 -0
- package/src/plugins/plugin.js +189 -267
- package/src/utils/detect-ui-framework.d.ts +1 -0
- package/src/utils/detect-ui-framework.d.ts.map +1 -0
- package/src/utils/detect-ui-framework.js +9 -20
- package/src/utils/e2e-web-server-info-utils.d.ts +1 -0
- package/src/utils/e2e-web-server-info-utils.d.ts.map +1 -0
- package/src/utils/e2e-web-server-info-utils.js +23 -35
- package/src/utils/ensure-dependencies.d.ts +1 -0
- package/src/utils/ensure-dependencies.d.ts.map +1 -0
- package/src/utils/ensure-dependencies.js +24 -26
- package/src/utils/executor-utils.d.ts +1 -0
- package/src/utils/executor-utils.d.ts.map +1 -0
- package/src/utils/executor-utils.js +27 -43
- package/src/utils/find-vite-config.d.ts +1 -0
- package/src/utils/find-vite-config.d.ts.map +1 -0
- package/src/utils/find-vite-config.js +12 -37
- package/src/utils/generator-utils.d.ts +1 -0
- package/src/utils/generator-utils.d.ts.map +1 -0
- package/src/utils/generator-utils.js +204 -216
- package/src/utils/ignore-vite-temp-files.d.ts +1 -0
- package/src/utils/ignore-vite-temp-files.d.ts.map +1 -0
- package/src/utils/ignore-vite-temp-files.js +22 -32
- package/src/utils/nx-tsconfig-paths-find-file.d.ts +1 -0
- package/src/utils/nx-tsconfig-paths-find-file.d.ts.map +1 -0
- package/src/utils/nx-tsconfig-paths-find-file.js +10 -16
- package/src/utils/options-utils.d.ts +1 -0
- package/src/utils/options-utils.d.ts.map +1 -0
- package/src/utils/options-utils.js +48 -58
- package/src/utils/test-files/test-vite-configs.d.ts +1 -0
- package/src/utils/test-files/test-vite-configs.d.ts.map +1 -0
- package/src/utils/test-files/test-vite-configs.js +21 -82
- package/src/utils/test-utils.d.ts +1 -0
- package/src/utils/test-utils.d.ts.map +1 -0
- package/src/utils/test-utils.js +103 -130
- package/src/utils/version-utils.d.ts +1 -0
- package/src/utils/version-utils.d.ts.map +1 -0
- package/src/utils/version-utils.js +26 -44
- package/src/utils/versions.d.ts +1 -0
- package/src/utils/versions.d.ts.map +1 -0
- package/src/utils/versions.js +22 -82
- package/src/utils/vite-config-edit-utils.d.ts +1 -0
- package/src/utils/vite-config-edit-utils.d.ts.map +1 -0
- package/src/utils/vite-config-edit-utils.js +145 -125
- package/executors.js.map +0 -1
- package/index.js.map +0 -1
- package/plugin.js.map +0 -1
- package/plugins/nx-copy-assets.plugin.js.map +0 -1
- package/plugins/nx-tsconfig-paths.plugin.js.map +0 -1
- package/plugins/nx-vite-build-coordination.plugin.js.map +0 -1
- package/plugins/rollup-replace-files.plugin.js.map +0 -1
- package/src/executors/build/build.impl.js.map +0 -1
- package/src/executors/build/compat.js.map +0 -1
- package/src/executors/build/schema.d.js +0 -3
- package/src/executors/build/schema.d.js.map +0 -1
- package/src/executors/dev-server/compat.js.map +0 -1
- package/src/executors/dev-server/dev-server.impl.js.map +0 -1
- package/src/executors/dev-server/schema.d.js +0 -3
- package/src/executors/dev-server/schema.d.js.map +0 -1
- package/src/executors/preview-server/compat.js.map +0 -1
- package/src/executors/preview-server/preview-server.impl.js.map +0 -1
- package/src/executors/preview-server/schema.d.js +0 -3
- package/src/executors/preview-server/schema.d.js.map +0 -1
- package/src/executors/test/compat.js.map +0 -1
- package/src/executors/test/lib/nx-reporter.js.map +0 -1
- package/src/executors/test/lib/utils.js.map +0 -1
- package/src/executors/test/schema.d.js +0 -3
- package/src/executors/test/schema.d.js.map +0 -1
- package/src/executors/test/vitest.impl.js.map +0 -1
- package/src/generators/configuration/configuration.js.map +0 -1
- package/src/generators/configuration/lib/convert-non-vite.js.map +0 -1
- package/src/generators/configuration/schema.d.js +0 -3
- package/src/generators/configuration/schema.d.js.map +0 -1
- package/src/generators/convert-to-inferred/convert-to-inferred.js.map +0 -1
- package/src/generators/convert-to-inferred/lib/build-post-target-transformer.js.map +0 -1
- package/src/generators/convert-to-inferred/lib/preview-post-target-transformer.js.map +0 -1
- package/src/generators/convert-to-inferred/lib/serve-post-target-transformer.js.map +0 -1
- package/src/generators/convert-to-inferred/lib/test-post-target-transformer.js.map +0 -1
- package/src/generators/convert-to-inferred/lib/utils.js.map +0 -1
- package/src/generators/init/init.js.map +0 -1
- package/src/generators/init/lib/utils.js.map +0 -1
- package/src/generators/init/schema.d.js +0 -3
- package/src/generators/init/schema.d.js.map +0 -1
- package/src/generators/setup-paths-plugin/lib/utils.js.map +0 -1
- package/src/generators/setup-paths-plugin/schema.d.js +0 -3
- package/src/generators/setup-paths-plugin/schema.d.js.map +0 -1
- package/src/generators/setup-paths-plugin/setup-paths-plugin.js.map +0 -1
- package/src/generators/vitest/schema.d.js +0 -3
- package/src/generators/vitest/schema.d.js.map +0 -1
- package/src/generators/vitest/vitest-generator.js.map +0 -1
- package/src/migrations/update-19-6-0/add-depends-on-for-preview.js.map +0 -1
- package/src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore.js.map +0 -1
- package/src/migrations/update-20-3-0/add-vitest-temp-files-to-git-ignore.js.map +0 -1
- package/src/migrations/update-20-5-0/eslint-ignore-vite-temp-files.js.map +0 -1
- package/src/migrations/update-20-5-0/install-jiti.js.map +0 -1
- package/src/migrations/update-20-5-0/update-resolve-conditions.js.map +0 -1
- package/src/plugins/plugin.js.map +0 -1
- package/src/utils/detect-ui-framework.js.map +0 -1
- package/src/utils/e2e-web-server-info-utils.js.map +0 -1
- package/src/utils/ensure-dependencies.js.map +0 -1
- package/src/utils/executor-utils.js.map +0 -1
- package/src/utils/find-vite-config.js.map +0 -1
- package/src/utils/generator-utils.js.map +0 -1
- package/src/utils/ignore-vite-temp-files.js.map +0 -1
- package/src/utils/nx-tsconfig-paths-find-file.js.map +0 -1
- package/src/utils/options-utils.js.map +0 -1
- package/src/utils/test-files/test-vite-configs.js.map +0 -1
- package/src/utils/test-utils.js.map +0 -1
- package/src/utils/version-utils.js.map +0 -1
- package/src/utils/versions.js.map +0 -1
- package/src/utils/vite-config-edit-utils.js.map +0 -1
|
@@ -1,83 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
default: function() {
|
|
13
|
-
return _default;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
const _devkit = require("@nx/devkit");
|
|
17
|
-
const _executortopluginmigrator = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
|
|
18
|
-
const _plugin = require("../../plugins/plugin");
|
|
19
|
-
const _buildposttargettransformer = require("./lib/build-post-target-transformer");
|
|
20
|
-
const _serveposttargettransformer = require("./lib/serve-post-target-transformer");
|
|
21
|
-
const _previewposttargettransformer = require("./lib/preview-post-target-transformer");
|
|
22
|
-
const _testposttargettransformer = require("./lib/test-post-target-transformer");
|
|
23
|
-
const _aggregatelogutil = require("@nx/devkit/src/generators/plugin-migrations/aggregate-log-util");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertToInferred = convertToInferred;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const executor_to_plugin_migrator_1 = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
|
|
6
|
+
const plugin_1 = require("../../plugins/plugin");
|
|
7
|
+
const build_post_target_transformer_1 = require("./lib/build-post-target-transformer");
|
|
8
|
+
const serve_post_target_transformer_1 = require("./lib/serve-post-target-transformer");
|
|
9
|
+
const preview_post_target_transformer_1 = require("./lib/preview-post-target-transformer");
|
|
10
|
+
const test_post_target_transformer_1 = require("./lib/test-post-target-transformer");
|
|
11
|
+
const aggregate_log_util_1 = require("@nx/devkit/src/generators/plugin-migrations/aggregate-log-util");
|
|
24
12
|
async function convertToInferred(tree, options) {
|
|
25
|
-
const projectGraph = await (0,
|
|
26
|
-
const migrationLogs = new
|
|
27
|
-
const migratedProjects = await (0,
|
|
13
|
+
const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
|
|
14
|
+
const migrationLogs = new aggregate_log_util_1.AggregatedLog();
|
|
15
|
+
const migratedProjects = await (0, executor_to_plugin_migrator_1.migrateProjectExecutorsToPlugin)(tree, projectGraph, '@nx/vite/plugin', plugin_1.createNodesV2, {
|
|
28
16
|
buildTargetName: 'build',
|
|
29
17
|
serveTargetName: 'serve',
|
|
30
18
|
previewTargetName: 'preview',
|
|
31
19
|
testTargetName: 'test',
|
|
32
|
-
serveStaticTargetName: 'serve-static'
|
|
20
|
+
serveStaticTargetName: 'serve-static',
|
|
33
21
|
}, [
|
|
34
22
|
{
|
|
35
|
-
executors: [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
postTargetTransformer: _buildposttargettransformer.buildPostTargetTransformer,
|
|
39
|
-
targetPluginOptionMapper: (target)=>({
|
|
40
|
-
buildTargetName: target
|
|
41
|
-
})
|
|
23
|
+
executors: ['@nx/vite:build'],
|
|
24
|
+
postTargetTransformer: build_post_target_transformer_1.buildPostTargetTransformer,
|
|
25
|
+
targetPluginOptionMapper: (target) => ({ buildTargetName: target }),
|
|
42
26
|
},
|
|
43
27
|
{
|
|
44
|
-
executors: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
postTargetTransformer: (0, _serveposttargettransformer.servePostTargetTransformer)(migrationLogs),
|
|
48
|
-
targetPluginOptionMapper: (target)=>({
|
|
49
|
-
serveTargetName: target
|
|
50
|
-
})
|
|
28
|
+
executors: ['@nx/vite:dev-server'],
|
|
29
|
+
postTargetTransformer: (0, serve_post_target_transformer_1.servePostTargetTransformer)(migrationLogs),
|
|
30
|
+
targetPluginOptionMapper: (target) => ({ serveTargetName: target }),
|
|
51
31
|
},
|
|
52
32
|
{
|
|
53
|
-
executors: [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
postTargetTransformer: (0, _previewposttargettransformer.previewPostTargetTransformer)(migrationLogs),
|
|
57
|
-
targetPluginOptionMapper: (target)=>({
|
|
58
|
-
previewTargetName: target
|
|
59
|
-
})
|
|
33
|
+
executors: ['@nx/vite:preview-server'],
|
|
34
|
+
postTargetTransformer: (0, preview_post_target_transformer_1.previewPostTargetTransformer)(migrationLogs),
|
|
35
|
+
targetPluginOptionMapper: (target) => ({ previewTargetName: target }),
|
|
60
36
|
},
|
|
61
37
|
{
|
|
62
|
-
executors: [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
targetPluginOptionMapper: (target)=>({
|
|
67
|
-
testTargetName: target
|
|
68
|
-
})
|
|
69
|
-
}
|
|
38
|
+
executors: ['@nx/vite:test'],
|
|
39
|
+
postTargetTransformer: test_post_target_transformer_1.testPostTargetTransformer,
|
|
40
|
+
targetPluginOptionMapper: (target) => ({ testTargetName: target }),
|
|
41
|
+
},
|
|
70
42
|
], options.project);
|
|
71
43
|
if (migratedProjects.size === 0) {
|
|
72
|
-
throw new
|
|
44
|
+
throw new executor_to_plugin_migrator_1.NoTargetsToMigrateError();
|
|
73
45
|
}
|
|
74
46
|
if (!options.skipFormat) {
|
|
75
|
-
await (0,
|
|
47
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
76
48
|
}
|
|
77
|
-
return ()=>{
|
|
49
|
+
return () => {
|
|
78
50
|
migrationLogs.flushLogs();
|
|
79
51
|
};
|
|
80
52
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
//# sourceMappingURL=convert-to-inferred.js.map
|
|
53
|
+
exports.default = convertToInferred;
|
|
@@ -4,3 +4,4 @@ export declare function buildPostTargetTransformer(target: TargetConfiguration,
|
|
|
4
4
|
root: string;
|
|
5
5
|
}, inferredTargetConfiguration: TargetConfiguration): TargetConfiguration<any>;
|
|
6
6
|
export declare function moveBuildLibsFromSourceToViteConfig(tree: Tree, configPath: string): void;
|
|
7
|
+
//# sourceMappingURL=build-post-target-transformer.d.ts.map
|
|
@@ -0,0 +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,QA6FnB"}
|
|
@@ -1,46 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return buildPostTargetTransformer;
|
|
11
|
-
},
|
|
12
|
-
moveBuildLibsFromSourceToViteConfig: function() {
|
|
13
|
-
return moveBuildLibsFromSourceToViteConfig;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
const _devkit = require("@nx/devkit");
|
|
17
|
-
const _tsquery = require("@phenomnomnominal/tsquery");
|
|
18
|
-
const _posix = require("path/posix");
|
|
19
|
-
const _utils = require("./utils");
|
|
20
|
-
const _pluginmigrationutils = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildPostTargetTransformer = buildPostTargetTransformer;
|
|
4
|
+
exports.moveBuildLibsFromSourceToViteConfig = moveBuildLibsFromSourceToViteConfig;
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
7
|
+
const posix_1 = require("path/posix");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
|
|
21
10
|
function buildPostTargetTransformer(target, tree, projectDetails, inferredTargetConfiguration) {
|
|
22
|
-
let viteConfigPath = (0,
|
|
11
|
+
let viteConfigPath = (0, utils_1.getViteConfigPath)(tree, projectDetails.root);
|
|
23
12
|
const configValues = {
|
|
24
|
-
default: {}
|
|
13
|
+
default: {},
|
|
25
14
|
};
|
|
26
15
|
if (target.configurations) {
|
|
27
|
-
for(const configurationName in target.configurations){
|
|
16
|
+
for (const configurationName in target.configurations) {
|
|
28
17
|
const configuration = target.configurations[configurationName];
|
|
29
18
|
configValues[configurationName] = {};
|
|
30
19
|
let configurationConfigFile = viteConfigPath;
|
|
31
20
|
if (configuration.configFile) {
|
|
32
21
|
if ('buildLibsFromSource' in target.options) {
|
|
33
|
-
configuration.buildLibsFromSource =
|
|
22
|
+
configuration.buildLibsFromSource =
|
|
23
|
+
target.options.buildLibsFromSource;
|
|
34
24
|
}
|
|
35
25
|
configurationConfigFile = configuration.configFile;
|
|
36
26
|
}
|
|
37
27
|
removePropertiesFromTargetOptions(tree, configuration, configurationConfigFile, projectDetails.root, configValues[configurationName], configuration.configFile && configuration.configFile !== viteConfigPath);
|
|
38
28
|
}
|
|
39
|
-
for(const configurationName in target.configurations){
|
|
29
|
+
for (const configurationName in target.configurations) {
|
|
40
30
|
const configuration = target.configurations[configurationName];
|
|
41
|
-
if (configuration.config &&
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
if (configuration.config &&
|
|
32
|
+
configuration.config !==
|
|
33
|
+
(0, utils_1.toProjectRelativePath)(viteConfigPath, projectDetails.root)) {
|
|
34
|
+
const configFilePath = (0, devkit_1.joinPathFragments)(projectDetails.root, configuration.config);
|
|
35
|
+
(0, utils_1.addConfigValuesToViteConfig)(tree, configFilePath, configValues);
|
|
44
36
|
}
|
|
45
37
|
}
|
|
46
38
|
if (Object.keys(target.configurations).length === 0) {
|
|
@@ -49,7 +41,8 @@ function buildPostTargetTransformer(target, tree, projectDetails, inferredTarget
|
|
|
49
41
|
}
|
|
50
42
|
delete target.configurations;
|
|
51
43
|
}
|
|
52
|
-
if ('defaultConfiguration' in target &&
|
|
44
|
+
if ('defaultConfiguration' in target &&
|
|
45
|
+
!target.configurations[target.defaultConfiguration]) {
|
|
53
46
|
delete target.defaultConfiguration;
|
|
54
47
|
}
|
|
55
48
|
}
|
|
@@ -60,29 +53,25 @@ function buildPostTargetTransformer(target, tree, projectDetails, inferredTarget
|
|
|
60
53
|
removePropertiesFromTargetOptions(tree, target.options, viteConfigPath, projectDetails.root, configValues['default'], true);
|
|
61
54
|
}
|
|
62
55
|
if (target.outputs) {
|
|
63
|
-
(0,
|
|
64
|
-
{
|
|
65
|
-
newName: 'outDir',
|
|
66
|
-
oldName: 'outputPath'
|
|
67
|
-
}
|
|
68
|
-
], inferredTargetConfiguration, {
|
|
56
|
+
(0, plugin_migration_utils_1.processTargetOutputs)(target, [{ newName: 'outDir', oldName: 'outputPath' }], inferredTargetConfiguration, {
|
|
69
57
|
projectName: projectDetails.projectName,
|
|
70
|
-
projectRoot: projectDetails.root
|
|
58
|
+
projectRoot: projectDetails.root,
|
|
71
59
|
});
|
|
72
60
|
}
|
|
73
|
-
if (target.inputs &&
|
|
61
|
+
if (target.inputs &&
|
|
62
|
+
target.inputs.every((i) => i === 'production' || i === '^production')) {
|
|
74
63
|
delete target.inputs;
|
|
75
64
|
}
|
|
76
|
-
(0,
|
|
65
|
+
(0, utils_1.addConfigValuesToViteConfig)(tree, viteConfigPath, configValues);
|
|
77
66
|
return target;
|
|
78
67
|
}
|
|
79
68
|
function removePropertiesFromTargetOptions(tree, targetOptions, viteConfigPath, projectRoot, configValues, needsAstTransform = false) {
|
|
80
69
|
if ('configFile' in targetOptions) {
|
|
81
|
-
targetOptions.config = (0,
|
|
70
|
+
targetOptions.config = (0, utils_1.toProjectRelativePath)(targetOptions.configFile, projectRoot);
|
|
82
71
|
delete targetOptions.configFile;
|
|
83
72
|
}
|
|
84
73
|
if (targetOptions.outputPath) {
|
|
85
|
-
targetOptions.outDir = (0,
|
|
74
|
+
targetOptions.outDir = (0, utils_1.toProjectRelativePath)(targetOptions.outputPath, projectRoot);
|
|
86
75
|
delete targetOptions.outputPath;
|
|
87
76
|
}
|
|
88
77
|
if ('buildLibsFromSource' in targetOptions) {
|
|
@@ -109,52 +98,51 @@ function moveBuildLibsFromSourceToViteConfig(tree, configPath) {
|
|
|
109
98
|
const PLUGINS_PROPERTY_SELECTOR = 'PropertyAssignment:has(Identifier[name=plugins])';
|
|
110
99
|
const PLUGINS_NX_VITE_TS_PATHS_SELECTOR = 'PropertyAssignment:has(Identifier[name=plugins]) CallExpression:has(Identifier[name=nxViteTsPaths])';
|
|
111
100
|
const BUILD_LIBS_FROM_SOURCE_SELECTOR = 'PropertyAssignment:has(Identifier[name=plugins]) CallExpression:has(Identifier[name=nxViteTsPaths]) ObjectLiteralExpression > PropertyAssignment:has(Identifier[name=buildLibsFromSource])';
|
|
112
|
-
const nxViteTsPathsImport = (0,
|
|
101
|
+
const nxViteTsPathsImport = (0, posix_1.extname)(configPath) === 'js'
|
|
102
|
+
? 'const {nxViteTsPaths} = require("@nx/vite/plugins/nx-tsconfig-paths.plugin");'
|
|
103
|
+
: 'import { nxViteTsPaths } from "@nx/vite/plugins/nx-tsconfig-paths.plugin";';
|
|
113
104
|
const plugin = `nxViteTsPaths({ buildLibsFromSource: options.buildLibsFromSource }),`;
|
|
114
105
|
const viteConfigContents = tree.read(configPath, 'utf-8');
|
|
115
106
|
let newViteConfigContents = viteConfigContents;
|
|
116
|
-
const ast =
|
|
117
|
-
const buildLibsFromSourceNodes = (0,
|
|
118
|
-
visitAllChildren: true
|
|
119
|
-
});
|
|
107
|
+
const ast = tsquery_1.tsquery.ast(viteConfigContents);
|
|
108
|
+
const buildLibsFromSourceNodes = (0, tsquery_1.tsquery)(ast, BUILD_LIBS_FROM_SOURCE_SELECTOR, { visitAllChildren: true });
|
|
120
109
|
if (buildLibsFromSourceNodes.length > 0) {
|
|
121
110
|
return;
|
|
122
111
|
}
|
|
123
|
-
const nxViteTsPathsNodes = (0,
|
|
124
|
-
visitAllChildren: true
|
|
112
|
+
const nxViteTsPathsNodes = (0, tsquery_1.tsquery)(ast, PLUGINS_NX_VITE_TS_PATHS_SELECTOR, {
|
|
113
|
+
visitAllChildren: true,
|
|
125
114
|
});
|
|
126
115
|
if (nxViteTsPathsNodes.length === 0) {
|
|
127
|
-
const pluginsNodes = (0,
|
|
128
|
-
visitAllChildren: true
|
|
116
|
+
const pluginsNodes = (0, tsquery_1.tsquery)(ast, PLUGINS_PROPERTY_SELECTOR, {
|
|
117
|
+
visitAllChildren: true,
|
|
129
118
|
});
|
|
130
119
|
if (pluginsNodes.length === 0) {
|
|
131
120
|
// Add plugin property
|
|
132
|
-
const configNodes = (0,
|
|
133
|
-
visitAllChildren: true
|
|
134
|
-
});
|
|
121
|
+
const configNodes = (0, tsquery_1.tsquery)(ast, 'CallExpression:has(Identifier[name=defineConfig]) > ObjectLiteralExpression', { visitAllChildren: true });
|
|
135
122
|
if (configNodes.length === 0) {
|
|
136
123
|
return;
|
|
137
124
|
}
|
|
138
125
|
newViteConfigContents = `${nxViteTsPathsImport}\n${viteConfigContents.slice(0, configNodes[0].getStart() + 1)}plugins: [${plugin}],${viteConfigContents.slice(configNodes[0].getStart() + 1)}`;
|
|
139
|
-
}
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
140
128
|
// Add nxViteTsPaths plugin
|
|
141
|
-
const pluginsArrayNodes = (0,
|
|
129
|
+
const pluginsArrayNodes = (0, tsquery_1.tsquery)(pluginsNodes[0], 'ArrayLiteralExpression');
|
|
142
130
|
if (pluginsArrayNodes.length === 0) {
|
|
143
131
|
return;
|
|
144
132
|
}
|
|
145
133
|
newViteConfigContents = `${nxViteTsPathsImport}\n${viteConfigContents.slice(0, pluginsArrayNodes[0].getStart() + 1)}${plugin}${viteConfigContents.slice(pluginsArrayNodes[0].getStart() + 1)}`;
|
|
146
134
|
}
|
|
147
|
-
}
|
|
148
|
-
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
const pluginOptionsNodes = (0, tsquery_1.tsquery)(nxViteTsPathsNodes[0], 'ObjectLiteralExpression');
|
|
149
138
|
if (pluginOptionsNodes.length === 0) {
|
|
150
139
|
// Add the options
|
|
151
140
|
newViteConfigContents = `${viteConfigContents.slice(0, nxViteTsPathsNodes[0].getStart())}${plugin}${viteConfigContents.slice(nxViteTsPathsNodes[0].getEnd())}`;
|
|
152
|
-
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
153
143
|
// update the object
|
|
154
144
|
newViteConfigContents = `${viteConfigContents.slice(0, pluginOptionsNodes[0].getStart() + 1)}buildLibsFromSource: options.buildLibsFromSource, ${viteConfigContents.slice(pluginOptionsNodes[0].getStart() + 1)}`;
|
|
155
145
|
}
|
|
156
146
|
}
|
|
157
147
|
tree.write(configPath, newViteConfigContents);
|
|
158
148
|
}
|
|
159
|
-
|
|
160
|
-
//# sourceMappingURL=build-post-target-transformer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/vite/src/generators/convert-to-inferred/lib/preview-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,gEAAgE,CAAC;AAE/F,wBAAgB,4BAA4B,CAAC,aAAa,EAAE,aAAa,IAErE,QAAQ,mBAAmB,EAC3B,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,6BAA6B,mBAAmB,8BAuCnD"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return previewPostTargetTransformer;
|
|
6
|
-
}
|
|
7
|
-
});
|
|
8
|
-
const _utils = require("./utils");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.previewPostTargetTransformer = previewPostTargetTransformer;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
9
5
|
function previewPostTargetTransformer(migrationLogs) {
|
|
10
|
-
return (target, tree, projectDetails, inferredTargetConfiguration)=>{
|
|
11
|
-
const viteConfigPath = (0,
|
|
6
|
+
return (target, tree, projectDetails, inferredTargetConfiguration) => {
|
|
7
|
+
const viteConfigPath = (0, utils_1.getViteConfigPath)(tree, projectDetails.root);
|
|
12
8
|
if (target.options) {
|
|
13
9
|
removePropertiesFromTargetOptions(target.options, projectDetails.projectName, migrationLogs);
|
|
14
10
|
}
|
|
15
11
|
if (target.configurations) {
|
|
16
|
-
for(const configurationName in target.configurations){
|
|
12
|
+
for (const configurationName in target.configurations) {
|
|
17
13
|
const configuration = target.configurations[configurationName];
|
|
18
14
|
removePropertiesFromTargetOptions(configuration, projectDetails.projectName, migrationLogs);
|
|
19
15
|
}
|
|
@@ -23,7 +19,8 @@ function previewPostTargetTransformer(migrationLogs) {
|
|
|
23
19
|
}
|
|
24
20
|
delete target.configurations;
|
|
25
21
|
}
|
|
26
|
-
if ('defaultConfiguration' in target &&
|
|
22
|
+
if ('defaultConfiguration' in target &&
|
|
23
|
+
!target.configurations[target.defaultConfiguration]) {
|
|
27
24
|
delete target.defaultConfiguration;
|
|
28
25
|
}
|
|
29
26
|
}
|
|
@@ -41,10 +38,8 @@ function removePropertiesFromTargetOptions(targetOptions, projectName, migration
|
|
|
41
38
|
migrationLogs.addLog({
|
|
42
39
|
executorName: '@nx/vite:preview-server',
|
|
43
40
|
project: projectName,
|
|
44
|
-
log: `Encountered 'proxyConfig' in project.json. You will need to copy the contents of this file to the 'server.proxy' property in your Vite config file
|
|
41
|
+
log: `Encountered 'proxyConfig' in project.json. You will need to copy the contents of this file to the 'server.proxy' property in your Vite config file.`,
|
|
45
42
|
});
|
|
46
43
|
delete targetOptions.proxyConfig;
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=preview-post-target-transformer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/vite/src/generators/convert-to-inferred/lib/serve-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,gEAAgE,CAAC;AAE/F,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,aAAa,IAEnE,QAAQ,mBAAmB,EAC3B,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,6BAA6B,mBAAmB,8BA8CnD"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return servePostTargetTransformer;
|
|
6
|
-
}
|
|
7
|
-
});
|
|
8
|
-
const _utils = require("./utils");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.servePostTargetTransformer = servePostTargetTransformer;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
9
5
|
function servePostTargetTransformer(migrationLogs) {
|
|
10
|
-
return (target, tree, projectDetails, inferredTargetConfiguration)=>{
|
|
11
|
-
const viteConfigPath = (0,
|
|
6
|
+
return (target, tree, projectDetails, inferredTargetConfiguration) => {
|
|
7
|
+
const viteConfigPath = (0, utils_1.getViteConfigPath)(tree, projectDetails.root);
|
|
12
8
|
if (target.options) {
|
|
13
9
|
removePropertiesFromTargetOptions(tree, target.options, viteConfigPath, projectDetails.root, projectDetails.projectName, migrationLogs, true);
|
|
14
10
|
}
|
|
15
11
|
if (target.configurations) {
|
|
16
|
-
for(const configurationName in target.configurations){
|
|
12
|
+
for (const configurationName in target.configurations) {
|
|
17
13
|
const configuration = target.configurations[configurationName];
|
|
18
14
|
removePropertiesFromTargetOptions(tree, configuration, viteConfigPath, projectDetails.root, projectDetails.projectName, migrationLogs);
|
|
19
15
|
}
|
|
@@ -23,7 +19,8 @@ function servePostTargetTransformer(migrationLogs) {
|
|
|
23
19
|
}
|
|
24
20
|
delete target.configurations;
|
|
25
21
|
}
|
|
26
|
-
if ('defaultConfiguration' in target &&
|
|
22
|
+
if ('defaultConfiguration' in target &&
|
|
23
|
+
!target.configurations[target.defaultConfiguration]) {
|
|
27
24
|
delete target.defaultConfiguration;
|
|
28
25
|
}
|
|
29
26
|
}
|
|
@@ -38,7 +35,7 @@ function removePropertiesFromTargetOptions(tree, targetOptions, viteConfigPath,
|
|
|
38
35
|
migrationLogs.addLog({
|
|
39
36
|
executorName: '@nx/vite:dev-server',
|
|
40
37
|
project: projectName,
|
|
41
|
-
log: `Encountered 'buildLibsFromSource' in project.json. This property will be added to your Vite config file via the '@nx/vite:build' executor migration
|
|
38
|
+
log: `Encountered 'buildLibsFromSource' in project.json. This property will be added to your Vite config file via the '@nx/vite:build' executor migration.`,
|
|
42
39
|
});
|
|
43
40
|
delete targetOptions.buildLibsFromSource;
|
|
44
41
|
}
|
|
@@ -49,10 +46,8 @@ function removePropertiesFromTargetOptions(tree, targetOptions, viteConfigPath,
|
|
|
49
46
|
migrationLogs.addLog({
|
|
50
47
|
executorName: '@nx/vite:dev-server',
|
|
51
48
|
project: projectName,
|
|
52
|
-
log: `Encountered 'proxyConfig' in project.json. You will need to copy the contents of this file to the 'server.proxy' property in your Vite config file
|
|
49
|
+
log: `Encountered 'proxyConfig' in project.json. You will need to copy the contents of this file to the 'server.proxy' property in your Vite config file.`,
|
|
53
50
|
});
|
|
54
51
|
delete targetOptions.proxyConfig;
|
|
55
52
|
}
|
|
56
53
|
}
|
|
57
|
-
|
|
58
|
-
//# sourceMappingURL=serve-post-target-transformer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/vite/src/generators/convert-to-inferred/lib/test-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAIjE,wBAAgB,yBAAyB,CACvC,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,4BA+CjD"}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
});
|
|
8
|
-
const _utils = require("./utils");
|
|
9
|
-
const _pluginmigrationutils = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.testPostTargetTransformer = testPostTargetTransformer;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
|
|
10
6
|
function testPostTargetTransformer(target, tree, projectDetails, inferredTargetConfiguration) {
|
|
11
7
|
if (target.options) {
|
|
12
8
|
removePropertiesFromTargetOptions(target.options, projectDetails.root);
|
|
13
9
|
}
|
|
14
10
|
if (target.configurations) {
|
|
15
|
-
for(const configurationName in target.configurations){
|
|
11
|
+
for (const configurationName in target.configurations) {
|
|
16
12
|
const configuration = target.configurations[configurationName];
|
|
17
13
|
removePropertiesFromTargetOptions(configuration, projectDetails.root);
|
|
18
14
|
}
|
|
@@ -22,42 +18,39 @@ function testPostTargetTransformer(target, tree, projectDetails, inferredTargetC
|
|
|
22
18
|
}
|
|
23
19
|
delete target.configurations;
|
|
24
20
|
}
|
|
25
|
-
if ('defaultConfiguration' in target &&
|
|
21
|
+
if ('defaultConfiguration' in target &&
|
|
22
|
+
!target.configurations[target.defaultConfiguration]) {
|
|
26
23
|
delete target.defaultConfiguration;
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
26
|
if (target.outputs) {
|
|
30
|
-
(0,
|
|
31
|
-
{
|
|
32
|
-
newName: 'coverage.reportsDirectory',
|
|
33
|
-
oldName: 'reportsDirectory'
|
|
34
|
-
}
|
|
35
|
-
], inferredTargetConfiguration, {
|
|
27
|
+
(0, plugin_migration_utils_1.processTargetOutputs)(target, [{ newName: 'coverage.reportsDirectory', oldName: 'reportsDirectory' }], inferredTargetConfiguration, {
|
|
36
28
|
projectName: projectDetails.projectName,
|
|
37
|
-
projectRoot: projectDetails.root
|
|
29
|
+
projectRoot: projectDetails.root,
|
|
38
30
|
});
|
|
39
31
|
}
|
|
40
|
-
if (target.inputs &&
|
|
32
|
+
if (target.inputs &&
|
|
33
|
+
target.inputs.every((i) => i === 'default' || i === '^production')) {
|
|
41
34
|
delete target.inputs;
|
|
42
35
|
}
|
|
43
36
|
return target;
|
|
44
37
|
}
|
|
45
38
|
function removePropertiesFromTargetOptions(targetOptions, projectRoot) {
|
|
46
39
|
if ('configFile' in targetOptions) {
|
|
47
|
-
targetOptions.config = (0,
|
|
40
|
+
targetOptions.config = (0, utils_1.toProjectRelativePath)(targetOptions.configFile, projectRoot);
|
|
48
41
|
delete targetOptions.configFile;
|
|
49
42
|
}
|
|
50
43
|
if ('reportsDirectory' in targetOptions) {
|
|
51
44
|
if (targetOptions.reportsDirectory.startsWith('../')) {
|
|
52
45
|
targetOptions.reportsDirectory = targetOptions.reportsDirectory.replace(/(\.\.\/)+/, '');
|
|
53
46
|
}
|
|
54
|
-
targetOptions['coverage.reportsDirectory'] = (0,
|
|
47
|
+
targetOptions['coverage.reportsDirectory'] = (0, utils_1.toProjectRelativePath)(targetOptions.reportsDirectory, projectRoot);
|
|
55
48
|
delete targetOptions.reportsDirectory;
|
|
56
49
|
}
|
|
57
50
|
if ('testFiles' in targetOptions) {
|
|
58
|
-
targetOptions.testNamePattern = `"/(${targetOptions.testFiles
|
|
51
|
+
targetOptions.testNamePattern = `"/(${targetOptions.testFiles
|
|
52
|
+
.map((f) => f.replace('.', '\\.'))
|
|
53
|
+
.join('|')})/"`;
|
|
59
54
|
delete targetOptions.testFiles;
|
|
60
55
|
}
|
|
61
56
|
}
|
|
62
|
-
|
|
63
|
-
//# sourceMappingURL=test-post-target-transformer.js.map
|
|
@@ -2,3 +2,4 @@ import { type Tree } from '@nx/devkit';
|
|
|
2
2
|
export declare function toProjectRelativePath(path: string, projectRoot: string): string;
|
|
3
3
|
export declare function getViteConfigPath(tree: Tree, root: string): string;
|
|
4
4
|
export declare function addConfigValuesToViteConfig(tree: Tree, configFile: string, configValues: Record<string, Record<string, unknown>>): void;
|
|
5
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +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,QAiCtD"}
|
|
@@ -1,50 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
addConfigValuesToViteConfig: function() {
|
|
10
|
-
return addConfigValuesToViteConfig;
|
|
11
|
-
},
|
|
12
|
-
getViteConfigPath: function() {
|
|
13
|
-
return getViteConfigPath;
|
|
14
|
-
},
|
|
15
|
-
toProjectRelativePath: function() {
|
|
16
|
-
return toProjectRelativePath;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _posix = require("path/posix");
|
|
20
|
-
const _devkit = require("@nx/devkit");
|
|
21
|
-
const _tsquery = require("@phenomnomnominal/tsquery");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toProjectRelativePath = toProjectRelativePath;
|
|
4
|
+
exports.getViteConfigPath = getViteConfigPath;
|
|
5
|
+
exports.addConfigValuesToViteConfig = addConfigValuesToViteConfig;
|
|
6
|
+
const posix_1 = require("path/posix");
|
|
7
|
+
const devkit_1 = require("@nx/devkit");
|
|
8
|
+
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
22
9
|
function toProjectRelativePath(path, projectRoot) {
|
|
23
10
|
if (projectRoot === '.') {
|
|
24
11
|
// workspace and project root are the same, we normalize it to ensure it
|
|
25
12
|
// works with Jest since some paths only work when they start with `./`
|
|
26
13
|
return path.startsWith('.') ? path : `./${path}`;
|
|
27
14
|
}
|
|
28
|
-
const relativePath = (0,
|
|
15
|
+
const relativePath = (0, posix_1.relative)((0, posix_1.resolve)(devkit_1.workspaceRoot, projectRoot), (0, posix_1.resolve)(devkit_1.workspaceRoot, path));
|
|
29
16
|
return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;
|
|
30
17
|
}
|
|
31
18
|
function getViteConfigPath(tree, root) {
|
|
32
19
|
return [
|
|
33
|
-
(0,
|
|
34
|
-
(0,
|
|
35
|
-
(0,
|
|
36
|
-
(0,
|
|
37
|
-
(0,
|
|
38
|
-
(0,
|
|
39
|
-
].find((f)=>tree.exists(f));
|
|
20
|
+
(0, devkit_1.joinPathFragments)(root, `vite.config.ts`),
|
|
21
|
+
(0, devkit_1.joinPathFragments)(root, `vite.config.cts`),
|
|
22
|
+
(0, devkit_1.joinPathFragments)(root, `vite.config.mts`),
|
|
23
|
+
(0, devkit_1.joinPathFragments)(root, `vite.config.js`),
|
|
24
|
+
(0, devkit_1.joinPathFragments)(root, `vite.config.cjs`),
|
|
25
|
+
(0, devkit_1.joinPathFragments)(root, `vite.config.mjs`),
|
|
26
|
+
].find((f) => tree.exists(f));
|
|
40
27
|
}
|
|
41
28
|
function addConfigValuesToViteConfig(tree, configFile, configValues) {
|
|
42
29
|
const IMPORT_PROPERTY_SELECTOR = 'ImportDeclaration';
|
|
43
30
|
const viteConfigContents = tree.read(configFile, 'utf-8');
|
|
44
|
-
const ast =
|
|
31
|
+
const ast = tsquery_1.tsquery.ast(viteConfigContents);
|
|
45
32
|
// AST TO GET SECTION TO APPEND TO
|
|
46
|
-
const importNodes = (0,
|
|
47
|
-
visitAllChildren: true
|
|
33
|
+
const importNodes = (0, tsquery_1.tsquery)(ast, IMPORT_PROPERTY_SELECTOR, {
|
|
34
|
+
visitAllChildren: true,
|
|
48
35
|
});
|
|
49
36
|
if (importNodes.length === 0) {
|
|
50
37
|
return;
|
|
@@ -65,5 +52,3 @@ function addConfigValuesToViteConfig(tree, configFile, configValues) {
|
|
|
65
52
|
${configValuesString}
|
|
66
53
|
${viteConfigContents.slice(lastImportNode.getEnd())}`);
|
|
67
54
|
}
|
|
68
|
-
|
|
69
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -4,3 +4,4 @@ export declare function updateNxJsonSettings(tree: Tree): void;
|
|
|
4
4
|
export declare function initGenerator(tree: Tree, schema: InitGeneratorSchema): Promise<GeneratorCallback>;
|
|
5
5
|
export declare function initGeneratorInternal(tree: Tree, schema: InitGeneratorSchema): Promise<GeneratorCallback>;
|
|
6
6
|
export default initGenerator;
|
|
7
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/vite/src/generators/init/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAGjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI/C,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,QA+B9C;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,8BAEpE;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,mBAAmB,8BA2D5B;AAED,eAAe,aAAa,CAAC"}
|