@umijs/utils 4.0.7 → 4.0.10

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.
@@ -1,21 +1,45 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
4
10
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_1 = require("fs");
7
- const path_1 = require("path");
8
- const deepmerge_1 = __importDefault(require("../compiled/deepmerge"));
9
- const prettier_1 = __importDefault(require("../compiled/prettier"));
10
- function updatePackageJSON({ opts, cwd = process.cwd(), }) {
11
- const packageJsonPath = (0, path_1.resolve)(cwd, 'package.json');
12
- const pkg = require(packageJsonPath);
13
- const projectPkg = (0, deepmerge_1.default)(pkg, opts);
14
- (0, fs_1.writeFileSync)(packageJsonPath,
15
- // 删除一个包之后 json会多了一些空行。sortPackage 可以删除掉并且排序
16
- // prettier 会容忍一个空行
17
- prettier_1.default.format(JSON.stringify(projectPkg), {
18
- parser: 'json',
19
- }));
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/updatePackageJSON.ts
23
+ var updatePackageJSON_exports = {};
24
+ __export(updatePackageJSON_exports, {
25
+ default: () => updatePackageJSON_default
26
+ });
27
+ module.exports = __toCommonJS(updatePackageJSON_exports);
28
+ var import_fs = require("fs");
29
+ var import_path = require("path");
30
+ var import_deepmerge = __toESM(require("../compiled/deepmerge"));
31
+ var import_prettier = __toESM(require("../compiled/prettier"));
32
+ function updatePackageJSON({
33
+ opts,
34
+ cwd = process.cwd()
35
+ }) {
36
+ const packageJsonPath = (0, import_path.resolve)(cwd, "package.json");
37
+ const pkg = require(packageJsonPath);
38
+ const projectPkg = (0, import_deepmerge.default)(pkg, opts);
39
+ (0, import_fs.writeFileSync)(packageJsonPath, import_prettier.default.format(JSON.stringify(projectPkg), {
40
+ parser: "json"
41
+ }));
20
42
  }
21
- exports.default = updatePackageJSON;
43
+ var updatePackageJSON_default = updatePackageJSON;
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {});
package/dist/winPath.js CHANGED
@@ -1,11 +1,35 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.winPath = void 0;
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/winPath.ts
20
+ var winPath_exports = {};
21
+ __export(winPath_exports, {
22
+ winPath: () => winPath
23
+ });
24
+ module.exports = __toCommonJS(winPath_exports);
4
25
  function winPath(path) {
5
- const isExtendedLengthPath = /^\\\\\?\\/.test(path);
6
- if (isExtendedLengthPath) {
7
- return path;
8
- }
9
- return path.replace(/\\/g, '/');
26
+ const isExtendedLengthPath = /^\\\\\?\\/.test(path);
27
+ if (isExtendedLengthPath) {
28
+ return path;
29
+ }
30
+ return path.replace(/\\/g, "/");
10
31
  }
11
- exports.winPath = winPath;
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ winPath
35
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/utils",
3
- "version": "4.0.7",
3
+ "version": "4.0.10",
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": {
@@ -15,9 +15,9 @@
15
15
  "compiled"
16
16
  ],
17
17
  "scripts": {
18
- "build": "pnpm tsc",
18
+ "build": "umi-scripts father build",
19
19
  "build:deps": "umi-scripts bundleDeps",
20
- "dev": "pnpm build --watch",
20
+ "dev": "umi-scripts father dev",
21
21
  "test": "umi-scripts jest-turbo"
22
22
  },
23
23
  "dependencies": {