@modern-js/utils 1.7.8 → 1.7.10
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -0
- package/dist/analyzeProject.js +5 -1
- package/dist/compiled.d.ts +1 -0
- package/dist/generateMetaTags.d.ts +1 -1
- package/dist/getEntryOptions.d.ts +1 -1
- package/dist/getServerConfig.js +5 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -1
- package/dist/is/index.js +5 -1
- package/dist/storage.js +5 -1
- package/dist/tryResolve.d.ts +11 -0
- package/dist/tryResolve.js +38 -0
- package/dist/watch.js +5 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# @modern-js/utils
|
2
2
|
|
3
|
+
## 1.7.10
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- b82869d: export ExecaError type
|
8
|
+
|
9
|
+
## 1.7.9
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- a90bc96: perf(babel): skip babel-plugin-import if package not installed
|
14
|
+
|
3
15
|
## 1.7.8
|
4
16
|
|
5
17
|
### Patch Changes
|
package/dist/analyzeProject.js
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
3
|
if (k2 === undefined) k2 = k;
|
4
|
-
Object.
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
5
9
|
}) : (function(o, m, k, k2) {
|
6
10
|
if (k2 === undefined) k2 = k;
|
7
11
|
o[k2] = m[k];
|
package/dist/compiled.d.ts
CHANGED
@@ -31,6 +31,7 @@ export type { SignaleOptions } from '../compiled/signale';
|
|
31
31
|
export type { IOptions as GlobOptions } from '../compiled/glob';
|
32
32
|
export type { GlobbyOptions } from '../compiled/globby';
|
33
33
|
export type { FSWatcher, WatchOptions } from '../compiled/chokidar';
|
34
|
+
export type { ExecaError } from '../compiled/execa';
|
34
35
|
/**
|
35
36
|
* Lazy import some expensive modules that will slow down startup speed.
|
36
37
|
* Notice that `csmith-tools build` can not bundle lazy imported modules.
|
@@ -13,4 +13,4 @@ export declare type MetaAttributes = {
|
|
13
13
|
export interface MetaOptions {
|
14
14
|
[name: string]: string | false | MetaAttributes;
|
15
15
|
}
|
16
|
-
export declare const generateMetaTags: (metaOptions?: MetaOptions
|
16
|
+
export declare const generateMetaTags: (metaOptions?: MetaOptions) => string;
|
@@ -1 +1 @@
|
|
1
|
-
export declare const getEntryOptions: <T>(name: string, baseOptions?: T | undefined, optionsByEntries?: Record<string, T> | undefined, packageName?: string
|
1
|
+
export declare const getEntryOptions: <T>(name: string, baseOptions?: T | undefined, optionsByEntries?: Record<string, T> | undefined, packageName?: string) => T | undefined;
|
package/dist/getServerConfig.js
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
3
|
if (k2 === undefined) k2 = k;
|
4
|
-
Object.
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
5
9
|
}) : (function(o, m, k, k2) {
|
6
10
|
if (k2 === undefined) k2 = k;
|
7
11
|
o[k2] = m[k];
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
3
|
if (k2 === undefined) k2 = k;
|
4
|
-
Object.
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
5
9
|
}) : (function(o, m, k, k2) {
|
6
10
|
if (k2 === undefined) k2 = k;
|
7
11
|
o[k2] = m[k];
|
@@ -43,5 +47,6 @@ __exportStar(require("./wait"), exports);
|
|
43
47
|
__exportStar(require("./emptyDir"), exports);
|
44
48
|
__exportStar(require("./getServerConfig"), exports);
|
45
49
|
__exportStar(require("./ssr"), exports);
|
50
|
+
__exportStar(require("./tryResolve"), exports);
|
46
51
|
__exportStar(require("./analyzeProject"), exports);
|
47
52
|
__exportStar(require("./chainId"), exports);
|
package/dist/is/index.js
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
3
|
if (k2 === undefined) k2 = k;
|
4
|
-
Object.
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
5
9
|
}) : (function(o, m, k, k2) {
|
6
10
|
if (k2 === undefined) k2 = k;
|
7
11
|
o[k2] = m[k];
|
package/dist/storage.js
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
3
|
if (k2 === undefined) k2 = k;
|
4
|
-
Object.
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
5
9
|
}) : (function(o, m, k, k2) {
|
6
10
|
if (k2 === undefined) k2 = k;
|
7
11
|
o[k2] = m[k];
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* Try to resolve npm package entry file path.
|
3
|
+
* @param name - Package name.
|
4
|
+
* @param resolvePath - Path to resolve dependencies.
|
5
|
+
* @returns Resolved file path.
|
6
|
+
*/
|
7
|
+
export declare const tryResolve: (name: string, resolvePath: string) => string;
|
8
|
+
/**
|
9
|
+
* Try to resolve npm package, return true if package is installed.
|
10
|
+
*/
|
11
|
+
export declare const isPackageInstalled: (name: string, resolvePaths: string | string[]) => boolean;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isPackageInstalled = exports.tryResolve = void 0;
|
4
|
+
const ensureArray_1 = require("./ensureArray");
|
5
|
+
/**
|
6
|
+
* Try to resolve npm package entry file path.
|
7
|
+
* @param name - Package name.
|
8
|
+
* @param resolvePath - Path to resolve dependencies.
|
9
|
+
* @returns Resolved file path.
|
10
|
+
*/
|
11
|
+
const tryResolve = (name, resolvePath) => {
|
12
|
+
let filePath = '';
|
13
|
+
try {
|
14
|
+
filePath = require.resolve(name, { paths: [resolvePath] });
|
15
|
+
delete require.cache[filePath];
|
16
|
+
}
|
17
|
+
catch (err) {
|
18
|
+
if (err.code === 'MODULE_NOT_FOUND') {
|
19
|
+
throw new Error(`Can not find module ${name}.`);
|
20
|
+
}
|
21
|
+
throw err;
|
22
|
+
}
|
23
|
+
return filePath;
|
24
|
+
};
|
25
|
+
exports.tryResolve = tryResolve;
|
26
|
+
/**
|
27
|
+
* Try to resolve npm package, return true if package is installed.
|
28
|
+
*/
|
29
|
+
const isPackageInstalled = (name, resolvePaths) => {
|
30
|
+
try {
|
31
|
+
require.resolve(name, { paths: (0, ensureArray_1.ensureArray)(resolvePaths) });
|
32
|
+
return true;
|
33
|
+
}
|
34
|
+
catch (err) {
|
35
|
+
return false;
|
36
|
+
}
|
37
|
+
};
|
38
|
+
exports.isPackageInstalled = isPackageInstalled;
|
package/dist/watch.js
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
3
|
if (k2 === undefined) k2 = k;
|
4
|
-
Object.
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
5
9
|
}) : (function(o, m, k, k2) {
|
6
10
|
if (k2 === undefined) k2 = k;
|
7
11
|
o[k2] = m[k];
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "1.7.
|
14
|
+
"version": "1.7.10",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/index.d.ts",
|
17
17
|
"main": "./dist/index.js",
|
@@ -98,7 +98,7 @@
|
|
98
98
|
"lodash": "^4.17.21"
|
99
99
|
},
|
100
100
|
"devDependencies": {
|
101
|
-
"@modern-js/types": "1.5.
|
101
|
+
"@modern-js/types": "1.5.5",
|
102
102
|
"@scripts/build": "0.0.0",
|
103
103
|
"@scripts/jest-config": "0.0.0",
|
104
104
|
"@types/jest": "^27",
|