@modern-js/utils 2.22.0 → 2.22.1-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/FileSizeReporter.d.ts +16 -0
- package/dist/FileSizeReporter.js +162 -0
- package/dist/alias.d.ts +25 -0
- package/dist/alias.js +108 -0
- package/dist/analyzeProject.d.ts +2 -0
- package/dist/analyzeProject.js +71 -0
- package/dist/applyOptionsChain.d.ts +3 -0
- package/dist/applyOptionsChain.js +58 -0
- package/dist/babel.d.ts +3 -0
- package/dist/babel.js +136 -0
- package/dist/chainId.d.ts +244 -0
- package/dist/chainId.js +196 -0
- package/dist/clearConsole.d.ts +1 -0
- package/dist/clearConsole.js +31 -0
- package/dist/commands.d.ts +4 -0
- package/dist/commands.js +48 -0
- package/dist/compatRequire.d.ts +13 -0
- package/dist/compatRequire.js +82 -0
- package/dist/compiled.d.ts +43 -0
- package/dist/compiled.js +142 -0
- package/dist/constants.d.ts +244 -0
- package/dist/constants.js +320 -0
- package/dist/debug.d.ts +6 -0
- package/dist/debug.js +28 -0
- package/dist/emptyDir.d.ts +1 -0
- package/dist/emptyDir.js +52 -0
- package/dist/ensureAbsolutePath.d.ts +7 -0
- package/dist/ensureAbsolutePath.js +38 -0
- package/dist/ensureArray.d.ts +1 -0
- package/dist/ensureArray.js +32 -0
- package/dist/findExists.d.ts +6 -0
- package/dist/findExists.js +45 -0
- package/dist/generateMetaTags.d.ts +16 -0
- package/dist/generateMetaTags.js +61 -0
- package/dist/getBrowserslist.d.ts +2 -0
- package/dist/getBrowserslist.js +31 -0
- package/dist/getCoreJsVersion.d.ts +1 -0
- package/dist/getCoreJsVersion.js +46 -0
- package/dist/getEntryOptions.d.ts +1 -0
- package/dist/getEntryOptions.js +54 -0
- package/dist/getPackageManager.d.ts +1 -0
- package/dist/getPackageManager.js +87 -0
- package/dist/getPort.d.ts +14 -0
- package/dist/getPort.js +112 -0
- package/dist/getServerConfig.d.ts +1 -0
- package/dist/getServerConfig.js +67 -0
- package/dist/getTargetDir.d.ts +1 -0
- package/dist/getTargetDir.js +41 -0
- package/dist/import.d.ts +5 -0
- package/dist/import.js +33 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +60 -0
- package/dist/is/index.d.ts +58 -0
- package/dist/is/index.js +114 -0
- package/dist/is/nodeEnv.d.ts +8 -0
- package/dist/is/nodeEnv.js +39 -0
- package/dist/is/platform.d.ts +2 -0
- package/dist/is/platform.js +30 -0
- package/dist/is/type.d.ts +8 -0
- package/dist/is/type.js +64 -0
- package/dist/logger.d.ts +65 -0
- package/dist/logger.js +145 -0
- package/dist/monorepo.d.ts +11 -0
- package/dist/monorepo.js +137 -0
- package/dist/nodeEnv.d.ts +3 -0
- package/dist/nodeEnv.js +81 -0
- package/dist/path.d.ts +18 -0
- package/dist/path.js +92 -0
- package/dist/pathSerializer.d.ts +16 -0
- package/dist/pathSerializer.js +76 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +46 -0
- package/dist/prettyInstructions.d.ts +9 -0
- package/dist/prettyInstructions.js +112 -0
- package/dist/printBuildError.d.ts +8 -0
- package/dist/printBuildError.js +57 -0
- package/dist/react.d.ts +1 -0
- package/dist/react.js +64 -0
- package/dist/readTsConfig.d.ts +2 -0
- package/dist/readTsConfig.js +47 -0
- package/dist/removeSlash.d.ts +3 -0
- package/dist/removeSlash.js +33 -0
- package/dist/resolve.d.ts +13 -0
- package/dist/resolve.js +63 -0
- package/dist/routes.d.ts +2 -0
- package/dist/routes.js +58 -0
- package/dist/runtimeExports.d.ts +4 -0
- package/dist/runtimeExports.js +73 -0
- package/dist/ssr.d.ts +8 -0
- package/dist/ssr.js +30 -0
- package/dist/storage.d.ts +5 -0
- package/dist/storage.js +75 -0
- package/dist/testUtils.d.ts +5 -0
- package/dist/testUtils.js +38 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +15 -0
- package/dist/universal/constants.d.ts +9 -0
- package/dist/universal/constants.js +30 -0
- package/dist/universal/formatWebpack.d.ts +13 -0
- package/dist/universal/formatWebpack.js +100 -0
- package/dist/universal/nestedRoutes.d.ts +8 -0
- package/dist/universal/nestedRoutes.js +131 -0
- package/dist/universal/remixRouter.d.ts +1 -0
- package/dist/universal/remixRouter.js +17 -0
- package/dist/universal/serialize.d.ts +1 -0
- package/dist/universal/serialize.js +40 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +92 -0
- package/dist/wait.d.ts +2 -0
- package/dist/wait.js +29 -0
- package/dist/watch.d.ts +8 -0
- package/dist/watch.js +90 -0
- package/package.json +3 -3
package/dist/watch.js
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all)
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
+
}
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
+
mod
|
26
|
+
));
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
+
var __async = (__this, __arguments, generator) => {
|
29
|
+
return new Promise((resolve, reject) => {
|
30
|
+
var fulfilled = (value) => {
|
31
|
+
try {
|
32
|
+
step(generator.next(value));
|
33
|
+
} catch (e) {
|
34
|
+
reject(e);
|
35
|
+
}
|
36
|
+
};
|
37
|
+
var rejected = (value) => {
|
38
|
+
try {
|
39
|
+
step(generator.throw(value));
|
40
|
+
} catch (e) {
|
41
|
+
reject(e);
|
42
|
+
}
|
43
|
+
};
|
44
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
45
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
46
|
+
});
|
47
|
+
};
|
48
|
+
var watch_exports = {};
|
49
|
+
__export(watch_exports, {
|
50
|
+
WatchChangeType: () => WatchChangeType,
|
51
|
+
watch: () => watch
|
52
|
+
});
|
53
|
+
module.exports = __toCommonJS(watch_exports);
|
54
|
+
var path = __toESM(require("path"));
|
55
|
+
var import_compiled = require("./compiled");
|
56
|
+
const WatchChangeType = {
|
57
|
+
ADD: "add",
|
58
|
+
UNLINK: "unlink",
|
59
|
+
CHANGE: "change"
|
60
|
+
};
|
61
|
+
const watch = (watchDir, runTask, ignored = []) => {
|
62
|
+
let ready = false;
|
63
|
+
const watcher = import_compiled.chokidar.watch(watchDir, {
|
64
|
+
ignored
|
65
|
+
});
|
66
|
+
watcher.on("ready", () => ready = true);
|
67
|
+
watcher.on("change", (filePath) => __async(void 0, null, function* () {
|
68
|
+
const changedFilePath = path.resolve(filePath);
|
69
|
+
yield runTask({ changedFilePath, changeType: WatchChangeType.CHANGE });
|
70
|
+
}));
|
71
|
+
watcher.on("add", (filePath) => __async(void 0, null, function* () {
|
72
|
+
const changedFilePath = path.resolve(filePath);
|
73
|
+
if (ready) {
|
74
|
+
yield runTask({ changedFilePath, changeType: WatchChangeType.ADD });
|
75
|
+
}
|
76
|
+
}));
|
77
|
+
watcher.on("unlink", (filePath) => __async(void 0, null, function* () {
|
78
|
+
const changedFilePath = path.resolve(filePath);
|
79
|
+
yield runTask({ changedFilePath, changeType: WatchChangeType.UNLINK });
|
80
|
+
}));
|
81
|
+
watcher.on("error", (err) => {
|
82
|
+
throw err;
|
83
|
+
});
|
84
|
+
return watcher;
|
85
|
+
};
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
87
|
+
0 && (module.exports = {
|
88
|
+
WatchChangeType,
|
89
|
+
watch
|
90
|
+
});
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.22.0",
|
18
|
+
"version": "2.22.1-alpha.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -232,8 +232,8 @@
|
|
232
232
|
"webpack": "^5.82.1",
|
233
233
|
"@types/serialize-javascript": "^5.0.1",
|
234
234
|
"@modern-js/types": "2.22.0",
|
235
|
-
"@scripts/
|
236
|
-
"@scripts/
|
235
|
+
"@scripts/build": "2.22.0",
|
236
|
+
"@scripts/jest-config": "2.22.0"
|
237
237
|
},
|
238
238
|
"sideEffects": false,
|
239
239
|
"scripts": {
|