@nizza/devkit 0.2.1 → 0.2.3-beta.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.
Files changed (32) hide show
  1. package/dist/cjs/executors/deploy/helpers.cjs +1 -1
  2. package/dist/cjs/executors/deploy/schema.json +7 -0
  3. package/dist/cjs/index.cjs +7 -22
  4. package/dist/cjs/shared/logger.cjs +7 -4
  5. package/dist/cjs/vitejs/config-builder/configs/base.cjs +37 -0
  6. package/dist/cjs/vitejs/config-builder/configs/lib.cjs +2 -4
  7. package/dist/cjs/vitejs/config-builder/configs/script.cjs +0 -1
  8. package/dist/cjs/vitejs/config-builder/main.cjs +1 -2
  9. package/dist/cjs/vitejs/config-builder/plugins.cjs +4 -3
  10. package/dist/cjs/vitejs/config-builder/shared/types.cjs +26 -15
  11. package/dist/cjs/vitejs/config-builder/shared/utils/helpers.cjs +12 -6
  12. package/dist/cjs/vitejs/config-builder/shared/utils/{projectConfig.cjs → project-config.cjs} +1 -1
  13. package/dist/esm/executors/deploy/helpers.mjs +1 -1
  14. package/dist/esm/executors/deploy/schema.json +7 -0
  15. package/dist/esm/index.mjs +2 -2
  16. package/dist/esm/shared/logger.mjs +5 -3
  17. package/dist/esm/vitejs/config-builder/configs/base.mjs +37 -1
  18. package/dist/esm/vitejs/config-builder/configs/lib.mjs +2 -4
  19. package/dist/esm/vitejs/config-builder/configs/script.mjs +0 -1
  20. package/dist/esm/vitejs/config-builder/main.mjs +1 -2
  21. package/dist/esm/vitejs/config-builder/plugins.mjs +4 -3
  22. package/dist/esm/vitejs/config-builder/shared/types.mjs +20 -15
  23. package/dist/esm/vitejs/config-builder/shared/utils/helpers.mjs +12 -6
  24. package/dist/esm/vitejs/config-builder/shared/utils/{projectConfig.mjs → project-config.mjs} +1 -1
  25. package/package.json +1 -1
  26. package/dist/index.d.ts +0 -376
  27. /package/dist/cjs/node_modules/.pnpm/{@vitejs_plugin-basic-ssl@1.1.0_vite@5.2.10_@types_node@18.19.31_sass@1.75.0_ → @vitejs_plugin-basic-ssl@1.1.0_vite@7.0.3_@types_node@18.19.31_jiti@1.21.0_sass@1.75.0_terser@5.37.0_yaml@2.7.0_}/node_modules/@vitejs/plugin-basic-ssl/dist/chunks/certificate.cjs +0 -0
  28. /package/dist/cjs/node_modules/.pnpm/{@vitejs_plugin-basic-ssl@1.1.0_vite@5.2.10_@types_node@18.19.31_sass@1.75.0_ → @vitejs_plugin-basic-ssl@1.1.0_vite@7.0.3_@types_node@18.19.31_jiti@1.21.0_sass@1.75.0_terser@5.37.0_yaml@2.7.0_}/node_modules/@vitejs/plugin-basic-ssl/dist/index.cjs +0 -0
  29. /package/dist/cjs/vitejs/config-builder/shared/utils/{viteCommand.cjs → vite-command.cjs} +0 -0
  30. /package/dist/esm/node_modules/.pnpm/{@vitejs_plugin-basic-ssl@1.1.0_vite@5.2.10_@types_node@18.19.31_sass@1.75.0_ → @vitejs_plugin-basic-ssl@1.1.0_vite@7.0.3_@types_node@18.19.31_jiti@1.21.0_sass@1.75.0_terser@5.37.0_yaml@2.7.0_}/node_modules/@vitejs/plugin-basic-ssl/dist/chunks/certificate.mjs +0 -0
  31. /package/dist/esm/node_modules/.pnpm/{@vitejs_plugin-basic-ssl@1.1.0_vite@5.2.10_@types_node@18.19.31_sass@1.75.0_ → @vitejs_plugin-basic-ssl@1.1.0_vite@7.0.3_@types_node@18.19.31_jiti@1.21.0_sass@1.75.0_terser@5.37.0_yaml@2.7.0_}/node_modules/@vitejs/plugin-basic-ssl/dist/index.mjs +0 -0
  32. /package/dist/esm/vitejs/config-builder/shared/utils/{viteCommand.mjs → vite-command.mjs} +0 -0
@@ -33,7 +33,7 @@ function buildS3Path(args) {
33
33
  const s3Bucket = `s3://${args.s3Bucket}`;
34
34
  const s3Path = `${rootDir}${slash(assetsDir)}`;
35
35
  const s3FullPath = `${s3Bucket}${slash(s3Path)}`;
36
- const cloudFrontInvalidationPaths = [
36
+ const cloudFrontInvalidationPaths = args.cloudFrontInvalidationPaths ?? [
37
37
  `${slash(s3Path)}/*`
38
38
  ];
39
39
  return {
@@ -21,6 +21,13 @@
21
21
  "type": "string",
22
22
  "description": "The ID of the AWS CloudFront distribution for cache invalidation, ensuring updated assets are served."
23
23
  },
24
+ "cloudFrontInvalidationPaths": {
25
+ "type": "array",
26
+ "description": "The paths of the CloudFront distribution to be invalidated after deployment.",
27
+ "items": {
28
+ "type": "string"
29
+ }
30
+ },
24
31
  "buildTarget": {
25
32
  "type": "string",
26
33
  "description": "Build command relative to the project and without the name of the project because it is not necessary"
@@ -10,8 +10,8 @@ var index$6 = require('./executors/vtex-link/index.cjs');
10
10
  var main = require('./vitejs/config-builder/main.cjs');
11
11
  var types = require('./vitejs/config-builder/shared/types.cjs');
12
12
  var helpers = require('./vitejs/config-builder/shared/utils/helpers.cjs');
13
- var projectConfig = require('./vitejs/config-builder/shared/utils/projectConfig.cjs');
14
- var viteCommand = require('./vitejs/config-builder/shared/utils/viteCommand.cjs');
13
+ var projectConfig = require('./vitejs/config-builder/shared/utils/project-config.cjs');
14
+ var viteCommand = require('./vitejs/config-builder/shared/utils/vite-command.cjs');
15
15
  var main$1 = require('./vitejs/plugins/third-party-css-inject/main.cjs');
16
16
  var index$7 = require('./vitejs/plugins/shadow-dom-inject-css/index.cjs');
17
17
 
@@ -25,26 +25,11 @@ exports.updateExecutorsFileExecutor = index$4;
25
25
  exports.verifyChangesetsExecutor = index$5;
26
26
  exports.vtexLinkExecutor = index$6;
27
27
  exports.createConfigBuilder = main.createConfigBuilder;
28
- Object.defineProperty(exports, "Flag", {
29
- enumerable: true,
30
- get: function () { return types.Flag; }
31
- });
32
- Object.defineProperty(exports, "ProjectType", {
33
- enumerable: true,
34
- get: function () { return types.ProjectType; }
35
- });
36
- Object.defineProperty(exports, "Stage", {
37
- enumerable: true,
38
- get: function () { return types.Stage; }
39
- });
40
- Object.defineProperty(exports, "Target", {
41
- enumerable: true,
42
- get: function () { return types.Target; }
43
- });
44
- Object.defineProperty(exports, "ViteMode", {
45
- enumerable: true,
46
- get: function () { return types.ViteMode; }
47
- });
28
+ exports.Flag = types.Flag;
29
+ exports.ProjectType = types.ProjectType;
30
+ exports.Stage = types.Stage;
31
+ exports.Target = types.Target;
32
+ exports.ViteMode = types.ViteMode;
48
33
  exports.chunkName = helpers.chunkName;
49
34
  exports.deepMerge = helpers.deepMerge;
50
35
  exports.getNxTsConfigPaths = helpers.getNxTsConfigPaths;
@@ -3,13 +3,15 @@
3
3
  var chalk = require('chalk');
4
4
  var R = require('ramda');
5
5
 
6
- exports.LogLevel = void 0;
7
- (function(LogLevel) {
6
+ /**
7
+ * Enum representing the different log levels.
8
+ */ var LogLevel = /*#__PURE__*/ function(LogLevel) {
8
9
  LogLevel[LogLevel["ERROR"] = 0] = "ERROR";
9
10
  LogLevel[LogLevel["WARN"] = 1] = "WARN";
10
11
  LogLevel[LogLevel["INFO"] = 2] = "INFO";
11
12
  LogLevel[LogLevel["DEBUG"] = 3] = "DEBUG";
12
- })(exports.LogLevel || (exports.LogLevel = {}));
13
+ return LogLevel;
14
+ }({});
13
15
  // Default log level
14
16
  exports.currentLogLevel = 2;
15
17
  /**
@@ -33,7 +35,7 @@ exports.currentLogLevel = 2;
33
35
  [3]: chalk.magenta
34
36
  };
35
37
  const getLogLevelKey = (value)=>{
36
- return Object.keys(exports.LogLevel).find((key)=>exports.LogLevel[key] === value);
38
+ return Object.keys(LogLevel).find((key)=>LogLevel[key] === value);
37
39
  };
38
40
  /**
39
41
  * Sets the log level for the logger.
@@ -94,5 +96,6 @@ const logger = {
94
96
  debug: log(3)
95
97
  };
96
98
 
99
+ exports.LogLevel = LogLevel;
97
100
  exports.logger = logger;
98
101
  exports.setLogLevel = setLogLevel;
@@ -2,6 +2,7 @@
2
2
 
3
3
  var fs = require('fs');
4
4
  var path = require('path');
5
+ var url = require('url');
5
6
  var plugins = require('../plugins.cjs');
6
7
  var types = require('../shared/types.cjs');
7
8
  var helpers = require('../shared/utils/helpers.cjs');
@@ -13,6 +14,8 @@ require('chalk');
13
14
  require('mri');
14
15
  require('vite');
15
16
 
17
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
18
+ const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('vitejs/config-builder/configs/base.cjs', document.baseURI).href))));
16
19
  const getBaseConfig = (ctx)=>{
17
20
  const { commonConfig, projectConfig, viteCmd } = ctx;
18
21
  const { resolveEnvs, path: path$1 } = projectConfig;
@@ -31,6 +34,7 @@ const getBaseConfig = (ctx)=>{
31
34
  // Verify if the local Environment file is present
32
35
  const envFilePath = fs.existsSync(path.resolve(path$1, 'src', envPath)) ? envPath : fallbackEnvPath;
33
36
  return {
37
+ root: path.resolve(path$1),
34
38
  envPrefix,
35
39
  plugins: helpers.getPlugins(ctx, plugins.basePlugins, plugins.httpsServerPlugin, plugins.bundleAnalysisPlugin),
36
40
  resolve: {
@@ -47,11 +51,44 @@ const getBaseConfig = (ctx)=>{
47
51
  'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
48
52
  __vite_process_env_NODE_ENV: JSON.stringify(NODE_ENV)
49
53
  },
54
+ optimizeDeps: {
55
+ esbuildOptions: {
56
+ define: {
57
+ global: 'globalThis'
58
+ }
59
+ }
60
+ },
50
61
  build: {
51
62
  sourcemap,
52
63
  minify: true,
53
64
  emptyOutDir: true,
54
65
  cssCodeSplit: true
66
+ },
67
+ test: {
68
+ watch: false,
69
+ globals: true,
70
+ pool: 'threads',
71
+ environment: 'jsdom',
72
+ include: [
73
+ 'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'
74
+ ],
75
+ reporters: [
76
+ 'default'
77
+ ],
78
+ setupFiles: path.resolve(__dirname$1, '../shared/test-setup.ts'),
79
+ coverage: {
80
+ reportsDirectory: `${path.resolve(path$1)}/coverage`,
81
+ provider: 'istanbul',
82
+ exclude: [
83
+ 'node_modules',
84
+ 'dist',
85
+ 'coverage',
86
+ 'postcss.config.js',
87
+ 'tailwind.config.js',
88
+ 'vite.config.ts',
89
+ 'vitest.config.ts'
90
+ ]
91
+ }
55
92
  }
56
93
  };
57
94
  };
@@ -2,9 +2,8 @@
2
2
 
3
3
  var path = require('path');
4
4
  var plugins = require('../plugins.cjs');
5
- require('../shared/types.cjs');
6
5
  var helpers = require('../shared/utils/helpers.cjs');
7
- var projectConfig = require('../shared/utils/projectConfig.cjs');
6
+ var projectConfig = require('../shared/utils/project-config.cjs');
8
7
  require('chalk');
9
8
  require('mri');
10
9
  require('vite');
@@ -40,8 +39,7 @@ const getLibConfig = (ctx)=>{
40
39
  name,
41
40
  entry,
42
41
  formats: [
43
- 'es',
44
- 'cjs'
42
+ 'es' /*'cjs'*/
45
43
  ],
46
44
  fileName: (format)=>`index.${format === 'es' ? 'mjs' : 'cjs'}`
47
45
  },
@@ -2,7 +2,6 @@
2
2
 
3
3
  var path = require('path');
4
4
  var plugins = require('../plugins.cjs');
5
- require('../shared/types.cjs');
6
5
  var helpers = require('../shared/utils/helpers.cjs');
7
6
  require('minimatch');
8
7
  require('../../../shared/logger.cjs');
@@ -4,11 +4,10 @@ var vite = require('vite');
4
4
  var logger = require('../../shared/logger.cjs');
5
5
  var utils = require('../../shared/utils.cjs');
6
6
  var index = require('./configs/index.cjs');
7
- require('./shared/types.cjs');
8
7
  require('@nx/devkit');
9
8
  require('path');
10
9
  require('ramda');
11
- var projectConfig = require('./shared/utils/projectConfig.cjs');
10
+ var projectConfig = require('./shared/utils/project-config.cjs');
12
11
  require('chalk');
13
12
  require('mri');
14
13
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  var vitePluginCommonjs = require('@originjs/vite-plugin-commonjs');
4
4
  var graphql = require('@rollup/plugin-graphql');
5
+ var index$1 = require('../../node_modules/.pnpm/@vitejs_plugin-basic-ssl@1.1.0_vite@7.0.3_@types_node@18.19.31_jiti@1.21.0_sass@1.75.0_terser@5.37.0_yaml@2.7.0_/node_modules/@vitejs/plugin-basic-ssl/dist/index.cjs');
5
6
  var react = require('@vitejs/plugin-react-swc');
6
7
  var path = require('path');
7
8
  var rollupPluginVisualizer = require('rollup-plugin-visualizer');
@@ -19,8 +20,8 @@ require('crypto');
19
20
  require('fs');
20
21
  require('chalk');
21
22
  require('mri');
22
- var index$1 = require('../../node_modules/.pnpm/@vitejs_plugin-basic-ssl@1.1.0_vite@5.2.10_@types_node@18.19.31_sass@1.75.0_/node_modules/@vitejs/plugin-basic-ssl/dist/index.cjs');
23
23
 
24
+ // import unpluginIsolatedDecl from 'unplugin-isolated-decl/vite';
24
25
  /**
25
26
  * Base plugins configuration for apps and libs.
26
27
  *
@@ -30,8 +31,8 @@ var index$1 = require('../../node_modules/.pnpm/@vitejs_plugin-basic-ssl@1.1.0_v
30
31
  * - @rollup/plugin-graphql
31
32
  * - @vitejs/plugin-react-swc
32
33
  */ const basePlugins = {
33
- generate: ()=>{
34
- const projects = helpers.getNxTsConfigPaths();
34
+ generate: (ctx)=>{
35
+ const projects = helpers.getNxTsConfigPaths(ctx);
35
36
  return [
36
37
  tsconfigPaths({
37
38
  projects
@@ -1,33 +1,44 @@
1
1
  'use strict';
2
2
 
3
- exports.ViteMode = void 0;
4
- (function(ViteMode) {
3
+ var ViteMode = /*#__PURE__*/ function(ViteMode) {
5
4
  ViteMode["PROD"] = "production";
6
5
  ViteMode["DEV"] = "development";
7
- })(exports.ViteMode || (exports.ViteMode = {}));
8
- exports.Stage = void 0;
9
- (function(Stage) {
6
+ ViteMode["TEST"] = "test";
7
+ return ViteMode;
8
+ }({});
9
+ /**
10
+ * Project stages, it coincides with the target configurations of the project.json of NX.
11
+ * @readonly
12
+ * @enum {string}
13
+ */ var Stage = /*#__PURE__*/ function(Stage) {
10
14
  Stage["PROD"] = "prod";
11
15
  Stage["DEV"] = "dev";
12
16
  Stage["LOCAL"] = "local";
13
- })(exports.Stage || (exports.Stage = {}));
14
- exports.ProjectType = void 0;
15
- (function(ProjectType) {
17
+ return Stage;
18
+ }({});
19
+ var ProjectType = /*#__PURE__*/ function(ProjectType) {
16
20
  ProjectType["APP"] = "app";
17
21
  ProjectType["LIB"] = "lib";
18
22
  ProjectType["SCRIPT"] = "script";
19
- })(exports.ProjectType || (exports.ProjectType = {}));
20
- exports.Flag = void 0;
21
- (function(Flag) {
23
+ return ProjectType;
24
+ }({});
25
+ var Flag = /*#__PURE__*/ function(Flag) {
22
26
  Flag["SOURCEMAP"] = "source-maps";
23
27
  Flag["ANALYZE"] = "analyze";
24
28
  Flag["VERBOSE"] = "verbose";
25
29
  Flag["VERBOSE_ALIAS"] = "v";
26
30
  Flag["HTTPS"] = "https";
27
- })(exports.Flag || (exports.Flag = {}));
28
- exports.Target = void 0;
29
- (function(Target) {
31
+ return Flag;
32
+ }({});
33
+ var Target = /*#__PURE__*/ function(Target) {
30
34
  Target["BUILD"] = "build";
31
35
  Target["PREVIEW"] = "preview";
32
36
  Target["SERVE"] = "serve";
33
- })(exports.Target || (exports.Target = {}));
37
+ return Target;
38
+ }({});
39
+
40
+ exports.Flag = Flag;
41
+ exports.ProjectType = ProjectType;
42
+ exports.Stage = Stage;
43
+ exports.Target = Target;
44
+ exports.ViteMode = ViteMode;
@@ -5,6 +5,7 @@ var path = require('path');
5
5
  var R = require('ramda');
6
6
  require('../../../../shared/logger.cjs');
7
7
  var utils = require('../../../../shared/utils.cjs');
8
+ var types = require('../types.cjs');
8
9
 
9
10
  function _interopNamespaceDefault(e) {
10
11
  var n = Object.create(null);
@@ -100,12 +101,17 @@ var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
100
101
  * console.log(tsConfigPaths);
101
102
  * // Output:
102
103
  * // ['apps/my-app/tsconfig.app.json', 'libs/my-lib/tsconfig.lib.json']
103
- */ const getNxTsConfigPaths = ()=>{
104
- const isValid = (p)=>p.data.root.startsWith('apps/') || p.data.root.startsWith('libs/');
105
- const getTsConfigPath = (p)=>path.resolve(p.data.root, `tsconfig.${p.type === 'app' ? 'app' : 'lib'}.json`);
106
- const graph = devkit.readCachedProjectGraph();
107
- const projects = graph.nodes;
108
- return Object.values(projects).filter(isValid).map(getTsConfigPath);
104
+ */ const getNxTsConfigPaths = ({ projectConfig })=>{
105
+ const isValidProject = (project)=>project.data.root.startsWith('apps/') || project.data.root.startsWith('libs/');
106
+ const generateTsConfigPath = (project)=>{
107
+ let tsconfigType = project.type === 'app' ? 'app' : 'lib';
108
+ if (projectConfig.viteEnv.mode === types.ViteMode.TEST && projectConfig.path.includes(project.data.root)) {
109
+ tsconfigType = 'spec';
110
+ }
111
+ return path.resolve(project.data.root, `tsconfig.${tsconfigType}.json`);
112
+ };
113
+ const { nodes } = devkit.readCachedProjectGraph();
114
+ return Object.values(nodes).filter(isValidProject).map(generateTsConfigPath);
109
115
  };
110
116
 
111
117
  exports.chunkName = chunkName;
@@ -5,7 +5,7 @@ var logger = require('../../../../shared/logger.cjs');
5
5
  var utils = require('../../../../shared/utils.cjs');
6
6
  var types = require('../types.cjs');
7
7
  var helpers = require('./helpers.cjs');
8
- var viteCommand = require('./viteCommand.cjs');
8
+ var viteCommand = require('./vite-command.cjs');
9
9
 
10
10
  /**
11
11
  * Initializes the project configuration with default values.
@@ -31,7 +31,7 @@ function buildS3Path(args) {
31
31
  const s3Bucket = `s3://${args.s3Bucket}`;
32
32
  const s3Path = `${rootDir}${slash(assetsDir)}`;
33
33
  const s3FullPath = `${s3Bucket}${slash(s3Path)}`;
34
- const cloudFrontInvalidationPaths = [
34
+ const cloudFrontInvalidationPaths = args.cloudFrontInvalidationPaths ?? [
35
35
  `${slash(s3Path)}/*`
36
36
  ];
37
37
  return {
@@ -21,6 +21,13 @@
21
21
  "type": "string",
22
22
  "description": "The ID of the AWS CloudFront distribution for cache invalidation, ensuring updated assets are served."
23
23
  },
24
+ "cloudFrontInvalidationPaths": {
25
+ "type": "array",
26
+ "description": "The paths of the CloudFront distribution to be invalidated after deployment.",
27
+ "items": {
28
+ "type": "string"
29
+ }
30
+ },
24
31
  "buildTarget": {
25
32
  "type": "string",
26
33
  "description": "Build command relative to the project and without the name of the project because it is not necessary"
@@ -8,7 +8,7 @@ export { default as vtexLinkExecutor } from './executors/vtex-link/index.mjs';
8
8
  export { createConfigBuilder } from './vitejs/config-builder/main.mjs';
9
9
  export { Flag, ProjectType, Stage, Target, ViteMode } from './vitejs/config-builder/shared/types.mjs';
10
10
  export { chunkName, deepMerge, getNxTsConfigPaths, getPlugins, when } from './vitejs/config-builder/shared/utils/helpers.mjs';
11
- export { getExternalDependencies, getInitials, initializeConfig, mergeConfigs } from './vitejs/config-builder/shared/utils/projectConfig.mjs';
12
- export { getViteCmdFlags, getViteCommand } from './vitejs/config-builder/shared/utils/viteCommand.mjs';
11
+ export { getExternalDependencies, getInitials, initializeConfig, mergeConfigs } from './vitejs/config-builder/shared/utils/project-config.mjs';
12
+ export { getViteCmdFlags, getViteCommand } from './vitejs/config-builder/shared/utils/vite-command.mjs';
13
13
  export { thirdPartyCssInjectPlugin } from './vitejs/plugins/third-party-css-inject/main.mjs';
14
14
  export { injectCssIntoShadowDom } from './vitejs/plugins/shadow-dom-inject-css/index.mjs';
@@ -1,13 +1,15 @@
1
1
  import chalk from 'chalk';
2
2
  import { pipe, map, join } from 'ramda';
3
3
 
4
- var LogLevel;
5
- (function(LogLevel) {
4
+ /**
5
+ * Enum representing the different log levels.
6
+ */ var LogLevel = /*#__PURE__*/ function(LogLevel) {
6
7
  LogLevel[LogLevel["ERROR"] = 0] = "ERROR";
7
8
  LogLevel[LogLevel["WARN"] = 1] = "WARN";
8
9
  LogLevel[LogLevel["INFO"] = 2] = "INFO";
9
10
  LogLevel[LogLevel["DEBUG"] = 3] = "DEBUG";
10
- })(LogLevel || (LogLevel = {}));
11
+ return LogLevel;
12
+ }({});
11
13
  // Default log level
12
14
  let currentLogLevel = 2;
13
15
  /**
@@ -1,5 +1,6 @@
1
1
  import { existsSync } from 'fs';
2
- import { resolve } from 'path';
2
+ import { dirname, resolve } from 'path';
3
+ import { fileURLToPath } from 'url';
3
4
  import { bundleAnalysisPlugin, httpsServerPlugin, basePlugins } from '../plugins.mjs';
4
5
  import { Target, ViteMode, Flag, Stage } from '../shared/types.mjs';
5
6
  import { getPlugins, when } from '../shared/utils/helpers.mjs';
@@ -11,6 +12,7 @@ import 'chalk';
11
12
  import 'mri';
12
13
  import 'vite';
13
14
 
15
+ const __dirname = dirname(fileURLToPath(import.meta.url));
14
16
  const getBaseConfig = (ctx)=>{
15
17
  const { commonConfig, projectConfig, viteCmd } = ctx;
16
18
  const { resolveEnvs, path } = projectConfig;
@@ -29,6 +31,7 @@ const getBaseConfig = (ctx)=>{
29
31
  // Verify if the local Environment file is present
30
32
  const envFilePath = existsSync(resolve(path, 'src', envPath)) ? envPath : fallbackEnvPath;
31
33
  return {
34
+ root: resolve(path),
32
35
  envPrefix,
33
36
  plugins: getPlugins(ctx, basePlugins, httpsServerPlugin, bundleAnalysisPlugin),
34
37
  resolve: {
@@ -45,11 +48,44 @@ const getBaseConfig = (ctx)=>{
45
48
  'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
46
49
  __vite_process_env_NODE_ENV: JSON.stringify(NODE_ENV)
47
50
  },
51
+ optimizeDeps: {
52
+ esbuildOptions: {
53
+ define: {
54
+ global: 'globalThis'
55
+ }
56
+ }
57
+ },
48
58
  build: {
49
59
  sourcemap,
50
60
  minify: true,
51
61
  emptyOutDir: true,
52
62
  cssCodeSplit: true
63
+ },
64
+ test: {
65
+ watch: false,
66
+ globals: true,
67
+ pool: 'threads',
68
+ environment: 'jsdom',
69
+ include: [
70
+ 'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'
71
+ ],
72
+ reporters: [
73
+ 'default'
74
+ ],
75
+ setupFiles: resolve(__dirname, '../shared/test-setup.ts'),
76
+ coverage: {
77
+ reportsDirectory: `${resolve(path)}/coverage`,
78
+ provider: 'istanbul',
79
+ exclude: [
80
+ 'node_modules',
81
+ 'dist',
82
+ 'coverage',
83
+ 'postcss.config.js',
84
+ 'tailwind.config.js',
85
+ 'vite.config.ts',
86
+ 'vitest.config.ts'
87
+ ]
88
+ }
53
89
  }
54
90
  };
55
91
  };
@@ -1,8 +1,7 @@
1
1
  import { resolve } from 'path';
2
2
  import { dtsPlugin } from '../plugins.mjs';
3
- import '../shared/types.mjs';
4
3
  import { when, getPlugins } from '../shared/utils/helpers.mjs';
5
- import { getExternalDependencies } from '../shared/utils/projectConfig.mjs';
4
+ import { getExternalDependencies } from '../shared/utils/project-config.mjs';
6
5
  import 'chalk';
7
6
  import 'mri';
8
7
  import 'vite';
@@ -38,8 +37,7 @@ const getLibConfig = (ctx)=>{
38
37
  name,
39
38
  entry,
40
39
  formats: [
41
- 'es',
42
- 'cjs'
40
+ 'es' /*'cjs'*/
43
41
  ],
44
42
  fileName: (format)=>`index.${format === 'es' ? 'mjs' : 'cjs'}`
45
43
  },
@@ -1,6 +1,5 @@
1
1
  import { resolve } from 'path';
2
2
  import { injectCssByJsPlugin, injectCssIntoShadowDomPlugin } from '../plugins.mjs';
3
- import '../shared/types.mjs';
4
3
  import { getPlugins, chunkName } from '../shared/utils/helpers.mjs';
5
4
  import 'minimatch';
6
5
  import '../../../shared/logger.mjs';
@@ -2,11 +2,10 @@ import { defineConfig } from 'vite';
2
2
  import { currentLogLevel, LogLevel, logger } from '../../shared/logger.mjs';
3
3
  import { getPkgJson } from '../../shared/utils.mjs';
4
4
  import { getConfig } from './configs/index.mjs';
5
- import './shared/types.mjs';
6
5
  import '@nx/devkit';
7
6
  import 'path';
8
7
  import 'ramda';
9
- import { initializeConfig, mergeConfigs } from './shared/utils/projectConfig.mjs';
8
+ import { initializeConfig, mergeConfigs } from './shared/utils/project-config.mjs';
10
9
  import 'chalk';
11
10
  import 'mri';
12
11
 
@@ -1,5 +1,6 @@
1
1
  import { viteCommonjs } from '@originjs/vite-plugin-commonjs';
2
2
  import graphql from '@rollup/plugin-graphql';
3
+ import viteBasicSslPlugin from '../../node_modules/.pnpm/@vitejs_plugin-basic-ssl@1.1.0_vite@7.0.3_@types_node@18.19.31_jiti@1.21.0_sass@1.75.0_terser@5.37.0_yaml@2.7.0_/node_modules/@vitejs/plugin-basic-ssl/dist/index.mjs';
3
4
  import react from '@vitejs/plugin-react-swc';
4
5
  import { resolve } from 'path';
5
6
  import { visualizer } from 'rollup-plugin-visualizer';
@@ -17,8 +18,8 @@ import 'crypto';
17
18
  import 'fs';
18
19
  import 'chalk';
19
20
  import 'mri';
20
- import viteBasicSslPlugin from '../../node_modules/.pnpm/@vitejs_plugin-basic-ssl@1.1.0_vite@5.2.10_@types_node@18.19.31_sass@1.75.0_/node_modules/@vitejs/plugin-basic-ssl/dist/index.mjs';
21
21
 
22
+ // import unpluginIsolatedDecl from 'unplugin-isolated-decl/vite';
22
23
  /**
23
24
  * Base plugins configuration for apps and libs.
24
25
  *
@@ -28,8 +29,8 @@ import viteBasicSslPlugin from '../../node_modules/.pnpm/@vitejs_plugin-basic-ss
28
29
  * - @rollup/plugin-graphql
29
30
  * - @vitejs/plugin-react-swc
30
31
  */ const basePlugins = {
31
- generate: ()=>{
32
- const projects = getNxTsConfigPaths();
32
+ generate: (ctx)=>{
33
+ const projects = getNxTsConfigPaths(ctx);
33
34
  return [
34
35
  tsconfigPaths({
35
36
  projects
@@ -1,33 +1,38 @@
1
- var ViteMode;
2
- (function(ViteMode) {
1
+ var ViteMode = /*#__PURE__*/ function(ViteMode) {
3
2
  ViteMode["PROD"] = "production";
4
3
  ViteMode["DEV"] = "development";
5
- })(ViteMode || (ViteMode = {}));
6
- var Stage;
7
- (function(Stage) {
4
+ ViteMode["TEST"] = "test";
5
+ return ViteMode;
6
+ }({});
7
+ /**
8
+ * Project stages, it coincides with the target configurations of the project.json of NX.
9
+ * @readonly
10
+ * @enum {string}
11
+ */ var Stage = /*#__PURE__*/ function(Stage) {
8
12
  Stage["PROD"] = "prod";
9
13
  Stage["DEV"] = "dev";
10
14
  Stage["LOCAL"] = "local";
11
- })(Stage || (Stage = {}));
12
- var ProjectType;
13
- (function(ProjectType) {
15
+ return Stage;
16
+ }({});
17
+ var ProjectType = /*#__PURE__*/ function(ProjectType) {
14
18
  ProjectType["APP"] = "app";
15
19
  ProjectType["LIB"] = "lib";
16
20
  ProjectType["SCRIPT"] = "script";
17
- })(ProjectType || (ProjectType = {}));
18
- var Flag;
19
- (function(Flag) {
21
+ return ProjectType;
22
+ }({});
23
+ var Flag = /*#__PURE__*/ function(Flag) {
20
24
  Flag["SOURCEMAP"] = "source-maps";
21
25
  Flag["ANALYZE"] = "analyze";
22
26
  Flag["VERBOSE"] = "verbose";
23
27
  Flag["VERBOSE_ALIAS"] = "v";
24
28
  Flag["HTTPS"] = "https";
25
- })(Flag || (Flag = {}));
26
- var Target;
27
- (function(Target) {
29
+ return Flag;
30
+ }({});
31
+ var Target = /*#__PURE__*/ function(Target) {
28
32
  Target["BUILD"] = "build";
29
33
  Target["PREVIEW"] = "preview";
30
34
  Target["SERVE"] = "serve";
31
- })(Target || (Target = {}));
35
+ return Target;
36
+ }({});
32
37
 
33
38
  export { Flag, ProjectType, Stage, Target, ViteMode };
@@ -3,6 +3,7 @@ import { resolve } from 'path';
3
3
  import * as R from 'ramda';
4
4
  import '../../../../shared/logger.mjs';
5
5
  import { shortId } from '../../../../shared/utils.mjs';
6
+ import { ViteMode } from '../types.mjs';
6
7
 
7
8
  /**
8
9
  * Deeply merges two objects, combining their properties.
@@ -79,12 +80,17 @@ import { shortId } from '../../../../shared/utils.mjs';
79
80
  * console.log(tsConfigPaths);
80
81
  * // Output:
81
82
  * // ['apps/my-app/tsconfig.app.json', 'libs/my-lib/tsconfig.lib.json']
82
- */ const getNxTsConfigPaths = ()=>{
83
- const isValid = (p)=>p.data.root.startsWith('apps/') || p.data.root.startsWith('libs/');
84
- const getTsConfigPath = (p)=>resolve(p.data.root, `tsconfig.${p.type === 'app' ? 'app' : 'lib'}.json`);
85
- const graph = readCachedProjectGraph();
86
- const projects = graph.nodes;
87
- return Object.values(projects).filter(isValid).map(getTsConfigPath);
83
+ */ const getNxTsConfigPaths = ({ projectConfig })=>{
84
+ const isValidProject = (project)=>project.data.root.startsWith('apps/') || project.data.root.startsWith('libs/');
85
+ const generateTsConfigPath = (project)=>{
86
+ let tsconfigType = project.type === 'app' ? 'app' : 'lib';
87
+ if (projectConfig.viteEnv.mode === ViteMode.TEST && projectConfig.path.includes(project.data.root)) {
88
+ tsconfigType = 'spec';
89
+ }
90
+ return resolve(project.data.root, `tsconfig.${tsconfigType}.json`);
91
+ };
92
+ const { nodes } = readCachedProjectGraph();
93
+ return Object.values(nodes).filter(isValidProject).map(generateTsConfigPath);
88
94
  };
89
95
 
90
96
  export { chunkName, deepMerge, getNxTsConfigPaths, getPlugins, when };
@@ -3,7 +3,7 @@ import { LogLevel, logger, setLogLevel } from '../../../../shared/logger.mjs';
3
3
  import { getPkgJson } from '../../../../shared/utils.mjs';
4
4
  import { Flag } from '../types.mjs';
5
5
  import { deepMerge } from './helpers.mjs';
6
- import { getViteCommand } from './viteCommand.mjs';
6
+ import { getViteCommand } from './vite-command.mjs';
7
7
 
8
8
  /**
9
9
  * Initializes the project configuration with default values.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizza/devkit",
3
- "version": "0.2.1",
3
+ "version": "0.2.3-beta.0",
4
4
  "type": "module",
5
5
  "main": "dist/cjs/index.cjs",
6
6
  "module": "dist/esm/index.mjs",
package/dist/index.d.ts DELETED
@@ -1,376 +0,0 @@
1
- // Generated by dts-bundle-generator v7.2.0
2
-
3
- import { ExecutorContext } from '@nx/devkit';
4
- import { PreRenderedChunk } from 'rollup';
5
- import { ConfigEnv, LibraryOptions, Plugin, PluginOption, UserConfig, ViteDevServer } from 'vite';
6
-
7
- export type ExecutorResponse = {
8
- success: boolean;
9
- };
10
- export interface ExecutorOptions {
11
- s3Bucket: string;
12
- cloudFrontId: string;
13
- buildTarget: string;
14
- assetsDir: string;
15
- rootDir?: string;
16
- skipBuild?: boolean;
17
- typings?: boolean;
18
- dryRun?: boolean;
19
- ignoreConfigs?: string[];
20
- }
21
- export function deployExecutor(opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
22
- export interface ExecutorOptions {
23
- }
24
- declare function runExecutor(_opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
25
- export interface ExecutorOptions {
26
- unlink?: boolean;
27
- }
28
- declare function runExecutor(opts: ExecutorOptions, context: ExecutorContext): Promise<ExecutorResponse>;
29
- export interface ExecutorOptions {
30
- tag: string;
31
- dryRun?: boolean;
32
- }
33
- declare function runExecutor(opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
34
- export interface ExecutorOptions {
35
- }
36
- declare function runExecutor(_opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
37
- declare function runExecutor(_opts: any, ctx: ExecutorContext): Promise<ExecutorResponse>;
38
- export interface ExecutorOptions {
39
- packageOrg: string;
40
- rollback?: boolean;
41
- skipLink?: boolean;
42
- }
43
- declare function runExecutor(opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
44
- declare enum LogLevel {
45
- ERROR = 0,
46
- WARN = 1,
47
- INFO = 2,
48
- DEBUG = 3
49
- }
50
- export declare enum ViteMode {
51
- PROD = "production",
52
- DEV = "development"
53
- }
54
- /**
55
- * Project stages, it coincides with the target configurations of the project.json of NX.
56
- * @readonly
57
- * @enum {string}
58
- */
59
- export declare enum Stage {
60
- PROD = "prod",
61
- DEV = "dev",
62
- LOCAL = "local"
63
- }
64
- export declare enum ProjectType {
65
- APP = "app",
66
- LIB = "lib",
67
- SCRIPT = "script"
68
- }
69
- export declare enum Flag {
70
- SOURCEMAP = "source-maps",
71
- ANALYZE = "analyze",
72
- VERBOSE = "verbose",
73
- VERBOSE_ALIAS = "v",
74
- HTTPS = "https"
75
- }
76
- export declare enum Target {
77
- BUILD = "build",
78
- PREVIEW = "preview",
79
- SERVE = "serve"
80
- }
81
- /**
82
- * Vite Environment.
83
- *
84
- * @property {ViteMode} mode - Vite mode.
85
- */
86
- export type ViteEnv = ConfigEnv & {
87
- mode: ViteMode;
88
- };
89
- /**
90
- * Externalizing libraries.
91
- *
92
- * @property {boolean} default - React externalizes and other common dependencies,
93
- * this only applies to libraries.
94
- * @property {boolean} glob - Glob expression or list of glob expressions to exclude
95
- * dependencies from the package.json.
96
- */
97
- export type ExternalizeLibs = {
98
- default: boolean;
99
- glob: string | string[];
100
- };
101
- export type ResolveEnvs = {
102
- default: boolean;
103
- local: boolean;
104
- };
105
- /**
106
- * Project configuration.
107
- *
108
- * @property {ProjectType} type - Type of the project.
109
- * @property {string} path - Path of the project.
110
- * @property {string} entry - Path of the file entry point.
111
- * @property {string} name - Name of the project, it is also used to define the name of the library.
112
- * @property {string} port - Server port.
113
- * @property {boolean} debug - Print data purification data.
114
- * @property {boolean} dts - Control if the .d.ts files are generated, by default it is True.
115
- * @property {Partial<ResolveEnvs>} resolveEnvs - Flag for resolving environment.
116
- * @property {boolean} shadowDom - If component is render into shadow dom.
117
- * @property {Partial<ExternalizeLibs>} externalizeLibs - Configuration for externalizing libraries.
118
- * @property {LibraryOptions['fileName']} fileName - Output file name for library.
119
- * @property {string} fileName - Prefix for chunk file name.
120
- * @property {ViteEnv} viteEnv - Vite environment configuration.
121
- * @property {UserConfig} overrides - Overrides for vite configuration.
122
- */
123
- export interface ProjectConfig {
124
- type: ProjectType;
125
- path: string;
126
- entry?: string;
127
- name?: string;
128
- port?: number;
129
- logLevel?: LogLevel;
130
- dts?: boolean;
131
- resolveEnvs?: Partial<ResolveEnvs>;
132
- shadowDom?: boolean;
133
- externalizeLibs?: Partial<ExternalizeLibs>;
134
- fileName?: LibraryOptions["fileName"];
135
- chunkPrefix?: string;
136
- viteEnv: ViteEnv;
137
- overrides?: UserConfig;
138
- }
139
- export interface ProjectConfigInitialized extends ProjectConfig {
140
- name: string;
141
- fileName: string;
142
- chunkPrefix: string;
143
- logLevel: LogLevel;
144
- overrides: UserConfig;
145
- shadowDom: boolean;
146
- resolveEnvs: ResolveEnvs;
147
- externalizeLibs: ExternalizeLibs;
148
- }
149
- /**
150
- * Vite command details.
151
- * @interface
152
- * @property {Stage} stage - Stage of the project.
153
- * @property {string} target - Command name.
154
- * @property {Record<string, any>} flags - Flags for customize command.
155
- */
156
- export interface ViteCommand {
157
- stage: Stage;
158
- target: string;
159
- flags: Record<string, any>;
160
- }
161
- /**
162
- * Common project configuration.
163
- *
164
- * @property {string} envPrefix - Prefix in lowercase for environment variables and output files.
165
- * @property {boolean} externalizeLibGlob - Glob expression or list of glob expressions to exclude
166
- * dependencies from the package.json.
167
- */
168
- export interface CommonProjectConfig {
169
- envPrefix: string;
170
- externalizeLibGlob?: string | string[];
171
- }
172
- /**
173
- * Config builder context.
174
- *
175
- * @property {CommonProjectConfig} commonConfig - Common configuration for the project.
176
- * @property {ProjectConfigInitialized} projectConfig - Initialized project configuration.
177
- * @property {ViteCommandDetail} viteCmd - Vite command details.
178
- */
179
- export interface Context {
180
- commonConfig: CommonProjectConfig;
181
- projectConfig: ProjectConfigInitialized;
182
- viteCmd: ViteCommand;
183
- localPkgJson: Record<string, any>;
184
- }
185
- /**
186
- * Interface for plugin configuration.
187
- */
188
- export interface PluginConfig {
189
- /**
190
- * Generates plugin(s) based on the provided configuration.
191
- * @param {Context} ctx - The main configuration object.
192
- * @returns {any[]} An array of plugins.
193
- */
194
- generate: (ctx: Context) => any[];
195
- /**
196
- * Condition to determine if the plugin(s) should be included.
197
- * @param {Context} ctx - The main configuration object.
198
- * @returns {boolean} True if the plugin(s) should be included; false otherwise.
199
- */
200
- condition?: (ctx: Context) => boolean;
201
- }
202
- /**
203
- * Deeply merges two objects, combining their properties.
204
- *
205
- * @param {Record<string, any>} v1 - The first object.
206
- * @param {Record<string, any>} v2 - The second object.
207
- * @returns {Record<string, any>} - The merged object.
208
- *
209
- * @example
210
- * const obj1 = { a: 1, b: { c: 2 } };
211
- * const obj2 = { b: { d: 3 } };
212
- * const merged = deepMerge(obj1, obj2); // Outputs: { a: 1, b: { c: 2, d: 3 } }
213
- */
214
- export declare function deepMerge(v1: Record<string, any>, v2: Record<string, any>): Record<string, any>;
215
- /**
216
- * Generates a name for js files.
217
- *
218
- * @param {string} [prefix] - An optional prefix for the chunk name.
219
- * @returns - A function that takes an item and generates a chunk name.
220
- *
221
- * @example
222
- * const generateChunkName = chunkName('prefix');
223
- * const name = generateChunkName({ name: 'example' }); // Outputs: "prefix-example-Aj3_Dk7_2j.js"
224
- */
225
- export declare const chunkName: (prefix?: string) => (x: PreRenderedChunk) => string;
226
- /**
227
- * Returns the given object if the condition is true, otherwise returns null.
228
- *
229
- * @param {any} condition - The condition to evaluate.
230
- * @param {Record<string, any>} obj - The object to return if the condition is true.
231
- * @returns {Record<string, any> | null} - The object or null based on the condition.
232
- *
233
- * @example
234
- * const obj = { a: 1 };
235
- * const result = when(true, obj); // Outputs: { a: 1 }
236
- * const result2 = when(false, obj); // Outputs: {}
237
- */
238
- export declare const when: (condition: any, obj: Record<string, any>) => Record<string, any>;
239
- /**
240
- * Filters and generates plugin configurations based on conditions and the provided context.
241
- *
242
- * @param {Context} ctx - The main configuration object.
243
- * @returns {any[]} - An array of generated plugin configurations.
244
- */
245
- export declare const getPlugins: (ctx: Context, ...pluginConfigs: PluginConfig[]) => PluginOption[];
246
- /**
247
- * Gets the paths to the tsconfig files for all relevant projects.
248
- *
249
- * @returns {string[]} - An array containing paths to tsconfig files for both app and lib projects.
250
- *
251
- * @example
252
- * const projects = {
253
- * 'my-app': {
254
- * type: 'app',
255
- * data: { root: 'apps/my-app' }
256
- * },
257
- * 'my-lib': {
258
- * type: 'lib',
259
- * data: { root: 'libs/my-lib' }
260
- * }
261
- * };
262
- *
263
- * const tsConfigPaths = getTsConfigPaths(projects);
264
- * console.log(tsConfigPaths);
265
- * // Output:
266
- * // ['apps/my-app/tsconfig.app.json', 'libs/my-lib/tsconfig.lib.json']
267
- */
268
- export declare const getNxTsConfigPaths: () => string[];
269
- /**
270
- * Initializes the project configuration with default values.
271
- *
272
- * @example
273
- * const config = { type: ProjectType.APP, path: '/path/to/project', viteEnv: { mode: ViteMode.DEV } };
274
- * const initializedConfig = initializeConfig(config);
275
- */
276
- export declare const initializeConfig: (ccfg: CommonProjectConfig, pcfg: ProjectConfig, localPkgJson: Record<string, any>) => {
277
- viteCmd: ViteCommand;
278
- cfg: ProjectConfigInitialized;
279
- };
280
- /**
281
- * Handles merging configurations and logs any errors.
282
- *
283
- * @param {UserConfig} defaultConfig - The default configuration.
284
- * @param {UserConfig} overrides - The overrides configuration.
285
- * @returns {UserConfig} - The merged configuration.
286
- */
287
- export declare const mergeConfigs: (defaultConfig: UserConfig, overrides: UserConfig) => UserConfig;
288
- /**
289
- * Resolves glob patterns to actual package names found in package.json dependencies.
290
- * This function is used to determine which packages should be treated as external
291
- * in a Rollup or Vite build configuration.
292
- *
293
- * @param {string} path - The base path where package.json is located.
294
- * @param {string | string[]} globs - A glob pattern or an array of glob patterns to match dependencies against.
295
- * @returns {string[]} An array of package names that match the given glob patterns.
296
- *
297
- * @example
298
- * // Example of using `getExternalDependencies` to find all dependencies starting with "my-lib" and "lodash"
299
- * const projectPath = '/path/to/project';
300
- * const globs = ['my-lib*', 'lodash'];
301
- * const externalDependencies = getExternalDependencies(projectPath, globs);
302
- * console.log(externalDependencies);
303
- * // Output might be: ['my-lib/utils', 'my-lib/core', 'lodash']
304
- */
305
- export declare const getExternalDependencies: (path: string, globs?: string | string[]) => string[];
306
- /**
307
- * Generates a string of initials based on the input string,
308
- * following certain rules:
309
- * 1. A word is considered as a sequence of characters
310
- * separated by hyphens.
311
- * 2. If the string contains '@', any characters before
312
- * and including the next '/' are ignored.
313
- * 3. The first character of each word is taken to form
314
- * the initials.
315
- *
316
- * @param {string} input - The input string from which to generate the initials.
317
- * @returns {string} The initials formed by taking the first character
318
- * of each word, after applying the specified rules.
319
- *
320
- * @example
321
- * getInitials("player-script"); // returns "ps"
322
- * getInitials("ssv-admin"); // returns "sa"
323
- * getInitials("@nizza/customize-live"); // returns "cl"
324
- */
325
- export declare function getInitials(input: string): string;
326
- /**
327
- * Retrieves the Vite command details.
328
- *
329
- * @param {ViteMode} mode - The Vite mode.
330
- * @returns {ViteCommand} - The command details.
331
- *
332
- * @example
333
- * const command = getViteCommand(ViteMode.PROD);
334
- * // Outputs: { stage: Stage.PROD, target: 'build', flags: {} }
335
- */
336
- export declare function getViteCommand(mode: ViteMode): ViteCommand;
337
- /**
338
- * Parses the command string to extract flags.
339
- *
340
- * @param {string | undefined} commandString - The command string.
341
- * @returns {Record<string, string>} - The flags extracted from the command string.
342
- *
343
- * @example
344
- * const flags = getViteCmdFlags('nx run core:build --source-maps');
345
- * // Outputs: { 'source-maps: 'true' }
346
- */
347
- export declare function getViteCmdFlags(commandString: string | undefined): Record<string, string>;
348
- /**
349
- * Builds the configuration based on common and project-specific configurations.
350
- *
351
- * @param {CommonProjectConfig} commonConfig - The common configuration.
352
- * @returns - Returns a function that accepts a project configuration and returns the Vite configuration.
353
- */
354
- export declare const createConfigBuilder: (commonConfig: CommonProjectConfig) => (projectConfig: ProjectConfig) => UserConfig;
355
- export interface Execute {
356
- function: (data?: string) => void;
357
- listen: string;
358
- observer: string;
359
- }
360
- export interface ThirdPartyCssInjectPlugin {
361
- topExecutionPriority?: boolean;
362
- execute?: Execute[];
363
- }
364
- /**
365
- * Inject the CSS compiled with JS.
366
- *
367
- * @return {Plugin}
368
- */
369
- export declare function thirdPartyCssInjectPlugin({ topExecutionPriority, execute }?: ThirdPartyCssInjectPlugin | undefined): Plugin;
370
- export declare function injectCssIntoShadowDom(): {
371
- name: string;
372
- configureServer(_server: ViteDevServer): void;
373
- transform(src: string, id: string): void;
374
- };
375
-
376
- export {};