juisy 2.1.0 → 2.3.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 (56) hide show
  1. package/LICENSE +1 -1
  2. package/bin/cli/cli.js +14 -0
  3. package/bin/cli/cmds/index.js +6 -4
  4. package/bin/cli/cmds/public/AddExt.js +49 -0
  5. package/bin/cli/cmds/public/RemoveExt.js +49 -0
  6. package/bin/cli/index.js +1 -0
  7. package/bin/cli/init.js +1 -0
  8. package/bin/cli/lib/index.js +71 -0
  9. package/dist/DataExporter.d.ts +1 -0
  10. package/dist/bootstrap.d.ts +1 -0
  11. package/dist/cli/CLIFactory.d.ts +1 -0
  12. package/dist/cli/Command.d.ts +23 -2
  13. package/dist/cli/InterfaceUtils.d.ts +11 -9
  14. package/dist/cli/OutputUtils.d.ts +30 -16
  15. package/dist/cli/Plugin.d.ts +9 -0
  16. package/dist/cli/extract-usage.d.ts +8 -0
  17. package/dist/cli/index.d.ts +1 -0
  18. package/dist/cli/index.js +193 -113
  19. package/dist/cli/plugins/command-meta/augment.d.ts +0 -3
  20. package/dist/cli/plugins/command-meta/index.d.ts +4 -0
  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/index.d.ts +4 -0
  24. package/dist/cli/plugins/private-commands/augment.d.ts +8 -0
  25. package/dist/cli/plugins/private-commands/command-visitors/private-command.d.ts +7 -3
  26. package/dist/cli/plugins/private-commands/index.d.ts +4 -0
  27. package/dist/cli/plugins/register-bump-version-command/index.d.ts +4 -0
  28. package/dist/cli/plugins/register-changelog-command/index.d.ts +4 -0
  29. package/dist/cli/plugins/register-docs-commands/index.d.ts +4 -0
  30. package/dist/cli/plugins/register-git-hooks-commands/index.d.ts +4 -0
  31. package/dist/cli/plugins/register-lint-commands/index.d.ts +4 -0
  32. package/dist/cli/plugins/register-lint-commands/settings.d.ts +2 -0
  33. package/dist/cli/plugins/register-lint-commands/types.d.ts +5 -9
  34. package/dist/cli/plugins/register-release-command/index.d.ts +4 -0
  35. package/dist/cli/plugins/register-test-command/index.d.ts +4 -0
  36. package/dist/cli/types.d.ts +7 -0
  37. package/dist/cli/utils.d.ts +3 -4
  38. package/dist/eject.d.ts +1 -0
  39. package/dist/get-package-info.d.ts +1 -0
  40. package/dist/index.d.ts +5 -1
  41. package/dist/index.js +192 -13
  42. package/dist/project-globals.d.ts +2 -0
  43. package/dist/shims/shims.d.ts +1440 -0
  44. package/dist/templater/index.d.ts +4 -1
  45. package/dist/templater/index.js +42 -23
  46. package/dist/templater/markdown-templater/ReadmeTemplater.d.ts +8 -10
  47. package/dist/templater/markdown-templater/index.d.ts +10 -1
  48. package/dist/utils/misc.d.ts +92 -10
  49. package/package.json +38 -44
  50. package/bin/cli/cmds/private/docs/generate-api.js +0 -31
  51. package/bin/cli/cmds/private/docs/index.js +0 -20
  52. package/bin/cli/cmds/private/test.js +0 -33
  53. package/dist/vite/plugins/inject-css-variables/index.d.ts +0 -23
  54. package/dist/vite/plugins/inject-css-variables/index.js +0 -60
  55. package/dist/vite/plugins/inject-project-globals/index.d.ts +0 -19
  56. package/dist/vite/plugins/inject-project-globals/index.js +0 -58
@@ -1,60 +0,0 @@
1
- /*!
2
- * juisy v2.1.0
3
- * Copyright © 2022-Present Hervé Perchec
4
- */
5
-
6
- function injectCssVariables(optsArg = []) {
7
- const optionsArray = optsArg instanceof Array ? optsArg : [optsArg];
8
- const virtualModules = /* @__PURE__ */ new Map();
9
- for (let i = 0; i < optionsArray.length; i++) {
10
- const options = optionsArray[i];
11
- if (!options.moduleId || options.moduleId.trim().length === 0) {
12
- throw new Error(`Please provide a non-empty module ID in plugin options at index ${i}`);
13
- }
14
- if (virtualModules.has(options.moduleId)) {
15
- throw new Error(`The module ID "${options.moduleId}" is already used. Please provide another ID`);
16
- }
17
- virtualModules.set(options.moduleId, options);
18
- }
19
- return {
20
- name: "vite-plugin-inject-css-variables",
21
- enforce: "pre",
22
- resolveId(id) {
23
- const options = virtualModules.get(id);
24
- if (!options) {
25
- return;
26
- } else {
27
- return "\0" + options.moduleId;
28
- }
29
- },
30
- async load(id) {
31
- const options = virtualModules.get(id.slice(1));
32
- if (!id.startsWith("\0") || !options) {
33
- return;
34
- }
35
- const { selector = ":root", variables } = options;
36
- try {
37
- if (Object.keys(variables).length === 0) {
38
- return "";
39
- }
40
- for (const key in variables) {
41
- if (typeof variables[key] === "string") {
42
- continue;
43
- }
44
- }
45
- } catch (e) {
46
- this.error(`The variables object for module "${options.moduleId}" is malformed`);
47
- }
48
- let css = `${selector} {
49
- `;
50
- for (const key in variables) {
51
- css += ` --${key}: ${variables[key]};
52
- `;
53
- }
54
- css += "}\n";
55
- return css;
56
- }
57
- };
58
- }
59
-
60
- export { injectCssVariables as default, injectCssVariables };
@@ -1,19 +0,0 @@
1
- import { Plugin } from 'vite';
2
- export type Options = {
3
- /**
4
- * The virtual module ID
5
- * @default 'virtual:project.globals.js'
6
- */
7
- moduleId?: string;
8
- /**
9
- * The project globals path (relative from root folder)
10
- */
11
- filePath?: string;
12
- };
13
- /**
14
- * Inject project globals via a virtual module
15
- * @param opts - The plugin options or an array of options
16
- * @returns {Plugin} The vite plugin function
17
- */
18
- export declare function injectProjectGlobals(options?: Options): Plugin;
19
- export default injectProjectGlobals;
@@ -1,58 +0,0 @@
1
- /*!
2
- * juisy v2.1.0
3
- * Copyright © 2022-Present Hervé Perchec
4
- */
5
-
6
- import { getProjectGlobals } from 'juisy';
7
- import { OutputUtils } from 'juisy/cli';
8
-
9
- function injectProjectGlobals(options = {}) {
10
- const { $style } = OutputUtils;
11
- let config;
12
- let moduleId = "virtual:project.globals.js";
13
- if (options.moduleId) {
14
- if (options.moduleId.trim().length === 0) {
15
- throw new Error("Please provide a non-empty module ID for juisy/vite-plugin-inject-project-globals");
16
- }
17
- moduleId = options.moduleId;
18
- }
19
- return {
20
- name: "vite-plugin-inject-project-globals",
21
- enforce: "pre",
22
- configResolved(resolvedConfig) {
23
- config = resolvedConfig;
24
- },
25
- resolveId(id) {
26
- if (id !== moduleId) {
27
- return;
28
- } else {
29
- return "\0" + moduleId;
30
- }
31
- },
32
- /**
33
- * Vite plugin `load` hook
34
- * @param id - The requested module ID
35
- * @returns The module content as a string
36
- * @description
37
- * Load the virtual module and return its content.
38
- * If the module ID is not the one defined by the plugin, simply return null.
39
- * Otherwise, call `getProjectGlobals` and build a js string.
40
- */
41
- async load(id) {
42
- if (!id.startsWith("\0") || id.slice(1) !== moduleId) {
43
- return;
44
- }
45
- const PROJECT_GLOBALS = {
46
- ...await getProjectGlobals(options.filePath)
47
- };
48
- if (PROJECT_GLOBALS.ENV) {
49
- config.logger.warn("\n[vite-plugin-inject-project-globals] " + $style.yellow("The following ENV variables are exposed:"));
50
- config.logger.warn(JSON.stringify(PROJECT_GLOBALS.ENV));
51
- config.logger.warn("\n");
52
- }
53
- return "const PROJECT_GLOBALS = " + JSON.stringify(PROJECT_GLOBALS) + "\nconst isBrowser = import.meta.env.SSR === false\nif (isBrowser) {\n if (PROJECT_GLOBALS.ENV) {\n console.warn('[vite-plugin-inject-project-globals] WARNING: some ENV variables are exposed! Be careful, do not expose sensitive data!')\n }\n}\nexport default PROJECT_GLOBALS\n";
54
- }
55
- };
56
- }
57
-
58
- export { injectProjectGlobals as default, injectProjectGlobals };