@umijs/preset-umi 4.0.65 → 4.0.66

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.
@@ -84,21 +84,12 @@ var ComponentGenerator = class {
84
84
  capitalizeName
85
85
  );
86
86
  const { _, eject: _eject, fallback, ...restArgs } = args;
87
- const indexFile = (0, import_path.join)(base, "index.ts");
88
- const compFile = (0, import_path.join)(base, `${capitalizeName}.tsx`);
89
87
  await (0, import_utils2.processGenerateFiles)({
90
88
  filesMap: [
91
89
  {
92
- from: (0, import_path.join)(appRoot, USER_TEMPLATE_COMP_DIR, "index"),
93
- fromFallback: INDEX_TPL,
94
- to: indexFile,
95
- exts: [".ts.tpl", ".ts", "tsx.tpl", "tsx"]
96
- },
97
- {
98
- from: (0, import_path.join)(appRoot, USER_TEMPLATE_COMP_DIR, "component"),
99
- fromFallback: COMP_TPL,
100
- to: compFile,
101
- exts: [".tsx.tpl", ".tsx"]
90
+ from: (0, import_path.join)(appRoot, USER_TEMPLATE_COMP_DIR),
91
+ fromFallback: COMP_TEMPLATE_DIR,
92
+ to: base
102
93
  }
103
94
  ],
104
95
  baseDir: appRoot,
@@ -112,8 +103,7 @@ var ComponentGenerator = class {
112
103
  });
113
104
  }
114
105
  };
115
- var INDEX_TPL = (0, import_path.join)(import_constants.TEMPLATES_DIR, "generate/component/index.ts.tpl");
116
- var COMP_TPL = (0, import_path.join)(import_constants.TEMPLATES_DIR, "generate/component/component.tsx.tpl");
106
+ var COMP_TEMPLATE_DIR = (0, import_path.join)(import_constants.TEMPLATES_DIR, "generate/component");
117
107
  var USER_TEMPLATE_COMP_DIR = "templates/component";
118
108
  // Annotate the CommonJS export names for ESM import in node:
119
109
  0 && (module.exports = {
@@ -39,11 +39,11 @@ var verify_commit_default = (api) => {
39
39
  api.describe({
40
40
  key: "verifyCommit",
41
41
  config: {
42
- schema(Joi) {
43
- return Joi.object({
44
- scope: Joi.array().items(Joi.string()),
45
- allowEmoji: Joi.boolean()
46
- });
42
+ schema({ zod }) {
43
+ return zod.object({
44
+ scope: zod.array(zod.string()),
45
+ allowEmoji: zod.boolean()
46
+ }).deepPartial();
47
47
  }
48
48
  }
49
49
  });
@@ -145,7 +145,7 @@ var icons_default = (api) => {
145
145
  const localIcons = [];
146
146
  if (import_fs.default.existsSync(localIconDir)) {
147
147
  localIcons.push(
148
- ...import_fs.default.readdirSync(localIconDir).filter((file) => file.endsWith(".svg")).map((file) => file.replace(/\.svg$/, ""))
148
+ ...readIconsFromDir(localIconDir).filter((file) => file.endsWith(".svg")).map((file) => file.replace(/\.svg$/, ""))
149
149
  );
150
150
  }
151
151
  api.writeTmpFile({
@@ -385,7 +385,7 @@ function normalizeRotate(rotate: number | string) {
385
385
  }
386
386
 
387
387
  function camelCase(str: string) {
388
- return str.replace(/-([a-z]|[1-9])/g, (g) => g[1].toUpperCase());
388
+ return str.replace(/\\//g, '-').replace(/-([a-zA-Z]|[1-9])/g, (g) => g[1].toUpperCase());
389
389
  }
390
390
 
391
391
  function normalizeIconName(name: string) {
@@ -433,5 +433,22 @@ function normalizeIconName(name: string) {
433
433
  return import_path.default.join(api.paths.absSrcPath, "icons");
434
434
  }
435
435
  };
436
+ function readIconsFromDir(dir) {
437
+ const icons = [];
438
+ const prefix = (0, import_utils.winPath)(import_path.default.join(dir, "./"));
439
+ const collect = (p) => {
440
+ if (import_fs.default.statSync(p).isDirectory()) {
441
+ const files = import_fs.default.readdirSync(p);
442
+ files.forEach((name) => {
443
+ collect(import_path.default.join(p, name));
444
+ });
445
+ } else {
446
+ const prunePath = (0, import_utils.winPath)(p).replace(prefix, "");
447
+ icons.push(prunePath);
448
+ }
449
+ };
450
+ collect(dir);
451
+ return icons;
452
+ }
436
453
  // Annotate the CommonJS export names for ESM import in node:
437
454
  0 && (module.exports = {});
@@ -38,7 +38,7 @@ var import_fs = __toESM(require("fs"));
38
38
  var import_path = __toESM(require("path"));
39
39
  var import_loadIcon = require("./loadIcon");
40
40
  function camelCase(str) {
41
- return str.replace(/-([a-z]|[0-9])/g, (g) => g[1].toUpperCase());
41
+ return str.replace(/\//g, "-").replace(/-([a-zA-Z]|[0-9])/g, (g) => g[1].toUpperCase());
42
42
  }
43
43
  function generateIconName(opts) {
44
44
  return camelCase(`${opts.collect}-${opts.icon}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/preset-umi",
3
- "version": "4.0.65",
3
+ "version": "4.0.66",
4
4
  "description": "@umijs/preset-umi",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/preset-umi#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -37,20 +37,20 @@
37
37
  "react-router": "6.3.0",
38
38
  "react-router-dom": "6.3.0",
39
39
  "regenerator-runtime": "0.13.11",
40
- "@umijs/ast": "4.0.65",
41
- "@umijs/babel-preset-umi": "4.0.65",
42
- "@umijs/bundler-vite": "4.0.65",
43
- "@umijs/core": "4.0.65",
44
- "@umijs/did-you-know": "1.0.3",
45
- "@umijs/mfsu": "4.0.65",
46
- "@umijs/renderer-react": "4.0.65",
47
- "@umijs/bundler-utils": "4.0.65",
48
- "@umijs/bundler-webpack": "4.0.65",
40
+ "@umijs/ast": "4.0.66",
41
+ "@umijs/babel-preset-umi": "4.0.66",
42
+ "@umijs/bundler-utils": "4.0.66",
43
+ "@umijs/bundler-vite": "4.0.66",
44
+ "@umijs/bundler-webpack": "4.0.66",
45
+ "@umijs/core": "4.0.66",
46
+ "@umijs/mfsu": "4.0.66",
47
+ "@umijs/plugin-run": "4.0.66",
48
+ "@umijs/renderer-react": "4.0.66",
49
+ "@umijs/server": "4.0.66",
50
+ "@umijs/utils": "4.0.66",
51
+ "@umijs/zod2ts": "4.0.66",
49
52
  "@umijs/ui": "3.0.0-alpha.0",
50
- "@umijs/utils": "4.0.65",
51
- "@umijs/zod2ts": "4.0.65",
52
- "@umijs/plugin-run": "4.0.65",
53
- "@umijs/server": "4.0.65"
53
+ "@umijs/did-you-know": "1.0.3"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@manypkg/get-packages": "1.1.3",