umi 4.0.0-beta.9 → 4.0.0-rc.3

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.
package/bin/forkedDev.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('v8-compile-cache');
3
+ // require('v8-compile-cache');
4
4
  require('../dist/cli/forkedDev');
package/bin/umi.js CHANGED
@@ -1,6 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('v8-compile-cache');
3
+ // disable since it's conflicted with typescript cjs + dynamic import
4
+ // require('v8-compile-cache');
5
+
6
+ // patch console for debug
7
+ // ref: https://remysharp.com/2014/05/23/where-is-that-console-log
8
+ if (process.env.DEBUG_CONSOLE) {
9
+ ['log', 'warn', 'error'].forEach((method) => {
10
+ const old = console[method];
11
+ console[method] = function () {
12
+ let stack = new Error().stack.split(/\n/);
13
+ // Chrome includes a single "Error" line, FF doesn't.
14
+ if (stack[0].indexOf('Error') === 0) {
15
+ stack = stack.slice(1);
16
+ }
17
+ const args = [].slice.apply(arguments).concat([stack[1].trim()]);
18
+ return old.apply(console, args);
19
+ };
20
+ });
21
+ }
22
+
4
23
  require('../dist/cli/cli')
5
24
  .run()
6
25
  .catch((e) => {
@@ -0,0 +1 @@
1
+ export declare function defineConfig(config: any): any;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineConfig = void 0;
4
+ function defineConfig(config) {
5
+ return config;
6
+ }
7
+ exports.defineConfig = defineConfig;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { IServicePluginAPI, PluginAPI } from '@umijs/core';
2
- import * as utils from '@umijs/utils';
3
- export declare type IApi = PluginAPI & IServicePluginAPI;
2
+ export { defineConfig } from './defineConfig';
4
3
  export * from './service/service';
5
- export { utils };
4
+ export declare type IApi = PluginAPI & IServicePluginAPI;
package/dist/index.js CHANGED
@@ -6,23 +6,11 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
6
6
  if (k2 === undefined) k2 = k;
7
7
  o[k2] = m[k];
8
8
  }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
9
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
11
  };
24
12
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.utils = void 0;
26
- const utils = __importStar(require("@umijs/utils"));
27
- exports.utils = utils;
13
+ exports.defineConfig = void 0;
14
+ var defineConfig_1 = require("./defineConfig");
15
+ Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return defineConfig_1.defineConfig; } });
28
16
  __exportStar(require("./service/service"), exports);
@@ -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);
package/dist/test.d.ts ADDED
@@ -0,0 +1,117 @@
1
+ import { Config } from '@umijs/test';
2
+ export * from '@umijs/test';
3
+ export declare function configUmiAlias(config: Config.InitialOptions): Promise<Partial<{
4
+ automock: boolean;
5
+ bail: number | boolean;
6
+ cache: boolean;
7
+ cacheDirectory: string;
8
+ ci: boolean;
9
+ clearMocks: boolean;
10
+ changedFilesWithAncestor: boolean;
11
+ changedSince: string;
12
+ collectCoverage: boolean;
13
+ collectCoverageFrom: string[];
14
+ collectCoverageOnlyFrom: {
15
+ [key: string]: boolean;
16
+ };
17
+ coverageDirectory: string;
18
+ coveragePathIgnorePatterns: string[];
19
+ coverageProvider: "babel" | "v8";
20
+ coverageReporters: Config.CoverageReporters;
21
+ coverageThreshold: {
22
+ [path: string]: Config.CoverageThresholdValue;
23
+ global: Config.CoverageThresholdValue;
24
+ };
25
+ dependencyExtractor: string;
26
+ detectLeaks: boolean;
27
+ detectOpenHandles: boolean;
28
+ displayName: string | Config.DisplayName;
29
+ expand: boolean;
30
+ extensionsToTreatAsEsm: string[];
31
+ extraGlobals: string[];
32
+ filter: string;
33
+ findRelatedTests: boolean;
34
+ forceCoverageMatch: string[];
35
+ forceExit: boolean;
36
+ json: boolean;
37
+ globals: Config.ConfigGlobals;
38
+ globalSetup: string | null | undefined;
39
+ globalTeardown: string | null | undefined;
40
+ haste: Config.HasteConfig;
41
+ injectGlobals: boolean;
42
+ reporters: (string | Config.ReporterConfig)[];
43
+ logHeapUsage: boolean;
44
+ lastCommit: boolean;
45
+ listTests: boolean;
46
+ maxConcurrency: number;
47
+ maxWorkers: string | number;
48
+ moduleDirectories: string[];
49
+ moduleFileExtensions: string[];
50
+ moduleLoader: string;
51
+ moduleNameMapper: {
52
+ [key: string]: string | string[];
53
+ };
54
+ modulePathIgnorePatterns: string[];
55
+ modulePaths: string[];
56
+ name: string;
57
+ noStackTrace: boolean;
58
+ notify: boolean;
59
+ notifyMode: string;
60
+ onlyChanged: boolean;
61
+ onlyFailures: boolean;
62
+ outputFile: string;
63
+ passWithNoTests: boolean;
64
+ preprocessorIgnorePatterns: string[];
65
+ preset: string | null | undefined;
66
+ prettierPath: string | null | undefined;
67
+ projects: (string | Config.InitialProjectOptions)[];
68
+ replname: string | null | undefined;
69
+ resetMocks: boolean;
70
+ resetModules: boolean;
71
+ resolver: string | null | undefined;
72
+ restoreMocks: boolean;
73
+ rootDir: string;
74
+ roots: string[];
75
+ runner: string;
76
+ runTestsByPath: boolean;
77
+ scriptPreprocessor: string;
78
+ setupFiles: string[];
79
+ setupTestFrameworkScriptFile: string;
80
+ setupFilesAfterEnv: string[];
81
+ silent: boolean;
82
+ skipFilter: boolean;
83
+ skipNodeResolution: boolean;
84
+ slowTestThreshold: number;
85
+ snapshotResolver: string;
86
+ snapshotSerializers: string[];
87
+ snapshotFormat: Config.PrettyFormatOptions;
88
+ errorOnDeprecated: boolean;
89
+ testEnvironment: string;
90
+ testEnvironmentOptions: Record<string, unknown>;
91
+ testFailureExitCode: string | number;
92
+ testLocationInResults: boolean;
93
+ testMatch: string[];
94
+ testNamePattern: string;
95
+ testPathDirs: string[];
96
+ testPathIgnorePatterns: string[];
97
+ testRegex: string | string[];
98
+ testResultsProcessor: string;
99
+ testRunner: string;
100
+ testSequencer: string;
101
+ testURL: string;
102
+ testTimeout: number;
103
+ timers: "real" | "fake" | "modern" | "legacy";
104
+ transform: {
105
+ [regex: string]: string | Config.TransformerConfig;
106
+ };
107
+ transformIgnorePatterns: string[];
108
+ watchPathIgnorePatterns: string[];
109
+ unmockedModulePathPatterns: string[];
110
+ updateSnapshot: boolean;
111
+ useStderr: boolean;
112
+ verbose?: boolean | undefined;
113
+ watch: boolean;
114
+ watchAll: boolean;
115
+ watchman: boolean;
116
+ watchPlugins: (string | [string, Record<string, unknown>])[];
117
+ }>>;
package/dist/test.js ADDED
@@ -0,0 +1,58 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.configUmiAlias = void 0;
23
+ const fs_1 = require("fs");
24
+ const service_1 = require("./service/service");
25
+ __exportStar(require("@umijs/test"), exports);
26
+ function getAliasPathWithKey(alias, key) {
27
+ const thePath = alias[key];
28
+ if (alias[thePath]) {
29
+ return getAliasPathWithKey(alias, thePath);
30
+ }
31
+ return thePath;
32
+ }
33
+ let service;
34
+ function configUmiAlias(config) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ if (!service) {
37
+ service = new service_1.Service();
38
+ yield service.run2({
39
+ name: 'setup',
40
+ args: { quiet: true },
41
+ });
42
+ }
43
+ config.moduleNameMapper || (config.moduleNameMapper = {});
44
+ const { alias } = service.config;
45
+ for (const key of Object.keys(alias)) {
46
+ const aliasPath = getAliasPathWithKey(alias, key);
47
+ if ((0, fs_1.existsSync)(aliasPath) && (0, fs_1.statSync)(aliasPath).isDirectory()) {
48
+ config.moduleNameMapper[`^${key}/(.*)$`] = `${aliasPath}/$1`;
49
+ config.moduleNameMapper[`^${key}$`] = aliasPath;
50
+ }
51
+ else {
52
+ config.moduleNameMapper[`^${key}$`] = aliasPath;
53
+ }
54
+ }
55
+ return config;
56
+ });
57
+ }
58
+ exports.configUmiAlias = configUmiAlias;
package/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
+ export * from '@@/exports';
1
2
  export type { IApi } from '@umijs/preset-umi';
2
- export * from '@umijs/renderer-react';
3
- export * from './dist/index';
3
+ export * from './dist';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umi",
3
- "version": "4.0.0-beta.9",
3
+ "version": "4.0.0-rc.3",
4
4
  "description": "umi",
5
5
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/umi#readme",
6
6
  "bugs": "https://github.com/umijs/umi-next/issues",
@@ -10,7 +10,6 @@
10
10
  },
11
11
  "license": "MIT",
12
12
  "main": "dist/index.js",
13
- "module": "index.esm.js",
14
13
  "types": "index.d.ts",
15
14
  "bin": {
16
15
  "umi": "bin/umi.js"
@@ -20,7 +19,10 @@
20
19
  "index.d.ts",
21
20
  "index.esm.js",
22
21
  "client",
23
- "bin"
22
+ "bin",
23
+ "plugin.js",
24
+ "plugin-utils.d.ts",
25
+ "plugin-utils.js"
24
26
  ],
25
27
  "scripts": {
26
28
  "build": "pnpm tsc",
@@ -29,11 +31,11 @@
29
31
  "dev": "pnpm build -- --watch"
30
32
  },
31
33
  "dependencies": {
32
- "@umijs/core": "4.0.0-beta.9",
33
- "@umijs/preset-umi": "4.0.0-beta.9",
34
- "@umijs/renderer-react": "4.0.0-beta.9",
35
- "@umijs/utils": "4.0.0-beta.9",
36
- "v8-compile-cache": "2.3.0"
34
+ "@umijs/core": "4.0.0-rc.3",
35
+ "@umijs/preset-umi": "4.0.0-rc.3",
36
+ "@umijs/renderer-react": "4.0.0-rc.3",
37
+ "@umijs/test": "4.0.0-rc.3",
38
+ "@umijs/utils": "4.0.0-rc.3"
37
39
  },
38
40
  "publishConfig": {
39
41
  "access": "public"
@@ -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';
package/index.esm.js DELETED
@@ -1,2 +0,0 @@
1
- export { Link, Outlet } from '@umijs/renderer-react';
2
- export { PluginManager } from './client/client/plugin';