juisy 2.2.0 → 3.0.0-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 (59) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +85 -0
  3. package/bin/cli/cli.js +3 -0
  4. package/bin/cli/cmds/index.js +2 -4
  5. package/bin/scripts/prepare.js +22 -22
  6. package/dist/DataExporter.d.ts +9 -4
  7. package/dist/bootstrap.d.ts +6 -0
  8. package/dist/bootstrap.js +21 -0
  9. package/dist/cli/CLIFactory.d.ts +1 -0
  10. package/dist/cli/Command.d.ts +23 -2
  11. package/dist/cli/GlobalSettings.schema.json +1 -1
  12. package/dist/cli/InterfaceUtils.d.ts +14 -12
  13. package/dist/cli/OutputUtils.d.ts +30 -16
  14. package/dist/cli/Plugin.d.ts +9 -0
  15. package/dist/cli/extract-usage.d.ts +8 -0
  16. package/dist/cli/index.d.ts +1 -0
  17. package/dist/cli/index.js +210 -122
  18. package/dist/cli/plugins/command-meta/augment.d.ts +1 -4
  19. package/dist/cli/plugins/command-meta/index.d.ts +4 -0
  20. package/dist/cli/plugins/default-command-fallbacks/augment.d.ts +1 -1
  21. package/dist/cli/plugins/default-command-fallbacks/command-visitors/default-command-fallbacks.d.ts +1 -1
  22. package/dist/cli/plugins/default-command-fallbacks/index.d.ts +4 -0
  23. package/dist/cli/plugins/load-env-file/augment.d.ts +1 -1
  24. package/dist/cli/plugins/load-env-file/index.d.ts +4 -0
  25. package/dist/cli/plugins/private-commands/augment.d.ts +8 -0
  26. package/dist/cli/plugins/private-commands/command-visitors/private-command.d.ts +7 -3
  27. package/dist/cli/plugins/private-commands/index.d.ts +4 -0
  28. package/dist/cli/plugins/register-bump-version-command/index.d.ts +4 -0
  29. package/dist/cli/plugins/register-changelog-command/index.d.ts +4 -0
  30. package/dist/cli/plugins/register-docs-commands/index.d.ts +4 -0
  31. package/dist/cli/plugins/register-git-hooks-commands/index.d.ts +4 -0
  32. package/dist/cli/plugins/register-lint-commands/index.d.ts +4 -0
  33. package/dist/cli/plugins/register-lint-commands/settings.d.ts +2 -0
  34. package/dist/cli/plugins/register-lint-commands/types.d.ts +5 -9
  35. package/dist/cli/plugins/register-release-command/index.d.ts +4 -0
  36. package/dist/cli/plugins/register-test-command/index.d.ts +4 -0
  37. package/dist/cli/types.d.ts +9 -1
  38. package/dist/cli/utils.d.ts +3 -4
  39. package/dist/eject.d.ts +1 -0
  40. package/dist/extensions.d.ts +26 -0
  41. package/dist/extensions.js +44 -0
  42. package/dist/get-package-info.d.ts +1 -0
  43. package/dist/index.d.ts +5 -5
  44. package/dist/index.js +23 -128
  45. package/dist/project-globals.d.ts +6 -2
  46. package/dist/shims/shims.d.ts +1440 -0
  47. package/dist/templater/index.d.ts +4 -1
  48. package/dist/templater/index.js +43 -24
  49. package/dist/templater/markdown-templater/ReadmeTemplater.d.ts +12 -12
  50. package/dist/templater/markdown-templater/index.d.ts +10 -1
  51. package/package.json +43 -49
  52. package/bin/cli/cmds/private/docs/generate-api.js +0 -31
  53. package/bin/cli/cmds/private/docs/index.js +0 -20
  54. package/bin/cli/cmds/private/test.js +0 -33
  55. package/dist/utils/misc.d.ts +0 -84
  56. package/dist/vite/plugins/inject-css-variables/index.d.ts +0 -23
  57. package/dist/vite/plugins/inject-css-variables/index.js +0 -60
  58. package/dist/vite/plugins/inject-project-globals/index.d.ts +0 -19
  59. package/dist/vite/plugins/inject-project-globals/index.js +0 -58
@@ -1,10 +1,10 @@
1
1
  import { CommandVisitor } from '../../../types';
2
2
  /**
3
3
  * Global command visitor to auto-set command meta
4
- * @ignore
5
4
  * @param commandObject - The command object
6
5
  * @param cli - The CLIEngine instance
7
6
  * @returns The commandObject with wrapped builder to inject CLI instance meta.
7
+ * @ignore
8
8
  */
9
9
  export declare const visitor: CommandVisitor;
10
10
  export declare const options: {};
@@ -1,3 +1,7 @@
1
1
  import { Plugin } from '../../Plugin';
2
+ /**
3
+ * Built-in plugin: 'built-in:default-command-fallbacks'
4
+ * @group None
5
+ */
2
6
  declare const _default: Plugin;
3
7
  export default _default;
@@ -1,3 +1,4 @@
1
+ export {};
1
2
  declare module '../../types' {
2
3
  interface CLIFactoryOptions {
3
4
  /**
@@ -6,4 +7,3 @@ declare module '../../types' {
6
7
  loadEnv?: boolean;
7
8
  }
8
9
  }
9
- export {};
@@ -1,3 +1,7 @@
1
1
  import { Plugin } from '../../Plugin';
2
+ /**
3
+ * Built-in plugin: 'built-in:load-env-file'
4
+ * @group None
5
+ */
2
6
  declare const _default: Plugin;
3
7
  export default _default;
@@ -1,4 +1,12 @@
1
1
  declare module '../../types' {
2
+ interface CLIEngine {
3
+ /**
4
+ * Make a command private or not
5
+ * @param visitor - A simple function that returns true to make private, false to make public, or undefined to do nothing.
6
+ * @returns The CLIEngine instance itself
7
+ */
8
+ makeCommandPrivate(visitor: (cmdObj: CommandObject) => (boolean | undefined)): this;
9
+ }
2
10
  interface CommandMeta {
3
11
  private: boolean;
4
12
  }
@@ -1,13 +1,17 @@
1
- import { CommandVisitor } from '../../../types';
1
+ import { CommandObject, CommandVisitor } from '../../../types';
2
2
  /**
3
+ * A local cache for visitors added via CLIEngine.makeCommandPrivate method
4
+ * @ignore
5
+ */
6
+ export declare const visitorsCache: Array<(cmdObj: CommandObject) => (boolean | undefined)>;
7
+ /**
8
+ * Global command visitor to auto-set command private status
3
9
  * @ignore
4
10
  * @param commandModule - The exported command object
5
11
  * @param engine - The CLI (yargs) instance
6
12
  * @param options - The global command visitor defined options
7
13
  * @returns {object|boolean} False if command is private and env key is set to "private".
8
14
  * Otherwise, returns the commandModule with wrapped builder to tag CLI instance as private.
9
- * @description
10
- * Global command visitor to auto-set command private status
11
15
  */
12
16
  export declare const visitor: CommandVisitor;
13
17
  export declare const options: {
@@ -1,3 +1,7 @@
1
1
  import { Plugin } from '../../Plugin';
2
+ /**
3
+ * Built-in plugin: 'built-in:private-commands'
4
+ * @group None
5
+ */
2
6
  declare const _default: Plugin;
3
7
  export default _default;
@@ -1,3 +1,7 @@
1
1
  import { Plugin } from '../../Plugin';
2
+ /**
3
+ * Built-in plugin: 'built-in:register-bump-version-command'
4
+ * @group None
5
+ */
2
6
  declare const _default: Plugin;
3
7
  export default _default;
@@ -1,3 +1,7 @@
1
1
  import { Plugin } from '../../Plugin';
2
+ /**
3
+ * Built-in plugin: 'built-in:register-changelog-command'
4
+ * @group None
5
+ */
2
6
  declare const _default: Plugin;
3
7
  export default _default;
@@ -1,3 +1,7 @@
1
1
  import { Plugin } from '../../Plugin';
2
+ /**
3
+ * Built-in plugin: 'built-in:register-docs-command'
4
+ * @group None
5
+ */
2
6
  declare const _default: Plugin;
3
7
  export default _default;
@@ -1,3 +1,7 @@
1
1
  import { Plugin } from '../../Plugin';
2
+ /**
3
+ * Built-in plugin: 'built-in:register-git-hooks-command'
4
+ * @group None
5
+ */
2
6
  declare const _default: Plugin;
3
7
  export default _default;
@@ -1,3 +1,7 @@
1
1
  import { Plugin } from '../../Plugin';
2
+ /**
3
+ * Built-in plugin: 'built-in:register-lint-command'
4
+ * @group None
5
+ */
2
6
  declare const _default: Plugin;
3
7
  export default _default;
@@ -2,6 +2,8 @@ import { GlobalSettings } from '../../types';
2
2
  import { SettingsLintMarkdown } from './types';
3
3
  /**
4
4
  * Resolve settings for 'lint' namespace
5
+ * @param settings - The lint settings object
6
+ * @group None
5
7
  */
6
8
  export default function resolveSettings(settings?: Required<GlobalSettings>['lint']): {
7
9
  default?: import('../..').UserProvidedConfigSetting<import("eslint").Linter.LegacyConfig | import("eslint").Linter.Config | import("eslint").Linter.Config[]>;
@@ -4,23 +4,19 @@
4
4
  */
5
5
  type MarkdownlintCLI2Config = {
6
6
  [key: string]: any;
7
- globs?: never;
8
7
  fix?: never;
9
8
  };
10
9
  /**
11
10
  * Object for root config in lint.markdown settings
11
+ * @group Types
12
12
  */
13
- export type SettingsLintMarkdown = Array<SettingsLintMarkdownRootConfig | SettingsLintMarkdownConfig>;
13
+ export type SettingsLintMarkdown = Array<SettingsLintMarkdownConfig>;
14
14
  /**
15
- * Object for root config in lint.markdown settings
15
+ * Object for config in lint.markdown settings
16
+ * @group Types
16
17
  */
17
- export type SettingsLintMarkdownRootConfig = {
18
+ export type SettingsLintMarkdownConfig = {
18
19
  config: string | MarkdownlintCLI2Config;
19
- };
20
- /**
21
- * Object for glob scoped config in lint.markdown settings
22
- */
23
- export type SettingsLintMarkdownConfig = SettingsLintMarkdownRootConfig & {
24
20
  globs?: string[];
25
21
  };
26
22
  export {};
@@ -1,3 +1,7 @@
1
1
  import { Plugin } from '../../Plugin';
2
+ /**
3
+ * Built-in plugin: 'built-in:register-release-command'
4
+ * @group None
5
+ */
2
6
  declare const _default: Plugin;
3
7
  export default _default;
@@ -1,3 +1,7 @@
1
1
  import { Plugin } from '../../Plugin';
2
+ /**
3
+ * Built-in plugin: 'built-in:register-test-command'
4
+ * @group None
5
+ */
2
6
  declare const _default: Plugin;
3
7
  export default _default;
@@ -90,7 +90,8 @@ export interface CLIEngine extends Argv {
90
90
  getValidationInstance(): any;
91
91
  hasParseCallback(): any;
92
92
  isGlobalContext(): any;
93
- postProcess(argv: any | Promise<any>, populateDoubleDash: boolean, calledFromCommand: boolean, runGlobalMiddleware: boolean): any;
93
+ postProcess(argv: any | Promise<any>, // eslint-disable-line @typescript-eslint/no-explicit-any
94
+ populateDoubleDash: boolean, calledFromCommand: boolean, runGlobalMiddleware: boolean): any;
94
95
  reset(aliases?: any): any;
95
96
  runValidation(aliases: Dictionary<string[]>, positionalMap: Dictionary<string[]>, parseErrors: Error | null, isDefaultCommand?: boolean): (argv: any) => void;
96
97
  runYargsParserAndExecuteCommands(args: string | string[] | null, shortCircuit?: boolean | null, calledFromCommand?: boolean, commandIndex?: number, helpOnly?: boolean): any | Promise<any>;
@@ -142,4 +143,11 @@ engine: CLIEngine,
142
143
  * The default options to set
143
144
  */
144
145
  options: any) => false | CommandObject);
146
+ /**
147
+ * CLI engine logger instance interface
148
+ * @group Types
149
+ */
150
+ export interface LoggerInstance {
151
+ log: Function;
152
+ }
145
153
  export {};
@@ -1,10 +1,9 @@
1
1
  import { CommandObject, CLIEngine } from './types';
2
2
  /**
3
- * @ignore
4
- * @param target - The target builder
5
- * @param builder - The wrap
6
- * @description
7
3
  * Wrap command builder (target) with builder passed as second parameter
8
4
  * that will be called before target. Target can be undefined
5
+ * @param target - The target builder
6
+ * @param builder - The wrap
7
+ * @ignore
9
8
  */
10
9
  export declare function wrapCommandBuilder(target: CommandObject['builder'], builder: (cli: CLIEngine) => CLIEngine): (cli: CLIEngine) => CLIEngine | PromiseLike<CLIEngine>;
package/dist/eject.d.ts CHANGED
@@ -23,6 +23,7 @@ export type EjectOptions = {
23
23
  * Takes content as unique argument and must return string or a Promise that resolves a string
24
24
  * @param options.onError - The callback if an error occurs
25
25
  * @param options.onSuccess - The callback in of success
26
+ * @group None
26
27
  */
27
28
  export default function eject(
28
29
  /**
@@ -0,0 +1,26 @@
1
+ import { CLIFactory as _CLIFactory } from './cli/index.ts';
2
+ /**
3
+ * Juisy extension object
4
+ */
5
+ export interface Extension {
6
+ /**
7
+ * Extends feature of the main juisy bin
8
+ * @param CLIFactory - {@link _CLIFactory CLIFactory}
9
+ */
10
+ juisyBin?: (CLIFactory: typeof _CLIFactory) => void;
11
+ }
12
+ /**
13
+ * Get the extensions locally added to juisy
14
+ * @param pkgJsonPath - The path to package.json file
15
+ * @returns The extension names
16
+ */
17
+ export declare function getExtensions(pkgJsonPath?: string): string[];
18
+ /**
19
+ * Get the loaded extensions
20
+ */
21
+ export declare function getLoadedExtensions(): Record<string, Extension>;
22
+ /**
23
+ * Load the extensions
24
+ * @param pkgJsonPath - The path to extensions cache file
25
+ */
26
+ export declare function loadExtensions(pkgJsonPath?: string): Promise<Record<string, Extension>>;
@@ -0,0 +1,44 @@
1
+ /*!
2
+ * juisy v3.0.0-beta.0
3
+ * Copyright © 2022-Present Hervé Perchec
4
+ */
5
+
6
+ import path from 'node:path';
7
+ import { pathToFileURL } from 'node:url';
8
+ import fs from 'fs-extra';
9
+ import { CLIFactory } from 'juisy/cli';
10
+
11
+ const loadedExtensions = /* @__PURE__ */ new Map();
12
+ function getExtensions(pkgJsonPath = "./package.json") {
13
+ const absolutePath = path.isAbsolute(pkgJsonPath) ? pkgJsonPath : path.resolve(pkgJsonPath);
14
+ const content = fs.readFileSync(absolutePath, "utf-8");
15
+ const extensionIds = JSON.parse(content).juisy?.extensions || [];
16
+ return extensionIds;
17
+ }
18
+ function getLoadedExtensions() {
19
+ const extensions = {};
20
+ for (const id of loadedExtensions.keys()) {
21
+ extensions[id] = loadedExtensions.get(id);
22
+ }
23
+ return extensions;
24
+ }
25
+ async function loadExtension(id) {
26
+ const modPath = id.startsWith(".") ? path.resolve(id) : id;
27
+ const mod = await (path.isAbsolute(modPath) ? import(pathToFileURL(modPath).toString()) : import(id));
28
+ return mod.extension || mod.default;
29
+ }
30
+ async function loadExtensions(pkgJsonPath = "./package.json") {
31
+ const extensionIds = getExtensions(pkgJsonPath);
32
+ for (const id of extensionIds) {
33
+ if (!loadedExtensions.has(id)) {
34
+ const extension = await loadExtension(id);
35
+ loadedExtensions.set(id, extension);
36
+ if (extension.juisyBin) {
37
+ extension.juisyBin(CLIFactory);
38
+ }
39
+ }
40
+ }
41
+ return getLoadedExtensions();
42
+ }
43
+
44
+ export { getExtensions, getLoadedExtensions, loadExtensions };
@@ -2,5 +2,6 @@ import { IPackageJson as PackageJson } from 'package-json-type';
2
2
  /**
3
3
  * Get package.json content
4
4
  * @returns The package.json content as object
5
+ * @group None
5
6
  */
6
7
  export default function getPackageInfo(): PackageJson;
package/dist/index.d.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * Public API of juisy library
3
3
  * @module juisy
4
+ * @importTarget .
4
5
  * @author Hervé Perchec
5
6
  */
6
- import * as utils from './utils/misc';
7
7
  export { DataExporter } from './DataExporter';
8
8
  export { default as eject } from './eject';
9
9
  export { default as getPackageInfo } from './get-package-info';
10
10
  export { defineGlobals, getProjectGlobals } from './project-globals';
11
- /**
12
- * @ignore
13
- */
14
- export { utils };
15
11
  export type * from './DataExporter';
16
12
  export type * from './eject';
13
+ export type * from './extensions';
17
14
  export type * from './project-globals';
15
+ export type * from './shims/shims';
16
+ declare const _default: {};
17
+ export default _default;
package/dist/index.js CHANGED
@@ -1,117 +1,24 @@
1
1
  /*!
2
- * juisy v2.2.0
2
+ * juisy v3.0.0-beta.0
3
3
  * Copyright © 2022-Present Hervé Perchec
4
4
  */
5
5
 
6
- import path$1, { dirname } from 'node:path';
7
- import { readdir, readFileSync } from 'node:fs';
8
- import { glob } from 'glob';
9
- import { packageDirectorySync } from 'pkg-dir';
10
6
  import yaml from 'yaml';
11
7
  import { json2csv } from 'json-2-csv';
12
8
  import jstoxml from 'jstoxml';
13
9
  import fs from 'fs-extra';
14
- import { fileURLToPath, pathToFileURL } from 'node:url';
10
+ import path from 'node:path';
11
+ import { packageDirectorySync } from 'pkg-dir';
15
12
  import log from 'loglevel';
16
13
  import { Templater } from 'juisy/templater';
14
+ import getFileUrls from '@juisy/utils/fs/get-file-urls';
15
+ import isFile from '@juisy/utils/fs/is-file';
16
+ import isDirectory from '@juisy/utils/fs/is-directory';
17
+ import { readFileSync } from 'node:fs';
18
+ import { pathToFileURL } from 'node:url';
17
19
  import dotenv from '@dotenvx/dotenvx';
18
20
  import deepmerge from 'deepmerge';
19
21
 
20
- function getFileUrls(pattern, options) {
21
- const files = glob.sync(pattern, options || {});
22
- return files;
23
- }
24
- async function* getFiles(dir) {
25
- const dirents = await readdir(dir, { withFileTypes: true });
26
- for (const dirent of dirents) {
27
- const res = path$1.resolve(dir, dirent.name);
28
- if (dirent.isDirectory()) {
29
- yield* getFiles(res);
30
- } else {
31
- yield res;
32
- }
33
- }
34
- }
35
- function getRootDir() {
36
- return packageDirectorySync();
37
- }
38
- const path = {
39
- /**
40
- * Convert a path to win32 format (with `\\` separator)
41
- * @param val - The path to convert
42
- * @example
43
- * utils.path.toWin32('a/posix/path') // => 'a\posix\path'
44
- * utils.path.toWin32('C:\\a\\win32\\absolute\\path') // => 'C:\a\win32\absolute\path'
45
- * utils.path.toWin32('a/mixed\\path') // => 'a\mixed\path'
46
- */
47
- toWin32(val) {
48
- return val.split(path$1.posix.sep).join(path$1.win32.sep);
49
- },
50
- /**
51
- * Convert a path to posix format (with `/` separator)
52
- * @param val - The path to convert
53
- * @example
54
- * utils.path.toPosix('a/posix/path') // => 'a/posix/path'
55
- * utils.path.toPosix('C:\\a\\win32\\absolute\\path') // => 'C:/a/win32/absolute/path'
56
- * utils.path.toPosix('a/mixed\\path') // => 'a/mixed/path'
57
- */
58
- toPosix(val) {
59
- return val.split(path$1.win32.sep).join(path$1.posix.sep);
60
- },
61
- /**
62
- * Automatically convert a path to OS specific format
63
- * @param val - The path to convert
64
- */
65
- toOsFormat(val) {
66
- const platform = process.platform;
67
- return platform === "win32" ? path.toWin32(val) : path.toPosix(val);
68
- },
69
- /**
70
- * Util to resolve a relative file path
71
- * @param from - The "from" absolute file path
72
- * @param to - The "to" absolute file path
73
- * @param separator - (Optional) The separator type: can be `"posix"` or `"win32"`
74
- * @returns The resolved relative path
75
- * @example
76
- * const base = 'C:\\Users\\JohnDoe\\Documents\\Projects\\MyProject'
77
- *
78
- * utils.path.resolveRel(base, 'C:\\Users\\JohnDoe\\Documents\\Projects\\MyProject\\src\\index.ts') // 'src\\index.ts'
79
- * utils.path.resolveRel('C:\\Users\\JohnDoe\\Documents\\Projects\\MyProject\\src\\index.ts', base) // '..\\..'
80
- * utils.path.resolveRel(base, 'C:\\Users\\JohnDoe\\Documents\\Projects\\MyProject\\src\\index.ts', 'posix') // 'src/index.ts'
81
- */
82
- resolveRel(from, to, separator) {
83
- const relativePath = path$1.relative(from, to);
84
- return separator ? separator === "posix" ? path.toPosix(relativePath) : path.toWin32(relativePath) : path.toOsFormat(relativePath);
85
- },
86
- /**
87
- * Util to resolve relative file path from root directory
88
- * @param to - The absolute file path
89
- * @param separator - (Optional) The separator type: can be `"posix"` or `"win32"`
90
- * @returns The resolved relative path from root directory
91
- */
92
- resolveRelFromRoot(to, separator) {
93
- return path.resolveRel(getRootDir(), to, separator);
94
- },
95
- /**
96
- * Util to resolve absolute file path from root directory
97
- * @param to - The relative file path
98
- * @param separator - (Optional) The separator type: can be `"posix"` or `"win32"`
99
- * @returns The resolved absolute path from root directory
100
- */
101
- resolveAbsFromRoot(to, separator) {
102
- const absolutePath = path$1.join(getRootDir(), to);
103
- return separator ? separator === "posix" ? path.toPosix(absolutePath) : path.toWin32(absolutePath) : path.toOsFormat(absolutePath);
104
- }
105
- };
106
-
107
- const misc = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
108
- __proto__: null,
109
- getFileUrls,
110
- getFiles,
111
- getRootDir,
112
- path
113
- }, Symbol.toStringTag, { value: 'Module' }));
114
-
115
22
  const xml = jstoxml.toXML;
116
23
  const SUPPORTED_FORMATS = [
117
24
  "json",
@@ -151,6 +58,7 @@ class DataExporter {
151
58
  throw new Error(`DataConverter: Unsupported "${format}" format`);
152
59
  }
153
60
  }
61
+ // eslint-disable-line @typescript-eslint/no-explicit-any
154
62
  exportSync(data, options) {
155
63
  switch (this.format) {
156
64
  case "json":
@@ -170,31 +78,13 @@ class DataExporter {
170
78
  }
171
79
  }
172
80
 
173
- const __filename = fileURLToPath(import.meta.url);
174
- dirname(__filename);
175
81
  const templater = new Templater("ejs", {
176
82
  engineOptions: {
177
83
  // ...
178
84
  }
179
85
  });
180
- async function isDirectory(filePath) {
181
- try {
182
- const stats = await fs.stat(filePath);
183
- return stats.isDirectory();
184
- } catch (err) {
185
- return false;
186
- }
187
- }
188
- async function isFile(filePath) {
189
- try {
190
- const stats = await fs.stat(filePath);
191
- return stats.isFile();
192
- } catch (err) {
193
- return false;
194
- }
195
- }
196
86
  async function ejectFile(from, to, identifier = null, options) {
197
- identifier = identifier || path$1.basename(from);
87
+ identifier = identifier || path.basename(from);
198
88
  const force = options?.force || false;
199
89
  const templateData = options?.templateData;
200
90
  const processor = options?.processor || (async (str, _identifier) => str);
@@ -208,7 +98,10 @@ async function ejectFile(from, to, identifier = null, options) {
208
98
  const write = await fs.exists(to) ? force : true;
209
99
  if (write) {
210
100
  const template = await fs.readFile(from, { encoding: "utf8" });
211
- const content = await templater.render(template, typeof templateData === "function" ? await templateData(identifier) : templateData);
101
+ const content = await templater.render(
102
+ template,
103
+ typeof templateData === "function" ? await templateData(identifier) : templateData
104
+ );
212
105
  const processedContent = await processor(content, identifier);
213
106
  await fs.ensureFile(to);
214
107
  await fs.writeFile(to, processedContent);
@@ -230,10 +123,10 @@ async function eject(templateDir, identifier, options) {
230
123
  throw new Error("eject: identifier is required");
231
124
  } else {
232
125
  try {
233
- const fullPath = path$1.resolve(templateDir, identifier);
126
+ const fullPath = path.resolve(templateDir, identifier);
234
127
  if (await isFile(fullPath)) {
235
128
  if (!ignoreFiles.includes(identifier)) {
236
- await ejectFile(fullPath, path$1.resolve(targetDir, identifier), identifier, {
129
+ await ejectFile(fullPath, path.resolve(targetDir, identifier), identifier, {
237
130
  force: options?.force,
238
131
  templateData: options?.templateData,
239
132
  processor: options?.processor,
@@ -244,9 +137,9 @@ async function eject(templateDir, identifier, options) {
244
137
  } else {
245
138
  const globPattern = await isDirectory(fullPath) ? identifier + "/**/*" : identifier;
246
139
  for (const fileRelativePath of getFileUrls(globPattern, { cwd: templateDir, nodir: true, posix: true, dot: true })) {
247
- const fullTemplateFilePath = path$1.resolve(templateDir, fileRelativePath);
140
+ const fullTemplateFilePath = path.resolve(templateDir, fileRelativePath);
248
141
  if (!ignoreFiles.includes(fileRelativePath)) {
249
- await ejectFile(fullTemplateFilePath, path$1.resolve(targetDir, fileRelativePath), fileRelativePath, {
142
+ await ejectFile(fullTemplateFilePath, path.resolve(targetDir, fileRelativePath), fileRelativePath, {
250
143
  force: options?.force,
251
144
  templateData: options?.templateData,
252
145
  processor: options?.processor,
@@ -264,7 +157,7 @@ async function eject(templateDir, identifier, options) {
264
157
  }
265
158
 
266
159
  function getPackageInfo() {
267
- const pkgPath = path$1.resolve(packageDirectorySync(), "./package.json");
160
+ const pkgPath = path.resolve(packageDirectorySync(), "./package.json");
268
161
  return JSON.parse(readFileSync(pkgPath, "utf8"));
269
162
  }
270
163
 
@@ -320,7 +213,9 @@ function defineGlobals(config, builder) {
320
213
  return deepmerge(GLOBALS, JSON.parse(JSON.stringify(builder(ctx))));
321
214
  }
322
215
  async function getProjectGlobals(filePath = "./project.globals.js") {
323
- return (await import(pathToFileURL(path$1.resolve(filePath)))).default;
216
+ return (await import(pathToFileURL(path.resolve(filePath)))).default;
324
217
  }
325
218
 
326
- export { DataExporter, defineGlobals, eject, getPackageInfo, getProjectGlobals, misc as utils };
219
+ const index = {};
220
+
221
+ export { DataExporter, index as default, defineGlobals, eject, getPackageInfo, getProjectGlobals };
@@ -29,7 +29,8 @@ export type DotenvOptions = Omit<DotenvConfigOptions, 'processEnv'>;
29
29
  /**
30
30
  * @group Types
31
31
  */
32
- export type DefineGlobalsBuilder<T extends Record<string, any>> = (ctx: {
32
+ export type DefineGlobalsBuilder<T extends Record<string, any>> = (// eslint-disable-line @typescript-eslint/no-explicit-any
33
+ ctx: {
33
34
  env: NodeJS.ProcessEnv;
34
35
  pkg: PackageJson;
35
36
  }) => T;
@@ -38,8 +39,10 @@ export type DefineGlobalsBuilder<T extends Record<string, any>> = (ctx: {
38
39
  * @param config - The config object
39
40
  * @param builder - The builder function
40
41
  * @returns The computed globals object
42
+ * @group None
41
43
  */
42
- export declare function defineGlobals<CustomGlobals extends Record<string, any>>(config: {
44
+ export declare function defineGlobals<CustomGlobals extends Record<string, any>>(// eslint-disable-line @typescript-eslint/no-explicit-any
45
+ config: {
43
46
  env?: {
44
47
  map?: string[];
45
48
  dotenvOptions?: DotenvOptions;
@@ -49,5 +52,6 @@ export declare function defineGlobals<CustomGlobals extends Record<string, any>>
49
52
  * Get project globals
50
53
  * @param filePath - The filePath. Default is `'./project.globals.js'`
51
54
  * @returns The resolved project globals object
55
+ * @group None
52
56
  */
53
57
  export declare function getProjectGlobals(filePath?: string): Promise<DefaultProjectGlobals & Record<string, string | Record<string, unknown> | undefined>>;