umi 4.0.0-beta.1 → 4.0.0-beta.13

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.
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('v8-compile-cache');
4
+ require('../dist/cli/forkedDev');
package/bin/umi.js ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('v8-compile-cache');
4
+ require('../dist/cli/cli')
5
+ .run()
6
+ .catch((e) => {
7
+ console.error(e);
8
+ process.exit(1);
9
+ });
package/dist/cli/cli.d.ts CHANGED
@@ -1 +1,5 @@
1
+ interface IOpts {
2
+ presets?: string[];
3
+ }
4
+ export declare function run(opts?: IOpts): Promise<void>;
1
5
  export {};
package/dist/cli/cli.js CHANGED
@@ -9,43 +9,50 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.run = void 0;
12
13
  const utils_1 = require("@umijs/utils");
13
14
  const constants_1 = require("../constants");
14
15
  const service_1 = require("../service/service");
15
16
  const dev_1 = require("./dev");
16
17
  const node_1 = require("./node");
17
- (0, node_1.checkVersion)();
18
- (0, node_1.checkLocal)();
19
- (0, node_1.setNodeTitle)();
20
- (0, node_1.setNoDeprecation)();
21
- (() => __awaiter(void 0, void 0, void 0, function* () {
22
- const args = (0, utils_1.yParser)(process.argv.slice(2), {
23
- alias: {
24
- version: ['v'],
25
- help: ['h'],
26
- },
27
- boolean: ['version'],
28
- });
29
- const command = args._[0];
30
- if ([constants_1.DEV_COMMAND, 'setup'].includes(command)) {
31
- process.env.NODE_ENV = 'development';
32
- }
33
- else if (command === 'build') {
34
- process.env.NODE_ENV = 'production';
35
- }
36
- if (command === constants_1.DEV_COMMAND) {
37
- (0, dev_1.dev)();
38
- }
39
- else {
40
- try {
41
- yield new service_1.Service().run2({
42
- name: args._[0],
43
- args,
44
- });
18
+ function run(opts) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ (0, node_1.checkVersion)();
21
+ (0, node_1.checkLocal)();
22
+ (0, node_1.setNodeTitle)();
23
+ (0, node_1.setNoDeprecation)();
24
+ const args = (0, utils_1.yParser)(process.argv.slice(2), {
25
+ alias: {
26
+ version: ['v'],
27
+ help: ['h'],
28
+ },
29
+ boolean: ['version'],
30
+ });
31
+ const command = args._[0];
32
+ if ([constants_1.DEV_COMMAND, 'setup'].includes(command)) {
33
+ process.env.NODE_ENV = 'development';
34
+ }
35
+ else if (command === 'build') {
36
+ process.env.NODE_ENV = 'production';
37
+ }
38
+ if (opts === null || opts === void 0 ? void 0 : opts.presets) {
39
+ process.env.UMI_PRESETS = opts.presets.join(',');
45
40
  }
46
- catch (e) {
47
- utils_1.logger.error(e);
48
- process.exit(1);
41
+ if (command === constants_1.DEV_COMMAND) {
42
+ (0, dev_1.dev)();
49
43
  }
50
- }
51
- }))();
44
+ else {
45
+ try {
46
+ yield new service_1.Service().run2({
47
+ name: args._[0],
48
+ args,
49
+ });
50
+ }
51
+ catch (e) {
52
+ utils_1.logger.error(e);
53
+ process.exit(1);
54
+ }
55
+ }
56
+ });
57
+ }
58
+ exports.run = run;
package/dist/cli/node.js CHANGED
@@ -12,7 +12,7 @@ function checkVersion() {
12
12
  }
13
13
  exports.checkVersion = checkVersion;
14
14
  function checkLocal() {
15
- if (__filename.includes('packages/umi')) {
15
+ if (__filename.includes(`packages/${constants_1.FRAMEWORK_NAME}`)) {
16
16
  utils_1.logger.info('@local');
17
17
  }
18
18
  }
@@ -0,0 +1 @@
1
+ export * from '@umijs/utils';
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("@umijs/utils"), exports);
@@ -19,10 +19,7 @@ class Service extends core_1.Service {
19
19
  constructor(opts) {
20
20
  process.env.UMI_DIR = (0, path_1.dirname)(require.resolve('../../package'));
21
21
  const cwd = (0, cwd_1.getCwd)();
22
- super(Object.assign(Object.assign({}, opts), { env: process.env.NODE_ENV, cwd, defaultConfigFiles: constants_1.DEFAULT_CONFIG_FILES, frameworkName: constants_1.FRAMEWORK_NAME, presets: [
23
- require.resolve('@umijs/preset-built-in'),
24
- ...((opts === null || opts === void 0 ? void 0 : opts.presets) || []),
25
- ], plugins: [
22
+ super(Object.assign(Object.assign({}, opts), { env: process.env.NODE_ENV, cwd, defaultConfigFiles: constants_1.DEFAULT_CONFIG_FILES, frameworkName: constants_1.FRAMEWORK_NAME, presets: [require.resolve('@umijs/preset-umi'), ...((opts === null || opts === void 0 ? void 0 : opts.presets) || [])], plugins: [
26
23
  (0, fs_1.existsSync)((0, path_1.join)(cwd, 'plugin.ts')) && (0, path_1.join)(cwd, 'plugin.ts'),
27
24
  (0, fs_1.existsSync)((0, path_1.join)(cwd, 'plugin.js')) && (0, path_1.join)(cwd, 'plugin.js'),
28
25
  ].filter(Boolean) }));
package/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export type { IApi } from '@umijs/preset-built-in';
1
+ export type { IApi } from '@umijs/preset-umi';
2
2
  export * from '@umijs/renderer-react';
3
3
  export * from './dist/index';
package/index.esm.js CHANGED
@@ -1,2 +1,20 @@
1
- export { Link, Outlet } from '@umijs/renderer-react';
1
+ export {
2
+ createSearchParams,
3
+ Link,
4
+ matchPath,
5
+ matchRoutes,
6
+ NavLink,
7
+ Outlet,
8
+ renderClient,
9
+ useAppData,
10
+ useLocation,
11
+ useMatch,
12
+ useNavigate,
13
+ useOutlet,
14
+ useParams,
15
+ useResolvedPath,
16
+ useRouteData,
17
+ useRoutes,
18
+ useSearchParams,
19
+ } from '@umijs/renderer-react';
2
20
  export { PluginManager } from './client/client/plugin';
package/package.json CHANGED
@@ -1,15 +1,29 @@
1
1
  {
2
2
  "name": "umi",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.13",
4
4
  "description": "umi",
5
+ "homepage": "https://github.com/umijs/umi-next/tree/master/packages/umi#readme",
6
+ "bugs": "https://github.com/umijs/umi-next/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/umijs/umi-next"
10
+ },
11
+ "license": "MIT",
5
12
  "main": "dist/index.js",
6
13
  "module": "index.esm.js",
7
14
  "types": "index.d.ts",
15
+ "bin": {
16
+ "umi": "bin/umi.js"
17
+ },
8
18
  "files": [
9
19
  "dist",
10
20
  "index.d.ts",
11
21
  "index.esm.js",
12
- "client"
22
+ "client",
23
+ "bin",
24
+ "plugin.js",
25
+ "plugin-utils.d.ts",
26
+ "plugin-utils.js"
13
27
  ],
14
28
  "scripts": {
15
29
  "build": "pnpm tsc",
@@ -17,24 +31,17 @@
17
31
  "build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
18
32
  "dev": "pnpm build -- --watch"
19
33
  },
20
- "repository": {
21
- "type": "git",
22
- "url": "https://github.com/umijs/umi-next"
34
+ "dependencies": {
35
+ "@umijs/core": "4.0.0-beta.13",
36
+ "@umijs/preset-umi": "4.0.0-beta.13",
37
+ "@umijs/renderer-react": "4.0.0-beta.13",
38
+ "@umijs/utils": "4.0.0-beta.13",
39
+ "v8-compile-cache": "2.3.0"
23
40
  },
24
- "authors": [
25
- "chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
26
- ],
27
- "license": "MIT",
28
- "bugs": "https://github.com/umijs/umi-next/issues",
29
- "homepage": "https://github.com/umijs/umi-next/tree/master/packages/umi#readme",
30
41
  "publishConfig": {
31
42
  "access": "public"
32
43
  },
33
- "dependencies": {
34
- "@umijs/core": "4.0.0-beta.1",
35
- "@umijs/preset-built-in": "4.0.0-beta.1",
36
- "@umijs/renderer-react": "4.0.0-beta.1",
37
- "@umijs/utils": "4.0.0-beta.1",
38
- "v8-compile-cache": "2.3.0"
39
- }
44
+ "authors": [
45
+ "chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
46
+ ]
40
47
  }
@@ -0,0 +1 @@
1
+ export type * from './dist/pluginUtils';
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/pluginUtils');
package/plugin.js ADDED
@@ -0,0 +1 @@
1
+ export { getPluginManager } from '@@/core/plugin';