@modern-js/utils 1.7.0 → 1.7.1-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * ensure absolute file path.
3
3
  * @param base - Base path to resolve relative from.
4
- * @param filePath - Aboluste or relative file path.
4
+ * @param filePath - Absolute or relative file path.
5
5
  * @returns Resolved absolute file path.
6
6
  */
7
7
  export declare const ensureAbsolutePath: (base: string, filePath: string) => string;
@@ -8,7 +8,7 @@ const path_1 = __importDefault(require("path"));
8
8
  /**
9
9
  * ensure absolute file path.
10
10
  * @param base - Base path to resolve relative from.
11
- * @param filePath - Aboluste or relative file path.
11
+ * @param filePath - Absolute or relative file path.
12
12
  * @returns Resolved absolute file path.
13
13
  */
14
14
  const ensureAbsolutePath = (base, filePath) => path_1.default.isAbsolute(filePath) ? filePath : path_1.default.resolve(base, filePath);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Find first already exists file.
3
- * @param files - Asbolute file paths with extension.
3
+ * @param files - Absolute file paths with extension.
4
4
  * @returns The file path if exists, or false if no file exists.
5
5
  */
6
6
  export declare const findExists: (files: string[]) => string | false;
@@ -7,7 +7,7 @@ exports.findExists = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  /**
9
9
  * Find first already exists file.
10
- * @param files - Asbolute file paths with extension.
10
+ * @param files - Absolute file paths with extension.
11
11
  * @returns The file path if exists, or false if no file exists.
12
12
  */
13
13
  const findExists = (files) => {
package/dist/format.js CHANGED
@@ -92,13 +92,13 @@ function formatWebpackMessages(json) {
92
92
  exports.formatWebpackMessages = formatWebpackMessages;
93
93
  /* eslint-enable no-param-reassign */
94
94
  function formatProxyOptions(proxyOptions) {
95
- const formatedProxy = [];
95
+ const formattedProxy = [];
96
96
  if (!Array.isArray(proxyOptions)) {
97
97
  if ('target' in proxyOptions) {
98
- formatedProxy.push(proxyOptions);
98
+ formattedProxy.push(proxyOptions);
99
99
  }
100
100
  else {
101
- Array.prototype.push.apply(formatedProxy, Object.keys(proxyOptions).reduce((total, source) => {
101
+ Array.prototype.push.apply(formattedProxy, Object.keys(proxyOptions).reduce((total, source) => {
102
102
  const option = proxyOptions[source];
103
103
  total.push({
104
104
  context: source,
@@ -111,8 +111,8 @@ function formatProxyOptions(proxyOptions) {
111
111
  }
112
112
  }
113
113
  else {
114
- formatedProxy.push(...proxyOptions);
114
+ formattedProxy.push(...proxyOptions);
115
115
  }
116
- return formatedProxy;
116
+ return formattedProxy;
117
117
  }
118
118
  exports.formatProxyOptions = formatProxyOptions;
package/dist/monorepo.js CHANGED
@@ -8,16 +8,16 @@ const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const compiled_1 = require("./compiled");
10
10
  const PACKAGE_MAX_DEPTH = 5;
11
- const WOKRSPACES_FILES = {
11
+ const WORKSPACES_FILES = {
12
12
  YARN: 'package.json',
13
13
  PNPM: 'pnpm-workspaces.yaml',
14
14
  LERNA: 'lerna.json',
15
15
  };
16
- const isLerna = (root) => fs_1.default.existsSync(path_1.default.join(root, WOKRSPACES_FILES.LERNA));
16
+ const isLerna = (root) => fs_1.default.existsSync(path_1.default.join(root, WORKSPACES_FILES.LERNA));
17
17
  exports.isLerna = isLerna;
18
18
  const isYarnWorkspaces = (root) => {
19
19
  var _a;
20
- const pkg = path_1.default.join(root, WOKRSPACES_FILES.YARN);
20
+ const pkg = path_1.default.join(root, WORKSPACES_FILES.YARN);
21
21
  if (!fs_1.default.existsSync(pkg)) {
22
22
  return false;
23
23
  }
@@ -25,7 +25,7 @@ const isYarnWorkspaces = (root) => {
25
25
  return Boolean((_a = json.workspaces) === null || _a === void 0 ? void 0 : _a.packages);
26
26
  };
27
27
  exports.isYarnWorkspaces = isYarnWorkspaces;
28
- const isPnpmWorkspaces = (root) => fs_1.default.existsSync(path_1.default.join(root, WOKRSPACES_FILES.PNPM));
28
+ const isPnpmWorkspaces = (root) => fs_1.default.existsSync(path_1.default.join(root, WORKSPACES_FILES.PNPM));
29
29
  exports.isPnpmWorkspaces = isPnpmWorkspaces;
30
30
  const isMonorepo = (root) => (0, exports.isLerna)(root) || (0, exports.isYarnWorkspaces)(root) || (0, exports.isPnpmWorkspaces)(root);
31
31
  exports.isMonorepo = isMonorepo;
@@ -62,7 +62,7 @@ const getMonorepoPackages = (root) => {
62
62
  ({ packages } = json);
63
63
  }
64
64
  else {
65
- ({ packages } = compiled_1.yaml.load(fs_1.default.readFileSync(path_1.default.join(root, WOKRSPACES_FILES.PNPM), 'utf8')));
65
+ ({ packages } = compiled_1.yaml.load(fs_1.default.readFileSync(path_1.default.join(root, WORKSPACES_FILES.PNPM), 'utf8')));
66
66
  }
67
67
  if (packages) {
68
68
  return packages
@@ -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 rendered as static HTML\n');
60
+ message += compiled_1.chalk.cyanBright(' ○ (Static) client-side renders as static HTML\n');
61
61
  }
62
62
  return message;
63
63
  };
@@ -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 fromat error.
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 fromat error.
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/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.7.0",
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",
@@ -19,31 +19,10 @@
19
19
  "jsnext:modern": "./dist/index.js",
20
20
  "_comment": "Provide ESM and CJS exports, ESM is used by runtime package, for treeshaking",
21
21
  "exports": {
22
- ".": {
23
- "jsnext:source": "./src/index.ts",
24
- "default": "./dist/index.js"
25
- },
26
- "./format": {
27
- "jsnext:source": "./src/format.ts",
28
- "default": "./dist/format.js"
29
- },
30
- "./constants": {
31
- "jsnext:source": "./src/constants.ts",
32
- "default": "./dist/constants.js"
33
- },
34
- "./ssr": {
35
- "jsnext:source": "./src/ssr.ts",
36
- "default": "./dist/ssr.js"
37
- },
38
- "./chalk": "./compiled/chalk/index.js",
39
- "./json5": "./compiled/json5/index.js",
40
- "./semver": "./compiled/semver/index.js",
41
- "./lodash": "./compiled/lodash/index.js",
42
- "./globby": "./compiled/globby/index.js",
43
- "./fast-glob": "./compiled/fast-glob/index.js",
44
- "./gzip-size": "./compiled/gzip-size/index.js",
45
- "./mime-types": "./compiled/mime-types/index.js",
46
- "./strip-ansi": "./compiled/strip-ansi/index.js"
22
+ ".": "./dist/index.js",
23
+ "./format": "./dist/format.js",
24
+ "./constants": "./dist/constants.js",
25
+ "./ssr": "./dist/ssr.js"
47
26
  },
48
27
  "typesVersions": {
49
28
  "*": {