@umijs/utils 4.0.53 → 4.0.55

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.
Files changed (31) hide show
  1. package/compiled/@ampproject/remapping/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts +70 -0
  2. package/compiled/@ampproject/remapping/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts +12 -0
  3. package/compiled/@ampproject/remapping/@jridgewell/gen-mapping/dist/types/types.d.ts +35 -0
  4. package/compiled/@ampproject/remapping/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +16 -0
  5. package/compiled/@ampproject/remapping/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +74 -0
  6. package/compiled/@ampproject/remapping/@jridgewell/trace-mapping/dist/types/types.d.ts +92 -0
  7. package/compiled/@ampproject/remapping/LICENSE +202 -0
  8. package/compiled/@ampproject/remapping/dist/types/remapping.d.ts +19 -0
  9. package/compiled/@ampproject/remapping/dist/types/source-map.d.ts +17 -0
  10. package/compiled/@ampproject/remapping/dist/types/types.d.ts +14 -0
  11. package/compiled/@ampproject/remapping/index.js +1 -0
  12. package/compiled/@ampproject/remapping/package.json +1 -0
  13. package/compiled/magic-string/LICENSE +7 -0
  14. package/compiled/magic-string/index.d.ts +250 -0
  15. package/compiled/magic-string/index.js +1 -0
  16. package/compiled/magic-string/package.json +1 -0
  17. package/compiled/tsconfig-paths/LICENSE +21 -0
  18. package/compiled/tsconfig-paths/index.js +1 -0
  19. package/compiled/tsconfig-paths/lib/index.d.ts +5 -0
  20. package/compiled/tsconfig-paths/package.json +1 -0
  21. package/dist/BaseGenerator/BaseGenerator.js +0 -4
  22. package/dist/Generator/Generator.js +0 -4
  23. package/dist/index.d.ts +5 -1
  24. package/dist/index.js +10 -0
  25. package/dist/logger.js +8 -3
  26. package/dist/npmClient.js +0 -4
  27. package/dist/readDirFiles.d.ts +9 -0
  28. package/dist/readDirFiles.js +62 -0
  29. package/dist/register.js +0 -2
  30. package/dist/updatePackageJSON.js +7 -4
  31. package/package.json +11 -4
@@ -0,0 +1,62 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/readDirFiles.ts
20
+ var readDirFiles_exports = {};
21
+ __export(readDirFiles_exports, {
22
+ readDirFiles: () => readDirFiles
23
+ });
24
+ module.exports = __toCommonJS(readDirFiles_exports);
25
+ var import_path = require("path");
26
+ var import_fs_extra = require("../compiled/fs-extra");
27
+ var readDirFiles = (opts) => {
28
+ const { dir, exclude = [] } = opts;
29
+ const list = [];
30
+ const recursiveReadFiles = (p) => {
31
+ if (!(0, import_fs_extra.existsSync)(p)) {
32
+ return;
33
+ }
34
+ const isFile = (0, import_fs_extra.statSync)(p).isFile();
35
+ if (isFile) {
36
+ const name = (0, import_path.basename)(p);
37
+ list.push({
38
+ filePath: p,
39
+ name
40
+ });
41
+ return;
42
+ }
43
+ const files = (0, import_fs_extra.readdirSync)(p).filter((name) => {
44
+ return name !== ".DS_Store";
45
+ }).map((file) => {
46
+ const absolutePath = (0, import_path.join)(p, file);
47
+ return absolutePath;
48
+ }).filter((file) => {
49
+ const isExclude = exclude.some((reg) => reg.test(file));
50
+ return !isExclude;
51
+ });
52
+ files.forEach((file) => {
53
+ recursiveReadFiles(file);
54
+ });
55
+ };
56
+ recursiveReadFiles(dir);
57
+ return list;
58
+ };
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ readDirFiles
62
+ });
package/dist/register.js CHANGED
@@ -42,8 +42,6 @@ function transform(opts) {
42
42
  return implementor.transformSync(code, {
43
43
  sourcefile: filename,
44
44
  loader: ext.slice(1),
45
- // consistent with `tsconfig.base.json`
46
- // https://github.com/umijs/umi-next/pull/729
47
45
  target: "es2019",
48
46
  format: "cjs",
49
47
  logLevel: "error"
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -31,7 +35,6 @@ module.exports = __toCommonJS(updatePackageJSON_exports);
31
35
  var import_fs = require("fs");
32
36
  var import_path = require("path");
33
37
  var import_deepmerge = __toESM(require("../compiled/deepmerge"));
34
- var import_prettier = __toESM(require("../compiled/prettier"));
35
38
  function updatePackageJSON({
36
39
  opts,
37
40
  cwd = process.cwd()
@@ -41,9 +44,9 @@ function updatePackageJSON({
41
44
  const projectPkg = (0, import_deepmerge.default)(pkg, opts);
42
45
  (0, import_fs.writeFileSync)(
43
46
  packageJsonPath,
44
- import_prettier.default.format(JSON.stringify(projectPkg), {
45
- parser: "json"
46
- })
47
+ `${JSON.stringify(projectPkg, null, 2)}
48
+ `,
49
+ "utf-8"
47
50
  );
48
51
  }
49
52
  var updatePackageJSON_default = updatePackageJSON;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/utils",
3
- "version": "4.0.53",
3
+ "version": "4.0.55",
4
4
  "homepage": "https://github.com/umijs/umi/tree/master/packages/utils#readme",
5
5
  "bugs": "https://github.com/umijs/umi/issues",
6
6
  "repository": {
@@ -25,6 +25,7 @@
25
25
  "pino": "7.11.0"
26
26
  },
27
27
  "devDependencies": {
28
+ "@ampproject/remapping": "2.2.0",
28
29
  "@clack/prompts": "0.2.2",
29
30
  "@hapi/joi": "17.1.1",
30
31
  "@types/color": "3.0.3",
@@ -54,16 +55,18 @@
54
55
  "gzip-size": "7.0.0",
55
56
  "import-lazy": "4.0.0",
56
57
  "lodash": "4.17.21",
58
+ "magic-string": "0.27.0",
57
59
  "mustache": "4.2.0",
58
60
  "pirates": "4.0.5",
59
61
  "pkg-up": "4.0.0",
60
62
  "portfinder": "1.0.32",
61
- "prettier": "2.8.2",
63
+ "prettier": "2.8.4",
62
64
  "prompts": "2.4.2",
63
65
  "resolve": "1.22.0",
64
66
  "rimraf": "3.0.2",
65
67
  "semver": "7.3.8",
66
68
  "strip-ansi": "7.0.1",
69
+ "tsconfig-paths": "4.1.2",
67
70
  "yargs-parser": "21.1.1"
68
71
  },
69
72
  "publishConfig": {
@@ -99,7 +102,10 @@
99
102
  "yargs-parser",
100
103
  "pirates",
101
104
  "@hapi/joi",
102
- "@clack/prompts"
105
+ "@clack/prompts",
106
+ "magic-string",
107
+ "@ampproject/remapping",
108
+ "tsconfig-paths"
103
109
  ],
104
110
  "externals": {
105
111
  "address": "$$LOCAL",
@@ -121,7 +127,8 @@
121
127
  "strip-ansi": "$$LOCAL",
122
128
  "yargs-parser": "$$LOCAL",
123
129
  "pirates": "$$LOCAL",
124
- "@hapi/joi": "$$LOCAL"
130
+ "@hapi/joi": "$$LOCAL",
131
+ "tsconfig-paths": "$$LOCAL"
125
132
  }
126
133
  }
127
134
  }