@modern-js/app-tools 2.62.1-alpha.0 → 2.62.1
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/modern.js +2 -2
- package/dist/cjs/index.js +142 -4
- package/dist/esm/index.js +248 -2
- package/dist/esm-node/index.js +130 -2
- package/dist/types/index.d.ts +6 -2
- package/package.json +18 -26
- package/dist/cjs/new/compat/hooks.js +0 -160
- package/dist/cjs/new/compat/index.js +0 -52
- package/dist/cjs/new/compat/utils.js +0 -95
- package/dist/cjs/new/constants.js +0 -37
- package/dist/cjs/new/context.js +0 -63
- package/dist/cjs/new/getConfigFile.js +0 -41
- package/dist/cjs/new/index.js +0 -76
- package/dist/cjs/new/loadPlugins.js +0 -57
- package/dist/cjs/new/run.js +0 -66
- package/dist/cjs/new/types/index.js +0 -16
- package/dist/cjs/new/utils/index.js +0 -34
- package/dist/cjs/old.js +0 -179
- package/dist/esm/new/compat/hooks.js +0 -418
- package/dist/esm/new/compat/index.js +0 -30
- package/dist/esm/new/compat/utils.js +0 -69
- package/dist/esm/new/constants.js +0 -10
- package/dist/esm/new/context.js +0 -30
- package/dist/esm/new/getConfigFile.js +0 -11
- package/dist/esm/new/index.js +0 -52
- package/dist/esm/new/loadPlugins.js +0 -94
- package/dist/esm/new/run.js +0 -79
- package/dist/esm/new/types/index.js +0 -0
- package/dist/esm/new/utils/index.js +0 -33
- package/dist/esm/old.js +0 -258
- package/dist/esm-node/new/compat/hooks.js +0 -135
- package/dist/esm-node/new/compat/index.js +0 -28
- package/dist/esm-node/new/compat/utils.js +0 -69
- package/dist/esm-node/new/constants.js +0 -10
- package/dist/esm-node/new/context.js +0 -29
- package/dist/esm-node/new/getConfigFile.js +0 -7
- package/dist/esm-node/new/index.js +0 -49
- package/dist/esm-node/new/loadPlugins.js +0 -33
- package/dist/esm-node/new/run.js +0 -42
- package/dist/esm-node/new/types/index.js +0 -0
- package/dist/esm-node/new/utils/index.js +0 -10
- package/dist/esm-node/old.js +0 -140
- package/dist/types/new/compat/hooks.d.ts +0 -8
- package/dist/types/new/compat/index.d.ts +0 -4
- package/dist/types/new/compat/utils.d.ts +0 -6
- package/dist/types/new/constants.d.ts +0 -4
- package/dist/types/new/context.d.ts +0 -32
- package/dist/types/new/getConfigFile.d.ts +0 -1
- package/dist/types/new/index.d.ts +0 -15
- package/dist/types/new/loadPlugins.d.ts +0 -9
- package/dist/types/new/run.d.ts +0 -13
- package/dist/types/new/types/index.d.ts +0 -89
- package/dist/types/new/utils/index.d.ts +0 -1
- package/dist/types/old.d.ts +0 -20
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.62.1
|
18
|
+
"version": "2.62.1",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -34,11 +34,6 @@
|
|
34
34
|
"jsnext:source": "./src/index.ts",
|
35
35
|
"default": "./dist/cjs/index.js"
|
36
36
|
},
|
37
|
-
"./cli/run": {
|
38
|
-
"types": "./dist/types/new/run.d.ts",
|
39
|
-
"jsnext:source": "./src/new/run.ts",
|
40
|
-
"default": "./dist/cjs/new/run.js"
|
41
|
-
},
|
42
37
|
"./types": {
|
43
38
|
"types": "./lib/types.d.ts",
|
44
39
|
"jsnext:source": "./lib/types.d.ts",
|
@@ -63,9 +58,6 @@
|
|
63
58
|
".": [
|
64
59
|
"./dist/types/index.d.ts"
|
65
60
|
],
|
66
|
-
"cli/run": [
|
67
|
-
"./dist/types/new/run.d.ts"
|
68
|
-
],
|
69
61
|
"types": [
|
70
62
|
"./lib/types.d.ts"
|
71
63
|
],
|
@@ -96,20 +88,19 @@
|
|
96
88
|
"mlly": "^1.6.1",
|
97
89
|
"pkg-types": "^1.1.0",
|
98
90
|
"std-env": "^3.7.0",
|
99
|
-
"@modern-js/core": "2.62.
|
100
|
-
"@modern-js/
|
101
|
-
"@modern-js/plugin
|
102
|
-
"@modern-js/
|
103
|
-
"@modern-js/plugin": "2.62.
|
104
|
-
"@modern-js/server": "2.62.
|
105
|
-
"@modern-js/
|
106
|
-
"@modern-js/
|
107
|
-
"@modern-js/rsbuild-plugin-esbuild": "2.62.
|
108
|
-
"@modern-js/
|
109
|
-
"@modern-js/server-utils": "2.62.
|
110
|
-
"@modern-js/
|
111
|
-
"@modern-js/
|
112
|
-
"@modern-js/utils": "2.62.0"
|
91
|
+
"@modern-js/core": "2.62.1",
|
92
|
+
"@modern-js/node-bundle-require": "2.62.1",
|
93
|
+
"@modern-js/plugin": "2.62.1",
|
94
|
+
"@modern-js/plugin-data-loader": "2.62.1",
|
95
|
+
"@modern-js/plugin-i18n": "2.62.1",
|
96
|
+
"@modern-js/prod-server": "2.62.1",
|
97
|
+
"@modern-js/server": "2.62.1",
|
98
|
+
"@modern-js/server-core": "2.62.1",
|
99
|
+
"@modern-js/rsbuild-plugin-esbuild": "2.62.1",
|
100
|
+
"@modern-js/types": "2.62.1",
|
101
|
+
"@modern-js/server-utils": "2.62.1",
|
102
|
+
"@modern-js/uni-builder": "2.62.1",
|
103
|
+
"@modern-js/utils": "2.62.1"
|
113
104
|
},
|
114
105
|
"devDependencies": {
|
115
106
|
"@rsbuild/plugin-webpack-swc": "~1.0.3",
|
@@ -121,8 +112,8 @@
|
|
121
112
|
"tsconfig-paths": "^4.2.0",
|
122
113
|
"typescript": "^5",
|
123
114
|
"webpack": "^5.96.1",
|
124
|
-
"@scripts/
|
125
|
-
"@scripts/
|
115
|
+
"@scripts/jest-config": "2.62.1",
|
116
|
+
"@scripts/build": "2.62.1"
|
126
117
|
},
|
127
118
|
"peerDependencies": {
|
128
119
|
"ts-node": "^10.7.0",
|
@@ -139,7 +130,8 @@
|
|
139
130
|
"sideEffects": false,
|
140
131
|
"publishConfig": {
|
141
132
|
"registry": "https://registry.npmjs.org/",
|
142
|
-
"access": "public"
|
133
|
+
"access": "public",
|
134
|
+
"provenance": true
|
143
135
|
},
|
144
136
|
"scripts": {
|
145
137
|
"new": "modern-lib new",
|
@@ -1,160 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var hooks_exports = {};
|
20
|
-
__export(hooks_exports, {
|
21
|
-
getHookRunners: () => getHookRunners,
|
22
|
-
handleSetupResult: () => handleSetupResult
|
23
|
-
});
|
24
|
-
module.exports = __toCommonJS(hooks_exports);
|
25
|
-
var import_utils = require("./utils");
|
26
|
-
function getHookRunners(context) {
|
27
|
-
const { hooks } = context;
|
28
|
-
return {
|
29
|
-
/**
|
30
|
-
* app tools hooks
|
31
|
-
*/
|
32
|
-
beforeConfig: async () => {
|
33
|
-
return hooks.onBeforeConfig.call();
|
34
|
-
},
|
35
|
-
afterPrepare: async () => {
|
36
|
-
return hooks.onAfterPrepare.call();
|
37
|
-
},
|
38
|
-
deploy: async () => {
|
39
|
-
return hooks.deploy.call();
|
40
|
-
},
|
41
|
-
_internalRuntimePlugins: async (params) => {
|
42
|
-
return hooks._internalRuntimePlugins.call(params);
|
43
|
-
},
|
44
|
-
_internalServerPlugins: async (params) => {
|
45
|
-
return hooks._internalServerPlugins.call(params);
|
46
|
-
},
|
47
|
-
checkEntryPoint: async (params) => {
|
48
|
-
return hooks.checkEntryPoint.call(params);
|
49
|
-
},
|
50
|
-
modifyEntrypoints: async (params) => {
|
51
|
-
return hooks.modifyEntrypoints.call(params);
|
52
|
-
},
|
53
|
-
modifyFileSystemRoutes: async (params) => {
|
54
|
-
return hooks.modifyFileSystemRoutes.call(params);
|
55
|
-
},
|
56
|
-
modifyServerRoutes: async (params) => {
|
57
|
-
return hooks.modifyServerRoutes.call(params);
|
58
|
-
},
|
59
|
-
generateEntryCode: async (params) => {
|
60
|
-
return hooks.generateEntryCode.call(params);
|
61
|
-
},
|
62
|
-
beforeGenerateRoutes: async (params) => {
|
63
|
-
return hooks.onBeforeGenerateRoutes.call(params);
|
64
|
-
},
|
65
|
-
beforePrintInstructions: async (params) => {
|
66
|
-
return hooks.onBeforePrintInstructions.call(params);
|
67
|
-
},
|
68
|
-
/**
|
69
|
-
* common hooks
|
70
|
-
*/
|
71
|
-
config: async () => {
|
72
|
-
return hooks.config.call();
|
73
|
-
},
|
74
|
-
resolvedConfig: (params) => {
|
75
|
-
return hooks.modifyResolvedConfig.call(params);
|
76
|
-
},
|
77
|
-
htmlPartials: async (params) => {
|
78
|
-
return hooks.modifyHtmlPartials.call(params);
|
79
|
-
},
|
80
|
-
commands: async (params) => {
|
81
|
-
return hooks.addCommand.call(params);
|
82
|
-
},
|
83
|
-
watchFiles: async () => {
|
84
|
-
return hooks.addWatchFiles.call();
|
85
|
-
},
|
86
|
-
prepare: async () => {
|
87
|
-
return hooks.onPrepare.call();
|
88
|
-
},
|
89
|
-
filedChange: async (params) => {
|
90
|
-
return hooks.onFileChanged.call(params);
|
91
|
-
},
|
92
|
-
beforeCreateCompiler: async (params) => {
|
93
|
-
return hooks.onBeforeCreateCompiler.call(params);
|
94
|
-
},
|
95
|
-
afterCreateCompiler: async (params) => {
|
96
|
-
return hooks.onAfterCreateCompiler.call(params);
|
97
|
-
},
|
98
|
-
beforeBuild: async (params) => {
|
99
|
-
return hooks.onBeforeBuild.call(params);
|
100
|
-
},
|
101
|
-
afterBuild: async (params) => {
|
102
|
-
return hooks.onAfterBuild.call(params);
|
103
|
-
},
|
104
|
-
beforeDev: async () => {
|
105
|
-
return hooks.onBeforeDev.call();
|
106
|
-
},
|
107
|
-
afterDev: async (params) => {
|
108
|
-
return hooks.onAfterDev.call(params);
|
109
|
-
},
|
110
|
-
beforeDeploy: async () => {
|
111
|
-
return hooks.onBeforeDeploy.call();
|
112
|
-
},
|
113
|
-
afterDeploy: async () => {
|
114
|
-
return hooks.onAfterDeploy.call();
|
115
|
-
},
|
116
|
-
beforeExit: async () => {
|
117
|
-
return hooks.onBeforeExit.call();
|
118
|
-
},
|
119
|
-
beforeRestart: async () => {
|
120
|
-
return hooks.onBeforeRestart.call();
|
121
|
-
},
|
122
|
-
/**
|
123
|
-
* @deprecated
|
124
|
-
*/
|
125
|
-
registerDev: async (params) => {
|
126
|
-
return hooks.registerDev.call(params);
|
127
|
-
},
|
128
|
-
/**
|
129
|
-
* @deprecated
|
130
|
-
*/
|
131
|
-
registerBuildPlatform: async (params) => {
|
132
|
-
return hooks.registerBuildPlatform.call(params);
|
133
|
-
},
|
134
|
-
/**
|
135
|
-
* @deprecated
|
136
|
-
*/
|
137
|
-
addRuntimeExports: async (params) => {
|
138
|
-
return hooks.addRuntimeExports.call(params);
|
139
|
-
}
|
140
|
-
};
|
141
|
-
}
|
142
|
-
function handleSetupResult(setupResult, api) {
|
143
|
-
if (!setupResult) {
|
144
|
-
return;
|
145
|
-
}
|
146
|
-
Object.keys(setupResult).forEach((key) => {
|
147
|
-
const fn = setupResult[key];
|
148
|
-
if (typeof fn === "function") {
|
149
|
-
const newAPI = (0, import_utils.transformHookRunner)(key);
|
150
|
-
if (api[newAPI]) {
|
151
|
-
api[newAPI](async (params) => (0, import_utils.transformHookResult)(key, await fn((0, import_utils.transformHookParams)(key, params))));
|
152
|
-
}
|
153
|
-
}
|
154
|
-
});
|
155
|
-
}
|
156
|
-
// Annotate the CommonJS export names for ESM import in node:
|
157
|
-
0 && (module.exports = {
|
158
|
-
getHookRunners,
|
159
|
-
handleSetupResult
|
160
|
-
});
|
@@ -1,52 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var compat_exports = {};
|
20
|
-
__export(compat_exports, {
|
21
|
-
compatPlugin: () => compatPlugin
|
22
|
-
});
|
23
|
-
module.exports = __toCommonJS(compat_exports);
|
24
|
-
var import_hooks = require("./hooks");
|
25
|
-
const compatPlugin = () => ({
|
26
|
-
name: "@modern-js/app-tools-compat",
|
27
|
-
registryApi: (context, updateAppContext) => {
|
28
|
-
return {
|
29
|
-
useAppContext: () => {
|
30
|
-
return context;
|
31
|
-
},
|
32
|
-
setAppContext: (context2) => {
|
33
|
-
return updateAppContext(context2);
|
34
|
-
},
|
35
|
-
useConfigContext: () => {
|
36
|
-
return context.config;
|
37
|
-
},
|
38
|
-
useResolvedConfigContext: () => {
|
39
|
-
return context.normalizedConfig;
|
40
|
-
},
|
41
|
-
useHookRunners: () => {
|
42
|
-
return (0, import_hooks.getHookRunners)(context);
|
43
|
-
}
|
44
|
-
};
|
45
|
-
},
|
46
|
-
setup: (_api) => {
|
47
|
-
}
|
48
|
-
});
|
49
|
-
// Annotate the CommonJS export names for ESM import in node:
|
50
|
-
0 && (module.exports = {
|
51
|
-
compatPlugin
|
52
|
-
});
|
@@ -1,95 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var utils_exports = {};
|
20
|
-
__export(utils_exports, {
|
21
|
-
transformHookParams: () => transformHookParams,
|
22
|
-
transformHookResult: () => transformHookResult,
|
23
|
-
transformHookRunner: () => transformHookRunner
|
24
|
-
});
|
25
|
-
module.exports = __toCommonJS(utils_exports);
|
26
|
-
function transformHookRunner(hookRunnerName) {
|
27
|
-
switch (hookRunnerName) {
|
28
|
-
case "beforeConfig":
|
29
|
-
return "onBeforeConfig";
|
30
|
-
case "prepare":
|
31
|
-
return "onPrepare";
|
32
|
-
case "afterPrepare":
|
33
|
-
return "onAfterPrepare";
|
34
|
-
case "beforeGenerateRoutes":
|
35
|
-
return "onBeforeGenerateRoutes";
|
36
|
-
case "beforePrintInstructions":
|
37
|
-
return "onBeforePrintInstructions";
|
38
|
-
case "resolvedConfig":
|
39
|
-
return "modifyResolvedConfig";
|
40
|
-
case "commands":
|
41
|
-
return "addCommand";
|
42
|
-
case "watchFiles":
|
43
|
-
return "addWatchFiles";
|
44
|
-
case "filedChange":
|
45
|
-
return "onFileChanged";
|
46
|
-
case "beforeCreateCompiler":
|
47
|
-
return "onBeforeCreateCompiler";
|
48
|
-
case "afterCreateCompiler":
|
49
|
-
return "onAfterCreateCompiler";
|
50
|
-
case "beforeBuild":
|
51
|
-
return "onBeforeBuild";
|
52
|
-
case "afterBuild":
|
53
|
-
return "onAfterBuild";
|
54
|
-
case "beforeDev":
|
55
|
-
return "onBeforeDev";
|
56
|
-
case "afterDev":
|
57
|
-
return "onAfterDev";
|
58
|
-
case "beforeDeploy":
|
59
|
-
return "onBeforeDeploy";
|
60
|
-
case "afterDeploy":
|
61
|
-
return "onAfterDeploy";
|
62
|
-
case "beforeExit":
|
63
|
-
return "onBeforeExit";
|
64
|
-
case "beforeRestart":
|
65
|
-
return "onBeforeRestart";
|
66
|
-
case "htmlPartials":
|
67
|
-
return "modifyHtmlPartials";
|
68
|
-
default:
|
69
|
-
return hookRunnerName;
|
70
|
-
}
|
71
|
-
}
|
72
|
-
function transformHookParams(hookRunnerName, params) {
|
73
|
-
switch (hookRunnerName) {
|
74
|
-
case "resolvedConfig":
|
75
|
-
return {
|
76
|
-
resolved: params
|
77
|
-
};
|
78
|
-
default:
|
79
|
-
return params;
|
80
|
-
}
|
81
|
-
}
|
82
|
-
function transformHookResult(hookRunnerName, result) {
|
83
|
-
switch (hookRunnerName) {
|
84
|
-
case "resolvedConfig":
|
85
|
-
return result.resolved;
|
86
|
-
default:
|
87
|
-
return result;
|
88
|
-
}
|
89
|
-
}
|
90
|
-
// Annotate the CommonJS export names for ESM import in node:
|
91
|
-
0 && (module.exports = {
|
92
|
-
transformHookParams,
|
93
|
-
transformHookResult,
|
94
|
-
transformHookRunner
|
95
|
-
});
|
@@ -1,37 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var constants_exports = {};
|
20
|
-
__export(constants_exports, {
|
21
|
-
DEFAULT_CONFIG_FILE: () => DEFAULT_CONFIG_FILE,
|
22
|
-
DEFAULT_RUNTIME_CONFIG_FILE: () => DEFAULT_RUNTIME_CONFIG_FILE,
|
23
|
-
DEFAULT_SERVER_CONFIG_FILE: () => DEFAULT_SERVER_CONFIG_FILE,
|
24
|
-
PACKAGE_JSON_CONFIG_NAME: () => PACKAGE_JSON_CONFIG_NAME
|
25
|
-
});
|
26
|
-
module.exports = __toCommonJS(constants_exports);
|
27
|
-
const PACKAGE_JSON_CONFIG_NAME = "modernConfig";
|
28
|
-
const DEFAULT_CONFIG_FILE = "modern.config";
|
29
|
-
const DEFAULT_SERVER_CONFIG_FILE = "modern.server-runtime.config";
|
30
|
-
const DEFAULT_RUNTIME_CONFIG_FILE = "modern.runtime";
|
31
|
-
// Annotate the CommonJS export names for ESM import in node:
|
32
|
-
0 && (module.exports = {
|
33
|
-
DEFAULT_CONFIG_FILE,
|
34
|
-
DEFAULT_RUNTIME_CONFIG_FILE,
|
35
|
-
DEFAULT_SERVER_CONFIG_FILE,
|
36
|
-
PACKAGE_JSON_CONFIG_NAME
|
37
|
-
});
|
package/dist/cjs/new/context.js
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __create = Object.create;
|
3
|
-
var __defProp = Object.defineProperty;
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
-
var __export = (target, all) => {
|
9
|
-
for (var name in all)
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
-
};
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
-
for (let key of __getOwnPropNames(from))
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
-
}
|
18
|
-
return to;
|
19
|
-
};
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
-
mod
|
27
|
-
));
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
var context_exports = {};
|
30
|
-
__export(context_exports, {
|
31
|
-
initAppContext: () => initAppContext
|
32
|
-
});
|
33
|
-
module.exports = __toCommonJS(context_exports);
|
34
|
-
var import_path = __toESM(require("path"));
|
35
|
-
var import_utils = require("@modern-js/utils");
|
36
|
-
const initAppContext = ({ appDirectory, runtimeConfigFile, options, serverConfigFile }) => {
|
37
|
-
const { metaName = "modern-js", apiDir = "api", distDir = "", sharedDir = "shared" } = options || {};
|
38
|
-
return {
|
39
|
-
metaName,
|
40
|
-
runtimeConfigFile,
|
41
|
-
serverConfigFile,
|
42
|
-
ip: import_utils.address.ip(),
|
43
|
-
port: 0,
|
44
|
-
moduleType: require(import_path.default.resolve(appDirectory, "./package.json")).type || "commonjs",
|
45
|
-
apiDirectory: import_path.default.resolve(appDirectory, apiDir),
|
46
|
-
lambdaDirectory: import_path.default.resolve(appDirectory, apiDir, "lambda"),
|
47
|
-
sharedDirectory: import_path.default.resolve(appDirectory, sharedDir),
|
48
|
-
distDirectory: distDir,
|
49
|
-
serverPlugins: [],
|
50
|
-
internalDirectory: import_path.default.resolve(appDirectory, `./node_modules/.${metaName}`),
|
51
|
-
htmlTemplates: {},
|
52
|
-
serverRoutes: [],
|
53
|
-
entrypoints: [],
|
54
|
-
checkedEntries: [],
|
55
|
-
apiOnly: false,
|
56
|
-
internalDirAlias: `@_${metaName.replace(/-/g, "_")}_internal`,
|
57
|
-
internalSrcAlias: `@_${metaName.replace(/-/g, "_")}_src`
|
58
|
-
};
|
59
|
-
};
|
60
|
-
// Annotate the CommonJS export names for ESM import in node:
|
61
|
-
0 && (module.exports = {
|
62
|
-
initAppContext
|
63
|
-
});
|
@@ -1,41 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __create = Object.create;
|
3
|
-
var __defProp = Object.defineProperty;
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
-
var __export = (target, all) => {
|
9
|
-
for (var name in all)
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
-
};
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
-
for (let key of __getOwnPropNames(from))
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
-
}
|
18
|
-
return to;
|
19
|
-
};
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
-
mod
|
27
|
-
));
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
var getConfigFile_exports = {};
|
30
|
-
__export(getConfigFile_exports, {
|
31
|
-
getConfigFile: () => getConfigFile
|
32
|
-
});
|
33
|
-
module.exports = __toCommonJS(getConfigFile_exports);
|
34
|
-
var import_path = __toESM(require("path"));
|
35
|
-
var import_utils = require("@modern-js/utils");
|
36
|
-
var import_constants = require("./constants");
|
37
|
-
const getConfigFile = (configFile) => (0, import_utils.findExists)(import_utils.CONFIG_FILE_EXTENSIONS.map((extension) => import_path.default.resolve(process.cwd(), `${configFile || import_constants.DEFAULT_CONFIG_FILE}${extension}`)));
|
38
|
-
// Annotate the CommonJS export names for ESM import in node:
|
39
|
-
0 && (module.exports = {
|
40
|
-
getConfigFile
|
41
|
-
});
|
package/dist/cjs/new/index.js
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
20
|
-
var new_exports = {};
|
21
|
-
__export(new_exports, {
|
22
|
-
appTools: () => appTools,
|
23
|
-
initAppContext: () => import_context.initAppContext
|
24
|
-
});
|
25
|
-
module.exports = __toCommonJS(new_exports);
|
26
|
-
var import_plugin_v2 = require("@modern-js/plugin-v2");
|
27
|
-
var import_old = require("../old");
|
28
|
-
var import_compat = require("./compat");
|
29
|
-
var import_constants = require("./constants");
|
30
|
-
var import_context = require("./context");
|
31
|
-
__reExport(new_exports, require("../defineConfig"), module.exports);
|
32
|
-
const appTools = (options = {
|
33
|
-
// default webpack to be compatible with original projects
|
34
|
-
bundler: "webpack"
|
35
|
-
}) => ({
|
36
|
-
name: "@modern-js/app-tools",
|
37
|
-
usePlugins: [
|
38
|
-
(0, import_compat.compatPlugin)(),
|
39
|
-
(0, import_old.appTools)(options)
|
40
|
-
],
|
41
|
-
post: [
|
42
|
-
"@modern-js/app-tools-old"
|
43
|
-
],
|
44
|
-
registryHooks: {
|
45
|
-
onBeforeConfig: (0, import_plugin_v2.createAsyncHook)(),
|
46
|
-
onAfterPrepare: (0, import_plugin_v2.createAsyncHook)(),
|
47
|
-
deploy: (0, import_plugin_v2.createAsyncHook)(),
|
48
|
-
_internalRuntimePlugins: (0, import_plugin_v2.createAsyncHook)(),
|
49
|
-
_internalServerPlugins: (0, import_plugin_v2.createAsyncHook)(),
|
50
|
-
checkEntryPoint: (0, import_plugin_v2.createAsyncHook)(),
|
51
|
-
modifyEntrypoints: (0, import_plugin_v2.createAsyncHook)(),
|
52
|
-
modifyFileSystemRoutes: (0, import_plugin_v2.createAsyncHook)(),
|
53
|
-
modifyServerRoutes: (0, import_plugin_v2.createAsyncHook)(),
|
54
|
-
generateEntryCode: (0, import_plugin_v2.createAsyncHook)(),
|
55
|
-
onBeforeGenerateRoutes: (0, import_plugin_v2.createAsyncHook)(),
|
56
|
-
onBeforePrintInstructions: (0, import_plugin_v2.createAsyncHook)(),
|
57
|
-
registerDev: (0, import_plugin_v2.createAsyncHook)(),
|
58
|
-
registerBuildPlatform: (0, import_plugin_v2.createAsyncHook)(),
|
59
|
-
addRuntimeExports: (0, import_plugin_v2.createAsyncHook)()
|
60
|
-
},
|
61
|
-
setup: (api) => {
|
62
|
-
const context = api.getAppContext();
|
63
|
-
api.updateAppContext((0, import_context.initAppContext)({
|
64
|
-
appDirectory: context.appDirectory,
|
65
|
-
options: {},
|
66
|
-
serverConfigFile: import_constants.DEFAULT_SERVER_CONFIG_FILE,
|
67
|
-
runtimeConfigFile: import_constants.DEFAULT_RUNTIME_CONFIG_FILE
|
68
|
-
}));
|
69
|
-
}
|
70
|
-
});
|
71
|
-
// Annotate the CommonJS export names for ESM import in node:
|
72
|
-
0 && (module.exports = {
|
73
|
-
appTools,
|
74
|
-
initAppContext,
|
75
|
-
...require("../defineConfig")
|
76
|
-
});
|
@@ -1,57 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var loadPlugins_exports = {};
|
20
|
-
__export(loadPlugins_exports, {
|
21
|
-
loadInternalPlugins: () => loadInternalPlugins
|
22
|
-
});
|
23
|
-
module.exports = __toCommonJS(loadPlugins_exports);
|
24
|
-
var import_utils = require("@modern-js/utils");
|
25
|
-
const debug = (0, import_utils.createDebugger)("load-plugins");
|
26
|
-
const resolveCliPlugin = async (p, appDirectory) => {
|
27
|
-
const pkg = typeof p === "string" ? p : p[0];
|
28
|
-
const pluginOptions = typeof p === "string" ? void 0 : p[1];
|
29
|
-
const path = (0, import_utils.tryResolve)(pkg, appDirectory);
|
30
|
-
let module2;
|
31
|
-
try {
|
32
|
-
module2 = await (0, import_utils.compatibleRequire)(path);
|
33
|
-
} catch (e) {
|
34
|
-
({ default: module2 } = await (0, import_utils.dynamicImport)(path));
|
35
|
-
}
|
36
|
-
if (typeof module2 === "function") {
|
37
|
-
const result = module2(pluginOptions);
|
38
|
-
return result;
|
39
|
-
}
|
40
|
-
return module2;
|
41
|
-
};
|
42
|
-
const loadInternalPlugins = async (appDirectory, internalPlugins, autoLoad, autoLoadPlugins, forceAutoLoadPlugins) => {
|
43
|
-
const plugins = [
|
44
|
-
...forceAutoLoadPlugins || autoLoadPlugins ? (0, import_utils.getInternalPlugins)(appDirectory, internalPlugins) : [],
|
45
|
-
...autoLoad ? (0, import_utils.getInternalPlugins)(appDirectory, autoLoad) : []
|
46
|
-
];
|
47
|
-
const loadedPlugins = await Promise.all(plugins.map((plugin) => {
|
48
|
-
const loadedPlugin = resolveCliPlugin(plugin, appDirectory);
|
49
|
-
debug(`resolve plugin %s: %s`, plugin, loadedPlugin);
|
50
|
-
return loadedPlugin;
|
51
|
-
}));
|
52
|
-
return loadedPlugins;
|
53
|
-
};
|
54
|
-
// Annotate the CommonJS export names for ESM import in node:
|
55
|
-
0 && (module.exports = {
|
56
|
-
loadInternalPlugins
|
57
|
-
});
|