virmator 7.0.3 → 7.1.0

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.
@@ -1,3 +1,5 @@
1
1
  import {defineConfig} from 'virmator/dist/compiled-base-configs/base-vite';
2
2
 
3
- export default defineConfig({forGitHubPages: true}, {});
3
+ export default defineConfig({forGitHubPages: true}, (baseConfig) => {
4
+ return baseConfig;
5
+ });
@@ -69,6 +69,7 @@ exports.frontendCommandDefinition = (0, define_command_1.defineCommand)({
69
69
  packageDir: package_paths_1.virmatorPackageDir,
70
70
  });
71
71
  const tempFilePath = (0, path_1.join)((0, path_1.dirname)(viteConfigPath), `config-output-${Date.now()}-${(0, node_js_1.randomString)()}.cjs`);
72
+ const oldWrite = process.stdout.write;
72
73
  try {
73
74
  const needToBuild = !!inputs.inputSubCommands.length;
74
75
  const useDefaultConfigArgs = !inputs.filteredInputArgs.includes('--config');
@@ -86,7 +87,6 @@ exports.frontendCommandDefinition = (0, define_command_1.defineCommand)({
86
87
  * Disable console logs the first time we require this, as logs will also print when
87
88
  * Vite loads the config again.
88
89
  */
89
- const oldWrite = process.stdout.write;
90
90
  process.stdout.write = () => false;
91
91
  const viteConfig = await require(tempFilePath).default;
92
92
  process.stdout.write = oldWrite;
@@ -135,6 +135,7 @@ exports.frontendCommandDefinition = (0, define_command_1.defineCommand)({
135
135
  };
136
136
  }
137
137
  finally {
138
+ process.stdout.write = oldWrite;
138
139
  await (0, promises_1.unlink)(tempFilePath);
139
140
  }
140
141
  });
@@ -1,4 +1,3 @@
1
- import { MaybePromise } from '@augment-vir/common';
2
1
  import { UserConfig, UserConfigExport } from 'vite';
3
2
  export declare const basePlugins: readonly [import("vite").PluginOption, import("vite").Plugin];
4
3
  export declare const currentDir: string;
@@ -11,5 +10,5 @@ export type BaseConfigOptions = {
11
10
  forGitHubPages: boolean;
12
11
  };
13
12
  export declare function createBaseConfig({ forGitHubPages }: BaseConfigOptions): UserConfig;
14
- export declare function combineConfigs(baseConfigOptions: BaseConfigOptions, overrideConfigInput: MaybePromise<UserConfig>): Promise<UserConfig>;
15
- export declare function defineConfig(baseConfigOptions: BaseConfigOptions, configOverride: UserConfigExport): UserConfigExport;
13
+ export declare function combineConfigs(baseConfigOptions: BaseConfigOptions, overrideCallback: ((baseConfig: UserConfig) => UserConfig | Promise<UserConfig>) | undefined): Promise<UserConfig>;
14
+ export declare function defineConfig(baseConfigOptions: BaseConfigOptions, overrideCallback: ((baseConfig: UserConfig) => UserConfig | Promise<UserConfig>) | undefined): UserConfigExport;
@@ -46,13 +46,9 @@ function createBaseConfig({ forGitHubPages }) {
46
46
  };
47
47
  }
48
48
  exports.createBaseConfig = createBaseConfig;
49
- async function combineConfigs(baseConfigOptions, overrideConfigInput) {
49
+ async function combineConfigs(baseConfigOptions, overrideCallback) {
50
50
  const baseConfig = createBaseConfig(baseConfigOptions);
51
- const overrideConfig = await overrideConfigInput;
52
- const fullConfig = {
53
- ...baseConfig,
54
- ...overrideConfig,
55
- };
51
+ const fullConfig = overrideCallback ? await overrideCallback(baseConfig) : baseConfig;
56
52
  node_js_1.log.faint(`public dir: ${node_js_1.logColors.info}${(0, path_1.relative)(process.cwd(), fullConfig.publicDir || '')}${node_js_1.logColors.reset}`);
57
53
  node_js_1.log.faint(`root dir: ${node_js_1.logColors.info}${(0, path_1.relative)(process.cwd(), fullConfig.root || '')}${node_js_1.logColors.reset}`);
58
54
  node_js_1.log.faint(`out dir: ${node_js_1.logColors.info}${(0, path_1.relative)(process.cwd(), fullConfig.build?.outDir || '')}${node_js_1.logColors.reset}`);
@@ -60,14 +56,7 @@ async function combineConfigs(baseConfigOptions, overrideConfigInput) {
60
56
  return fullConfig;
61
57
  }
62
58
  exports.combineConfigs = combineConfigs;
63
- function defineConfig(baseConfigOptions, configOverride) {
64
- if (typeof configOverride === 'function') {
65
- return (envConfig) => {
66
- return combineConfigs(baseConfigOptions, configOverride(envConfig));
67
- };
68
- }
69
- else {
70
- return combineConfigs(baseConfigOptions, configOverride);
71
- }
59
+ function defineConfig(baseConfigOptions, overrideCallback) {
60
+ return combineConfigs(baseConfigOptions, overrideCallback);
72
61
  }
73
62
  exports.defineConfig = defineConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virmator",
3
- "version": "7.0.3",
3
+ "version": "7.1.0",
4
4
  "description": "Handle common package configs, commands, and dependencies.",
5
5
  "keywords": [
6
6
  "automation",