@genexus/mercury 0.35.1 → 0.36.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 (36) hide show
  1. package/README.md +0 -29
  2. package/dist/assets-manager.d.ts +3 -3
  3. package/dist/bundles/css/all.css +1 -1
  4. package/dist/bundles/css/base/base-globant.css +1 -1
  5. package/dist/bundles/css/base/base.css +1 -1
  6. package/dist/bundles/css/base/icons.css +1 -1
  7. package/dist/register-mercury.js +1 -1
  8. package/package.json +14 -26
  9. package/dist/assets/MERCURY_ASSETS.ts +0 -19314
  10. package/dist/assets/images/mercury-favicon-32x32.png +0 -0
  11. package/dist/assets/images/noise-texture-200x200-original.png +0 -0
  12. package/dist/assets/images/noise-texture-200x200.png +0 -0
  13. package/dist/cli/bundle.d.ts +0 -2
  14. package/dist/cli/bundle.js +0 -191
  15. package/dist/cli/internal/constants.d.ts +0 -19
  16. package/dist/cli/internal/constants.js +0 -24
  17. package/dist/cli/internal/create-bundles-with-custom-paths.d.ts +0 -10
  18. package/dist/cli/internal/create-bundles-with-custom-paths.js +0 -114
  19. package/dist/cli/internal/file-management.d.ts +0 -5
  20. package/dist/cli/internal/file-management.js +0 -53
  21. package/dist/cli/internal/print-utils.d.ts +0 -18
  22. package/dist/cli/internal/print-utils.js +0 -35
  23. package/dist/cli/internal/transpile-bundle-and-create-mappings.d.ts +0 -2
  24. package/dist/cli/internal/transpile-bundle-and-create-mappings.js +0 -57
  25. package/dist/cli/internal/types.d.ts +0 -20
  26. package/dist/cli/internal/types.js +0 -1
  27. package/dist/cli/internal/utils.d.ts +0 -14
  28. package/dist/cli/internal/utils.js +0 -47
  29. package/dist/cli/internal/validate-args.d.ts +0 -2
  30. package/dist/cli/internal/validate-args.js +0 -126
  31. package/dist/cli/internal/watch-fs.d.ts +0 -3
  32. package/dist/cli/internal/watch-fs.js +0 -101
  33. package/dist/cli/mercury.d.ts +0 -2
  34. package/dist/cli/mercury.js +0 -14
  35. /package/dist/{assets/MERCURY_ASSETS.d.ts → MERCURY_ASSETS.d.ts} +0 -0
  36. /package/dist/{assets/MERCURY_ASSETS.js → MERCURY_ASSETS.js} +0 -0
@@ -1,126 +0,0 @@
1
- import { DEFAULT_FONT_FACE_PATH, DEFAULT_ICONS_PATH, DEFAULT_OUT_DIR_PATH, SEPARATE_BY_COMMA_REGEX } from "./constants.js";
2
- import { printArgumentDoesNotExistsError, printDuplicatedArgumentError, printInvalidArgumentError, printMissingFontPathArgumentWarning, printMissingIconsPathArgumentWarning, printMissingOutDirPathArgumentWarning } from "./print-utils.js";
3
- import { sanitizeBundleName } from "./utils.js";
4
- const ARGUMENT_VALUE_AND_NAME_SEPARATOR_REGEX = /\s*=\s*/g;
5
- const ERROR_IN_CHECK = false;
6
- const SUCCESS_CHECK = true;
7
- const [, , ...args] = process.argv;
8
- const AVOID_HASH_ARGUMENTS = new Set(["--avoid-hash", "--ah", "-ah"]);
9
- const ICONS_PATH_ARGUMENTS = new Set(["--icons-path", "--icons", "--i", "-i"]);
10
- const FONT_FACE_PATH_ARGUMENTS = new Set([
11
- "--font-face-path",
12
- "--font-face",
13
- "--f",
14
- "-f"
15
- ]);
16
- const OUT_DIR_ARGUMENTS = new Set(["--outdir", "--o", "-o"]);
17
- const GLOBANT_ARGUMENTS = new Set(["--globant", "--gl", "-gl"]);
18
- const isAvoidHashArgument = (arg) => AVOID_HASH_ARGUMENTS.has(arg.toLowerCase());
19
- const isFontFaceArgument = (arg) => FONT_FACE_PATH_ARGUMENTS.has(arg.toLowerCase());
20
- const isGlobantArgument = (arg) => GLOBANT_ARGUMENTS.has(arg.toLowerCase());
21
- const isIconsArgument = (arg) => ICONS_PATH_ARGUMENTS.has(arg.toLowerCase());
22
- const isOutDirArgument = (arg) => OUT_DIR_ARGUMENTS.has(arg.toLowerCase());
23
- let hasAvoidHash = false;
24
- let hasGlobant = false;
25
- let hasFontFacePath = false;
26
- let hasIconsPath = false;
27
- let hasOutDirPath = false;
28
- let anyWarning = false;
29
- let avoidHash = [];
30
- let fontFacePath = "";
31
- let iconsPath = "";
32
- let outDirPath = "";
33
- const checkArgument = (argument) => {
34
- if (isGlobantArgument(argument)) {
35
- if (hasGlobant) {
36
- printDuplicatedArgumentError(argument);
37
- return ERROR_IN_CHECK;
38
- }
39
- hasGlobant = true;
40
- return SUCCESS_CHECK;
41
- }
42
- const argNameWithValue = argument.split(ARGUMENT_VALUE_AND_NAME_SEPARATOR_REGEX);
43
- if (argNameWithValue.length !== 2) {
44
- // Special arguments that don't throw error
45
- if (argNameWithValue[0] === "--watch" || argNameWithValue[0] === "--ci") {
46
- return SUCCESS_CHECK;
47
- }
48
- printInvalidArgumentError(argument);
49
- return ERROR_IN_CHECK;
50
- }
51
- const argName = argNameWithValue[0];
52
- const argValue = argNameWithValue[1];
53
- if (isAvoidHashArgument(argName)) {
54
- if (hasAvoidHash) {
55
- printDuplicatedArgumentError(argument);
56
- return ERROR_IN_CHECK;
57
- }
58
- avoidHash = argValue.split(SEPARATE_BY_COMMA_REGEX);
59
- hasAvoidHash = true;
60
- return SUCCESS_CHECK;
61
- }
62
- if (isFontFaceArgument(argName)) {
63
- if (hasFontFacePath) {
64
- printDuplicatedArgumentError(argument);
65
- return ERROR_IN_CHECK;
66
- }
67
- fontFacePath = argValue;
68
- hasFontFacePath = true;
69
- return SUCCESS_CHECK;
70
- }
71
- if (isIconsArgument(argName)) {
72
- if (hasIconsPath) {
73
- printDuplicatedArgumentError(argument);
74
- return ERROR_IN_CHECK;
75
- }
76
- iconsPath = argValue;
77
- hasIconsPath = true;
78
- return SUCCESS_CHECK;
79
- }
80
- if (isOutDirArgument(argName)) {
81
- if (hasOutDirPath) {
82
- printDuplicatedArgumentError(argument);
83
- return ERROR_IN_CHECK;
84
- }
85
- outDirPath = argValue;
86
- hasOutDirPath = true;
87
- return SUCCESS_CHECK;
88
- }
89
- printArgumentDoesNotExistsError(argument);
90
- return ERROR_IN_CHECK;
91
- };
92
- export const getArguments = () => {
93
- for (let index = 0; index < args.length; index++) {
94
- if (checkArgument(args[index]) === ERROR_IN_CHECK) {
95
- return undefined;
96
- }
97
- }
98
- if (!fontFacePath) {
99
- printMissingFontPathArgumentWarning();
100
- fontFacePath = DEFAULT_FONT_FACE_PATH;
101
- anyWarning = true;
102
- }
103
- if (!iconsPath) {
104
- printMissingIconsPathArgumentWarning();
105
- iconsPath = DEFAULT_ICONS_PATH;
106
- anyWarning = true;
107
- }
108
- if (!outDirPath) {
109
- printMissingOutDirPathArgumentWarning();
110
- outDirPath = DEFAULT_OUT_DIR_PATH;
111
- anyWarning = true;
112
- }
113
- // Print a line break to better visualize warnings
114
- if (anyWarning) {
115
- console.log("");
116
- }
117
- // Sanitize bundle names to avoid issues with "/" and "\" in paths
118
- const sanitizedAvoidHash = new Set(avoidHash.map(bundleName => sanitizeBundleName(bundleName)));
119
- return {
120
- avoidHash: new Set(sanitizedAvoidHash),
121
- globant: hasGlobant,
122
- fontFacePath,
123
- iconsPath,
124
- outDirPath
125
- };
126
- };
@@ -1,3 +0,0 @@
1
- export declare const printRebuilding: (firstBuild: boolean) => void;
2
- export declare const stopRebuildingStdout: () => void;
3
- export declare const watchFileSystemChanges: (callbackToCompile: () => Promise<void>) => void;
@@ -1,101 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- import { styleText } from "node:util";
5
- import readline from "readline";
6
- /**
7
- * This debounce value is useful to batch multiples updates attempt into a
8
- * single compilation. In some cases, multiples files can be changed at one, so
9
- * if we don't debounce the next compilation, we would trigger to compilations.
10
- *
11
- * This case can also happen when performing ESLint on auto-save.
12
- */
13
- const DEBOUNCE = 100; // 100ms
14
- const progressDictionary = {
15
- 0: "-",
16
- 1: "\\",
17
- 2: "|",
18
- 3: "/"
19
- };
20
- let lastRebuildInterval;
21
- let updateCounter = 0;
22
- const { isTTY } = process.stdout;
23
- const readLineInterface = readline.createInterface({
24
- input: process.stdin,
25
- output: process.stdout
26
- });
27
- export const printRebuilding = (firstBuild) => {
28
- // process.stdout doesn't work on the CI
29
- if (!isTTY) {
30
- return;
31
- }
32
- // Hide the cursor to improve the CLI design
33
- readLineInterface.write("\u001B[?25l");
34
- // First write
35
- process.stdout.write(`${styleText("yellow", progressDictionary[(updateCounter % 4)])} ${firstBuild ? "Building bundles..." : "Changes detected. Rebuilding..."}`);
36
- // Update the left symbol each 100ms
37
- lastRebuildInterval = setInterval(() => {
38
- process.stdout.cursorTo(1);
39
- process.stdout.clearLine(-1);
40
- process.stdout.cursorTo(0);
41
- process.stdout.write(`${styleText("yellow", progressDictionary[(updateCounter % 4)])}`);
42
- updateCounter++;
43
- }, 100);
44
- };
45
- export const stopRebuildingStdout = () => {
46
- // process.stdout doesn't work on the CI
47
- if (!isTTY) {
48
- return;
49
- }
50
- clearInterval(lastRebuildInterval);
51
- process.stdout.clearLine(0);
52
- console.log("");
53
- updateCounter = 0;
54
- // Show again the cursor
55
- readLineInterface.write("\u001B[?25h");
56
- };
57
- export const watchFileSystemChanges = (callbackToCompile) => {
58
- // This is a WA to have __filename and __dirname in ES modules
59
- const __filename = fileURLToPath(import.meta.url);
60
- const SRC_PATH = path.join(__filename, "../../../../src");
61
- const BASE_PATH = path.join(SRC_PATH, "base");
62
- const BUNDLES_PATH = path.join(SRC_PATH, "bundles");
63
- const COMPONENTS_PATH = path.join(SRC_PATH, "components");
64
- const MERCURY_SCSS_PATH = path.join(SRC_PATH, "mercury.scss");
65
- let compileStatus = "idle";
66
- const performCompilationIfNecessary = () => {
67
- // The current compilation is waiting to be started, so there is no need to
68
- // queue another one after the current has finished
69
- if (compileStatus === "debouncing-compiling") {
70
- return;
71
- }
72
- // There is no compilation in process. Queue one.
73
- if (compileStatus === "idle") {
74
- compileStatus = "debouncing-compiling";
75
- }
76
- // There is a compilation in progress. We can set a flag to queue a
77
- // compilation after the current one has finished
78
- else {
79
- if (compileStatus === "compiling") {
80
- compileStatus = "queued-after-compile";
81
- }
82
- return;
83
- }
84
- setTimeout(() => {
85
- compileStatus = "compiling";
86
- console.time(styleText("green", "Rebuild done in"));
87
- callbackToCompile().then(() => {
88
- console.timeEnd(styleText("green", "Rebuild done in"));
89
- const hasToRecompile = compileStatus === "queued-after-compile";
90
- compileStatus = "idle";
91
- if (hasToRecompile) {
92
- performCompilationIfNecessary();
93
- }
94
- });
95
- }, DEBOUNCE);
96
- };
97
- fs.watch(BASE_PATH, { recursive: true }, performCompilationIfNecessary);
98
- fs.watch(BUNDLES_PATH, { recursive: true }, performCompilationIfNecessary);
99
- fs.watch(COMPONENTS_PATH, { recursive: true }, performCompilationIfNecessary);
100
- fs.watch(MERCURY_SCSS_PATH, { recursive: true }, performCompilationIfNecessary);
101
- };
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createBundlesWithCustomPaths } from "./internal/create-bundles-with-custom-paths.js";
3
- import { ensureDirectoryExistsAndItsClear } from "./internal/file-management.js";
4
- import { getArguments } from "./internal/validate-args.js";
5
- import { measureTime } from "./internal/utils.js";
6
- measureTime(async () => {
7
- // Improve process visualization
8
- console.log("");
9
- const args = getArguments();
10
- if (args) {
11
- ensureDirectoryExistsAndItsClear(args.outDirPath);
12
- await createBundlesWithCustomPaths(args);
13
- }
14
- });