@modern-js/utils 1.3.7-alpha.prebundle.0 → 1.4.1
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/CHANGELOG.md +20 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.js +14 -1
- package/dist/getServerConfig.d.ts +1 -0
- package/dist/{src/watch.js → getServerConfig.js} +8 -34
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -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/package.json +2 -2
- package/dist/compiled/upath/index.d.ts +0 -225
- package/dist/compiled/upath/index.js +0 -1
- package/dist/pkgUp.d.ts +0 -2
- package/dist/pkgUp.js +0 -8
- package/dist/src/FileSizeReporter.d.ts +0 -16
- package/dist/src/FileSizeReporter.js +0 -152
- package/dist/src/alias.d.ts +0 -21
- package/dist/src/alias.js +0 -62
- package/dist/src/applyOptionsChain.d.ts +0 -6
- package/dist/src/applyOptionsChain.js +0 -30
- package/dist/src/clearConsole.d.ts +0 -1
- package/dist/src/clearConsole.js +0 -9
- package/dist/src/compatRequire.d.ts +0 -8
- package/dist/src/compatRequire.js +0 -28
- package/dist/src/compiled.d.ts +0 -7
- package/dist/src/compiled.js +0 -19
- package/dist/src/constants.d.ts +0 -209
- package/dist/src/constants.js +0 -264
- package/dist/src/debug.d.ts +0 -7
- package/dist/src/debug.js +0 -14
- package/dist/src/emptyDir.d.ts +0 -1
- package/dist/src/emptyDir.js +0 -22
- package/dist/src/ensureAbsolutePath.d.ts +0 -7
- package/dist/src/ensureAbsolutePath.js +0 -15
- package/dist/src/findExists.d.ts +0 -6
- package/dist/src/findExists.js +0 -21
- package/dist/src/format.d.ts +0 -16
- package/dist/src/format.js +0 -115
- package/dist/src/generateMetaTags.d.ts +0 -16
- package/dist/src/generateMetaTags.js +0 -48
- package/dist/src/getBrowserslist.d.ts +0 -2
- package/dist/src/getBrowserslist.js +0 -7
- package/dist/src/getCacheIdentifier.d.ts +0 -7
- package/dist/src/getCacheIdentifier.js +0 -24
- package/dist/src/getEntryOptions.d.ts +0 -1
- package/dist/src/getEntryOptions.js +0 -26
- package/dist/src/getPackageManager.d.ts +0 -1
- package/dist/src/getPackageManager.js +0 -47
- package/dist/src/getPort.d.ts +0 -7
- package/dist/src/getPort.js +0 -62
- package/dist/src/import.d.ts +0 -5
- package/dist/src/import.js +0 -10
- package/dist/src/index.d.ts +0 -32
- package/dist/src/index.js +0 -57
- package/dist/src/is/index.d.ts +0 -34
- package/dist/src/is/index.js +0 -82
- package/dist/src/is/node-env.d.ts +0 -4
- package/dist/src/is/node-env.js +0 -12
- package/dist/src/is/platform.d.ts +0 -2
- package/dist/src/is/platform.js +0 -10
- package/dist/src/is/type.d.ts +0 -8
- package/dist/src/is/type.js +0 -38
- package/dist/src/logger.d.ts +0 -63
- package/dist/src/logger.js +0 -129
- package/dist/src/monorepo.d.ts +0 -11
- package/dist/src/monorepo.js +0 -81
- package/dist/src/nodeEnv.d.ts +0 -3
- package/dist/src/nodeEnv.js +0 -52
- package/dist/src/path.d.ts +0 -3
- package/dist/src/path.js +0 -14
- package/dist/src/prettyInstructions.d.ts +0 -6
- package/dist/src/prettyInstructions.js +0 -64
- package/dist/src/printBuildError.d.ts +0 -8
- package/dist/src/printBuildError.js +0 -43
- package/dist/src/readTsConfig.d.ts +0 -2
- package/dist/src/readTsConfig.js +0 -19
- package/dist/src/removeSlash.d.ts +0 -3
- package/dist/src/removeSlash.js +0 -9
- package/dist/src/runtimeExports.d.ts +0 -4
- package/dist/src/runtimeExports.js +0 -53
- package/dist/src/wait.d.ts +0 -2
- package/dist/src/wait.js +0 -7
- package/dist/src/watch.d.ts +0 -8
package/dist/src/readTsConfig.js
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.readTsConfigByFile = exports.readTsConfig = void 0;
|
7
|
-
const path_1 = __importDefault(require("path"));
|
8
|
-
const readTsConfig = (root) => {
|
9
|
-
// import typescript from 'typescript' cause eslint fromat error.
|
10
|
-
const typescript = require('typescript');
|
11
|
-
return typescript.readConfigFile(path_1.default.resolve(root, './tsconfig.json'), typescript.sys.readFile).config;
|
12
|
-
};
|
13
|
-
exports.readTsConfig = readTsConfig;
|
14
|
-
const readTsConfigByFile = (filename) => {
|
15
|
-
// import typescript from 'typescript' cause eslint fromat error.
|
16
|
-
const typescript = require('typescript');
|
17
|
-
return typescript.readConfigFile(path_1.default.resolve(filename), typescript.sys.readFile).config;
|
18
|
-
};
|
19
|
-
exports.readTsConfigByFile = readTsConfigByFile;
|
package/dist/src/removeSlash.js
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.removeSlash = exports.removeTailSlash = exports.removeLeadingSlash = void 0;
|
4
|
-
const removeLeadingSlash = (s) => s.replace(/^\/+/, '');
|
5
|
-
exports.removeLeadingSlash = removeLeadingSlash;
|
6
|
-
const removeTailSlash = (s) => s.replace(/\/+$/, '');
|
7
|
-
exports.removeTailSlash = removeTailSlash;
|
8
|
-
const removeSlash = (s) => (0, exports.removeLeadingSlash)((0, exports.removeTailSlash)(s));
|
9
|
-
exports.removeSlash = removeSlash;
|
@@ -1,53 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.createRuntimeExportsUtils = void 0;
|
7
|
-
const path_1 = __importDefault(require("path"));
|
8
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
9
|
-
const path_2 = require("./path");
|
10
|
-
const memo = (fn) => {
|
11
|
-
const cache = new Map();
|
12
|
-
return (...params) => {
|
13
|
-
const stringifiedParams = JSON.stringify(params);
|
14
|
-
const cachedResult = cache.get(stringifiedParams);
|
15
|
-
if (cachedResult) {
|
16
|
-
return cachedResult;
|
17
|
-
}
|
18
|
-
const res = fn(...params);
|
19
|
-
cache.set(stringifiedParams, res);
|
20
|
-
return res;
|
21
|
-
};
|
22
|
-
};
|
23
|
-
exports.createRuntimeExportsUtils = memo((pwd = '', namespace, ts = false) => {
|
24
|
-
const entryExportFile = path_1.default.join(pwd, `.runtime-exports/${namespace ? `${namespace}.js` : 'index.js'}`);
|
25
|
-
const entryExportTsFile = path_1.default.join(pwd, `.runtime-exports/${namespace ? `${namespace}.d.ts` : 'index.d.ts'}`);
|
26
|
-
// const ensure = () => {
|
27
|
-
// if (!fs.existsSync(entryExportFile)) {
|
28
|
-
// fs.outputFileSync(entryExportFile, '');
|
29
|
-
// }
|
30
|
-
// fs.ensureFileSync(entryExportFile);
|
31
|
-
// };
|
32
|
-
const addExport = (statement) => {
|
33
|
-
// eslint-disable-next-line no-param-reassign
|
34
|
-
statement = (0, path_2.normalizeOutputPath)(statement);
|
35
|
-
try {
|
36
|
-
fs_extra_1.default.ensureFileSync(entryExportFile);
|
37
|
-
fs_extra_1.default.ensureFileSync(entryExportTsFile);
|
38
|
-
if (!fs_extra_1.default.readFileSync(entryExportFile, 'utf8').includes(statement)) {
|
39
|
-
fs_extra_1.default.appendFileSync(entryExportFile, `${statement}\n`);
|
40
|
-
ts &&
|
41
|
-
fs_extra_1.default.appendFileSync(entryExportTsFile, `${statement.replace('.js', '.d')}\n`);
|
42
|
-
}
|
43
|
-
}
|
44
|
-
catch (_a) {
|
45
|
-
// FIXME:
|
46
|
-
}
|
47
|
-
};
|
48
|
-
const getPath = () => entryExportFile;
|
49
|
-
return {
|
50
|
-
addExport,
|
51
|
-
getPath,
|
52
|
-
};
|
53
|
-
});
|
package/dist/src/wait.d.ts
DELETED
package/dist/src/wait.js
DELETED
package/dist/src/watch.d.ts
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
export declare type WatchChangeTypeValueT = 'add' | 'unlink' | 'change';
|
2
|
-
export declare const WatchChangeType: Record<'ADD' | 'UNLINK' | 'CHANGE', WatchChangeTypeValueT>;
|
3
|
-
declare type RunTaskType = (option: {
|
4
|
-
changedFilePath: string;
|
5
|
-
changeType: WatchChangeTypeValueT;
|
6
|
-
}) => void | Promise<void>;
|
7
|
-
export declare const watch: (watchDir: string | string[], runTask: RunTaskType, ignored?: string[]) => import("chokidar").FSWatcher;
|
8
|
-
export {};
|