watchful-cli 1.7.58 → 1.7.59
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/.swcrc +11 -0
- package/lib/abbreviations.js +32 -0
- package/lib/action/batch.js +56 -0
- package/lib/action/help.js +15 -0
- package/lib/action/incremental.js +54 -0
- package/lib/action/version.js +19 -0
- package/lib/action.js +19 -0
- package/lib/bundleFiles.js +36 -0
- package/lib/commands.js +30 -0
- package/lib/configure.js +25 -0
- package/lib/constants.js +62 -0
- package/lib/defaults.js +79 -0
- package/lib/events.js +38 -0
- package/lib/main.js +59 -0
- package/lib/messages.js +118 -0
- package/lib/operation/bundleFiles.js +28 -0
- package/lib/operation/createBundleFilesFunction.js +29 -0
- package/lib/operation/createTranspileFileFunction.js +24 -0
- package/lib/operation/initialise.js +125 -0
- package/lib/operation/retrieveFilePaths.js +45 -0
- package/lib/operation/transpileFiles/mutilpleProcesses.js +51 -0
- package/lib/operation/transpileFiles/singleProcess.js +33 -0
- package/lib/operation/transpileFiles.js +36 -0
- package/lib/options.js +74 -0
- package/lib/paths.js +30 -0
- package/lib/process/transpileFile.js +26 -0
- package/lib/queue.js +93 -0
- package/lib/task/bundleFiles.js +115 -0
- package/lib/task/deleteDirectory.js +119 -0
- package/lib/task/deleteFile.js +119 -0
- package/lib/task/transpileFile.js +120 -0
- package/lib/task.js +101 -0
- package/lib/transpileFile.js +24 -0
- package/lib/utilities/bundle.js +106 -0
- package/lib/utilities/callback.js +46 -0
- package/lib/utilities/fileSystem.js +88 -0
- package/lib/utilities/metrics.js +73 -0
- package/lib/utilities/option.js +29 -0
- package/lib/utilities/path.js +110 -0
- package/lib/utilities/transpile.js +103 -0
- package/lib/utilities/watch.js +102 -0
- package/lib/watch.js +35 -0
- package/lib/wrapper/transpileFile.js +107 -0
- package/package.json +20 -5
- package/{bin → src}/abbreviations.js +18 -19
- package/src/action/batch.js +46 -0
- package/{bin → src}/action/help.js +1 -3
- package/{bin → src}/action/incremental.js +8 -10
- package/src/action/version.js +13 -0
- package/{bin → src}/action.js +2 -4
- package/{bin → src}/bundleFiles.js +2 -4
- package/src/commands.js +6 -0
- package/{bin → src}/configure.js +3 -5
- package/src/constants.js +14 -0
- package/src/defaults.js +20 -0
- package/src/events.js +8 -0
- package/{bin → src}/main.js +23 -25
- package/src/messages.js +28 -0
- package/{bin → src}/operation/bundleFiles.js +2 -4
- package/{bin → src}/operation/createBundleFilesFunction.js +2 -4
- package/{bin → src}/operation/createTranspileFileFunction.js +2 -4
- package/{bin → src}/operation/initialise.js +18 -20
- package/{bin → src}/operation/retrieveFilePaths.js +5 -7
- package/{bin → src}/operation/transpileFiles/mutilpleProcesses.js +3 -5
- package/{bin → src}/operation/transpileFiles/singleProcess.js +3 -5
- package/{bin → src}/operation/transpileFiles.js +5 -7
- package/src/options.js +17 -0
- package/src/paths.js +6 -0
- package/{bin → src}/process/transpileFile.js +4 -4
- package/{bin → src}/queue.js +2 -4
- package/{bin → src}/task/bundleFiles.js +3 -5
- package/{bin → src}/task/deleteDirectory.js +4 -6
- package/{bin → src}/task/deleteFile.js +4 -6
- package/{bin → src}/task/transpileFile.js +5 -7
- package/{bin → src}/task.js +1 -3
- package/{bin → src}/transpileFile.js +2 -4
- package/{bin → src}/utilities/bundle.js +12 -16
- package/{bin → src}/utilities/callback.js +2 -6
- package/{bin → src}/utilities/fileSystem.js +11 -17
- package/{bin → src}/utilities/metrics.js +6 -15
- package/{bin → src}/utilities/option.js +1 -5
- package/{bin → src}/utilities/path.js +32 -42
- package/{bin → src}/utilities/transpile.js +11 -15
- package/{bin → src}/utilities/watch.js +9 -14
- package/{bin → src}/watch.js +6 -8
- package/{bin → src}/wrapper/transpileFile.js +3 -5
- package/watchful.js +3 -3
- package/bin/action/batch.js +0 -48
- package/bin/action/version.js +0 -15
- package/bin/commands.js +0 -13
- package/bin/constants.js +0 -33
- package/bin/defaults.js +0 -39
- package/bin/events.js +0 -17
- package/bin/messages.js +0 -57
- package/bin/options.js +0 -35
- package/bin/paths.js +0 -13
package/{bin → src}/configure.js
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { DEFAULT_HELP, DEFAULT_VERSION } from "./defaults";
|
|
4
|
+
import { HELP_COMMAND, VERSION_COMMAND } from "./commands";
|
|
5
5
|
|
|
6
|
-
function configure(command, argument, options, main) {
|
|
6
|
+
export default function configure(command, argument, options, main) {
|
|
7
7
|
const { help = DEFAULT_HELP, version = DEFAULT_VERSION } = options;
|
|
8
8
|
|
|
9
9
|
if (false) {
|
|
@@ -16,5 +16,3 @@ function configure(command, argument, options, main) {
|
|
|
16
16
|
|
|
17
17
|
main(command, argument, options);
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
module.exports = configure;
|
package/src/constants.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const S = "s";
|
|
4
|
+
export const NODE = "node";
|
|
5
|
+
export const BABEL = "babel";
|
|
6
|
+
export const W_PLUS = "w+";
|
|
7
|
+
export const INLINE = "inline";
|
|
8
|
+
export const MESSAGE = "message";
|
|
9
|
+
export const BROWSERIFY = "browserify";
|
|
10
|
+
export const EMPTY_STRING = "";
|
|
11
|
+
export const WATCHFUL_CLI = "Watchful-CLI";
|
|
12
|
+
export const SOURCE_MAP_PREAMBLE = "//# sourceMappingURL=data:application/json;base64,";
|
|
13
|
+
export const PROCESS_TRANSPILE_FILE = "../process/transpileFile";
|
|
14
|
+
export const SOURCE_DIRECTORY_WATCH_PATTERN = "/**/*.js";
|
package/src/defaults.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { BABEL, BROWSERIFY } from "./constants";
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_HELP = false;
|
|
6
|
+
export const DEFAULT_WAIT = 0;
|
|
7
|
+
export const DEFAULT_NODE = false;
|
|
8
|
+
export const DEFAULT_DEBUG = false;
|
|
9
|
+
export const DEFAULT_RELEASE = false;
|
|
10
|
+
export const DEFAULT_BUNDLER = BROWSERIFY;
|
|
11
|
+
export const DEFAULT_VERSION = false;
|
|
12
|
+
export const DEFAULT_QUIETLY = false;
|
|
13
|
+
export const DEFAULT_METRICS = false;
|
|
14
|
+
export const DEFAULT_PROCESSES = 1;
|
|
15
|
+
export const DEFAULT_TRANSPILER = BABEL;
|
|
16
|
+
export const DEFAULT_ENTRY_FILE = null;
|
|
17
|
+
export const DEFAULT_BUNDLE_FILE = null;
|
|
18
|
+
export const DEFAULT_LIB_DIRECTORY = null;
|
|
19
|
+
export const DEFAULT_TEMP_DIRECTORY = null;
|
|
20
|
+
export const DEFAULT_SOURCE_DIRECTORY = null;
|
package/src/events.js
ADDED
package/{bin → src}/main.js
RENAMED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
function main(command, argument, options) {
|
|
3
|
+
import helpAction from "./action/help";
|
|
4
|
+
import batchAction from "./action/batch";
|
|
5
|
+
import versionAction from "./action/version";
|
|
6
|
+
import incrementalAction from "./action/incremental";
|
|
7
|
+
|
|
8
|
+
import { NO_COMMAND_GIVEN_MESSAGE, COMMAND_NOT_RECOGNISED_MESSAGE } from "./messages";
|
|
9
|
+
import { HELP_COMMAND, BATCH_COMMAND, VERSION_COMMAND, INCREMENTAL_COMMAND } from "./commands";
|
|
10
|
+
import { DEFAULT_WAIT,
|
|
11
|
+
DEFAULT_NODE,
|
|
12
|
+
DEFAULT_DEBUG,
|
|
13
|
+
DEFAULT_RELEASE,
|
|
14
|
+
DEFAULT_BUNDLER,
|
|
15
|
+
DEFAULT_QUIETLY,
|
|
16
|
+
DEFAULT_METRICS,
|
|
17
|
+
DEFAULT_ENTRY_FILE,
|
|
18
|
+
DEFAULT_PROCESSES,
|
|
19
|
+
DEFAULT_TRANSPILER,
|
|
20
|
+
DEFAULT_BUNDLE_FILE,
|
|
21
|
+
DEFAULT_LIB_DIRECTORY,
|
|
22
|
+
DEFAULT_TEMP_DIRECTORY,
|
|
23
|
+
DEFAULT_SOURCE_DIRECTORY } from "./defaults";
|
|
24
|
+
|
|
25
|
+
export default function main(command, argument, options) {
|
|
26
26
|
const { wait = DEFAULT_WAIT,
|
|
27
27
|
node = DEFAULT_NODE,
|
|
28
28
|
debug = DEFAULT_DEBUG,
|
|
@@ -76,5 +76,3 @@ function main(command, argument, options) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
module.exports = main;
|
package/src/messages.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const SWC_FAILED_MESSAGE = "swc failed:";
|
|
4
|
+
export const BABEL_FAILED_MESSAGE = "Babel failed:";
|
|
5
|
+
export const ESBUILD_FAILED_MESSAGE = "esbuild failed.";
|
|
6
|
+
export const BROWSERIFY_FAILED_MESSAGE = "Browserify failed:";
|
|
7
|
+
export const BATCH_BUILD_FAILED_MESSAGE = "The batch build failed.";
|
|
8
|
+
export const INCREMENTAL_BUILD_FAILED_MESSAGE = "The incremental build failed.";
|
|
9
|
+
export const SWC_NOT_INSTALLED_MESSAGE = "The '@swc/core' package is not installed.";
|
|
10
|
+
export const BABEL_NOT_INSTALLED_MESSAGE = "The '@babel/core' package is not installed.";
|
|
11
|
+
export const ESBUILD_NOT_INSTALLED_MESSAGE = "esbuild is not installed.";
|
|
12
|
+
export const BROWSERIFY_NOT_INSTALLED_MESSAGE = "Browserify is not installed.";
|
|
13
|
+
export const NO_COMMAND_GIVEN_MESSAGE = "No command has been given.";
|
|
14
|
+
export const COMMAND_NOT_RECOGNISED_MESSAGE = "The command is not recognised.";
|
|
15
|
+
export const NO_ENTRY_FILE_SPECIFIED_MESSAGE = "If a temp directory is specified then an entry file must also be given.";
|
|
16
|
+
export const NO_BUNDLE_FILE_SPECIFIED_MESSAGE = "If a temp directory is specified then a bundle file must also be given.";
|
|
17
|
+
export const DEBUG_AND_RELEAES_BOTH_SET_MESSAGE = "The debug and release flags cannot both be set at the same time.";
|
|
18
|
+
export const NO_SOURCE_DIRECTORY_SPECIFIED_MESSAGE = "The source directory has not been specified.";
|
|
19
|
+
export const ENTRY_FILE_BUT_NO_BUNDLE_FILE_SPECIFIED_MESSAGE = "If an entry file is specified then a bundle file must also be given.";
|
|
20
|
+
export const BUNDLE_FILE_BUT_NO_ENTRY_FILE_SPECIFIED_MESSAGE = "If a bundle file is specified then an entry file must also be given.";
|
|
21
|
+
export const BOTH_LIB_AND_TEMP_DIRECTORIES_SPECIFIED_MESSAGE = "There is no need to specify both a lib and a temp directory.";
|
|
22
|
+
export const NEITHER_LIB_NOR_TEMP_DIRECTORY_SPECIFIED_MESSAGE = "Neither a lib directory nor a temp directory has been specified";
|
|
23
|
+
export const ENTRY_FILE_NOT_INCLUDED_IN_BUNDLED_FILES_MESSAGE = "The entry file is not included in the files to be bundled.";
|
|
24
|
+
export const ENTRY_FILE_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE = "The entry file path is not relative to the current directory.";
|
|
25
|
+
export const BUNDLE_FILE_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE = "The bundle file path is not relative to the current directory.";
|
|
26
|
+
export const LIB_DIRECTORY_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE = "The lib directory path is not relative to the current directory.";
|
|
27
|
+
export const TEMP_DIRECTORY_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE = "The temp directory path is not relative to the current directory.";
|
|
28
|
+
export const SOURCE_DIRECTORY_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE = "The source directory path is not relative to the current directory.";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import bundleFiles from "../bundleFiles";
|
|
4
4
|
|
|
5
|
-
function bundleFilesOperation(proceed, abort, context) {
|
|
5
|
+
export default function bundleFilesOperation(proceed, abort, context) {
|
|
6
6
|
const { entryFilePath } = context;
|
|
7
7
|
|
|
8
8
|
if (!entryFilePath) {
|
|
@@ -15,5 +15,3 @@ function bundleFilesOperation(proceed, abort, context) {
|
|
|
15
15
|
proceed();
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
module.exports = bundleFilesOperation;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { createBundleFilesFunction } from "../utilities/bundle";
|
|
4
4
|
|
|
5
|
-
function createBundleFilesFunctionOperation(proceed, abort, context) {
|
|
5
|
+
export default function createBundleFilesFunctionOperation(proceed, abort, context) {
|
|
6
6
|
const { bundleFilePath } = context;
|
|
7
7
|
|
|
8
8
|
if (bundleFilePath === null) {
|
|
@@ -25,5 +25,3 @@ function createBundleFilesFunctionOperation(proceed, abort, context) {
|
|
|
25
25
|
|
|
26
26
|
proceed();
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
module.exports = createBundleFilesFunctionOperation;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { createTranspileFileFunction } from "../utilities/transpile";
|
|
4
4
|
|
|
5
|
-
function createTranspileFileFunctionOperation(proceed, abort, context) {
|
|
5
|
+
export default function createTranspileFileFunctionOperation(proceed, abort, context) {
|
|
6
6
|
const transpileFileFunction = createTranspileFileFunction(context);
|
|
7
7
|
|
|
8
8
|
if (transpileFileFunction === null) {
|
|
@@ -17,5 +17,3 @@ function createTranspileFileFunctionOperation(proceed, abort, context) {
|
|
|
17
17
|
|
|
18
18
|
proceed();
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
module.exports = createTranspileFileFunctionOperation;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function initialiseOperation(proceed, abort, context) {
|
|
3
|
+
import { pathFromOption } from "../utilities/path";
|
|
4
|
+
import { initialiseMetrics } from "../utilities/metrics";
|
|
5
|
+
import { NO_ENTRY_FILE_SPECIFIED_MESSAGE,
|
|
6
|
+
NO_BUNDLE_FILE_SPECIFIED_MESSAGE,
|
|
7
|
+
DEBUG_AND_RELEAES_BOTH_SET_MESSAGE,
|
|
8
|
+
NO_SOURCE_DIRECTORY_SPECIFIED_MESSAGE,
|
|
9
|
+
ENTRY_FILE_BUT_NO_BUNDLE_FILE_SPECIFIED_MESSAGE,
|
|
10
|
+
BUNDLE_FILE_BUT_NO_ENTRY_FILE_SPECIFIED_MESSAGE,
|
|
11
|
+
BOTH_LIB_AND_TEMP_DIRECTORIES_SPECIFIED_MESSAGE,
|
|
12
|
+
NEITHER_LIB_NOR_TEMP_DIRECTORY_SPECIFIED_MESSAGE,
|
|
13
|
+
ENTRY_FILE_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE,
|
|
14
|
+
BUNDLE_FILE_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE,
|
|
15
|
+
LIB_DIRECTORY_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE,
|
|
16
|
+
TEMP_DIRECTORY_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE,
|
|
17
|
+
SOURCE_DIRECTORY_PATH_NOT_RELATIVE_TO_CURRENT_DIRECTORY_MESSAGE } from "../messages";
|
|
18
|
+
|
|
19
|
+
export default function initialiseOperation(proceed, abort, context) {
|
|
20
20
|
const { wait,
|
|
21
21
|
node,
|
|
22
22
|
debug,
|
|
@@ -47,7 +47,7 @@ function initialiseOperation(proceed, abort, context) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
if (sourceDirectory === null) {
|
|
50
|
-
console.log(
|
|
50
|
+
console.log(NO_SOURCE_DIRECTORY_SPECIFIED_MESSAGE);
|
|
51
51
|
|
|
52
52
|
abort();
|
|
53
53
|
|
|
@@ -199,5 +199,3 @@ function initialiseOperation(proceed, abort, context) {
|
|
|
199
199
|
|
|
200
200
|
proceed();
|
|
201
201
|
}
|
|
202
|
-
|
|
203
|
-
module.exports = initialiseOperation;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import chokidar from "chokidar";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { ADD_EVENT, READY_EVENT } from "../events";
|
|
6
|
+
import { ENTRY_FILE_NOT_INCLUDED_IN_BUNDLED_FILES_MESSAGE } from "../messages";
|
|
7
|
+
import { pathWithoutDirectoryPathFromPathAndDirectoryPath } from "../utilities/path";
|
|
8
8
|
|
|
9
|
-
function retrieveFilePathsOperation(proceed, abort, context) {
|
|
9
|
+
export default function retrieveFilePathsOperation(proceed, abort, context) {
|
|
10
10
|
const { sourceDirectoryPath } = context,
|
|
11
11
|
globPattern = `${sourceDirectoryPath}/**/*.js`,
|
|
12
12
|
filePaths = [],
|
|
@@ -43,5 +43,3 @@ function retrieveFilePathsOperation(proceed, abort, context) {
|
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
module.exports = retrieveFilePathsOperation;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import TranspileFileWrapper from "../../wrapper/transpileFile";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { updateCountMetric } from "../../utilities/metrics";
|
|
6
6
|
|
|
7
|
-
function multipleProcessesTranspileFilesOperation(done, context) {
|
|
7
|
+
export default function multipleProcessesTranspileFilesOperation(done, context) {
|
|
8
8
|
const { filePaths, processesLength } = context,
|
|
9
9
|
filePathsLength = filePaths.length,
|
|
10
10
|
transpileFileWrappers = [],
|
|
@@ -53,5 +53,3 @@ function multipleProcessesTranspileFilesOperation(done, context) {
|
|
|
53
53
|
next();
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
module.exports = multipleProcessesTranspileFilesOperation;
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { asynchronousUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import transpileFile from "../../transpileFile";
|
|
6
6
|
|
|
7
7
|
const { updateCountMetric } = require("../../utilities/metrics");
|
|
8
8
|
|
|
9
9
|
const { forEach } = asynchronousUtilities;
|
|
10
10
|
|
|
11
|
-
function singleProcessTranspileFilesOperation(done, context) {
|
|
11
|
+
export default function singleProcessTranspileFilesOperation(done, context) {
|
|
12
12
|
const { filePaths } = context;
|
|
13
13
|
|
|
14
14
|
forEach(filePaths, transpileFileOperation, done, context);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
module.exports = singleProcessTranspileFilesOperation;
|
|
18
|
-
|
|
19
17
|
function transpileFileOperation(filePath, next, done, context) {
|
|
20
18
|
transpileFile(filePath, context, (success) => {
|
|
21
19
|
if (success) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import singleProcessTranspileFilesCallback from ".//transpileFiles/singleProcess";
|
|
4
|
+
import multipleProcessesTranspileFilesCallback from ".//transpileFiles/mutilpleProcesses";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { S, EMPTY_STRING } from "../constants";
|
|
7
|
+
import { startCountMetric, endCountMetric, startSecondsMetric, endSecondsMetric } from "../utilities/metrics";
|
|
8
8
|
|
|
9
|
-
function transpileFilesOperation(proceed, abort, context) {
|
|
9
|
+
export default function transpileFilesOperation(proceed, abort, context) {
|
|
10
10
|
const { metrics, processesLength } = context;
|
|
11
11
|
|
|
12
12
|
if (metrics) {
|
|
@@ -33,5 +33,3 @@ function transpileFilesOperation(proceed, abort, context) {
|
|
|
33
33
|
proceed();
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
module.exports = transpileFilesOperation;
|
package/src/options.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const HELP_OPTION = "help";
|
|
4
|
+
export const WAIT_OPTION = "wait";
|
|
5
|
+
export const NODE_OPTION = "node";
|
|
6
|
+
export const DEBUG_OPTION = "debug";
|
|
7
|
+
export const BUNDLER_OPTION = "bundler";
|
|
8
|
+
export const QUIETLY_OPTION = "quietly";
|
|
9
|
+
export const VERSION_OPTION = "version";
|
|
10
|
+
export const METRICS_OPTION = "metrics";
|
|
11
|
+
export const PROCESSES_OPTION = "processes";
|
|
12
|
+
export const TRANSPILER_OPTION = "transpiler";
|
|
13
|
+
export const ENTRY_FILE_OPTION = "entry-file";
|
|
14
|
+
export const BUNDLE_FILE_OPTION = "bundle-file";
|
|
15
|
+
export const LIB_DIRECTORY_OPTION = "lib-directory";
|
|
16
|
+
export const TEMP_DIRECTORY_OPTION = "temp-directory";
|
|
17
|
+
export const SOURCE_DIRECTORY_OPTION = "source-directory";
|
package/src/paths.js
ADDED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import transpileFile from "../transpileFile";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
import { MESSAGE } from "../constants";
|
|
8
|
+
import { createTranspileFileFunction } from "../utilities/transpile";
|
|
9
9
|
|
|
10
10
|
const { third } = arrayUtilities;
|
|
11
11
|
|
package/{bin → src}/queue.js
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
const { first } = arrayUtilities;
|
|
6
6
|
|
|
7
|
-
class Queue {
|
|
7
|
+
export default class Queue {
|
|
8
8
|
constructor(tasks, emptyHandler) {
|
|
9
9
|
this.tasks = tasks;
|
|
10
10
|
this.emptyHandler = emptyHandler;
|
|
@@ -65,5 +65,3 @@ class Queue {
|
|
|
65
65
|
return queue;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
module.exports = Queue;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import Task from "../task";
|
|
4
|
+
import bundleFiles from "../bundleFiles";
|
|
5
5
|
|
|
6
|
-
class BundleFilesTask extends Task {
|
|
6
|
+
export default class BundleFilesTask extends Task {
|
|
7
7
|
static fromContext(context) {
|
|
8
8
|
let bundleFilesTask = null;
|
|
9
9
|
|
|
@@ -18,5 +18,3 @@ class BundleFilesTask extends Task {
|
|
|
18
18
|
return bundleFilesTask;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
module.exports = BundleFilesTask;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import Task from "../task";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { deleteDirectory, checkDirectoryExists } from "../utilities/fileSystem";
|
|
6
|
+
import { combinePaths, pathWithoutDirectoryPathFromPathAndDirectoryPath } from "../utilities/path";
|
|
7
7
|
|
|
8
|
-
class DeleteDirectoryTask extends Task {
|
|
8
|
+
export default class DeleteDirectoryTask extends Task {
|
|
9
9
|
static fromPath(path, context) {
|
|
10
10
|
let deleteDirectoryTask = null;
|
|
11
11
|
|
|
@@ -28,5 +28,3 @@ class DeleteDirectoryTask extends Task {
|
|
|
28
28
|
return deleteDirectoryTask;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
module.exports = DeleteDirectoryTask;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import Task from "../task";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { deleteFile, checkFileExists } from "../utilities/fileSystem";
|
|
6
|
+
import { combinePaths, pathWithoutDirectoryPathFromPathAndDirectoryPath } from "../utilities/path";
|
|
7
7
|
|
|
8
|
-
class DeleteFileTask extends Task {
|
|
8
|
+
export default class DeleteFileTask extends Task {
|
|
9
9
|
static fromPath(path, context) {
|
|
10
10
|
let deleteFileTask = null;
|
|
11
11
|
|
|
@@ -28,5 +28,3 @@ class DeleteFileTask extends Task {
|
|
|
28
28
|
return deleteFileTask;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
module.exports = DeleteFileTask;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import Task from "../task";
|
|
4
|
+
import transpileFile from '../transpileFile';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { updateCountMetric } from "../utilities/metrics";
|
|
7
|
+
import { pathWithoutDirectoryPathFromPathAndDirectoryPath } from "../utilities/path";
|
|
8
8
|
|
|
9
|
-
class TranspileFileTask extends Task {
|
|
9
|
+
export default class TranspileFileTask extends Task {
|
|
10
10
|
static fromPath(path, context) {
|
|
11
11
|
let transpileFileTask = null;
|
|
12
12
|
|
|
@@ -27,5 +27,3 @@ class TranspileFileTask extends Task {
|
|
|
27
27
|
return transpileFileTask;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
module.exports = TranspileFileTask;
|
package/{bin → src}/task.js
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
class Task {
|
|
3
|
+
export default class Task {
|
|
4
4
|
constructor(method, ...remainingArguments) {
|
|
5
5
|
const callback = remainingArguments.pop(); ///
|
|
6
6
|
|
|
@@ -28,5 +28,3 @@ class Task {
|
|
|
28
28
|
method.call(this, ...remainingArguments, callback);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
module.exports = Task;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { combinePaths } from "./utilities/path";
|
|
4
4
|
|
|
5
|
-
function transpileFile(filePath, context, callback) {
|
|
5
|
+
export default function transpileFile(filePath, context, callback) {
|
|
6
6
|
const { transpileFileFunction, sourceDirectoryPath, targetDirectoryPath } = context;
|
|
7
7
|
|
|
8
8
|
transpileFileFunction(filePath, sourceDirectoryPath, targetDirectoryPath, (success) => {
|
|
@@ -17,5 +17,3 @@ function transpileFile(filePath, context, callback) {
|
|
|
17
17
|
callback(success);
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
module.exports = transpileFile;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function createBundleFilesFunction(context) {
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
import { combinePaths } from "../utilities/path";
|
|
6
|
+
import { NODE, INLINE, BROWSERIFY } from "../constants";
|
|
7
|
+
import { ESBUILD_PATH, BROWSERIFY_PATH } from "../paths";
|
|
8
|
+
import { writeFileEx, createParentDirectory } from "../utilities/fileSystem";
|
|
9
|
+
import { ESBUILD_FAILED_MESSAGE,
|
|
10
|
+
BROWSERIFY_FAILED_MESSAGE,
|
|
11
|
+
ESBUILD_NOT_INSTALLED_MESSAGE,
|
|
12
|
+
BROWSERIFY_NOT_INSTALLED_MESSAGE } from "../messages";
|
|
13
|
+
|
|
14
|
+
export function createBundleFilesFunction(context) {
|
|
15
15
|
const { bundler } = context,
|
|
16
16
|
bundleFilesFunction = (bundler === BROWSERIFY) ?
|
|
17
17
|
createBrowserifyBundleFilesFunction(context) :
|
|
@@ -20,10 +20,6 @@ function createBundleFilesFunction(context) {
|
|
|
20
20
|
return bundleFilesFunction;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
module.exports = {
|
|
24
|
-
createBundleFilesFunction
|
|
25
|
-
};
|
|
26
|
-
|
|
27
23
|
function createEsbuildBundleFilesFunction(context) {
|
|
28
24
|
let esBuildBundleFilesFunction = null;
|
|
29
25
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { asynchronousUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
const { whilst } = asynchronousUtilities;
|
|
6
6
|
|
|
7
|
-
function executeOperations(operations, callback, context) {
|
|
7
|
+
export function executeOperations(operations, callback, context) {
|
|
8
8
|
const completed = true;
|
|
9
9
|
|
|
10
10
|
Object.assign(context, {
|
|
@@ -23,10 +23,6 @@ function executeOperations(operations, callback, context) {
|
|
|
23
23
|
}, context);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
module.exports = {
|
|
27
|
-
executeOperations
|
|
28
|
-
};
|
|
29
|
-
|
|
30
26
|
function executeOperation(next, done, context, index) {
|
|
31
27
|
const { operations } = context,
|
|
32
28
|
operationsLength = operations.length,
|