umi 4.0.0-beta.9 → 4.0.0-canary-20240513.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/LICENSE +21 -0
- package/bin/forkedDev.js +1 -1
- package/bin/umi.js +20 -1
- package/client/client/plugin.js +213 -116
- package/client/client/utils.js +16 -10
- package/dist/cli/cli.js +68 -56
- package/dist/cli/dev.js +49 -23
- package/dist/cli/fork.js +86 -36
- package/dist/cli/forkedDev.js +35 -50
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +45 -12
- package/dist/defineConfig.d.ts +10 -0
- package/dist/defineConfig.js +31 -0
- package/dist/defineMock.d.ts +8 -0
- package/dist/defineMock.js +31 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +39 -26
- package/dist/pluginUtils.d.ts +5 -0
- package/dist/pluginUtils.js +48 -0
- package/dist/service/cwd.js +35 -11
- package/dist/service/requireHook.d.ts +1 -0
- package/dist/service/requireHook.js +14 -0
- package/dist/service/service.js +69 -40
- package/dist/test-setup.d.ts +1 -0
- package/dist/test-setup.js +3 -0
- package/dist/test.d.ts +119 -0
- package/dist/test.js +82 -0
- package/eslint.js +7 -0
- package/index.d.ts +10 -3
- package/package.json +38 -20
- package/plugin-utils.d.ts +1 -0
- package/plugin-utils.js +1 -0
- package/plugin.js +1 -0
- package/prettier.js +13 -0
- package/stylelint.js +7 -0
- package/test-setup.js +1 -0
- package/test.d.ts +1 -0
- package/test.js +1 -0
- package/dist/cli/node.d.ts +0 -4
- package/dist/cli/node.js +0 -32
- package/dist/client/plugin.d.ts +0 -34
- package/dist/client/plugin.js +0 -125
- package/dist/client/utils.d.ts +0 -6
- package/dist/client/utils.js +0 -20
- package/index.esm.js +0 -2
package/dist/service/service.js
CHANGED
|
@@ -1,42 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
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 });
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/service/service.ts
|
|
30
|
+
var service_exports = {};
|
|
31
|
+
__export(service_exports, {
|
|
32
|
+
Service: () => Service
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(service_exports);
|
|
35
|
+
var import_core = require("@umijs/core");
|
|
36
|
+
var import_fs = require("fs");
|
|
37
|
+
var import_path = require("path");
|
|
38
|
+
var import_constants = require("../constants");
|
|
39
|
+
var import_cwd = require("./cwd");
|
|
40
|
+
var Service = class extends import_core.Service {
|
|
41
|
+
constructor(opts) {
|
|
42
|
+
process.env.UMI_DIR = (0, import_path.dirname)(require.resolve("../../package"));
|
|
43
|
+
const cwd = (0, import_cwd.getCwd)();
|
|
44
|
+
require("./requireHook");
|
|
45
|
+
super({
|
|
46
|
+
...opts,
|
|
47
|
+
env: process.env.NODE_ENV,
|
|
48
|
+
cwd,
|
|
49
|
+
defaultConfigFiles: (opts == null ? void 0 : opts.defaultConfigFiles) || import_constants.DEFAULT_CONFIG_FILES,
|
|
50
|
+
frameworkName: (opts == null ? void 0 : opts.frameworkName) || import_constants.FRAMEWORK_NAME,
|
|
51
|
+
presets: [require.resolve("@umijs/preset-umi"), ...(opts == null ? void 0 : opts.presets) || []],
|
|
52
|
+
plugins: [
|
|
53
|
+
(0, import_fs.existsSync)((0, import_path.join)(cwd, "plugin.ts")) && (0, import_path.join)(cwd, "plugin.ts"),
|
|
54
|
+
(0, import_fs.existsSync)((0, import_path.join)(cwd, "plugin.js")) && (0, import_path.join)(cwd, "plugin.js")
|
|
55
|
+
].filter(Boolean)
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async run2(opts) {
|
|
59
|
+
let name = opts.name;
|
|
60
|
+
if ((opts == null ? void 0 : opts.args.version) || name === "v") {
|
|
61
|
+
name = "version";
|
|
62
|
+
} else if ((opts == null ? void 0 : opts.args.help) || !name || name === "h") {
|
|
63
|
+
name = "help";
|
|
40
64
|
}
|
|
41
|
-
}
|
|
42
|
-
|
|
65
|
+
return await this.run({ ...opts, name });
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
Service
|
|
71
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/test.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Config } from '@umijs/test';
|
|
2
|
+
export * from '@umijs/test';
|
|
3
|
+
export declare function getAliasPathWithKey(alias: Record<string, string>, key: string): string;
|
|
4
|
+
export declare function getUmiAlias(): Promise<any>;
|
|
5
|
+
export declare function configUmiAlias(config: Config.InitialOptions): Promise<Partial<{
|
|
6
|
+
automock: boolean;
|
|
7
|
+
bail: number | boolean;
|
|
8
|
+
cache: boolean;
|
|
9
|
+
cacheDirectory: string;
|
|
10
|
+
ci: boolean;
|
|
11
|
+
clearMocks: boolean;
|
|
12
|
+
changedFilesWithAncestor: boolean;
|
|
13
|
+
changedSince: string;
|
|
14
|
+
collectCoverage: boolean;
|
|
15
|
+
collectCoverageFrom: string[];
|
|
16
|
+
collectCoverageOnlyFrom: {
|
|
17
|
+
[key: string]: boolean;
|
|
18
|
+
};
|
|
19
|
+
coverageDirectory: string;
|
|
20
|
+
coveragePathIgnorePatterns: string[];
|
|
21
|
+
coverageProvider: "babel" | "v8";
|
|
22
|
+
coverageReporters: Config.CoverageReporters;
|
|
23
|
+
coverageThreshold: {
|
|
24
|
+
[path: string]: Config.CoverageThresholdValue;
|
|
25
|
+
global: Config.CoverageThresholdValue;
|
|
26
|
+
};
|
|
27
|
+
dependencyExtractor: string;
|
|
28
|
+
detectLeaks: boolean;
|
|
29
|
+
detectOpenHandles: boolean;
|
|
30
|
+
displayName: string | Config.DisplayName;
|
|
31
|
+
expand: boolean;
|
|
32
|
+
extensionsToTreatAsEsm: string[];
|
|
33
|
+
extraGlobals: string[];
|
|
34
|
+
filter: string;
|
|
35
|
+
findRelatedTests: boolean;
|
|
36
|
+
forceCoverageMatch: string[];
|
|
37
|
+
forceExit: boolean;
|
|
38
|
+
json: boolean;
|
|
39
|
+
globals: Config.ConfigGlobals;
|
|
40
|
+
globalSetup: string | null | undefined;
|
|
41
|
+
globalTeardown: string | null | undefined;
|
|
42
|
+
haste: Config.HasteConfig;
|
|
43
|
+
injectGlobals: boolean;
|
|
44
|
+
reporters: (string | Config.ReporterConfig)[];
|
|
45
|
+
logHeapUsage: boolean;
|
|
46
|
+
lastCommit: boolean;
|
|
47
|
+
listTests: boolean;
|
|
48
|
+
maxConcurrency: number;
|
|
49
|
+
maxWorkers: string | number;
|
|
50
|
+
moduleDirectories: string[];
|
|
51
|
+
moduleFileExtensions: string[];
|
|
52
|
+
moduleLoader: string;
|
|
53
|
+
moduleNameMapper: {
|
|
54
|
+
[key: string]: string | string[];
|
|
55
|
+
};
|
|
56
|
+
modulePathIgnorePatterns: string[];
|
|
57
|
+
modulePaths: string[];
|
|
58
|
+
name: string;
|
|
59
|
+
noStackTrace: boolean;
|
|
60
|
+
notify: boolean;
|
|
61
|
+
notifyMode: string;
|
|
62
|
+
onlyChanged: boolean;
|
|
63
|
+
onlyFailures: boolean;
|
|
64
|
+
outputFile: string;
|
|
65
|
+
passWithNoTests: boolean;
|
|
66
|
+
preprocessorIgnorePatterns: string[];
|
|
67
|
+
preset: string | null | undefined;
|
|
68
|
+
prettierPath: string | null | undefined;
|
|
69
|
+
projects: (string | Config.InitialProjectOptions)[];
|
|
70
|
+
replname: string | null | undefined;
|
|
71
|
+
resetMocks: boolean;
|
|
72
|
+
resetModules: boolean;
|
|
73
|
+
resolver: string | null | undefined;
|
|
74
|
+
restoreMocks: boolean;
|
|
75
|
+
rootDir: string;
|
|
76
|
+
roots: string[];
|
|
77
|
+
runner: string;
|
|
78
|
+
runTestsByPath: boolean;
|
|
79
|
+
scriptPreprocessor: string;
|
|
80
|
+
setupFiles: string[];
|
|
81
|
+
setupTestFrameworkScriptFile: string;
|
|
82
|
+
setupFilesAfterEnv: string[];
|
|
83
|
+
silent: boolean;
|
|
84
|
+
skipFilter: boolean;
|
|
85
|
+
skipNodeResolution: boolean;
|
|
86
|
+
slowTestThreshold: number;
|
|
87
|
+
snapshotResolver: string;
|
|
88
|
+
snapshotSerializers: string[];
|
|
89
|
+
snapshotFormat: Config.PrettyFormatOptions;
|
|
90
|
+
errorOnDeprecated: boolean;
|
|
91
|
+
testEnvironment: string;
|
|
92
|
+
testEnvironmentOptions: Record<string, unknown>;
|
|
93
|
+
testFailureExitCode: string | number;
|
|
94
|
+
testLocationInResults: boolean;
|
|
95
|
+
testMatch: string[];
|
|
96
|
+
testNamePattern: string;
|
|
97
|
+
testPathDirs: string[];
|
|
98
|
+
testPathIgnorePatterns: string[];
|
|
99
|
+
testRegex: string | string[];
|
|
100
|
+
testResultsProcessor: string;
|
|
101
|
+
testRunner: string;
|
|
102
|
+
testSequencer: string;
|
|
103
|
+
testURL: string;
|
|
104
|
+
testTimeout: number;
|
|
105
|
+
timers: "real" | "fake" | "modern" | "legacy";
|
|
106
|
+
transform: {
|
|
107
|
+
[regex: string]: string | Config.TransformerConfig;
|
|
108
|
+
};
|
|
109
|
+
transformIgnorePatterns: string[];
|
|
110
|
+
watchPathIgnorePatterns: string[];
|
|
111
|
+
unmockedModulePathPatterns: string[];
|
|
112
|
+
updateSnapshot: boolean;
|
|
113
|
+
useStderr: boolean;
|
|
114
|
+
verbose?: boolean | undefined;
|
|
115
|
+
watch: boolean;
|
|
116
|
+
watchAll: boolean;
|
|
117
|
+
watchman: boolean;
|
|
118
|
+
watchPlugins: (string | [string, Record<string, unknown>])[];
|
|
119
|
+
}>>;
|
package/dist/test.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/test.ts
|
|
21
|
+
var test_exports = {};
|
|
22
|
+
__export(test_exports, {
|
|
23
|
+
configUmiAlias: () => configUmiAlias,
|
|
24
|
+
getAliasPathWithKey: () => getAliasPathWithKey,
|
|
25
|
+
getUmiAlias: () => getUmiAlias
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(test_exports);
|
|
28
|
+
var import_utils = require("@umijs/utils");
|
|
29
|
+
var import_fs = require("fs");
|
|
30
|
+
var import_service = require("./service/service");
|
|
31
|
+
__reExport(test_exports, require("@umijs/test"), module.exports);
|
|
32
|
+
function getAliasPathWithKey(alias, key) {
|
|
33
|
+
if (alias[key]) {
|
|
34
|
+
return getAliasPathWithKey(alias, alias[key]);
|
|
35
|
+
}
|
|
36
|
+
const aliasKeys = Object.keys(alias);
|
|
37
|
+
const keyStartedWith = aliasKeys.find(
|
|
38
|
+
(k) => !k.endsWith("$") && key.startsWith(`${k}/`)
|
|
39
|
+
);
|
|
40
|
+
if (keyStartedWith) {
|
|
41
|
+
const realPath = alias[keyStartedWith];
|
|
42
|
+
const newKey = realPath + key.slice(keyStartedWith.length);
|
|
43
|
+
return getAliasPathWithKey(alias, newKey);
|
|
44
|
+
} else {
|
|
45
|
+
return key;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
var service;
|
|
49
|
+
async function getUmiAlias() {
|
|
50
|
+
if (!service) {
|
|
51
|
+
service = new import_service.Service();
|
|
52
|
+
await service.run2({
|
|
53
|
+
name: "setup",
|
|
54
|
+
args: { quiet: true }
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return service.config.alias;
|
|
58
|
+
}
|
|
59
|
+
async function configUmiAlias(config) {
|
|
60
|
+
(0, import_utils.setNoDeprecation)();
|
|
61
|
+
config.moduleNameMapper || (config.moduleNameMapper = {});
|
|
62
|
+
const alias = await getUmiAlias();
|
|
63
|
+
for (const key of Object.keys(alias)) {
|
|
64
|
+
const aliasPath = getAliasPathWithKey(alias, key);
|
|
65
|
+
if (key.endsWith("$")) {
|
|
66
|
+
config.moduleNameMapper[`^${key}`] = aliasPath;
|
|
67
|
+
} else if ((0, import_fs.existsSync)(aliasPath) && (0, import_fs.statSync)(aliasPath).isDirectory()) {
|
|
68
|
+
config.moduleNameMapper[`^${key}/(.*)$`] = `${aliasPath}/$1`;
|
|
69
|
+
config.moduleNameMapper[`^${key}$`] = aliasPath;
|
|
70
|
+
} else {
|
|
71
|
+
config.moduleNameMapper[`^${key}$`] = aliasPath;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return config;
|
|
75
|
+
}
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
78
|
+
configUmiAlias,
|
|
79
|
+
getAliasPathWithKey,
|
|
80
|
+
getUmiAlias,
|
|
81
|
+
...require("@umijs/test")
|
|
82
|
+
});
|
package/eslint.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
try {
|
|
2
|
+
require.resolve('@umijs/lint/package.json');
|
|
3
|
+
} catch (err) {
|
|
4
|
+
throw new Error('@umijs/lint is not built-in, please install it manually before run umi lint.');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
module.exports = process.env.LEGACY_ESLINT ? require('@umijs/lint/dist/config/eslint/legacy') : require('@umijs/lint/dist/config/eslint');
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export * from '
|
|
3
|
-
export
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
export * from '@@/exports';
|
|
3
|
+
export type {
|
|
4
|
+
IApi,
|
|
5
|
+
webpack,
|
|
6
|
+
IRoute,
|
|
7
|
+
UmiApiRequest,
|
|
8
|
+
UmiApiResponse,
|
|
9
|
+
} from '@umijs/preset-umi';
|
|
10
|
+
export * from './dist';
|
package/package.json
CHANGED
|
@@ -1,44 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "umi",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-canary-20240513.3",
|
|
4
4
|
"description": "umi",
|
|
5
|
-
"homepage": "https://github.com/umijs/umi
|
|
6
|
-
"bugs": "https://github.com/umijs/umi
|
|
5
|
+
"homepage": "https://github.com/umijs/umi/tree/master/packages/umi#readme",
|
|
6
|
+
"bugs": "https://github.com/umijs/umi/issues",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/umijs/umi
|
|
9
|
+
"url": "https://github.com/umijs/umi"
|
|
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"
|
|
17
16
|
},
|
|
18
17
|
"files": [
|
|
18
|
+
"bin",
|
|
19
|
+
"client",
|
|
19
20
|
"dist",
|
|
21
|
+
"eslint.js",
|
|
20
22
|
"index.d.ts",
|
|
21
23
|
"index.esm.js",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
+
"plugin-utils.d.ts",
|
|
25
|
+
"plugin-utils.js",
|
|
26
|
+
"plugin.js",
|
|
27
|
+
"prettier.js",
|
|
28
|
+
"stylelint.js",
|
|
29
|
+
"test-setup.js",
|
|
30
|
+
"test.d.ts",
|
|
31
|
+
"test.js"
|
|
24
32
|
],
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "pnpm tsc",
|
|
27
|
-
"build:client": "pnpm tsc --project ./tsconfig.client.json",
|
|
28
|
-
"build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
|
|
29
|
-
"dev": "pnpm build -- --watch"
|
|
30
|
-
},
|
|
31
33
|
"dependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"@umijs/utils": "4.0.0-
|
|
36
|
-
"
|
|
34
|
+
"@babel/runtime": "7.23.6",
|
|
35
|
+
"prettier-plugin-organize-imports": "^3.2.2",
|
|
36
|
+
"prettier-plugin-packagejson": "2.4.3",
|
|
37
|
+
"@umijs/bundler-utils": "4.0.0-canary-20240513.3",
|
|
38
|
+
"@umijs/core": "4.0.0-canary-20240513.3",
|
|
39
|
+
"@umijs/renderer-react": "4.0.0-canary-20240513.3",
|
|
40
|
+
"@umijs/bundler-webpack": "4.0.0-canary-20240513.3",
|
|
41
|
+
"@umijs/preset-umi": "4.0.0-canary-20240513.3",
|
|
42
|
+
"@umijs/server": "4.0.0-canary-20240513.3",
|
|
43
|
+
"@umijs/test": "4.0.0-canary-20240513.3",
|
|
44
|
+
"@umijs/utils": "4.0.0-canary-20240513.3",
|
|
45
|
+
"@umijs/lint": "4.0.0-canary-20240513.3"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=14"
|
|
37
49
|
},
|
|
38
50
|
"publishConfig": {
|
|
39
51
|
"access": "public"
|
|
40
52
|
},
|
|
41
53
|
"authors": [
|
|
42
54
|
"chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
|
|
43
|
-
]
|
|
44
|
-
|
|
55
|
+
],
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "umi-scripts father build",
|
|
58
|
+
"build:deps": "umi-scripts bundleDeps",
|
|
59
|
+
"dev": "umi-scripts father dev",
|
|
60
|
+
"test": "umi-scripts jest-turbo"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/pluginUtils';
|
package/plugin-utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/pluginUtils');
|
package/plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getPluginManager } from '@@/core/plugin';
|
package/prettier.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
printWidth: 80,
|
|
3
|
+
singleQuote: true,
|
|
4
|
+
trailingComma: 'all',
|
|
5
|
+
proseWrap: 'never',
|
|
6
|
+
endOfLine: 'lf',
|
|
7
|
+
overrides: [{ files: '.prettierrc', options: { parser: 'json' } }],
|
|
8
|
+
plugins: [
|
|
9
|
+
require.resolve('prettier-plugin-packagejson'),
|
|
10
|
+
require.resolve('prettier-plugin-organize-imports'),
|
|
11
|
+
],
|
|
12
|
+
pluginSearchDirs: false,
|
|
13
|
+
};
|
package/stylelint.js
ADDED
package/test-setup.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('./dist/test-setup');
|
package/test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/test';
|
package/test.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/test');
|
package/dist/cli/node.d.ts
DELETED
package/dist/cli/node.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setNoDeprecation = exports.setNodeTitle = exports.checkLocal = exports.checkVersion = void 0;
|
|
4
|
-
const utils_1 = require("@umijs/utils");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
function checkVersion() {
|
|
7
|
-
const v = parseInt(process.version.slice(1));
|
|
8
|
-
if (v < constants_1.MIN_NODE_VERSION || v === constants_1.EXCLUDE_NODE_VERSION) {
|
|
9
|
-
utils_1.logger.error(`Your node version ${v} is not supported, please upgrade to ${constants_1.MIN_NODE_VERSION} or above except ${constants_1.EXCLUDE_NODE_VERSION}.`);
|
|
10
|
-
process.exit(1);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.checkVersion = checkVersion;
|
|
14
|
-
function checkLocal() {
|
|
15
|
-
if (__filename.includes(`packages/${constants_1.FRAMEWORK_NAME}`)) {
|
|
16
|
-
utils_1.logger.info('@local');
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.checkLocal = checkLocal;
|
|
20
|
-
function setNodeTitle(name) {
|
|
21
|
-
if (process.title === 'node') {
|
|
22
|
-
process.title = name || constants_1.FRAMEWORK_NAME;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.setNodeTitle = setNodeTitle;
|
|
26
|
-
function setNoDeprecation() {
|
|
27
|
-
// Use magic to suppress node deprecation warnings
|
|
28
|
-
// See: https://github.com/nodejs/node/blob/master/lib/internal/process/warning.js#L77
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
process.noDeprecation = '1';
|
|
31
|
-
}
|
|
32
|
-
exports.setNoDeprecation = setNoDeprecation;
|
package/dist/client/plugin.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export declare enum ApplyPluginsType {
|
|
2
|
-
compose = "compose",
|
|
3
|
-
modify = "modify",
|
|
4
|
-
event = "event"
|
|
5
|
-
}
|
|
6
|
-
interface IPlugin {
|
|
7
|
-
path?: string;
|
|
8
|
-
apply: Record<string, any>;
|
|
9
|
-
}
|
|
10
|
-
export declare class PluginManager {
|
|
11
|
-
opts: {
|
|
12
|
-
validKeys: string[];
|
|
13
|
-
};
|
|
14
|
-
hooks: {
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
};
|
|
17
|
-
constructor(opts: {
|
|
18
|
-
validKeys: string[];
|
|
19
|
-
});
|
|
20
|
-
register(plugin: IPlugin): void;
|
|
21
|
-
getHooks(keyWithDot: string): any;
|
|
22
|
-
applyPlugins({ key, type, initialValue, args, async, }: {
|
|
23
|
-
key: string;
|
|
24
|
-
type: ApplyPluginsType;
|
|
25
|
-
initialValue?: any;
|
|
26
|
-
args?: object;
|
|
27
|
-
async?: boolean;
|
|
28
|
-
}): any;
|
|
29
|
-
static create(opts: {
|
|
30
|
-
validKeys: string[];
|
|
31
|
-
plugins: IPlugin[];
|
|
32
|
-
}): PluginManager;
|
|
33
|
-
}
|
|
34
|
-
export {};
|