@modern-js/utils 1.3.7 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +9 -0
- package/CHANGELOG.md +31 -0
- package/compiled/browserslist/index.d.ts +178 -0
- package/compiled/browserslist/index.js +1 -0
- package/compiled/browserslist/license +20 -0
- package/compiled/browserslist/package.json +1 -0
- package/compiled/chalk/index.d.ts +415 -0
- package/compiled/chalk/index.js +1 -0
- package/compiled/chalk/license +9 -0
- package/compiled/chalk/package.json +1 -0
- package/compiled/chokidar/anymatch/index.d.ts +19 -0
- package/compiled/chokidar/fsevents.node +0 -0
- package/compiled/chokidar/index.js +40 -0
- package/compiled/chokidar/license +21 -0
- package/compiled/chokidar/package.json +1 -0
- package/compiled/chokidar/types/index.d.ts +188 -0
- package/compiled/commander/index.js +1 -0
- package/compiled/commander/license +22 -0
- package/compiled/commander/package.json +1 -0
- package/compiled/commander/typings/index.d.ts +774 -0
- package/compiled/debug/index.d.ts +54 -0
- package/compiled/debug/index.js +1 -0
- package/compiled/debug/license +20 -0
- package/compiled/debug/ms/index.d.ts +25 -0
- package/compiled/debug/package.json +1 -0
- package/compiled/execa/index.d.ts +564 -0
- package/compiled/execa/index.js +1 -0
- package/compiled/execa/license +9 -0
- package/compiled/execa/package.json +1 -0
- package/compiled/filesize/filesize.d.ts +131 -0
- package/compiled/filesize/index.js +9 -0
- package/compiled/filesize/license +28 -0
- package/compiled/filesize/package.json +1 -0
- package/compiled/fs-extra/index.d.ts +563 -0
- package/compiled/fs-extra/index.js +1 -0
- package/compiled/fs-extra/license +15 -0
- package/compiled/fs-extra/package.json +1 -0
- package/compiled/glob/index.d.ts +91 -0
- package/compiled/glob/index.js +1 -0
- package/compiled/glob/license +21 -0
- package/compiled/glob/minimatch/index.d.ts +204 -0
- package/compiled/glob/package.json +1 -0
- package/compiled/gzip-size/index.d.ts +96 -0
- package/compiled/gzip-size/index.js +1 -0
- package/compiled/gzip-size/license +9 -0
- package/compiled/gzip-size/package.json +1 -0
- package/compiled/import-lazy/index.d.ts +26 -0
- package/compiled/import-lazy/index.js +1 -0
- package/compiled/import-lazy/license +9 -0
- package/compiled/import-lazy/package.json +1 -0
- package/compiled/js-yaml/index.d.ts +154 -0
- package/compiled/js-yaml/index.js +1 -0
- package/compiled/js-yaml/license +21 -0
- package/compiled/js-yaml/package.json +1 -0
- package/compiled/lodash/common/array.d.ts +2126 -0
- package/compiled/lodash/common/collection.d.ts +1930 -0
- package/compiled/lodash/common/common.d.ts +280 -0
- package/compiled/lodash/common/date.d.ts +23 -0
- package/compiled/lodash/common/function.d.ts +1446 -0
- package/compiled/lodash/common/lang.d.ts +1693 -0
- package/compiled/lodash/common/math.d.ts +405 -0
- package/compiled/lodash/common/number.d.ts +131 -0
- package/compiled/lodash/common/object.d.ts +2519 -0
- package/compiled/lodash/common/seq.d.ts +210 -0
- package/compiled/lodash/common/string.d.ts +788 -0
- package/compiled/lodash/common/util.d.ts +1220 -0
- package/compiled/lodash/index.d.ts +46 -0
- package/compiled/lodash/index.js +9 -0
- package/compiled/lodash/license +47 -0
- package/compiled/lodash/package.json +1 -0
- package/compiled/pkg-up/index.d.ts +48 -0
- package/compiled/pkg-up/index.js +1 -0
- package/compiled/pkg-up/license +9 -0
- package/compiled/pkg-up/package.json +1 -0
- package/compiled/recursive-readdir/index.d.ts +21 -0
- package/compiled/recursive-readdir/index.js +1 -0
- package/compiled/recursive-readdir/license +21 -0
- package/compiled/recursive-readdir/package.json +1 -0
- package/compiled/signale/index.d.ts +162 -0
- package/compiled/signale/index.js +1 -0
- package/compiled/signale/package.json +1 -0
- package/compiled/strip-ansi/index.d.ts +17 -0
- package/compiled/strip-ansi/index.js +1 -0
- package/compiled/strip-ansi/license +9 -0
- package/compiled/strip-ansi/package.json +1 -0
- package/compiled/upath/index.js +1 -0
- package/compiled/upath/license +22 -0
- package/compiled/upath/package.json +1 -0
- package/compiled/upath/upath.d.ts +241 -0
- package/dist/{types/FileSizeReporter.d.ts → FileSizeReporter.d.ts} +5 -5
- package/dist/FileSizeReporter.js +151 -0
- package/dist/{types/alias.d.ts → alias.d.ts} +12 -14
- package/dist/alias.js +62 -0
- package/dist/analyzeProject.d.ts +1 -0
- package/dist/analyzeProject.js +44 -0
- package/dist/applyOptionsChain.d.ts +6 -0
- package/dist/applyOptionsChain.js +30 -0
- package/dist/clearConsole.d.ts +1 -0
- package/dist/clearConsole.js +9 -0
- package/dist/{types/compatRequire.d.ts → compatRequire.d.ts} +1 -1
- package/dist/compatRequire.js +28 -0
- package/dist/compiled.d.ts +21 -0
- package/dist/compiled.js +33 -0
- package/dist/constants.d.ts +222 -0
- package/dist/constants.js +277 -0
- package/dist/{js/modern/debug.js → debug.d.ts} +1 -3
- package/dist/debug.js +11 -0
- package/dist/emptyDir.d.ts +1 -0
- package/dist/emptyDir.js +19 -0
- package/dist/{types/ensureAbsolutePath.d.ts → ensureAbsolutePath.d.ts} +1 -1
- package/dist/ensureAbsolutePath.js +15 -0
- package/dist/{types/findExists.d.ts → findExists.d.ts} +1 -1
- package/dist/findExists.js +21 -0
- package/dist/{types/format.d.ts → format.d.ts} +3 -3
- package/dist/format.js +113 -0
- package/dist/{types/generateMetaTags.d.ts → generateMetaTags.d.ts} +3 -3
- package/dist/generateMetaTags.js +48 -0
- package/dist/{types/getBrowserslist.d.ts → getBrowserslist.d.ts} +1 -1
- package/dist/getBrowserslist.js +7 -0
- package/dist/{types/getCacheIdentifier.d.ts → getCacheIdentifier.d.ts} +3 -3
- package/dist/getCacheIdentifier.js +24 -0
- package/dist/{types/getEntryOptions.d.ts → getEntryOptions.d.ts} +1 -1
- package/dist/getEntryOptions.js +26 -0
- package/dist/{types/getPackageManager.d.ts → getPackageManager.d.ts} +1 -1
- package/dist/getPackageManager.js +47 -0
- package/dist/{types/getPort.d.ts → getPort.d.ts} +1 -1
- package/dist/getPort.js +62 -0
- package/dist/getServerConfig.d.ts +1 -0
- package/dist/getServerConfig.js +39 -0
- package/dist/{types/import.d.ts → import.d.ts} +2 -2
- package/dist/import.js +10 -0
- package/dist/{types/index.d.ts → index.d.ts} +5 -4
- package/dist/index.js +46 -0
- package/dist/{types/is → is}/index.d.ts +1 -4
- package/dist/is/index.js +82 -0
- package/dist/{types/is → is}/node-env.d.ts +1 -1
- package/dist/is/node-env.js +12 -0
- package/dist/is/platform.d.ts +2 -0
- package/dist/is/platform.js +10 -0
- package/dist/{types/is → is}/type.d.ts +1 -1
- package/dist/is/type.js +38 -0
- package/dist/logger.d.ts +63 -0
- package/dist/logger.js +128 -0
- package/dist/{types/monorepo.d.ts → monorepo.d.ts} +3 -3
- package/dist/monorepo.js +80 -0
- package/dist/{types/nodeEnv.d.ts → nodeEnv.d.ts} +1 -1
- package/dist/nodeEnv.js +49 -0
- package/dist/{types/path.d.ts → path.d.ts} +1 -1
- package/dist/path.js +14 -0
- package/dist/{types/prettyInstructions.d.ts → prettyInstructions.d.ts} +2 -2
- package/dist/prettyInstructions.js +64 -0
- package/dist/{types/printBuildError.d.ts → printBuildError.d.ts} +1 -1
- package/dist/printBuildError.js +43 -0
- package/dist/{types/readTsConfig.d.ts → readTsConfig.d.ts} +1 -1
- package/dist/readTsConfig.js +19 -0
- package/dist/{types/removeSlash.d.ts → removeSlash.d.ts} +1 -1
- package/dist/removeSlash.js +9 -0
- package/dist/{types/runtimeExports.d.ts → runtimeExports.d.ts} +3 -3
- package/dist/runtimeExports.js +53 -0
- package/dist/ssrHelpers.d.ts +4 -0
- package/dist/ssrHelpers.js +7 -0
- package/dist/storage.d.ts +5 -0
- package/dist/storage.js +61 -0
- package/dist/{types/wait.d.ts → wait.d.ts} +1 -1
- package/dist/wait.js +7 -0
- package/dist/{types/watch.d.ts → watch.d.ts} +4 -4
- package/dist/watch.js +64 -0
- package/package.json +55 -37
- package/tsconfig.json +3 -5
- package/dist/js/modern/FileSizeReporter.js +0 -156
- package/dist/js/modern/alias.js +0 -74
- package/dist/js/modern/applyOptionsChain.js +0 -27
- package/dist/js/modern/chalk.js +0 -2
- package/dist/js/modern/clearConsole.js +0 -5
- package/dist/js/modern/compatRequire.js +0 -26
- package/dist/js/modern/constants.js +0 -333
- package/dist/js/modern/emptyDir.js +0 -6
- package/dist/js/modern/ensureAbsolutePath.js +0 -9
- package/dist/js/modern/findExists.js +0 -16
- package/dist/js/modern/format.js +0 -137
- package/dist/js/modern/generateMetaTags.js +0 -49
- package/dist/js/modern/getBrowserslist.js +0 -5
- package/dist/js/modern/getCacheIdentifier.js +0 -20
- package/dist/js/modern/getEntryOptions.js +0 -24
- package/dist/js/modern/getPackageManager.js +0 -37
- package/dist/js/modern/getPort.js +0 -52
- package/dist/js/modern/import.js +0 -11
- package/dist/js/modern/index.js +0 -34
- package/dist/js/modern/is/index.js +0 -77
- package/dist/js/modern/is/node-env.js +0 -5
- package/dist/js/modern/is/platform.js +0 -2
- package/dist/js/modern/is/type.js +0 -25
- package/dist/js/modern/logger.js +0 -152
- package/dist/js/modern/monorepo.js +0 -84
- package/dist/js/modern/nodeEnv.js +0 -31
- package/dist/js/modern/path.js +0 -5
- package/dist/js/modern/pkgUp.js +0 -2
- package/dist/js/modern/prettyInstructions.js +0 -79
- package/dist/js/modern/printBuildError.js +0 -40
- package/dist/js/modern/readTsConfig.js +0 -13
- package/dist/js/modern/removeSlash.js +0 -3
- package/dist/js/modern/runtimeExports.js +0 -52
- package/dist/js/modern/wait.js +0 -5
- package/dist/js/modern/watch.js +0 -43
- package/dist/js/node/FileSizeReporter.js +0 -175
- package/dist/js/node/alias.js +0 -97
- package/dist/js/node/applyOptionsChain.js +0 -37
- package/dist/js/node/chalk.js +0 -15
- package/dist/js/node/clearConsole.js +0 -14
- package/dist/js/node/compatRequire.js +0 -41
- package/dist/js/node/constants.js +0 -353
- package/dist/js/node/debug.js +0 -19
- package/dist/js/node/emptyDir.js +0 -18
- package/dist/js/node/ensureAbsolutePath.js +0 -20
- package/dist/js/node/findExists.js +0 -27
- package/dist/js/node/format.js +0 -141
- package/dist/js/node/generateMetaTags.js +0 -58
- package/dist/js/node/getBrowserslist.js +0 -17
- package/dist/js/node/getCacheIdentifier.js +0 -27
- package/dist/js/node/getEntryOptions.js +0 -35
- package/dist/js/node/getPackageManager.js +0 -51
- package/dist/js/node/getPort.js +0 -67
- package/dist/js/node/import.js +0 -19
- package/dist/js/node/index.js +0 -465
- package/dist/js/node/is/index.js +0 -150
- package/dist/js/node/is/node-env.js +0 -23
- package/dist/js/node/is/platform.js +0 -14
- package/dist/js/node/is/type.js +0 -46
- package/dist/js/node/logger.js +0 -162
- package/dist/js/node/monorepo.js +0 -118
- package/dist/js/node/nodeEnv.js +0 -45
- package/dist/js/node/path.js +0 -24
- package/dist/js/node/pkgUp.js +0 -15
- package/dist/js/node/prettyInstructions.js +0 -95
- package/dist/js/node/printBuildError.js +0 -52
- package/dist/js/node/readTsConfig.js +0 -28
- package/dist/js/node/removeSlash.js +0 -18
- package/dist/js/node/runtimeExports.js +0 -68
- package/dist/js/node/wait.js +0 -12
- package/dist/js/node/watch.js +0 -61
- package/dist/js/treeshaking/FileSizeReporter.js +0 -185
- package/dist/js/treeshaking/alias.js +0 -72
- package/dist/js/treeshaking/applyOptionsChain.js +0 -31
- package/dist/js/treeshaking/chalk.js +0 -2
- package/dist/js/treeshaking/clearConsole.js +0 -5
- package/dist/js/treeshaking/compatRequire.js +0 -29
- package/dist/js/treeshaking/constants.js +0 -333
- package/dist/js/treeshaking/debug.js +0 -10
- package/dist/js/treeshaking/emptyDir.js +0 -37
- package/dist/js/treeshaking/ensureAbsolutePath.js +0 -11
- package/dist/js/treeshaking/findExists.js +0 -33
- package/dist/js/treeshaking/format.js +0 -167
- package/dist/js/treeshaking/generateMetaTags.js +0 -55
- package/dist/js/treeshaking/getBrowserslist.js +0 -7
- package/dist/js/treeshaking/getCacheIdentifier.js +0 -35
- package/dist/js/treeshaking/getEntryOptions.js +0 -26
- package/dist/js/treeshaking/getPackageManager.js +0 -101
- package/dist/js/treeshaking/getPort.js +0 -103
- package/dist/js/treeshaking/import.js +0 -11
- package/dist/js/treeshaking/index.js +0 -34
- package/dist/js/treeshaking/is/index.js +0 -81
- package/dist/js/treeshaking/is/node-env.js +0 -13
- package/dist/js/treeshaking/is/platform.js +0 -6
- package/dist/js/treeshaking/is/type.js +0 -27
- package/dist/js/treeshaking/logger.js +0 -188
- package/dist/js/treeshaking/monorepo.js +0 -95
- package/dist/js/treeshaking/nodeEnv.js +0 -108
- package/dist/js/treeshaking/path.js +0 -11
- package/dist/js/treeshaking/pkgUp.js +0 -2
- package/dist/js/treeshaking/prettyInstructions.js +0 -100
- package/dist/js/treeshaking/printBuildError.js +0 -40
- package/dist/js/treeshaking/readTsConfig.js +0 -13
- package/dist/js/treeshaking/removeSlash.js +0 -9
- package/dist/js/treeshaking/runtimeExports.js +0 -61
- package/dist/js/treeshaking/wait.js +0 -8
- package/dist/js/treeshaking/watch.js +0 -112
- package/dist/types/applyOptionsChain.d.ts +0 -6
- package/dist/types/chalk.d.ts +0 -2
- package/dist/types/clearConsole.d.ts +0 -1
- package/dist/types/constants.d.ts +0 -219
- package/dist/types/debug.d.ts +0 -8
- package/dist/types/emptyDir.d.ts +0 -1
- package/dist/types/is/platform.d.ts +0 -2
- package/dist/types/logger.d.ts +0 -63
- package/dist/types/pkgUp.d.ts +0 -2
- package/tests/.eslintrc.js +0 -6
- package/tests/__snapshots__/prettyInstructions.test.ts.snap +0 -19
- package/tests/applyOptionsChain.test.ts +0 -100
- package/tests/compatRequire.test.ts +0 -32
- package/tests/debug.test.ts +0 -25
- package/tests/ensureAbsolutePath.test.ts +0 -16
- package/tests/findExists.test.ts +0 -22
- package/tests/fixtures/browserlist/develop/package.json +0 -11
- package/tests/fixtures/browserlist/dotfile/.browserslistrc +0 -3
- package/tests/fixtures/browserlist/pkg/package.json +0 -7
- package/tests/fixtures/compat-require/cjs.js +0 -1
- package/tests/fixtures/compat-require/empty.js +0 -1
- package/tests/fixtures/compat-require/esm.js +0 -5
- package/tests/fixtures/compat-require/foo.js +0 -3
- package/tests/fixtures/file-exists/a.ejs +0 -0
- package/tests/fixtures/file-exists/a.js/.gitkeep +0 -0
- package/tests/fixtures/file-exists/a.mjs +0 -0
- package/tests/fixtures/file-exists/a.ts +0 -0
- package/tests/format.test.ts +0 -60
- package/tests/generateMetaTags.test.ts +0 -19
- package/tests/getBrowserslist.test.ts +0 -32
- package/tests/getCacheIdentifier.test.ts +0 -37
- package/tests/getEntryOptions.test.ts +0 -53
- package/tests/index.test.ts +0 -18
- package/tests/is.test.ts +0 -27
- package/tests/isPlatform.test.ts +0 -19
- package/tests/isType.test.ts +0 -85
- package/tests/logger.test.ts +0 -53
- package/tests/prettyInstructions.test.ts +0 -139
- package/tests/removeSlash.test.ts +0 -19
- package/tests/tsconfig.json +0 -11
- package/tests/wait.ts +0 -38
@@ -1,35 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.getEntryOptions = void 0;
|
7
|
-
|
8
|
-
var _is = require("./is");
|
9
|
-
|
10
|
-
var _constants = require("./constants");
|
11
|
-
|
12
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
13
|
-
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
|
-
|
16
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
17
|
-
|
18
|
-
const getEntryOptions = (name, baseOptions, optionsByEntries, packageName) => {
|
19
|
-
if (optionsByEntries) {
|
20
|
-
let optionsByEntry = getOptionsByEntryName(name, optionsByEntries); // compatible with main entry using packageName as the key
|
21
|
-
|
22
|
-
if (optionsByEntry === undefined && name === _constants.MAIN_ENTRY_NAME && packageName) {
|
23
|
-
optionsByEntry = getOptionsByEntryName(packageName, optionsByEntries);
|
24
|
-
} // eslint-disable-next-line no-nested-ternary
|
25
|
-
|
26
|
-
|
27
|
-
return optionsByEntry !== undefined ? (0, _is.isPlainObject)(optionsByEntry) && (0, _is.isPlainObject)(baseOptions) ? _objectSpread(_objectSpread({}, baseOptions), optionsByEntry) : optionsByEntry : baseOptions;
|
28
|
-
} else {
|
29
|
-
return baseOptions;
|
30
|
-
}
|
31
|
-
};
|
32
|
-
|
33
|
-
exports.getEntryOptions = getEntryOptions;
|
34
|
-
|
35
|
-
const getOptionsByEntryName = (name, optionsByEntries) => optionsByEntries.hasOwnProperty(name) ? optionsByEntries[name] : undefined;
|
@@ -1,51 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.getPackageManager = getPackageManager;
|
7
|
-
|
8
|
-
var _os = _interopRequireDefault(require("os"));
|
9
|
-
|
10
|
-
var _path = _interopRequireDefault(require("path"));
|
11
|
-
|
12
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
13
|
-
|
14
|
-
var _nodeEnv = require("./nodeEnv");
|
15
|
-
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
-
|
18
|
-
const MAX_TIMES = 5;
|
19
|
-
|
20
|
-
async function getPackageManager(cwd = process.cwd()) {
|
21
|
-
let appDirectory = cwd;
|
22
|
-
let times = 0;
|
23
|
-
|
24
|
-
while (_os.default.homedir() !== appDirectory && times < MAX_TIMES) {
|
25
|
-
times++;
|
26
|
-
|
27
|
-
if (_fsExtra.default.existsSync(_path.default.resolve(appDirectory, 'pnpm-lock.yaml'))) {
|
28
|
-
return 'pnpm';
|
29
|
-
}
|
30
|
-
|
31
|
-
if (_fsExtra.default.existsSync(_path.default.resolve(appDirectory, 'yarn.lock'))) {
|
32
|
-
return 'yarn';
|
33
|
-
}
|
34
|
-
|
35
|
-
if (_fsExtra.default.existsSync(_path.default.resolve(appDirectory, 'package-lock.json'))) {
|
36
|
-
return 'npm';
|
37
|
-
}
|
38
|
-
|
39
|
-
appDirectory = _path.default.join(appDirectory, '..');
|
40
|
-
}
|
41
|
-
|
42
|
-
if (await (0, _nodeEnv.canUsePnpm)()) {
|
43
|
-
return 'pnpm';
|
44
|
-
}
|
45
|
-
|
46
|
-
if (await (0, _nodeEnv.canUseYarn)()) {
|
47
|
-
return 'yarn';
|
48
|
-
}
|
49
|
-
|
50
|
-
return 'npm';
|
51
|
-
}
|
package/dist/js/node/getPort.js
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.getPort = void 0;
|
7
|
-
|
8
|
-
var _net = _interopRequireDefault(require("net"));
|
9
|
-
|
10
|
-
var _chalk = require("./chalk");
|
11
|
-
|
12
|
-
var _logger = require("./logger");
|
13
|
-
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Get available free port.
|
18
|
-
* @param port - Current port want to use.
|
19
|
-
* @param tryLimits - Maximum number of retries.
|
20
|
-
* @returns Available port number.
|
21
|
-
*/
|
22
|
-
|
23
|
-
/* eslint-disable no-param-reassign, @typescript-eslint/no-loop-func */
|
24
|
-
const getPort = async (port, tryLimits = 20) => {
|
25
|
-
if (typeof port === 'string') {
|
26
|
-
port = parseInt(port, 10);
|
27
|
-
}
|
28
|
-
|
29
|
-
const original = port;
|
30
|
-
let found = false;
|
31
|
-
let attempts = 0;
|
32
|
-
|
33
|
-
while (!found && attempts <= tryLimits) {
|
34
|
-
try {
|
35
|
-
await new Promise((resolve, reject) => {
|
36
|
-
const server = _net.default.createServer();
|
37
|
-
|
38
|
-
server.unref();
|
39
|
-
server.on('error', reject);
|
40
|
-
server.listen({
|
41
|
-
port,
|
42
|
-
host: '0.0.0.0'
|
43
|
-
}, () => {
|
44
|
-
found = true;
|
45
|
-
server.close(resolve);
|
46
|
-
});
|
47
|
-
});
|
48
|
-
} catch (e) {
|
49
|
-
if (e.code !== 'EADDRINUSE') {
|
50
|
-
throw e;
|
51
|
-
}
|
52
|
-
|
53
|
-
port++;
|
54
|
-
attempts++;
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
if (port !== original) {
|
59
|
-
_logger.logger.info(_chalk.chalk.red(`Something is already running on port ${original}. ${_chalk.chalk.yellow(`Use port ${port} instead.`)}`));
|
60
|
-
}
|
61
|
-
|
62
|
-
return port;
|
63
|
-
};
|
64
|
-
/* eslint-enable no-param-reassign, @typescript-eslint/no-loop-func */
|
65
|
-
|
66
|
-
|
67
|
-
exports.getPort = getPort;
|
package/dist/js/node/import.js
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.lazyImport = exports.Import = void 0;
|
7
|
-
|
8
|
-
// cover: https://rushstack.io/pages/api/node-core-library.import.lazy/
|
9
|
-
const lazy = (moduleName, requireFn) => {
|
10
|
-
const importLazyLocal = require('import-lazy')(requireFn);
|
11
|
-
|
12
|
-
return importLazyLocal(moduleName);
|
13
|
-
};
|
14
|
-
|
15
|
-
exports.lazyImport = lazy;
|
16
|
-
const Import = {
|
17
|
-
lazy
|
18
|
-
};
|
19
|
-
exports.Import = Import;
|
package/dist/js/node/index.js
DELETED
@@ -1,465 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
var _exportNames = {
|
7
|
-
fs: true
|
8
|
-
};
|
9
|
-
exports.fs = void 0;
|
10
|
-
|
11
|
-
var _fs = _interopRequireWildcard(require("fs-extra"));
|
12
|
-
|
13
|
-
exports.fs = _fs;
|
14
|
-
|
15
|
-
var _chalk = require("./chalk");
|
16
|
-
|
17
|
-
Object.keys(_chalk).forEach(function (key) {
|
18
|
-
if (key === "default" || key === "__esModule") return;
|
19
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
20
|
-
if (key in exports && exports[key] === _chalk[key]) return;
|
21
|
-
Object.defineProperty(exports, key, {
|
22
|
-
enumerable: true,
|
23
|
-
get: function () {
|
24
|
-
return _chalk[key];
|
25
|
-
}
|
26
|
-
});
|
27
|
-
});
|
28
|
-
|
29
|
-
var _format = require("./format");
|
30
|
-
|
31
|
-
Object.keys(_format).forEach(function (key) {
|
32
|
-
if (key === "default" || key === "__esModule") return;
|
33
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
34
|
-
if (key in exports && exports[key] === _format[key]) return;
|
35
|
-
Object.defineProperty(exports, key, {
|
36
|
-
enumerable: true,
|
37
|
-
get: function () {
|
38
|
-
return _format[key];
|
39
|
-
}
|
40
|
-
});
|
41
|
-
});
|
42
|
-
|
43
|
-
var _FileSizeReporter = require("./FileSizeReporter");
|
44
|
-
|
45
|
-
Object.keys(_FileSizeReporter).forEach(function (key) {
|
46
|
-
if (key === "default" || key === "__esModule") return;
|
47
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
48
|
-
if (key in exports && exports[key] === _FileSizeReporter[key]) return;
|
49
|
-
Object.defineProperty(exports, key, {
|
50
|
-
enumerable: true,
|
51
|
-
get: function () {
|
52
|
-
return _FileSizeReporter[key];
|
53
|
-
}
|
54
|
-
});
|
55
|
-
});
|
56
|
-
|
57
|
-
var _printBuildError = require("./printBuildError");
|
58
|
-
|
59
|
-
Object.keys(_printBuildError).forEach(function (key) {
|
60
|
-
if (key === "default" || key === "__esModule") return;
|
61
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
62
|
-
if (key in exports && exports[key] === _printBuildError[key]) return;
|
63
|
-
Object.defineProperty(exports, key, {
|
64
|
-
enumerable: true,
|
65
|
-
get: function () {
|
66
|
-
return _printBuildError[key];
|
67
|
-
}
|
68
|
-
});
|
69
|
-
});
|
70
|
-
|
71
|
-
var _debug = require("./debug");
|
72
|
-
|
73
|
-
Object.keys(_debug).forEach(function (key) {
|
74
|
-
if (key === "default" || key === "__esModule") return;
|
75
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
76
|
-
if (key in exports && exports[key] === _debug[key]) return;
|
77
|
-
Object.defineProperty(exports, key, {
|
78
|
-
enumerable: true,
|
79
|
-
get: function () {
|
80
|
-
return _debug[key];
|
81
|
-
}
|
82
|
-
});
|
83
|
-
});
|
84
|
-
|
85
|
-
var _findExists = require("./findExists");
|
86
|
-
|
87
|
-
Object.keys(_findExists).forEach(function (key) {
|
88
|
-
if (key === "default" || key === "__esModule") return;
|
89
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
90
|
-
if (key in exports && exports[key] === _findExists[key]) return;
|
91
|
-
Object.defineProperty(exports, key, {
|
92
|
-
enumerable: true,
|
93
|
-
get: function () {
|
94
|
-
return _findExists[key];
|
95
|
-
}
|
96
|
-
});
|
97
|
-
});
|
98
|
-
|
99
|
-
var _is = require("./is");
|
100
|
-
|
101
|
-
Object.keys(_is).forEach(function (key) {
|
102
|
-
if (key === "default" || key === "__esModule") return;
|
103
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
104
|
-
if (key in exports && exports[key] === _is[key]) return;
|
105
|
-
Object.defineProperty(exports, key, {
|
106
|
-
enumerable: true,
|
107
|
-
get: function () {
|
108
|
-
return _is[key];
|
109
|
-
}
|
110
|
-
});
|
111
|
-
});
|
112
|
-
|
113
|
-
var _compatRequire = require("./compatRequire");
|
114
|
-
|
115
|
-
Object.keys(_compatRequire).forEach(function (key) {
|
116
|
-
if (key === "default" || key === "__esModule") return;
|
117
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
118
|
-
if (key in exports && exports[key] === _compatRequire[key]) return;
|
119
|
-
Object.defineProperty(exports, key, {
|
120
|
-
enumerable: true,
|
121
|
-
get: function () {
|
122
|
-
return _compatRequire[key];
|
123
|
-
}
|
124
|
-
});
|
125
|
-
});
|
126
|
-
|
127
|
-
var _logger = require("./logger");
|
128
|
-
|
129
|
-
Object.keys(_logger).forEach(function (key) {
|
130
|
-
if (key === "default" || key === "__esModule") return;
|
131
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
132
|
-
if (key in exports && exports[key] === _logger[key]) return;
|
133
|
-
Object.defineProperty(exports, key, {
|
134
|
-
enumerable: true,
|
135
|
-
get: function () {
|
136
|
-
return _logger[key];
|
137
|
-
}
|
138
|
-
});
|
139
|
-
});
|
140
|
-
|
141
|
-
var _constants = require("./constants");
|
142
|
-
|
143
|
-
Object.keys(_constants).forEach(function (key) {
|
144
|
-
if (key === "default" || key === "__esModule") return;
|
145
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
146
|
-
if (key in exports && exports[key] === _constants[key]) return;
|
147
|
-
Object.defineProperty(exports, key, {
|
148
|
-
enumerable: true,
|
149
|
-
get: function () {
|
150
|
-
return _constants[key];
|
151
|
-
}
|
152
|
-
});
|
153
|
-
});
|
154
|
-
|
155
|
-
var _ensureAbsolutePath = require("./ensureAbsolutePath");
|
156
|
-
|
157
|
-
Object.keys(_ensureAbsolutePath).forEach(function (key) {
|
158
|
-
if (key === "default" || key === "__esModule") return;
|
159
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
160
|
-
if (key in exports && exports[key] === _ensureAbsolutePath[key]) return;
|
161
|
-
Object.defineProperty(exports, key, {
|
162
|
-
enumerable: true,
|
163
|
-
get: function () {
|
164
|
-
return _ensureAbsolutePath[key];
|
165
|
-
}
|
166
|
-
});
|
167
|
-
});
|
168
|
-
|
169
|
-
var _getCacheIdentifier = require("./getCacheIdentifier");
|
170
|
-
|
171
|
-
Object.keys(_getCacheIdentifier).forEach(function (key) {
|
172
|
-
if (key === "default" || key === "__esModule") return;
|
173
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
174
|
-
if (key in exports && exports[key] === _getCacheIdentifier[key]) return;
|
175
|
-
Object.defineProperty(exports, key, {
|
176
|
-
enumerable: true,
|
177
|
-
get: function () {
|
178
|
-
return _getCacheIdentifier[key];
|
179
|
-
}
|
180
|
-
});
|
181
|
-
});
|
182
|
-
|
183
|
-
var _clearConsole = require("./clearConsole");
|
184
|
-
|
185
|
-
Object.keys(_clearConsole).forEach(function (key) {
|
186
|
-
if (key === "default" || key === "__esModule") return;
|
187
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
188
|
-
if (key in exports && exports[key] === _clearConsole[key]) return;
|
189
|
-
Object.defineProperty(exports, key, {
|
190
|
-
enumerable: true,
|
191
|
-
get: function () {
|
192
|
-
return _clearConsole[key];
|
193
|
-
}
|
194
|
-
});
|
195
|
-
});
|
196
|
-
|
197
|
-
var _pkgUp = require("./pkgUp");
|
198
|
-
|
199
|
-
Object.keys(_pkgUp).forEach(function (key) {
|
200
|
-
if (key === "default" || key === "__esModule") return;
|
201
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
202
|
-
if (key in exports && exports[key] === _pkgUp[key]) return;
|
203
|
-
Object.defineProperty(exports, key, {
|
204
|
-
enumerable: true,
|
205
|
-
get: function () {
|
206
|
-
return _pkgUp[key];
|
207
|
-
}
|
208
|
-
});
|
209
|
-
});
|
210
|
-
|
211
|
-
var _applyOptionsChain = require("./applyOptionsChain");
|
212
|
-
|
213
|
-
Object.keys(_applyOptionsChain).forEach(function (key) {
|
214
|
-
if (key === "default" || key === "__esModule") return;
|
215
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
216
|
-
if (key in exports && exports[key] === _applyOptionsChain[key]) return;
|
217
|
-
Object.defineProperty(exports, key, {
|
218
|
-
enumerable: true,
|
219
|
-
get: function () {
|
220
|
-
return _applyOptionsChain[key];
|
221
|
-
}
|
222
|
-
});
|
223
|
-
});
|
224
|
-
|
225
|
-
var _getBrowserslist = require("./getBrowserslist");
|
226
|
-
|
227
|
-
Object.keys(_getBrowserslist).forEach(function (key) {
|
228
|
-
if (key === "default" || key === "__esModule") return;
|
229
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
230
|
-
if (key in exports && exports[key] === _getBrowserslist[key]) return;
|
231
|
-
Object.defineProperty(exports, key, {
|
232
|
-
enumerable: true,
|
233
|
-
get: function () {
|
234
|
-
return _getBrowserslist[key];
|
235
|
-
}
|
236
|
-
});
|
237
|
-
});
|
238
|
-
|
239
|
-
var _removeSlash = require("./removeSlash");
|
240
|
-
|
241
|
-
Object.keys(_removeSlash).forEach(function (key) {
|
242
|
-
if (key === "default" || key === "__esModule") return;
|
243
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
244
|
-
if (key in exports && exports[key] === _removeSlash[key]) return;
|
245
|
-
Object.defineProperty(exports, key, {
|
246
|
-
enumerable: true,
|
247
|
-
get: function () {
|
248
|
-
return _removeSlash[key];
|
249
|
-
}
|
250
|
-
});
|
251
|
-
});
|
252
|
-
|
253
|
-
var _getEntryOptions = require("./getEntryOptions");
|
254
|
-
|
255
|
-
Object.keys(_getEntryOptions).forEach(function (key) {
|
256
|
-
if (key === "default" || key === "__esModule") return;
|
257
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
258
|
-
if (key in exports && exports[key] === _getEntryOptions[key]) return;
|
259
|
-
Object.defineProperty(exports, key, {
|
260
|
-
enumerable: true,
|
261
|
-
get: function () {
|
262
|
-
return _getEntryOptions[key];
|
263
|
-
}
|
264
|
-
});
|
265
|
-
});
|
266
|
-
|
267
|
-
var _getPort = require("./getPort");
|
268
|
-
|
269
|
-
Object.keys(_getPort).forEach(function (key) {
|
270
|
-
if (key === "default" || key === "__esModule") return;
|
271
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
272
|
-
if (key in exports && exports[key] === _getPort[key]) return;
|
273
|
-
Object.defineProperty(exports, key, {
|
274
|
-
enumerable: true,
|
275
|
-
get: function () {
|
276
|
-
return _getPort[key];
|
277
|
-
}
|
278
|
-
});
|
279
|
-
});
|
280
|
-
|
281
|
-
var _monorepo = require("./monorepo");
|
282
|
-
|
283
|
-
Object.keys(_monorepo).forEach(function (key) {
|
284
|
-
if (key === "default" || key === "__esModule") return;
|
285
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
286
|
-
if (key in exports && exports[key] === _monorepo[key]) return;
|
287
|
-
Object.defineProperty(exports, key, {
|
288
|
-
enumerable: true,
|
289
|
-
get: function () {
|
290
|
-
return _monorepo[key];
|
291
|
-
}
|
292
|
-
});
|
293
|
-
});
|
294
|
-
|
295
|
-
var _getPackageManager = require("./getPackageManager");
|
296
|
-
|
297
|
-
Object.keys(_getPackageManager).forEach(function (key) {
|
298
|
-
if (key === "default" || key === "__esModule") return;
|
299
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
300
|
-
if (key in exports && exports[key] === _getPackageManager[key]) return;
|
301
|
-
Object.defineProperty(exports, key, {
|
302
|
-
enumerable: true,
|
303
|
-
get: function () {
|
304
|
-
return _getPackageManager[key];
|
305
|
-
}
|
306
|
-
});
|
307
|
-
});
|
308
|
-
|
309
|
-
var _runtimeExports = require("./runtimeExports");
|
310
|
-
|
311
|
-
Object.keys(_runtimeExports).forEach(function (key) {
|
312
|
-
if (key === "default" || key === "__esModule") return;
|
313
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
314
|
-
if (key in exports && exports[key] === _runtimeExports[key]) return;
|
315
|
-
Object.defineProperty(exports, key, {
|
316
|
-
enumerable: true,
|
317
|
-
get: function () {
|
318
|
-
return _runtimeExports[key];
|
319
|
-
}
|
320
|
-
});
|
321
|
-
});
|
322
|
-
|
323
|
-
var _readTsConfig = require("./readTsConfig");
|
324
|
-
|
325
|
-
Object.keys(_readTsConfig).forEach(function (key) {
|
326
|
-
if (key === "default" || key === "__esModule") return;
|
327
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
328
|
-
if (key in exports && exports[key] === _readTsConfig[key]) return;
|
329
|
-
Object.defineProperty(exports, key, {
|
330
|
-
enumerable: true,
|
331
|
-
get: function () {
|
332
|
-
return _readTsConfig[key];
|
333
|
-
}
|
334
|
-
});
|
335
|
-
});
|
336
|
-
|
337
|
-
var _path = require("./path");
|
338
|
-
|
339
|
-
Object.keys(_path).forEach(function (key) {
|
340
|
-
if (key === "default" || key === "__esModule") return;
|
341
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
342
|
-
if (key in exports && exports[key] === _path[key]) return;
|
343
|
-
Object.defineProperty(exports, key, {
|
344
|
-
enumerable: true,
|
345
|
-
get: function () {
|
346
|
-
return _path[key];
|
347
|
-
}
|
348
|
-
});
|
349
|
-
});
|
350
|
-
|
351
|
-
var _generateMetaTags = require("./generateMetaTags");
|
352
|
-
|
353
|
-
Object.keys(_generateMetaTags).forEach(function (key) {
|
354
|
-
if (key === "default" || key === "__esModule") return;
|
355
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
356
|
-
if (key in exports && exports[key] === _generateMetaTags[key]) return;
|
357
|
-
Object.defineProperty(exports, key, {
|
358
|
-
enumerable: true,
|
359
|
-
get: function () {
|
360
|
-
return _generateMetaTags[key];
|
361
|
-
}
|
362
|
-
});
|
363
|
-
});
|
364
|
-
|
365
|
-
var _prettyInstructions = require("./prettyInstructions");
|
366
|
-
|
367
|
-
Object.keys(_prettyInstructions).forEach(function (key) {
|
368
|
-
if (key === "default" || key === "__esModule") return;
|
369
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
370
|
-
if (key in exports && exports[key] === _prettyInstructions[key]) return;
|
371
|
-
Object.defineProperty(exports, key, {
|
372
|
-
enumerable: true,
|
373
|
-
get: function () {
|
374
|
-
return _prettyInstructions[key];
|
375
|
-
}
|
376
|
-
});
|
377
|
-
});
|
378
|
-
|
379
|
-
var _alias = require("./alias");
|
380
|
-
|
381
|
-
Object.keys(_alias).forEach(function (key) {
|
382
|
-
if (key === "default" || key === "__esModule") return;
|
383
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
384
|
-
if (key in exports && exports[key] === _alias[key]) return;
|
385
|
-
Object.defineProperty(exports, key, {
|
386
|
-
enumerable: true,
|
387
|
-
get: function () {
|
388
|
-
return _alias[key];
|
389
|
-
}
|
390
|
-
});
|
391
|
-
});
|
392
|
-
|
393
|
-
var _import = require("./import");
|
394
|
-
|
395
|
-
Object.keys(_import).forEach(function (key) {
|
396
|
-
if (key === "default" || key === "__esModule") return;
|
397
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
398
|
-
if (key in exports && exports[key] === _import[key]) return;
|
399
|
-
Object.defineProperty(exports, key, {
|
400
|
-
enumerable: true,
|
401
|
-
get: function () {
|
402
|
-
return _import[key];
|
403
|
-
}
|
404
|
-
});
|
405
|
-
});
|
406
|
-
|
407
|
-
var _watch = require("./watch");
|
408
|
-
|
409
|
-
Object.keys(_watch).forEach(function (key) {
|
410
|
-
if (key === "default" || key === "__esModule") return;
|
411
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
412
|
-
if (key in exports && exports[key] === _watch[key]) return;
|
413
|
-
Object.defineProperty(exports, key, {
|
414
|
-
enumerable: true,
|
415
|
-
get: function () {
|
416
|
-
return _watch[key];
|
417
|
-
}
|
418
|
-
});
|
419
|
-
});
|
420
|
-
|
421
|
-
var _nodeEnv = require("./nodeEnv");
|
422
|
-
|
423
|
-
Object.keys(_nodeEnv).forEach(function (key) {
|
424
|
-
if (key === "default" || key === "__esModule") return;
|
425
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
426
|
-
if (key in exports && exports[key] === _nodeEnv[key]) return;
|
427
|
-
Object.defineProperty(exports, key, {
|
428
|
-
enumerable: true,
|
429
|
-
get: function () {
|
430
|
-
return _nodeEnv[key];
|
431
|
-
}
|
432
|
-
});
|
433
|
-
});
|
434
|
-
|
435
|
-
var _wait = require("./wait");
|
436
|
-
|
437
|
-
Object.keys(_wait).forEach(function (key) {
|
438
|
-
if (key === "default" || key === "__esModule") return;
|
439
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
440
|
-
if (key in exports && exports[key] === _wait[key]) return;
|
441
|
-
Object.defineProperty(exports, key, {
|
442
|
-
enumerable: true,
|
443
|
-
get: function () {
|
444
|
-
return _wait[key];
|
445
|
-
}
|
446
|
-
});
|
447
|
-
});
|
448
|
-
|
449
|
-
var _emptyDir = require("./emptyDir");
|
450
|
-
|
451
|
-
Object.keys(_emptyDir).forEach(function (key) {
|
452
|
-
if (key === "default" || key === "__esModule") return;
|
453
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
454
|
-
if (key in exports && exports[key] === _emptyDir[key]) return;
|
455
|
-
Object.defineProperty(exports, key, {
|
456
|
-
enumerable: true,
|
457
|
-
get: function () {
|
458
|
-
return _emptyDir[key];
|
459
|
-
}
|
460
|
-
});
|
461
|
-
});
|
462
|
-
|
463
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
464
|
-
|
465
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|