watchful-cli 1.7.15 → 1.7.19
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,11 +6,8 @@ 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",
|
|
@@ -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
|
|
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 !==
|
|
38
|
+
if ((filePathWithoutBottommostName !== PERIOD_CHARACTER) && (filePathWithoutBottommostName !== null)) {
|
|
37
39
|
const parentDirectoryPath = filePathWithoutBottommostName; ///
|
|
38
40
|
|
|
39
41
|
createDirectory(parentDirectoryPath);
|
package/bin/utilities/path.js
CHANGED
|
@@ -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
|
|
5
|
+
const { EMPTY_STRING } = require("../constants");
|
|
6
6
|
|
|
7
|
-
const {
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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,15 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require("path");
|
|
4
4
|
|
|
5
|
+
const { encodings } = require("necessary");
|
|
6
|
+
|
|
5
7
|
const { SWC_CORE_PATH, BABEL_CORE_PATH } = require("../paths"),
|
|
6
8
|
{ readFile, writeFile, createParentDirectory } = require("../utilities/fileSystem"),
|
|
7
|
-
{ BABEL, INLINE,
|
|
9
|
+
{ BABEL, INLINE, SOURCE_MAP_PREAMBLE } = require("../constants"),
|
|
8
10
|
{ sourceFileNameFromSourceFilePathAndTargetFilePath } = require("../utilities/sourceMap"),
|
|
9
11
|
{ SWC_FAILED_MESSAGE,
|
|
10
12
|
BABEL_FAILED_MESSAGE,
|
|
11
13
|
SWC_NOT_INSTALLED_MESSAGE,
|
|
12
14
|
BABEL_NOT_INSTALLED_MESSAGE } = require("../messages");
|
|
13
15
|
|
|
16
|
+
const { BASE64_ENCODING } = encodings;
|
|
17
|
+
|
|
14
18
|
function createTranspileFileFunction(context) {
|
|
15
19
|
const { debug, transpiler } = context,
|
|
16
20
|
transpileFileFunction = (transpiler === BABEL) ?
|
|
@@ -122,7 +126,7 @@ function createSWCTranspileFileFunction(debug) {
|
|
|
122
126
|
});
|
|
123
127
|
|
|
124
128
|
const mapJSONString = JSON.stringify(mapJSON),
|
|
125
|
-
base64EncodedMapJSONString = Buffer.from(mapJSONString).toString(
|
|
129
|
+
base64EncodedMapJSONString = Buffer.from(mapJSONString).toString(BASE64_ENCODING);
|
|
126
130
|
|
|
127
131
|
targetFileContent = `${code}
|
|
128
132
|
${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.
|
|
4
|
+
"version": "1.7.19",
|
|
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,7 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"argumentative": "^2.0.14",
|
|
17
17
|
"chokidar": "^3.3.1",
|
|
18
|
-
"necessary": "^
|
|
18
|
+
"necessary": "^11.0.25"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {},
|
|
21
21
|
"scripts": {}
|