@modern-js/utils 1.5.0 → 1.7.1-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +28 -0
- package/compiled/address/index.js +1 -0
- package/compiled/address/lib/address.d.ts +28 -0
- package/compiled/address/package.json +1 -0
- package/compiled/browserslist/index.js +1 -1
- package/compiled/dotenv/index.js +1 -0
- package/compiled/dotenv/license +23 -0
- package/compiled/dotenv/package.json +1 -0
- package/compiled/dotenv/types/index.d.ts +59 -0
- package/compiled/dotenv-expand/index.d.ts +15 -0
- package/compiled/dotenv-expand/index.js +1 -0
- package/compiled/dotenv-expand/license +24 -0
- package/compiled/dotenv-expand/package.json +1 -0
- package/compiled/fast-glob/@nodelib/fs.scandir/out/adapters/fs.d.ts +20 -0
- package/compiled/fast-glob/@nodelib/fs.scandir/out/index.d.ts +12 -0
- package/compiled/fast-glob/@nodelib/fs.scandir/out/providers/async.d.ts +7 -0
- package/compiled/fast-glob/@nodelib/fs.scandir/out/settings.d.ts +20 -0
- package/compiled/fast-glob/@nodelib/fs.scandir/out/types/index.d.ts +20 -0
- package/compiled/fast-glob/@nodelib/fs.stat/out/adapters/fs.d.ts +13 -0
- package/compiled/fast-glob/@nodelib/fs.stat/out/index.d.ts +12 -0
- package/compiled/fast-glob/@nodelib/fs.stat/out/providers/async.d.ts +4 -0
- package/compiled/fast-glob/@nodelib/fs.stat/out/settings.d.ts +16 -0
- package/compiled/fast-glob/@nodelib/fs.stat/out/types/index.d.ts +4 -0
- package/compiled/fast-glob/@nodelib/fs.walk/out/index.d.ts +14 -0
- package/compiled/fast-glob/@nodelib/fs.walk/out/providers/async.d.ts +12 -0
- package/compiled/fast-glob/@nodelib/fs.walk/out/readers/async.d.ts +30 -0
- package/compiled/fast-glob/@nodelib/fs.walk/out/readers/reader.d.ts +6 -0
- package/compiled/fast-glob/@nodelib/fs.walk/out/settings.d.ts +30 -0
- package/compiled/fast-glob/@nodelib/fs.walk/out/types/index.d.ts +8 -0
- package/compiled/fast-glob/index.js +37 -0
- package/compiled/fast-glob/license +21 -0
- package/compiled/fast-glob/out/index.d.ts +27 -0
- package/compiled/fast-glob/out/managers/tasks.d.ts +22 -0
- package/compiled/fast-glob/out/settings.d.ts +164 -0
- package/compiled/fast-glob/out/types/index.d.ts +31 -0
- package/compiled/fast-glob/package.json +1 -0
- package/compiled/globby/index.d.ts +186 -0
- package/compiled/globby/index.js +1 -0
- package/compiled/globby/license +9 -0
- package/compiled/globby/package.json +1 -0
- package/compiled/inquirer/index.d.ts +997 -0
- package/compiled/inquirer/index.js +9 -0
- package/compiled/inquirer/lib/objects/choice.d.ts +65 -0
- package/compiled/inquirer/lib/objects/choices.d.ts +206 -0
- package/compiled/inquirer/lib/objects/separator.d.ts +37 -0
- package/compiled/inquirer/lib/ui/baseUI.d.ts +37 -0
- package/compiled/inquirer/lib/ui/bottom-bar.d.ts +65 -0
- package/compiled/inquirer/lib/ui/prompt.d.ts +104 -0
- package/compiled/inquirer/license +22 -0
- package/compiled/inquirer/package.json +1 -0
- package/compiled/inquirer/through/index.d.ts +25 -0
- package/compiled/json5/index.js +1 -0
- package/compiled/json5/lib/index.d.ts +4 -0
- package/compiled/json5/lib/parse.d.ts +15 -0
- package/compiled/json5/lib/stringify.d.ts +89 -0
- package/compiled/json5/package.json +1 -0
- package/compiled/lodash/index.js +4 -8
- package/compiled/mime-types/index.d.ts +14 -0
- package/compiled/mime-types/index.js +14 -0
- package/compiled/mime-types/license +23 -0
- package/compiled/mime-types/package.json +1 -0
- package/compiled/minimist/index.d.ts +95 -0
- package/compiled/minimist/index.js +1 -0
- package/compiled/minimist/license +18 -0
- package/compiled/minimist/package.json +1 -0
- package/compiled/ora/cli-spinners/index.d.ts +125 -0
- package/compiled/ora/index.d.ts +277 -0
- package/compiled/ora/index.js +3 -0
- package/compiled/ora/license +9 -0
- package/compiled/ora/package.json +1 -0
- package/compiled/semver/classes/comparator.d.ts +17 -0
- package/compiled/semver/classes/range.d.ts +21 -0
- package/compiled/semver/classes/semver.d.ts +62 -0
- package/compiled/semver/functions/clean.d.ts +8 -0
- package/compiled/semver/functions/cmp.d.ts +16 -0
- package/compiled/semver/functions/coerce.d.ts +12 -0
- package/compiled/semver/functions/compare-build.d.ts +16 -0
- package/compiled/semver/functions/compare-loose.d.ts +5 -0
- package/compiled/semver/functions/compare.d.ts +20 -0
- package/compiled/semver/functions/diff.d.ts +13 -0
- package/compiled/semver/functions/eq.d.ts +9 -0
- package/compiled/semver/functions/gt.d.ts +9 -0
- package/compiled/semver/functions/gte.d.ts +9 -0
- package/compiled/semver/functions/inc.d.ts +15 -0
- package/compiled/semver/functions/lt.d.ts +9 -0
- package/compiled/semver/functions/lte.d.ts +8 -0
- package/compiled/semver/functions/major.d.ts +9 -0
- package/compiled/semver/functions/minor.d.ts +9 -0
- package/compiled/semver/functions/neq.d.ts +9 -0
- package/compiled/semver/functions/parse.d.ts +12 -0
- package/compiled/semver/functions/patch.d.ts +9 -0
- package/compiled/semver/functions/prerelease.d.ts +12 -0
- package/compiled/semver/functions/rcompare.d.ts +15 -0
- package/compiled/semver/functions/rsort.d.ts +9 -0
- package/compiled/semver/functions/satisfies.d.ts +14 -0
- package/compiled/semver/functions/sort.d.ts +9 -0
- package/compiled/semver/functions/valid.d.ts +11 -0
- package/compiled/semver/index.d.ts +133 -0
- package/compiled/semver/index.js +1 -0
- package/compiled/semver/internals/identifiers.d.ts +13 -0
- package/compiled/semver/license +15 -0
- package/compiled/semver/package.json +1 -0
- package/compiled/semver/ranges/gtr.d.ts +14 -0
- package/compiled/semver/ranges/intersects.d.ts +13 -0
- package/compiled/semver/ranges/ltr.d.ts +14 -0
- package/compiled/semver/ranges/max-satisfying.d.ts +14 -0
- package/compiled/semver/ranges/min-satisfying.d.ts +14 -0
- package/compiled/semver/ranges/min-version.d.ts +10 -0
- package/compiled/semver/ranges/outside.d.ts +15 -0
- package/compiled/semver/ranges/simplify.d.ts +14 -0
- package/compiled/semver/ranges/subset.d.ts +13 -0
- package/compiled/semver/ranges/to-comparators.d.ts +9 -0
- package/compiled/semver/ranges/valid.d.ts +12 -0
- package/compiled/slash/index.d.ts +25 -0
- package/compiled/slash/index.js +1 -0
- package/compiled/slash/license +9 -0
- package/compiled/slash/package.json +1 -0
- package/compiled/url-join/index.d.ts +17 -0
- package/compiled/url-join/index.js +1 -0
- package/compiled/url-join/license +21 -0
- package/compiled/url-join/package.json +1 -0
- package/dist/alias.js +4 -1
- package/dist/analyzeProject.js +4 -17
- package/dist/compiled.d.ts +34 -17
- package/dist/compiled.js +59 -21
- package/dist/emptyDir.js +4 -13
- package/dist/ensureAbsolutePath.d.ts +1 -1
- package/dist/ensureAbsolutePath.js +1 -1
- package/dist/findExists.d.ts +1 -1
- package/dist/findExists.js +1 -1
- package/dist/format.js +11 -6
- package/dist/getEntryOptions.js +2 -1
- package/dist/getPackageManager.js +19 -30
- package/dist/getPort.js +3 -12
- package/dist/getServerConfig.js +2 -11
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/logger.d.ts +3 -0
- package/dist/logger.js +21 -6
- package/dist/monorepo.js +9 -6
- package/dist/nodeEnv.js +24 -39
- package/dist/prettyInstructions.js +1 -1
- package/dist/readTsConfig.js +2 -2
- package/dist/runtimeExports.js +1 -1
- package/dist/{ssrHelpers.d.ts → ssr.d.ts} +3 -0
- package/dist/{ssrHelpers.js → ssr.js} +0 -0
- package/dist/watch.js +9 -18
- package/package.json +33 -50
- package/tsconfig.json +1 -0
- package/dist/getCacheIdentifier.d.ts +0 -7
- package/dist/getCacheIdentifier.js +0 -24
- package/modern.config.js +0 -6
@@ -57,7 +57,7 @@ const prettyInstructions = (appContext, config) => {
|
|
57
57
|
});
|
58
58
|
message += '\n';
|
59
59
|
message += compiled_1.chalk.cyanBright(' λ (Server) server-side renders at runtime\n');
|
60
|
-
message += compiled_1.chalk.cyanBright(' ○ (Static) client-side
|
60
|
+
message += compiled_1.chalk.cyanBright(' ○ (Static) client-side renders as static HTML\n');
|
61
61
|
}
|
62
62
|
return message;
|
63
63
|
};
|
package/dist/readTsConfig.js
CHANGED
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.readTsConfigByFile = exports.readTsConfig = void 0;
|
7
7
|
const path_1 = __importDefault(require("path"));
|
8
8
|
const readTsConfig = (root) => {
|
9
|
-
// import typescript from 'typescript' cause eslint
|
9
|
+
// import typescript from 'typescript' cause eslint format error.
|
10
10
|
const typescript = require('typescript');
|
11
11
|
return typescript.readConfigFile(path_1.default.resolve(root, './tsconfig.json'), typescript.sys.readFile).config;
|
12
12
|
};
|
13
13
|
exports.readTsConfig = readTsConfig;
|
14
14
|
const readTsConfigByFile = (filename) => {
|
15
|
-
// import typescript from 'typescript' cause eslint
|
15
|
+
// import typescript from 'typescript' cause eslint format error.
|
16
16
|
const typescript = require('typescript');
|
17
17
|
return typescript.readConfigFile(path_1.default.resolve(filename), typescript.sys.readFile).config;
|
18
18
|
};
|
package/dist/runtimeExports.js
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
+
/**
|
3
|
+
* ssr helpers
|
4
|
+
*/
|
2
5
|
import type { IncomingHttpHeaders } from 'http';
|
3
6
|
declare const run: <O>(context: IncomingHttpHeaders, cb: () => O | Promise<O>) => Promise<O>, useHeaders: () => IncomingHttpHeaders;
|
4
7
|
export { run, useHeaders };
|
File without changes
|
package/dist/watch.js
CHANGED
@@ -18,15 +18,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
18
18
|
__setModuleDefault(result, mod);
|
19
19
|
return result;
|
20
20
|
};
|
21
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
22
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
23
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
24
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
25
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
26
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
27
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
28
|
-
});
|
29
|
-
};
|
30
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
31
22
|
exports.watch = exports.WatchChangeType = void 0;
|
32
23
|
const path = __importStar(require("path"));
|
@@ -42,20 +33,20 @@ const watch = (watchDir, runTask, ignored = []) => {
|
|
42
33
|
ignored,
|
43
34
|
});
|
44
35
|
watcher.on('ready', () => (ready = true));
|
45
|
-
watcher.on('change', (filePath) =>
|
36
|
+
watcher.on('change', async (filePath) => {
|
46
37
|
const changedFilePath = path.resolve(filePath);
|
47
|
-
|
48
|
-
})
|
49
|
-
watcher.on('add', (filePath) =>
|
38
|
+
await runTask({ changedFilePath, changeType: exports.WatchChangeType.CHANGE });
|
39
|
+
});
|
40
|
+
watcher.on('add', async (filePath) => {
|
50
41
|
const changedFilePath = path.resolve(filePath);
|
51
42
|
if (ready) {
|
52
|
-
|
43
|
+
await runTask({ changedFilePath, changeType: exports.WatchChangeType.ADD });
|
53
44
|
}
|
54
|
-
})
|
55
|
-
watcher.on('unlink', (filePath) =>
|
45
|
+
});
|
46
|
+
watcher.on('unlink', async (filePath) => {
|
56
47
|
const changedFilePath = path.resolve(filePath);
|
57
|
-
|
58
|
-
})
|
48
|
+
await runTask({ changedFilePath, changeType: exports.WatchChangeType.UNLINK });
|
49
|
+
});
|
59
50
|
watcher.on('error', err => {
|
60
51
|
throw err;
|
61
52
|
});
|
package/package.json
CHANGED
@@ -11,33 +11,18 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "1.
|
14
|
+
"version": "1.7.1-alpha.0",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/index.d.ts",
|
17
17
|
"main": "./dist/index.js",
|
18
18
|
"module": "./dist/index.js",
|
19
19
|
"jsnext:modern": "./dist/index.js",
|
20
|
+
"_comment": "Provide ESM and CJS exports, ESM is used by runtime package, for treeshaking",
|
20
21
|
"exports": {
|
21
|
-
".":
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
"./format": {
|
26
|
-
"jsnext:source": "./src/format.ts",
|
27
|
-
"default": "./dist/format.js"
|
28
|
-
},
|
29
|
-
"./constants": {
|
30
|
-
"jsnext:source": "./src/constants.ts",
|
31
|
-
"default": "./dist/constants.js"
|
32
|
-
},
|
33
|
-
"./lodash": {
|
34
|
-
"jsnext:source": "./compiled/lodash/index.js",
|
35
|
-
"default": "./compiled/lodash/index.js"
|
36
|
-
},
|
37
|
-
"./strip-ansi": {
|
38
|
-
"jsnext:source": "./compiled/strip-ansi/index.js",
|
39
|
-
"default": "./compiled/strip-ansi/index.js"
|
40
|
-
}
|
22
|
+
".": "./dist/index.js",
|
23
|
+
"./format": "./dist/format.js",
|
24
|
+
"./constants": "./dist/constants.js",
|
25
|
+
"./ssr": "./dist/ssr.js"
|
41
26
|
},
|
42
27
|
"typesVersions": {
|
43
28
|
"*": {
|
@@ -47,52 +32,50 @@
|
|
47
32
|
"constants": [
|
48
33
|
"./dist/constants.d.ts"
|
49
34
|
],
|
35
|
+
"ssr": [
|
36
|
+
"./dist/ssr.d.ts"
|
37
|
+
],
|
38
|
+
"chalk": [
|
39
|
+
"./compiled/chalk/index.d.ts"
|
40
|
+
],
|
41
|
+
"json5": [
|
42
|
+
"./compiled/json5/index.d.ts"
|
43
|
+
],
|
44
|
+
"semver": [
|
45
|
+
"./compiled/semver/index.d.ts"
|
46
|
+
],
|
50
47
|
"lodash": [
|
51
48
|
"./compiled/lodash/index.d.ts"
|
52
49
|
],
|
50
|
+
"globby": [
|
51
|
+
"./compiled/globby/index.d.ts"
|
52
|
+
],
|
53
|
+
"fast-glob": [
|
54
|
+
"./compiled/fast-glob/index.d.ts"
|
55
|
+
],
|
56
|
+
"gzip-size": [
|
57
|
+
"./compiled/gzip-size/index.d.ts"
|
58
|
+
],
|
59
|
+
"mime-types": [
|
60
|
+
"./compiled/mime-types/index.d.ts"
|
61
|
+
],
|
53
62
|
"strip-ansi": [
|
54
63
|
"./compiled/strip-ansi/index.d.ts"
|
55
64
|
]
|
56
65
|
}
|
57
66
|
},
|
58
67
|
"dependencies": {
|
59
|
-
"
|
60
|
-
"
|
68
|
+
"caniuse-lite": "^1.0.30001332",
|
69
|
+
"lodash": "^4.17.21",
|
61
70
|
"typescript": "^4"
|
62
71
|
},
|
63
72
|
"devDependencies": {
|
64
|
-
"@modern-js/types": "
|
73
|
+
"@modern-js/types": "1.5.2",
|
65
74
|
"@scripts/build": "0.0.0",
|
66
75
|
"@scripts/jest-config": "0.0.0",
|
67
|
-
"@types/debug": "4.1.7",
|
68
|
-
"@types/fs-extra": "9.0.13",
|
69
|
-
"@types/glob": "^7.1.4",
|
70
76
|
"@types/jest": "^26",
|
71
|
-
"@types/js-yaml": "4.0.5",
|
72
|
-
"@types/lodash": "4.14.181",
|
73
|
-
"@types/minimist": "^1.2.2",
|
74
77
|
"@types/node": "^14",
|
75
|
-
"@types/recursive-readdir": "2.2.0",
|
76
|
-
"@types/signale": "1.4.4",
|
77
|
-
"browserslist": "4.20.2",
|
78
|
-
"chalk": "4.1.2",
|
79
|
-
"chokidar": "3.5.3",
|
80
|
-
"commander": "8.3.0",
|
81
|
-
"debug": "4.3.4",
|
82
|
-
"execa": "5.1.1",
|
83
|
-
"filesize": "8.0.7",
|
84
|
-
"fs-extra": "10.0.1",
|
85
|
-
"glob": "7.2.0",
|
86
|
-
"gzip-size": "6.0.0",
|
87
|
-
"import-lazy": "4.0.0",
|
88
78
|
"jest": "^27",
|
89
|
-
"js-yaml": "4.1.0",
|
90
|
-
"lodash": "4.17.21",
|
91
|
-
"pkg-up": "3.1.0",
|
92
|
-
"recursive-readdir": "2.2.2",
|
93
|
-
"signale": "1.4.0",
|
94
|
-
"strip-ansi": "6.0.1",
|
95
|
-
"upath": "2.0.1",
|
96
79
|
"webpack": "^5.71.0"
|
97
80
|
},
|
98
81
|
"sideEffects": false,
|
package/tsconfig.json
CHANGED
@@ -1,24 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getCacheIdentifier = void 0;
|
4
|
-
const is_1 = require("./is");
|
5
|
-
/**
|
6
|
-
* Generate cache identifier from some packages and config files.
|
7
|
-
*/
|
8
|
-
function getCacheIdentifier(packages, _files) {
|
9
|
-
/* eslint-disable no-nested-ternary */
|
10
|
-
let cacheIdentifier = (0, is_1.isProd)()
|
11
|
-
? 'production'
|
12
|
-
: (0, is_1.isDev)()
|
13
|
-
? 'development'
|
14
|
-
: (0, is_1.isTest)()
|
15
|
-
? 'test'
|
16
|
-
: '';
|
17
|
-
/* eslint-enable no-nested-ternary */
|
18
|
-
for (const { name, version } of packages) {
|
19
|
-
cacheIdentifier += `:${name}@${version}`;
|
20
|
-
}
|
21
|
-
// TODO: config file hash
|
22
|
-
return cacheIdentifier;
|
23
|
-
}
|
24
|
-
exports.getCacheIdentifier = getCacheIdentifier;
|