@nx/vite 20.5.0-rc.1 → 20.5.0-rc.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": "20.5.0-rc.
|
|
3
|
+
"version": "20.5.0-rc.2",
|
|
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": "20.5.0-rc.
|
|
33
|
+
"@nx/devkit": "20.5.0-rc.2",
|
|
34
34
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
35
35
|
"@swc/helpers": "~0.5.0",
|
|
36
36
|
"enquirer": "~2.3.6",
|
|
37
|
-
"@nx/js": "20.5.0-rc.
|
|
37
|
+
"@nx/js": "20.5.0-rc.2",
|
|
38
38
|
"tsconfig-paths": "^4.1.2",
|
|
39
39
|
"minimatch": "9.0.3",
|
|
40
40
|
"semver": "^7.6.3"
|
|
@@ -53,16 +53,23 @@ async function getOptions(options, context, projectRoot) {
|
|
|
53
53
|
]), { options: { watch } } = _parseCLI, normalizedExtraArgs = _object_without_properties_loose._(_parseCLI.options, [
|
|
54
54
|
"watch"
|
|
55
55
|
]);
|
|
56
|
+
const { reportsDirectory, coverage } = normalizedExtraArgs, restNormalizedArgs = _object_without_properties_loose._(normalizedExtraArgs, [
|
|
57
|
+
"reportsDirectory",
|
|
58
|
+
"coverage"
|
|
59
|
+
]);
|
|
56
60
|
var _resolved_config_root;
|
|
57
61
|
const settings = _extends._({
|
|
58
62
|
// Explicitly set watch mode to false if not provided otherwise vitest
|
|
59
63
|
// will enable watch mode by default for non CI environments
|
|
60
64
|
watch: watch != null ? watch : false
|
|
61
|
-
},
|
|
65
|
+
}, restNormalizedArgs, {
|
|
62
66
|
// This should not be needed as it's going to be set in vite.config.ts
|
|
63
67
|
// but leaving it here in case someone did not migrate correctly
|
|
64
68
|
root: (_resolved_config_root = resolved.config.root) != null ? _resolved_config_root : root,
|
|
65
|
-
config: viteConfigPath
|
|
69
|
+
config: viteConfigPath,
|
|
70
|
+
coverage: _extends._({}, coverage != null ? coverage : {}, reportsDirectory && {
|
|
71
|
+
reportsDirectory
|
|
72
|
+
})
|
|
66
73
|
});
|
|
67
74
|
var _resolved_config_test;
|
|
68
75
|
return mergeConfig((_resolved_config_test = resolved == null ? void 0 : (_resolved_config1 = resolved.config) == null ? void 0 : _resolved_config1['test']) != null ? _resolved_config_test : {}, settings);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../packages/vite/src/executors/test/lib/utils.ts"],"sourcesContent":["import {\n ExecutorContext,\n joinPathFragments,\n logger,\n stripIndents,\n} from '@nx/devkit';\nimport { VitestExecutorOptions } from '../schema';\nimport { normalizeViteConfigFilePath } from '../../../utils/options-utils';\nimport { relative } from 'path';\nimport {\n loadViteDynamicImport,\n loadVitestDynamicImport,\n} from '../../../utils/executor-utils';\n\nexport async function getOptions(\n options: VitestExecutorOptions,\n context: ExecutorContext,\n projectRoot: string\n) {\n // Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.\n const { loadConfigFromFile, mergeConfig } = await loadViteDynamicImport();\n\n const viteConfigPath = normalizeViteConfigFilePath(\n context.root,\n projectRoot,\n options.configFile\n );\n\n if (!viteConfigPath) {\n throw new Error(\n stripIndents`\n Unable to load test config from config file ${viteConfigPath}.\n \n Please make sure that vitest is configured correctly, \n or use the @nx/vite:vitest generator to configure it for you.\n You can read more here: https://nx.dev/nx-api/vite/generators/vitest\n `\n );\n }\n\n const resolved = await loadConfigFromFile(\n {\n mode: options?.mode ?? 'production',\n command: 'serve',\n },\n viteConfigPath\n );\n\n if (!viteConfigPath || !resolved?.config?.['test']) {\n logger.warn(stripIndents`Unable to load test config from config file ${\n resolved?.path ?? viteConfigPath\n }\n Some settings may not be applied as expected.\n You can manually set the config in the project, ${\n context.projectName\n }, configuration.\n `);\n }\n const root =\n projectRoot === '.'\n ? process.cwd()\n : relative(context.cwd, joinPathFragments(context.root, projectRoot));\n\n const { parseCLI } = await loadVitestDynamicImport();\n\n const {\n options: { watch, ...normalizedExtraArgs },\n } = parseCLI(['vitest', ...getOptionsAsArgv(options)]);\n\n const settings = {\n // Explicitly set watch mode to false if not provided otherwise vitest\n // will enable watch mode by default for non CI environments\n watch: watch ?? false,\n ...
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/vite/src/executors/test/lib/utils.ts"],"sourcesContent":["import {\n ExecutorContext,\n joinPathFragments,\n logger,\n stripIndents,\n} from '@nx/devkit';\nimport { VitestExecutorOptions } from '../schema';\nimport { normalizeViteConfigFilePath } from '../../../utils/options-utils';\nimport { relative } from 'path';\nimport {\n loadViteDynamicImport,\n loadVitestDynamicImport,\n} from '../../../utils/executor-utils';\n\nexport async function getOptions(\n options: VitestExecutorOptions,\n context: ExecutorContext,\n projectRoot: string\n) {\n // Allows ESM to be required in CJS modules. Vite will be published as ESM in the future.\n const { loadConfigFromFile, mergeConfig } = await loadViteDynamicImport();\n\n const viteConfigPath = normalizeViteConfigFilePath(\n context.root,\n projectRoot,\n options.configFile\n );\n\n if (!viteConfigPath) {\n throw new Error(\n stripIndents`\n Unable to load test config from config file ${viteConfigPath}.\n \n Please make sure that vitest is configured correctly, \n or use the @nx/vite:vitest generator to configure it for you.\n You can read more here: https://nx.dev/nx-api/vite/generators/vitest\n `\n );\n }\n\n const resolved = await loadConfigFromFile(\n {\n mode: options?.mode ?? 'production',\n command: 'serve',\n },\n viteConfigPath\n );\n\n if (!viteConfigPath || !resolved?.config?.['test']) {\n logger.warn(stripIndents`Unable to load test config from config file ${\n resolved?.path ?? viteConfigPath\n }\n Some settings may not be applied as expected.\n You can manually set the config in the project, ${\n context.projectName\n }, configuration.\n `);\n }\n const root =\n projectRoot === '.'\n ? process.cwd()\n : relative(context.cwd, joinPathFragments(context.root, projectRoot));\n\n const { parseCLI } = await loadVitestDynamicImport();\n\n const {\n options: { watch, ...normalizedExtraArgs },\n } = parseCLI(['vitest', ...getOptionsAsArgv(options)]);\n\n const { reportsDirectory, coverage, ...restNormalizedArgs } =\n normalizedExtraArgs as Record<string, any>;\n\n const settings = {\n // Explicitly set watch mode to false if not provided otherwise vitest\n // will enable watch mode by default for non CI environments\n watch: watch ?? false,\n ...restNormalizedArgs,\n // This should not be needed as it's going to be set in vite.config.ts\n // but leaving it here in case someone did not migrate correctly\n root: resolved.config.root ?? root,\n config: viteConfigPath,\n coverage: {\n ...(coverage ?? {}),\n ...(reportsDirectory && { reportsDirectory }),\n },\n };\n\n return mergeConfig(resolved?.config?.['test'] ?? {}, settings);\n}\n\nexport function getOptionsAsArgv(obj: Record<string, any>): string[] {\n const argv: string[] = [];\n\n for (const [key, value] of Object.entries(obj)) {\n if (Array.isArray(value)) {\n value.forEach((item) => argv.push(`--${key}=${item}`));\n } else if (typeof value === 'object' && value !== null) {\n argv.push(`--${key}='${JSON.stringify(value)}'`);\n } else {\n argv.push(`--${key}=${value}`);\n }\n }\n\n return argv;\n}\n"],"names":["getOptions","getOptionsAsArgv","options","context","projectRoot","resolved","loadConfigFromFile","mergeConfig","loadViteDynamicImport","viteConfigPath","normalizeViteConfigFilePath","root","configFile","Error","stripIndents","mode","command","config","logger","warn","path","projectName","process","cwd","relative","joinPathFragments","parseCLI","loadVitestDynamicImport","watch","normalizedExtraArgs","reportsDirectory","coverage","restNormalizedArgs","settings","obj","argv","key","value","Object","entries","Array","isArray","forEach","item","push","JSON","stringify"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;IAcsBA,UAAU;eAAVA;;IA4ENC,gBAA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