@nizza/devkit 0.1.0-alpha.10 → 0.1.0-alpha.12

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 (115) hide show
  1. package/dist/cjs/executors/update-executors-file/index.cjs +2 -2
  2. package/dist/cjs/index.cjs +7 -22
  3. package/dist/cjs/shared/utils.cjs +0 -28
  4. package/dist/cjs/{vite → vitejs}/config-builder/configs/lib.cjs +2 -1
  5. package/dist/cjs/{vite → vitejs}/config-builder/plugins.cjs +3 -3
  6. package/dist/cjs/{vite → vitejs}/config-builder/shared/utils/helpers.cjs +2 -2
  7. package/dist/cjs/{vite → vitejs}/plugins/third-party-css-inject/utils.cjs +1 -3
  8. package/dist/esm/executors/update-executors-file/index.mjs +2 -2
  9. package/dist/esm/index.mjs +7 -9
  10. package/dist/esm/shared/utils.mjs +1 -28
  11. package/dist/esm/{vite → vitejs}/config-builder/configs/lib.mjs +2 -1
  12. package/dist/esm/{vite → vitejs}/config-builder/plugins.mjs +3 -3
  13. package/dist/esm/{vite → vitejs}/config-builder/shared/utils/helpers.mjs +2 -2
  14. package/dist/esm/{vite → vitejs}/config-builder/shared/utils/projectConfig.mjs +1 -1
  15. package/dist/esm/{vite → vitejs}/plugins/third-party-css-inject/utils.mjs +1 -3
  16. package/dist/index.d.ts +367 -0
  17. package/package.json +4 -6
  18. package/dist/cjs/executors/deploy/helpers.d.cts +0 -4
  19. package/dist/cjs/executors/deploy/index.d.cts +0 -11
  20. package/dist/cjs/executors/environments/helpers.d.cts +0 -25
  21. package/dist/cjs/executors/environments/index.d.cts +0 -16
  22. package/dist/cjs/executors/publish/helpers.d.cts +0 -19
  23. package/dist/cjs/executors/publish/index.d.cts +0 -12
  24. package/dist/cjs/executors/shared/utils.d.cts +0 -27
  25. package/dist/cjs/executors/update-executors-file/helpers.d.cts +0 -17
  26. package/dist/cjs/executors/update-executors-file/index.d.cts +0 -12
  27. package/dist/cjs/executors/vtex-link/constants.d.cts +0 -4
  28. package/dist/cjs/executors/vtex-link/helpers.d.cts +0 -77
  29. package/dist/cjs/executors/vtex-link/index.d.cts +0 -5
  30. package/dist/cjs/index-0ce2daf7.d.ts +0 -2
  31. package/dist/cjs/index-17143e35.d.ts +0 -2
  32. package/dist/cjs/index-3080371d.d.ts +0 -3
  33. package/dist/cjs/index-f6330edc.d.ts +0 -2
  34. package/dist/cjs/index.d.cts +0 -10
  35. package/dist/cjs/index.d.cts.map +0 -1
  36. package/dist/cjs/scripts/changeset-pre-mode.d.cts +0 -2
  37. package/dist/cjs/scripts/index.d.cts +0 -1
  38. package/dist/cjs/shared/logger.d.cts +0 -33
  39. package/dist/cjs/shared/utils.d.cts +0 -19
  40. package/dist/cjs/types-1282e639.d.ts +0 -12
  41. package/dist/cjs/types-7377dcc9.d.ts +0 -4
  42. package/dist/cjs/types-763439e4.d.ts +0 -14
  43. package/dist/cjs/vite/config-builder/configs/app.d.cts +0 -4
  44. package/dist/cjs/vite/config-builder/configs/base.d.cts +0 -4
  45. package/dist/cjs/vite/config-builder/configs/index.d.cts +0 -7
  46. package/dist/cjs/vite/config-builder/configs/lib.d.cts +0 -4
  47. package/dist/cjs/vite/config-builder/configs/script.d.cts +0 -4
  48. package/dist/cjs/vite/config-builder/main.d.cts +0 -10
  49. package/dist/cjs/vite/config-builder/plugins.d.cts +0 -30
  50. package/dist/cjs/vite/config-builder/shared/types.d.cts +0 -155
  51. package/dist/cjs/vite/config-builder/shared/utils/helpers.d.cts +0 -71
  52. package/dist/cjs/vite/config-builder/shared/utils/projectConfig.d.cts +0 -60
  53. package/dist/cjs/vite/config-builder/shared/utils/viteCommand.d.cts +0 -24
  54. package/dist/cjs/vite/plugins/shadow-dom-inject-css/index.d.cts +0 -7
  55. package/dist/cjs/vite/plugins/third-party-css-inject/main.d.cts +0 -17
  56. package/dist/cjs/vite/plugins/third-party-css-inject/utils.d.cts +0 -5
  57. package/dist/esm/executors/deploy/helpers.d.mts +0 -4
  58. package/dist/esm/executors/deploy/index.d.mts +0 -11
  59. package/dist/esm/executors/environments/helpers.d.mts +0 -25
  60. package/dist/esm/executors/environments/index.d.mts +0 -16
  61. package/dist/esm/executors/publish/helpers.d.mts +0 -19
  62. package/dist/esm/executors/publish/index.d.mts +0 -12
  63. package/dist/esm/executors/shared/utils.d.mts +0 -27
  64. package/dist/esm/executors/update-executors-file/helpers.d.mts +0 -17
  65. package/dist/esm/executors/update-executors-file/index.d.mts +0 -12
  66. package/dist/esm/executors/vtex-link/constants.d.mts +0 -4
  67. package/dist/esm/executors/vtex-link/helpers.d.mts +0 -77
  68. package/dist/esm/executors/vtex-link/index.d.mts +0 -5
  69. package/dist/esm/index-0ce2daf7.d.ts +0 -2
  70. package/dist/esm/index-17143e35.d.ts +0 -2
  71. package/dist/esm/index-3080371d.d.ts +0 -3
  72. package/dist/esm/index-f6330edc.d.ts +0 -2
  73. package/dist/esm/index.d.mts +0 -10
  74. package/dist/esm/index.d.mts.map +0 -1
  75. package/dist/esm/scripts/changeset-pre-mode.d.mts +0 -2
  76. package/dist/esm/scripts/index.d.mts +0 -1
  77. package/dist/esm/shared/logger.d.mts +0 -33
  78. package/dist/esm/shared/utils.d.mts +0 -19
  79. package/dist/esm/types-1282e639.d.ts +0 -12
  80. package/dist/esm/types-7377dcc9.d.ts +0 -4
  81. package/dist/esm/types-763439e4.d.ts +0 -14
  82. package/dist/esm/vite/config-builder/configs/app.d.mts +0 -4
  83. package/dist/esm/vite/config-builder/configs/base.d.mts +0 -4
  84. package/dist/esm/vite/config-builder/configs/index.d.mts +0 -7
  85. package/dist/esm/vite/config-builder/configs/lib.d.mts +0 -4
  86. package/dist/esm/vite/config-builder/configs/script.d.mts +0 -4
  87. package/dist/esm/vite/config-builder/main.d.mts +0 -10
  88. package/dist/esm/vite/config-builder/plugins.d.mts +0 -30
  89. package/dist/esm/vite/config-builder/shared/types.d.mts +0 -155
  90. package/dist/esm/vite/config-builder/shared/utils/helpers.d.mts +0 -71
  91. package/dist/esm/vite/config-builder/shared/utils/projectConfig.d.mts +0 -60
  92. package/dist/esm/vite/config-builder/shared/utils/viteCommand.d.mts +0 -24
  93. package/dist/esm/vite/plugins/shadow-dom-inject-css/index.d.mts +0 -7
  94. package/dist/esm/vite/plugins/third-party-css-inject/main.d.mts +0 -17
  95. package/dist/esm/vite/plugins/third-party-css-inject/utils.d.mts +0 -5
  96. package/dist/executors.json +0 -29
  97. /package/dist/cjs/{vite → vitejs}/config-builder/configs/app.cjs +0 -0
  98. /package/dist/cjs/{vite → vitejs}/config-builder/configs/base.cjs +0 -0
  99. /package/dist/cjs/{vite → vitejs}/config-builder/configs/index.cjs +0 -0
  100. /package/dist/cjs/{vite → vitejs}/config-builder/configs/script.cjs +0 -0
  101. /package/dist/cjs/{vite → vitejs}/config-builder/main.cjs +0 -0
  102. /package/dist/cjs/{vite → vitejs}/config-builder/shared/types.cjs +0 -0
  103. /package/dist/cjs/{vite → vitejs}/config-builder/shared/utils/projectConfig.cjs +0 -0
  104. /package/dist/cjs/{vite → vitejs}/config-builder/shared/utils/viteCommand.cjs +0 -0
  105. /package/dist/cjs/{vite → vitejs}/plugins/shadow-dom-inject-css/index.cjs +0 -0
  106. /package/dist/cjs/{vite → vitejs}/plugins/third-party-css-inject/main.cjs +0 -0
  107. /package/dist/esm/{vite → vitejs}/config-builder/configs/app.mjs +0 -0
  108. /package/dist/esm/{vite → vitejs}/config-builder/configs/base.mjs +0 -0
  109. /package/dist/esm/{vite → vitejs}/config-builder/configs/index.mjs +0 -0
  110. /package/dist/esm/{vite → vitejs}/config-builder/configs/script.mjs +0 -0
  111. /package/dist/esm/{vite → vitejs}/config-builder/main.mjs +0 -0
  112. /package/dist/esm/{vite → vitejs}/config-builder/shared/types.mjs +0 -0
  113. /package/dist/esm/{vite → vitejs}/config-builder/shared/utils/viteCommand.mjs +0 -0
  114. /package/dist/esm/{vite → vitejs}/plugins/shadow-dom-inject-css/index.mjs +0 -0
  115. /package/dist/esm/{vite → vitejs}/plugins/third-party-css-inject/main.mjs +0 -0
@@ -0,0 +1,367 @@
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
+ s3BucketPath: string;
12
+ cloudFrontDistributionId: string;
13
+ cloudFrontInvalidationPaths: string[];
14
+ buildTarget: string;
15
+ skipBuild?: boolean;
16
+ }
17
+ export function deployExecutor(opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
18
+ export interface ExecutorOptions {
19
+ }
20
+ declare function runExecutor(_opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
21
+ export interface ExecutorOptions {
22
+ tag: string;
23
+ dryRun?: boolean;
24
+ }
25
+ declare function runExecutor(opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
26
+ export interface ExecutorOptions {
27
+ }
28
+ declare function runExecutor(_opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
29
+ export interface ExecutorOptions {
30
+ packageOrg: string;
31
+ rollback?: boolean;
32
+ skipLink?: boolean;
33
+ }
34
+ declare function runExecutor(opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
35
+ declare enum LogLevel {
36
+ ERROR = 0,
37
+ WARN = 1,
38
+ INFO = 2,
39
+ DEBUG = 3
40
+ }
41
+ export declare enum ViteMode {
42
+ PROD = "production",
43
+ DEV = "development"
44
+ }
45
+ /**
46
+ * Project stages, it coincides with the target configurations of the project.json of NX.
47
+ * @readonly
48
+ * @enum {string}
49
+ */
50
+ export declare enum Stage {
51
+ PROD = "prod",
52
+ DEV = "dev",
53
+ STAGING = "staging",
54
+ LOCAL = "local"
55
+ }
56
+ export declare enum ProjectType {
57
+ APP = "app",
58
+ LIB = "lib",
59
+ SCRIPT = "script"
60
+ }
61
+ export declare enum Flag {
62
+ SOURCEMAP = "source-maps",
63
+ ANALYZE = "analyze",
64
+ VERBOSE = "verbose",
65
+ VERBOSE_ALIAS = "v"
66
+ }
67
+ export declare enum Target {
68
+ BUILD = "build",
69
+ PREVIEW = "preview",
70
+ SERVE = "serve"
71
+ }
72
+ /**
73
+ * Vite Environment.
74
+ *
75
+ * @property {ViteMode} mode - Vite mode.
76
+ */
77
+ export type ViteEnv = ConfigEnv & {
78
+ mode: ViteMode;
79
+ };
80
+ /**
81
+ * Externalizing libraries.
82
+ *
83
+ * @property {boolean} default - React externalizes and other common dependencies,
84
+ * this only applies to libraries.
85
+ * @property {boolean} glob - Glob expression or list of glob expressions to exclude
86
+ * dependencies from the package.json.
87
+ */
88
+ export type ExternalizeLibs = {
89
+ default: boolean;
90
+ glob: string | string[];
91
+ };
92
+ export type ResolveEnvs = {
93
+ default: boolean;
94
+ local: boolean;
95
+ };
96
+ /**
97
+ * Project configuration.
98
+ *
99
+ * @property {ProjectType} type - Type of the project.
100
+ * @property {string} path - Path of the project.
101
+ * @property {string} entry - Path of the file entry point.
102
+ * @property {string} name - Name of the project, it is also used to define the name of the library.
103
+ * @property {string} port - Server port.
104
+ * @property {boolean} debug - Print data purification data.
105
+ * @property {boolean} dts - Control if the .d.ts files are generated, by default it is True.
106
+ * @property {Partial<ResolveEnvs>} resolveEnvs - Flag for resolving environment.
107
+ * @property {boolean} shadowDom - If component is render into shadow dom.
108
+ * @property {Partial<ExternalizeLibs>} externalizeLibs - Configuration for externalizing libraries.
109
+ * @property {LibraryOptions['fileName']} fileName - Output file name for library.
110
+ * @property {string} fileName - Prefix for chunk file name.
111
+ * @property {ViteEnv} viteEnv - Vite environment configuration.
112
+ * @property {UserConfig} overrides - Overrides for vite configuration.
113
+ */
114
+ export interface ProjectConfig {
115
+ type: ProjectType;
116
+ path: string;
117
+ entry?: string;
118
+ name?: string;
119
+ port?: number;
120
+ logLevel?: LogLevel;
121
+ dts?: boolean;
122
+ resolveEnvs?: Partial<ResolveEnvs>;
123
+ shadowDom?: boolean;
124
+ externalizeLibs?: Partial<ExternalizeLibs>;
125
+ fileName?: LibraryOptions["fileName"];
126
+ chunkPrefix?: string;
127
+ viteEnv: ViteEnv;
128
+ overrides?: UserConfig;
129
+ }
130
+ export interface ProjectConfigInitialized extends ProjectConfig {
131
+ name: string;
132
+ fileName: string;
133
+ chunkPrefix: string;
134
+ logLevel: LogLevel;
135
+ overrides: UserConfig;
136
+ shadowDom: boolean;
137
+ resolveEnvs: ResolveEnvs;
138
+ externalizeLibs: ExternalizeLibs;
139
+ }
140
+ /**
141
+ * Vite command details.
142
+ * @interface
143
+ * @property {Stage} stage - Stage of the project.
144
+ * @property {string} target - Command name.
145
+ * @property {Record<string, any>} flags - Flags for customize command.
146
+ */
147
+ export interface ViteCommand {
148
+ stage: Stage;
149
+ target: string;
150
+ flags: Record<string, any>;
151
+ }
152
+ /**
153
+ * Common project configuration.
154
+ *
155
+ * @property {string} envPrefix - Prefix in lowercase for environment variables and output files.
156
+ * @property {boolean} externalizeLibGlob - Glob expression or list of glob expressions to exclude
157
+ * dependencies from the package.json.
158
+ */
159
+ export interface CommonProjectConfig {
160
+ envPrefix: string;
161
+ externalizeLibGlob?: string | string[];
162
+ }
163
+ /**
164
+ * Config builder context.
165
+ *
166
+ * @property {CommonProjectConfig} commonConfig - Common configuration for the project.
167
+ * @property {ProjectConfigInitialized} projectConfig - Initialized project configuration.
168
+ * @property {ViteCommandDetail} viteCmd - Vite command details.
169
+ */
170
+ export interface Context {
171
+ commonConfig: CommonProjectConfig;
172
+ projectConfig: ProjectConfigInitialized;
173
+ viteCmd: ViteCommand;
174
+ localPkgJson: Record<string, any>;
175
+ }
176
+ /**
177
+ * Interface for plugin configuration.
178
+ */
179
+ export interface PluginConfig {
180
+ /**
181
+ * Generates plugin(s) based on the provided configuration.
182
+ * @param {Context} ctx - The main configuration object.
183
+ * @returns {any[]} An array of plugins.
184
+ */
185
+ generate: (ctx: Context) => any[];
186
+ /**
187
+ * Condition to determine if the plugin(s) should be included.
188
+ * @param {Context} ctx - The main configuration object.
189
+ * @returns {boolean} True if the plugin(s) should be included; false otherwise.
190
+ */
191
+ condition?: (ctx: Context) => boolean;
192
+ }
193
+ /**
194
+ * Deeply merges two objects, combining their properties.
195
+ *
196
+ * @param {Record<string, any>} v1 - The first object.
197
+ * @param {Record<string, any>} v2 - The second object.
198
+ * @returns {Record<string, any>} - The merged object.
199
+ *
200
+ * @example
201
+ * const obj1 = { a: 1, b: { c: 2 } };
202
+ * const obj2 = { b: { d: 3 } };
203
+ * const merged = deepMerge(obj1, obj2); // Outputs: { a: 1, b: { c: 2, d: 3 } }
204
+ */
205
+ export declare function deepMerge(v1: Record<string, any>, v2: Record<string, any>): Record<string, any>;
206
+ /**
207
+ * Generates a name for js files.
208
+ *
209
+ * @param {string} [prefix] - An optional prefix for the chunk name.
210
+ * @returns - A function that takes an item and generates a chunk name.
211
+ *
212
+ * @example
213
+ * const generateChunkName = chunkName('prefix');
214
+ * const name = generateChunkName({ name: 'example' }); // Outputs: "prefix-example-Aj3_Dk7_2j.js"
215
+ */
216
+ export declare const chunkName: (prefix?: string) => (x: PreRenderedChunk) => string;
217
+ /**
218
+ * Returns the given object if the condition is true, otherwise returns null.
219
+ *
220
+ * @param {any} condition - The condition to evaluate.
221
+ * @param {Record<string, any>} obj - The object to return if the condition is true.
222
+ * @returns {Record<string, any> | null} - The object or null based on the condition.
223
+ *
224
+ * @example
225
+ * const obj = { a: 1 };
226
+ * const result = when(true, obj); // Outputs: { a: 1 }
227
+ * const result2 = when(false, obj); // Outputs: {}
228
+ */
229
+ export declare const when: (condition: any, obj: Record<string, any>) => Record<string, any>;
230
+ /**
231
+ * Filters and generates plugin configurations based on conditions and the provided context.
232
+ *
233
+ * @param {Context} ctx - The main configuration object.
234
+ * @returns {any[]} - An array of generated plugin configurations.
235
+ */
236
+ export declare const getPlugins: (ctx: Context, ...pluginConfigs: PluginConfig[]) => PluginOption[];
237
+ /**
238
+ * Gets the paths to the tsconfig files for all relevant projects.
239
+ *
240
+ * @returns {string[]} - An array containing paths to tsconfig files for both app and lib projects.
241
+ *
242
+ * @example
243
+ * const projects = {
244
+ * 'my-app': {
245
+ * type: 'app',
246
+ * data: { root: 'apps/my-app' }
247
+ * },
248
+ * 'my-lib': {
249
+ * type: 'lib',
250
+ * data: { root: 'libs/my-lib' }
251
+ * }
252
+ * };
253
+ *
254
+ * const tsConfigPaths = getTsConfigPaths(projects);
255
+ * console.log(tsConfigPaths);
256
+ * // Output:
257
+ * // ['apps/my-app/tsconfig.app.json', 'libs/my-lib/tsconfig.lib.json']
258
+ */
259
+ export declare const getNxTsConfigPaths: () => string[];
260
+ /**
261
+ * Initializes the project configuration with default values.
262
+ *
263
+ * @example
264
+ * const config = { type: ProjectType.APP, path: '/path/to/project', viteEnv: { mode: ViteMode.DEV } };
265
+ * const initializedConfig = initializeConfig(config);
266
+ */
267
+ export declare const initializeConfig: (ccfg: CommonProjectConfig, pcfg: ProjectConfig, localPkgJson: Record<string, any>) => {
268
+ viteCmd: ViteCommand;
269
+ cfg: ProjectConfigInitialized;
270
+ };
271
+ /**
272
+ * Handles merging configurations and logs any errors.
273
+ *
274
+ * @param {UserConfig} defaultConfig - The default configuration.
275
+ * @param {UserConfig} overrides - The overrides configuration.
276
+ * @returns {UserConfig} - The merged configuration.
277
+ */
278
+ export declare const mergeConfigs: (defaultConfig: UserConfig, overrides: UserConfig) => UserConfig;
279
+ /**
280
+ * Resolves glob patterns to actual package names found in package.json dependencies.
281
+ * This function is used to determine which packages should be treated as external
282
+ * in a Rollup or Vite build configuration.
283
+ *
284
+ * @param {string} path - The base path where package.json is located.
285
+ * @param {string | string[]} globs - A glob pattern or an array of glob patterns to match dependencies against.
286
+ * @returns {string[]} An array of package names that match the given glob patterns.
287
+ *
288
+ * @example
289
+ * // Example of using `getExternalDependencies` to find all dependencies starting with "my-lib" and "lodash"
290
+ * const projectPath = '/path/to/project';
291
+ * const globs = ['my-lib*', 'lodash'];
292
+ * const externalDependencies = getExternalDependencies(projectPath, globs);
293
+ * console.log(externalDependencies);
294
+ * // Output might be: ['my-lib/utils', 'my-lib/core', 'lodash']
295
+ */
296
+ export declare const getExternalDependencies: (path: string, globs?: string | string[]) => string[];
297
+ /**
298
+ * Generates a string of initials based on the input string,
299
+ * following certain rules:
300
+ * 1. A word is considered as a sequence of characters
301
+ * separated by hyphens.
302
+ * 2. If the string contains '@', any characters before
303
+ * and including the next '/' are ignored.
304
+ * 3. The first character of each word is taken to form
305
+ * the initials.
306
+ *
307
+ * @param {string} input - The input string from which to generate the initials.
308
+ * @returns {string} The initials formed by taking the first character
309
+ * of each word, after applying the specified rules.
310
+ *
311
+ * @example
312
+ * getInitials("player-script"); // returns "ps"
313
+ * getInitials("ssv-admin"); // returns "sa"
314
+ * getInitials("@nizza/customize-live"); // returns "cl"
315
+ */
316
+ export declare function getInitials(input: string): string;
317
+ /**
318
+ * Retrieves the Vite command details.
319
+ *
320
+ * @param {ViteMode} mode - The Vite mode.
321
+ * @returns {ViteCommand} - The command details.
322
+ *
323
+ * @example
324
+ * const command = getViteCommand(ViteMode.PROD);
325
+ * // Outputs: { stage: Stage.PROD, target: 'build', flags: {} }
326
+ */
327
+ export declare function getViteCommand(mode: ViteMode): ViteCommand;
328
+ /**
329
+ * Parses the command string to extract flags.
330
+ *
331
+ * @param {string | undefined} commandString - The command string.
332
+ * @returns {Record<string, string>} - The flags extracted from the command string.
333
+ *
334
+ * @example
335
+ * const flags = getViteCmdFlags('nx run core:build --source-maps');
336
+ * // Outputs: { 'source-maps: 'true' }
337
+ */
338
+ export declare function getViteCmdFlags(commandString: string | undefined): Record<string, string>;
339
+ /**
340
+ * Builds the configuration based on common and project-specific configurations.
341
+ *
342
+ * @param {CommonProjectConfig} commonConfig - The common configuration.
343
+ * @returns - Returns a function that accepts a project configuration and returns the Vite configuration.
344
+ */
345
+ export declare const createConfigBuilder: (commonConfig: CommonProjectConfig) => (projectConfig: ProjectConfig) => UserConfig;
346
+ export interface Execute {
347
+ function: (data?: string) => void;
348
+ listen: string;
349
+ observer: string;
350
+ }
351
+ export interface ThirdPartyCssInjectPlugin {
352
+ topExecutionPriority?: boolean;
353
+ execute?: Execute[];
354
+ }
355
+ /**
356
+ * Inject the CSS compiled with JS.
357
+ *
358
+ * @return {Plugin}
359
+ */
360
+ export declare function thirdPartyCssInjectPlugin({ topExecutionPriority, execute }?: ThirdPartyCssInjectPlugin | undefined): Plugin;
361
+ export declare function injectCssIntoShadowDom(): {
362
+ name: string;
363
+ configureServer(_server: ViteDevServer): void;
364
+ transform(src: string, id: string): void;
365
+ };
366
+
367
+ export {};
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@nizza/devkit",
3
- "version": "0.1.0-alpha.10",
3
+ "version": "0.1.0-alpha.12",
4
4
  "type": "module",
5
5
  "main": "dist/cjs/index.cjs",
6
6
  "module": "dist/esm/index.mjs",
7
7
  "source": "src/index.ts",
8
- "types": "dist/esm/index.d.ts",
8
+ "types": "dist/index.d.ts",
9
9
  "exports": {
10
10
  "./package.json": "./package.json",
11
11
  ".": {
@@ -13,11 +13,9 @@
13
13
  "require": "./dist/cjs/index.cjs"
14
14
  },
15
15
  "./import": {
16
- "types": "./dist/esm/index.d.mts",
17
16
  "default": "./dist/esm/index.mjs"
18
17
  },
19
18
  "./require": {
20
- "types": "./dist/cjs/index.d.cts",
21
19
  "default": "./dist/cjs/index.cjs"
22
20
  }
23
21
  },
@@ -41,8 +39,8 @@
41
39
  "rollup": "^4.2.0",
42
40
  "rollup-plugin-copy": "^3.5.0",
43
41
  "rollup-plugin-delete": "^2.0.0",
44
- "rollup-plugin-swc3": "^0.10.3",
45
- "rollup-plugin-ts": "^3.4.5"
42
+ "rollup-plugin-dts-bundle-generator": "^1.4.0",
43
+ "rollup-plugin-swc3": "^0.10.3"
46
44
  },
47
45
  "peerDependencies": {
48
46
  "@nx/devkit": "17.0.2",
@@ -1,4 +0,0 @@
1
- declare function cleanS3Bucket(s3BucketPath: string): Promise<void>;
2
- declare function copyAssetsToS3(s3BucketPath: string, projectRoot: string): Promise<void>;
3
- declare function createCloudFrontInvalidation(distributionId: string, invalidationPaths: string[]): Promise<void>;
4
- export { cleanS3Bucket, copyAssetsToS3, createCloudFrontInvalidation };
@@ -1,11 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import { ExecutorResponse } from "../../index-f6330edc.js";
3
- interface ExecutorOptions {
4
- s3BucketPath: string;
5
- cloudFrontDistributionId: string;
6
- cloudFrontInvalidationPaths: string[];
7
- buildTarget: string;
8
- skipBuild?: boolean;
9
- }
10
- declare function deployExecutor(opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
11
- export { ExecutorOptions, deployExecutor as default };
@@ -1,25 +0,0 @@
1
- interface CreateEnvironmentData {
2
- projectOrg: string;
3
- coreEnvFile: string;
4
- }
5
- /**
6
- * Creates the content for an environment file based on the core environment path.
7
- *
8
- * @param {CreateEnvironmentData} data - Values to replace in template.
9
- * @returns {string} The content of the environment file.
10
- */
11
- declare function createEnvironmentFileContent({ coreEnvFile, projectOrg, }: CreateEnvironmentData): Promise<string>;
12
- /**
13
- * Ensures that the given directory exists, creating it if it does not.
14
- *
15
- * @param {string} dir - The path to the directory to check/create.
16
- */
17
- declare function ensureDirectoryExists(dir: string): Promise<void>;
18
- /**
19
- * Writes environment files to the given base path if they do not already exist.
20
- *
21
- * @param {string} basePath - The base directory where the files should be written.
22
- * @param {Record<string, string>} files - An object containing filenames and their respective content.
23
- */
24
- declare function writeFilesIfNotExist(basePath: string, files: Record<string, string>): Promise<void>;
25
- export { createEnvironmentFileContent, ensureDirectoryExists, writeFilesIfNotExist };
@@ -1,16 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import { ExecutorResponse } from "../../index-f6330edc.js";
3
- interface ExecutorOptions {
4
- }
5
- /**
6
- * The executor function to create environment files.
7
- * Ensures that the directory for the environment files exists and creates the files
8
- * if they do not exist already. Files created are 'environment.ts', 'environment.prod.ts',
9
- * and 'environment.staging.ts'.
10
- *
11
- * @param {ExecutorOptions} _opts - Executor options, currently not used but provided for future extensibility.
12
- * @param {ExecutorContext} ctx - The executor context, providing access to the project configuration.
13
- * @returns {Promise<ExecutorResponse>} The result object with a success or error status.
14
- */
15
- declare function runExecutor(_opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
16
- export { ExecutorOptions, runExecutor as default };
@@ -1,19 +0,0 @@
1
- /**
2
- * Retrieves the version of a published package with a given name and tag.
3
- *
4
- * @param {string} packageName The name of the package to retrieve the version for.
5
- * @param {string} tag The tag to retrieve the version for.
6
- * @returns The version of the package as a string or an object containing versions for each tag.
7
- */
8
- declare function getPublishedPackageVersion(packageName: string, tag?: string): Promise<any>;
9
- /**
10
- * Checks if a package with the given name is already published and returns its version.
11
- *
12
- * @param {string} packageName The name of the package to check for.
13
- * @returns An object containing the published versions of the package and a flag indicating if it is the first version.
14
- */
15
- declare function checkPublishedVersion(packageName: string): Promise<{
16
- publishedVersion: any;
17
- isFirstVersion: boolean;
18
- }>;
19
- export { getPublishedPackageVersion, checkPublishedVersion };
@@ -1,12 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import { ExecutorResponse } from "../../index-f6330edc.js";
3
- interface ExecutorOptions {
4
- tag: string;
5
- dryRun?: boolean;
6
- }
7
- /**
8
- * This is a minimal script to publish package to "npm".
9
- * Need to authenticate with NPM before running this script.
10
- */
11
- declare function runExecutor(opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
12
- export { ExecutorOptions, runExecutor as default };
@@ -1,27 +0,0 @@
1
- import { ExecutorContext, ProjectConfiguration } from '@nx/devkit';
2
- import { ExecutorResponse } from "../../types-7377dcc9.js";
3
- /**
4
- * Indicates a successful executor operation.
5
- *
6
- * @param {string} message - Optional message to log for the success case.
7
- * @returns {ExecutorResponse} - An object representing a successful operation.
8
- */
9
- declare function ok(message?: string): ExecutorResponse;
10
- /**
11
- * Indicates a failed executor operation.
12
- *
13
- * @param {string | Error | unknown} err - An optional error object or message indicating the nature of the failure.
14
- * @param {string} message - An optional message to log for the error case. If not provided, a default error message is logged.
15
- * @returns {ExecutorResponse} - An object representing a failed operation.
16
- */
17
- declare function err(err?: string | Error | unknown, message?: string): ExecutorResponse;
18
- /**
19
- * Retrieves the project configuration for the current execution context.
20
- *
21
- * @param {ExecutorContext} ctx - The execution context containing project information.
22
- * @returns {ProjectConfiguration} - The configuration object for the current project.
23
- * @throws {Error} If the project configuration is invalid or not found.
24
- */
25
- declare function getProjectConfig(ctx: ExecutorContext): ProjectConfiguration;
26
- declare function runCommand(command: string, cwd?: string | URL): Promise<void>;
27
- export { ok, err, getProjectConfig, runCommand };
@@ -1,17 +0,0 @@
1
- import { Executors } from "../../types-763439e4.js";
2
- declare const transformPathToRoot: (path: string) => string;
3
- declare const transformPathToDist: (path: string) => string;
4
- /**
5
- * Updates the executor paths for the provided executors object.
6
- * @param {Executors} executors - The executors object from executors.json.
7
- * @param {boolean} toDist - Flag to determine if './dist' should be removed from paths.
8
- * @returns - The updated executors object with transformed paths.
9
- */
10
- declare const updateExecutorPaths: (executors: Executors, toDist: boolean) => Executors;
11
- /**
12
- * Writes a JSON file asynchronously.
13
- * @param {string} path - The file path where to write the JSON data.
14
- * @param {any} data - The data to be written to the file.
15
- */
16
- declare const writeJsonFileAsync: (path: string, data: any) => Promise<void>;
17
- export { transformPathToRoot, transformPathToDist, updateExecutorPaths, writeJsonFileAsync };
@@ -1,12 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import { ExecutorResponse } from "../../index-f6330edc.js";
3
- import { ExecutorOptions } from "../../types-763439e4.js";
4
- /**
5
- * Executor function to update paths in the executors.json file.
6
- *
7
- * @param {ExecutorOptions} _opts - Executor options, currently not used but provided for future extensibility.
8
- * @param {ExecutorContext} ctx - The executor context, providing access to the project configuration.
9
- * @returns {Promise<ExecutorResponse>} The result object with a success or error status.
10
- */
11
- declare function runExecutor(_opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
12
- export { runExecutor as default };
@@ -1,4 +0,0 @@
1
- declare const VTEX_PROJECT_PATH: string | undefined;
2
- declare const ERROR_LINKING_FLAG = "[31merror\u001B[39m: App build failed";
3
- declare const SUCCESS_LINKING_FLAG = "[32minfo\u001B[39m: App running";
4
- export { VTEX_PROJECT_PATH, ERROR_LINKING_FLAG, SUCCESS_LINKING_FLAG };
@@ -1,77 +0,0 @@
1
- import { SharedContext } from "../../types-1282e639.js";
2
- /**
3
- * Links the local package to the VTEX environment.
4
- *
5
- * @param {SharedContext} ctx - The shared context containing paths and configurations.
6
- * @returns {Promise<void>} A promise that resolves when the package is linked or rejects on error.
7
- */
8
- declare function vtexLink(ctx: SharedContext): Promise<void>;
9
- /**
10
- * Updates the package.json file within the VTEX project to use the local version of the package.
11
- *
12
- * @param {SharedContext} ctx - The shared context containing paths and configurations.
13
- * @param {string} packageName - The name of the package to link.
14
- * @returns {Promise<void>} A promise that resolves when the package.json is updated.
15
- */
16
- declare function changePackageJsonFromVtexProject(ctx: SharedContext, packageName: string): Promise<void>;
17
- /**
18
- * Restores the original package.json from the backup created before modifications.
19
- *
20
- * @param {SharedContext} ctx - The shared context containing paths and configurations.
21
- * @returns {Promise<void>} A promise that resolves when the package.json is restored.
22
- */
23
- declare function restorePackageJsonFromVtexProject(ctx: SharedContext): Promise<void>;
24
- /**
25
- * Renames the generated package file with a unique identifier.
26
- *
27
- * @param {SharedContext} ctx - The shared context containing paths and configurations.
28
- * @returns {Promise<string>} A promise that resolves with the new name of the package.
29
- */
30
- declare function renamePackage(ctx: SharedContext): Promise<string>;
31
- /**
32
- * Creates a pnpm package for uploading to VTEX.
33
- *
34
- * @param {SharedContext} ctx - The shared context containing paths and configurations.
35
- * @returns {Promise<string>} A promise that resolves with the name of the created package.
36
- */
37
- declare function createPackage(ctx: SharedContext): Promise<string>;
38
- /**
39
- * Searches for and lists all outdated packages in the VTEX project directory.
40
- *
41
- * @param {SharedContext} ctx - The shared context containing paths and configurations.
42
- * @returns {Promise<string[]>} A promise that resolves with a list of deprecated package names.
43
- */
44
- declare function findLastPackages(ctx: SharedContext): Promise<string[]>;
45
- /**
46
- * Removes all outdated packages in the VTEX project directory.
47
- *
48
- * @param {SharedContext} ctx - The shared context containing paths and configurations.
49
- * @returns {Promise<void>} A promise that resolves when the old packages are removed.
50
- */
51
- declare function removeOldPackages(ctx: SharedContext): Promise<void>;
52
- /**
53
- * Moves a package to the VTEX project directory.
54
- *
55
- * @param {SharedContext} ctx - The shared context containing paths and configurations.
56
- * @param {string} packageName - The name of the package to move.
57
- * @returns {Promise<void>} A promise that resolves when the package is moved successfully.
58
- */
59
- declare function movePackage(ctx: SharedContext, packageName: string): Promise<void>;
60
- /**
61
- * Builds the package, moves it to the VTEX project, and updates the project's package.json.
62
- *
63
- * @param {SharedContext} ctx - The shared context containing paths and configurations.
64
- * @returns {Promise<void>} A promise that resolves when the build is complete.
65
- */
66
- declare function buildPackage(ctx: SharedContext): Promise<void>;
67
- /**
68
- * Cleans the VTEX project by removing old packages and restoring the original package.json.
69
- *
70
- * @param {SharedContext} ctx - The shared context containing paths and configurations.
71
- * @returns {Promise<void>} A promise that resolves when the clean-up is complete.
72
- */
73
- declare function clean(ctx: SharedContext): Promise<void>;
74
- declare function validateEnvironment(): void;
75
- declare function performRollback(sharedContext: SharedContext): Promise<import("../../index-f6330edc.js").ExecutorResponse>;
76
- declare function buildAndLink(sharedContext: SharedContext, skipLink?: boolean): Promise<void>;
77
- export { vtexLink, changePackageJsonFromVtexProject, restorePackageJsonFromVtexProject, renamePackage, createPackage, findLastPackages, removeOldPackages, movePackage, buildPackage, clean, validateEnvironment, performRollback, buildAndLink };
@@ -1,5 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import { ExecutorResponse } from "../../index-f6330edc.js";
3
- import { ExecutorOptions } from "../../types-1282e639.js";
4
- declare function runExecutor(opts: ExecutorOptions, ctx: ExecutorContext): Promise<ExecutorResponse>;
5
- export { runExecutor as default };
@@ -1,2 +0,0 @@
1
- export * from "./index-3080371d.js";
2
- export * from "./vite/plugins/shadow-dom-inject-css/index.js";
@@ -1,2 +0,0 @@
1
- export * from "./shared/logger.js";
2
- export * from "./shared/utils.js";
@@ -1,3 +0,0 @@
1
- import { thirdPartyCssInjectPlugin } from "./vite/plugins/third-party-css-inject/main.js";
2
- export * from "./vite/plugins/third-party-css-inject/main.js";
3
- export { thirdPartyCssInjectPlugin as default };
@@ -1,2 +0,0 @@
1
- export * from "./types-7377dcc9.js";
2
- export * from "./executors/shared/utils.js";