umi 4.0.0-rc.2 → 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.
@@ -1,4 +1,4 @@
1
- export declare const MIN_NODE_VERSION = 16;
1
+ export declare const MIN_NODE_VERSION = 14;
2
2
  export declare const EXCLUDE_NODE_VERSION = 15;
3
3
  export declare const DEV_COMMAND = "dev";
4
4
  export declare const DEFAULT_CONFIG_FILES: string[];
package/dist/constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FRAMEWORK_NAME = exports.DEFAULT_CONFIG_FILES = exports.DEV_COMMAND = exports.EXCLUDE_NODE_VERSION = exports.MIN_NODE_VERSION = void 0;
4
- exports.MIN_NODE_VERSION = 16;
4
+ exports.MIN_NODE_VERSION = 14;
5
5
  exports.EXCLUDE_NODE_VERSION = 15;
6
6
  exports.DEV_COMMAND = 'dev';
7
7
  exports.DEFAULT_CONFIG_FILES = [
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umi",
3
- "version": "4.0.0-rc.2",
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",
@@ -31,10 +31,11 @@
31
31
  "dev": "pnpm build -- --watch"
32
32
  },
33
33
  "dependencies": {
34
- "@umijs/core": "4.0.0-rc.2",
35
- "@umijs/preset-umi": "4.0.0-rc.2",
36
- "@umijs/renderer-react": "4.0.0-rc.2",
37
- "@umijs/utils": "4.0.0-rc.2"
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"
38
39
  },
39
40
  "publishConfig": {
40
41
  "access": "public"