watchful-cli 1.7.17 → 1.7.20

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.
package/bin/constants.js CHANGED
@@ -6,16 +6,13 @@ const S = "s",
6
6
  BABEL = "babel",
7
7
  W_PLUS = "w+",
8
8
  INLINE = "inline",
9
- BASE_64 = "base64",
10
9
  MESSAGE = "message",
11
10
  ESBUILD = "esbuild",
12
- FULL_STOP = ".",
13
- DELIMITER = "/",
14
11
  BROWSERIFY = "browserify",
15
12
  EMPTY_STRING = "",
16
13
  WATCHFUL_CLI = "watchful-cli",
17
14
  PACKAGE_JSON = "package.json",
18
- SOURCE_MAP_PREAMBLE = "//# sourceMappingURL=data:application/json;charset=utf-8;base64,",
15
+ SOURCE_MAP_PREAMBLE = "//# sourceMappingURL=data:application/json;base64,",
19
16
  PROCESS_TRANSPILE_FILE = "../process/transpileFile",
20
17
  SOURCE_DIRECTORY_WATCH_PATTERN = "/**/*.js";
21
18
 
@@ -26,11 +23,8 @@ module.exports = {
26
23
  BABEL,
27
24
  W_PLUS,
28
25
  INLINE,
29
- BASE_64,
30
26
  MESSAGE,
31
27
  ESBUILD,
32
- FULL_STOP,
33
- DELIMITER,
34
28
  BROWSERIFY,
35
29
  EMPTY_STRING,
36
30
  WATCHFUL_CLI,
@@ -2,14 +2,16 @@
2
2
 
3
3
  const fs = require("fs");
4
4
 
5
- const { fileSystemUtilities } = require("necessary");
5
+ const { characters, fileSystemUtilities } = require("necessary");
6
6
 
7
- const { W_PLUS, FULL_STOP } = require("../constants"),
7
+ const { W_PLUS } = require("../constants"),
8
8
  { pathWithoutBottommostNameFromPath } = require("../utilities/path");
9
9
 
10
10
  const { openSync, writeSync, rmdirSync, unlinkSync } = fs,
11
11
  { readDirectory, isEntryDirectory, createDirectory } = fileSystemUtilities;
12
12
 
13
+ const { PERIOD_CHARACTER } = characters;
14
+
13
15
  function deleteFile(filePath, done) {
14
16
  unlinkSync(filePath);
15
17
 
@@ -33,7 +35,7 @@ function deleteDirectory(directoryPath, done) {
33
35
  function createParentDirectory(filePath) {
34
36
  const filePathWithoutBottommostName = pathWithoutBottommostNameFromPath(filePath);
35
37
 
36
- if ((filePathWithoutBottommostName !== FULL_STOP) && (filePathWithoutBottommostName !== null)) {
38
+ if ((filePathWithoutBottommostName !== PERIOD_CHARACTER) && (filePathWithoutBottommostName !== null)) {
37
39
  const parentDirectoryPath = filePathWithoutBottommostName; ///
38
40
 
39
41
  createDirectory(parentDirectoryPath);
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
 
3
- const { pathUtilities } = require("necessary");
3
+ const { characters, pathUtilities } = require("necessary");
4
4
 
5
- const { EMPTY_STRING, DELIMITER } = require("../constants");
5
+ const { EMPTY_STRING } = require("../constants");
6
6
 
7
- const { isPathName, bottommostNameFromPath } = pathUtilities;
7
+ const { FORWARD_SLASH_CHARACTER } = characters,
8
+ { isPathName, bottommostNameFromPath } = pathUtilities;
8
9
 
9
10
  const currentWorkingDirectoryPath = process.cwd(),
10
11
  currentWorkingDirectoryPathLength = currentWorkingDirectoryPath.length;
@@ -61,9 +62,9 @@ function pathFromFullyQualifiedPath(fullyQualifiedPath) {
61
62
  }
62
63
 
63
64
  function pathWithoutDirectoryPathFromPathAndDirectoryPath(path, directoryPath) {
64
- const delimiterLength = DELIMITER.length,
65
- directoryPathLength = directoryPath.length,
66
- pathWithoutDirectoryPath = path.substring(directoryPathLength + delimiterLength);
65
+ const directoryPathLength = directoryPath.length,
66
+ forwardSlashCharacterLength = FORWARD_SLASH_CHARACTER.length,
67
+ pathWithoutDirectoryPath = path.substring(directoryPathLength + forwardSlashCharacterLength);
67
68
 
68
69
  return pathWithoutDirectoryPath;
69
70
  }
@@ -2,9 +2,11 @@
2
2
 
3
3
  const path = require("path");
4
4
 
5
+ const { encode } = require("js-base64");
6
+
5
7
  const { SWC_CORE_PATH, BABEL_CORE_PATH } = require("../paths"),
6
8
  { readFile, writeFile, createParentDirectory } = require("../utilities/fileSystem"),
7
- { BABEL, INLINE, BASE_64, SOURCE_MAP_PREAMBLE } = require("../constants"),
9
+ { BABEL, INLINE, SOURCE_MAP_PREAMBLE } = require("../constants"),
8
10
  { sourceFileNameFromSourceFilePathAndTargetFilePath } = require("../utilities/sourceMap"),
9
11
  { SWC_FAILED_MESSAGE,
10
12
  BABEL_FAILED_MESSAGE,
@@ -122,7 +124,7 @@ function createSWCTranspileFileFunction(debug) {
122
124
  });
123
125
 
124
126
  const mapJSONString = JSON.stringify(mapJSON),
125
- base64EncodedMapJSONString = Buffer.from(mapJSONString).toString(BASE_64);
127
+ base64EncodedMapJSONString = encode(mapJSONString);
126
128
 
127
129
  targetFileContent = `${code}
128
130
  ${SOURCE_MAP_PREAMBLE}${base64EncodedMapJSONString}`; ///
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "watchful-cli",
3
3
  "author": "James Smith",
4
- "version": "1.7.17",
4
+ "version": "1.7.20",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/watchful-cli",
7
7
  "description": "Incremental transpilation with bundling.",
@@ -15,7 +15,8 @@
15
15
  "dependencies": {
16
16
  "argumentative": "^2.0.14",
17
17
  "chokidar": "^3.3.1",
18
- "necessary": "^11.0.1"
18
+ "js-base64": "^3.7.2",
19
+ "necessary": "^11.0.25"
19
20
  },
20
21
  "devDependencies": {},
21
22
  "scripts": {}