@modern-js/app-tools 2.68.11 → 2.68.13-alpha.0
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/dist/cjs/plugins/analyze/getBundleEntry.js +10 -4
- package/dist/cjs/plugins/analyze/getFileSystemEntry.js +6 -2
- package/dist/esm/plugins/analyze/getBundleEntry.js +11 -5
- package/dist/esm/plugins/analyze/getFileSystemEntry.js +3 -1
- package/dist/esm-node/plugins/analyze/getBundleEntry.js +11 -5
- package/dist/esm-node/plugins/analyze/getFileSystemEntry.js +3 -1
- package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +2 -0
- package/dist/types/types/config/deploy.d.ts +1 -0
- package/package.json +20 -20
@@ -63,16 +63,22 @@ const getBundleEntry = async (hooks, appContext, config) => {
|
|
63
63
|
Object.keys(entries).forEach((name) => {
|
64
64
|
const value = entries[name];
|
65
65
|
const entryName = typeof value === "string" ? value : value.entry;
|
66
|
+
const entryFile = (0, import_utils.ensureAbsolutePath)(appDirectory, entryName);
|
67
|
+
const entryDir = import_path.default.dirname(entryFile);
|
68
|
+
const customEntryFile = (0, import_getFileSystemEntry.hasEntry)(entryDir);
|
69
|
+
const serverEntryFile = (0, import_getFileSystemEntry.hasServerEntry)(entryDir);
|
66
70
|
const isAutoMount = typeof value === "string" ? true : !value.disableMount;
|
67
71
|
const entrypoint = {
|
68
72
|
entryName: name,
|
69
73
|
isMainEntry: false,
|
70
|
-
entry:
|
71
|
-
absoluteEntryDir: isDirectory(
|
74
|
+
entry: typeof value === "string" ? entryFile : value.customEntry ? customEntryFile || entryFile : entryFile,
|
75
|
+
absoluteEntryDir: isDirectory(entryFile) ? entryFile : import_path.default.dirname(entryFile),
|
72
76
|
isAutoMount,
|
73
77
|
customBootstrap: typeof value === "string" ? false : value.customBootstrap && (0, import_utils.ensureAbsolutePath)(appDirectory, value.customBootstrap),
|
74
|
-
fileSystemRoutes: import_utils.fs.statSync(
|
75
|
-
isCustomSourceEntry: true
|
78
|
+
fileSystemRoutes: import_utils.fs.statSync(entryFile).isDirectory() ? {} : void 0,
|
79
|
+
isCustomSourceEntry: true,
|
80
|
+
customEntry: typeof value === "string" ? false : value.customEntry,
|
81
|
+
customServerEntry: typeof value === "string" ? false : value.customEntry ? serverEntryFile : false
|
76
82
|
};
|
77
83
|
if (!ifAlreadyExists(defaults, entrypoint)) {
|
78
84
|
defaults.push(entrypoint);
|
@@ -28,7 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
29
|
var getFileSystemEntry_exports = {};
|
30
30
|
__export(getFileSystemEntry_exports, {
|
31
|
-
getFileSystemEntry: () => getFileSystemEntry
|
31
|
+
getFileSystemEntry: () => getFileSystemEntry,
|
32
|
+
hasEntry: () => hasEntry,
|
33
|
+
hasServerEntry: () => hasServerEntry
|
32
34
|
});
|
33
35
|
module.exports = __toCommonJS(getFileSystemEntry_exports);
|
34
36
|
var import_fs = __toESM(require("fs"));
|
@@ -136,5 +138,7 @@ const getFileSystemEntry = async (hooks, appContext, config) => {
|
|
136
138
|
};
|
137
139
|
// Annotate the CommonJS export names for ESM import in node:
|
138
140
|
0 && (module.exports = {
|
139
|
-
getFileSystemEntry
|
141
|
+
getFileSystemEntry,
|
142
|
+
hasEntry,
|
143
|
+
hasServerEntry
|
140
144
|
});
|
@@ -2,7 +2,7 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
3
3
|
import path from "path";
|
4
4
|
import { fs, JS_EXTENSIONS, MAIN_ENTRY_NAME, ensureAbsolutePath, findExists } from "@modern-js/utils";
|
5
|
-
import { getFileSystemEntry } from "./getFileSystemEntry";
|
5
|
+
import { getFileSystemEntry, hasEntry, hasServerEntry } from "./getFileSystemEntry";
|
6
6
|
import { isSubDirOrEqual } from "./utils";
|
7
7
|
var ensureExtensions = function(file) {
|
8
8
|
if (!path.extname(file)) {
|
@@ -59,16 +59,22 @@ var getBundleEntry = function() {
|
|
59
59
|
Object.keys(entries).forEach(function(name) {
|
60
60
|
var value = entries[name];
|
61
61
|
var entryName = typeof value === "string" ? value : value.entry;
|
62
|
+
var entryFile = ensureAbsolutePath(appDirectory, entryName);
|
63
|
+
var entryDir = path.dirname(entryFile);
|
64
|
+
var customEntryFile = hasEntry(entryDir);
|
65
|
+
var serverEntryFile = hasServerEntry(entryDir);
|
62
66
|
var isAutoMount = typeof value === "string" ? true : !value.disableMount;
|
63
67
|
var entrypoint = {
|
64
68
|
entryName: name,
|
65
69
|
isMainEntry: false,
|
66
|
-
entry:
|
67
|
-
absoluteEntryDir: isDirectory(
|
70
|
+
entry: typeof value === "string" ? entryFile : value.customEntry ? customEntryFile || entryFile : entryFile,
|
71
|
+
absoluteEntryDir: isDirectory(entryFile) ? entryFile : path.dirname(entryFile),
|
68
72
|
isAutoMount,
|
69
73
|
customBootstrap: typeof value === "string" ? false : value.customBootstrap && ensureAbsolutePath(appDirectory, value.customBootstrap),
|
70
|
-
fileSystemRoutes: fs.statSync(
|
71
|
-
isCustomSourceEntry: true
|
74
|
+
fileSystemRoutes: fs.statSync(entryFile).isDirectory() ? {} : void 0,
|
75
|
+
isCustomSourceEntry: true,
|
76
|
+
customEntry: typeof value === "string" ? false : value.customEntry,
|
77
|
+
customServerEntry: typeof value === "string" ? false : value.customEntry ? serverEntryFile : false
|
72
78
|
};
|
73
79
|
if (!ifAlreadyExists(defaults, entrypoint)) {
|
74
80
|
defaults.push(entrypoint);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import path from "path";
|
2
2
|
import { fs, JS_EXTENSIONS, MAIN_ENTRY_NAME, ensureAbsolutePath, findExists } from "@modern-js/utils";
|
3
|
-
import { getFileSystemEntry } from "./getFileSystemEntry";
|
3
|
+
import { getFileSystemEntry, hasEntry, hasServerEntry } from "./getFileSystemEntry";
|
4
4
|
import { isSubDirOrEqual } from "./utils";
|
5
5
|
const ensureExtensions = (file) => {
|
6
6
|
if (!path.extname(file)) {
|
@@ -30,16 +30,22 @@ const getBundleEntry = async (hooks, appContext, config) => {
|
|
30
30
|
Object.keys(entries).forEach((name) => {
|
31
31
|
const value = entries[name];
|
32
32
|
const entryName = typeof value === "string" ? value : value.entry;
|
33
|
+
const entryFile = ensureAbsolutePath(appDirectory, entryName);
|
34
|
+
const entryDir = path.dirname(entryFile);
|
35
|
+
const customEntryFile = hasEntry(entryDir);
|
36
|
+
const serverEntryFile = hasServerEntry(entryDir);
|
33
37
|
const isAutoMount = typeof value === "string" ? true : !value.disableMount;
|
34
38
|
const entrypoint = {
|
35
39
|
entryName: name,
|
36
40
|
isMainEntry: false,
|
37
|
-
entry:
|
38
|
-
absoluteEntryDir: isDirectory(
|
41
|
+
entry: typeof value === "string" ? entryFile : value.customEntry ? customEntryFile || entryFile : entryFile,
|
42
|
+
absoluteEntryDir: isDirectory(entryFile) ? entryFile : path.dirname(entryFile),
|
39
43
|
isAutoMount,
|
40
44
|
customBootstrap: typeof value === "string" ? false : value.customBootstrap && ensureAbsolutePath(appDirectory, value.customBootstrap),
|
41
|
-
fileSystemRoutes: fs.statSync(
|
42
|
-
isCustomSourceEntry: true
|
45
|
+
fileSystemRoutes: fs.statSync(entryFile).isDirectory() ? {} : void 0,
|
46
|
+
isCustomSourceEntry: true,
|
47
|
+
customEntry: typeof value === "string" ? false : value.customEntry,
|
48
|
+
customServerEntry: typeof value === "string" ? false : value.customEntry ? serverEntryFile : false
|
43
49
|
};
|
44
50
|
if (!ifAlreadyExists(defaults, entrypoint)) {
|
45
51
|
defaults.push(entrypoint);
|
@@ -2,4 +2,6 @@ import type { Entrypoint } from '@modern-js/types';
|
|
2
2
|
import type { AppNormalizedConfig } from '../../types';
|
3
3
|
import type { AppToolsContext, AppToolsHooks } from '../../types/new';
|
4
4
|
export type { Entrypoint };
|
5
|
+
export declare const hasEntry: (dir: string) => string | false;
|
6
|
+
export declare const hasServerEntry: (dir: string) => string | false;
|
5
7
|
export declare const getFileSystemEntry: (hooks: AppToolsHooks<"shared">, appContext: AppToolsContext<"shared">, config: AppNormalizedConfig<"shared">) => Promise<Entrypoint[]>;
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.68.
|
18
|
+
"version": "2.68.13-alpha.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -85,8 +85,8 @@
|
|
85
85
|
"@babel/parser": "^7.22.15",
|
86
86
|
"@babel/traverse": "^7.23.2",
|
87
87
|
"@babel/types": "^7.26.0",
|
88
|
-
"@rsbuild/core": "1.
|
89
|
-
"@rsbuild/plugin-node-polyfill": "1.4.
|
88
|
+
"@rsbuild/core": "1.5.6",
|
89
|
+
"@rsbuild/plugin-node-polyfill": "1.4.2",
|
90
90
|
"@swc/helpers": "^0.5.17",
|
91
91
|
"es-module-lexer": "^1.1.0",
|
92
92
|
"esbuild": "0.25.5",
|
@@ -96,20 +96,20 @@
|
|
96
96
|
"ndepe": "^0.1.12",
|
97
97
|
"pkg-types": "^1.3.1",
|
98
98
|
"std-env": "^3.7.0",
|
99
|
-
"@modern-js/
|
100
|
-
"@modern-js/
|
101
|
-
"@modern-js/
|
102
|
-
"@modern-js/plugin": "2.68.
|
103
|
-
"@modern-js/plugin-
|
104
|
-
"@modern-js/plugin-
|
105
|
-
"@modern-js/
|
106
|
-
"@modern-js/
|
107
|
-
"@modern-js/
|
108
|
-
"@modern-js/server
|
109
|
-
"@modern-js/server
|
110
|
-
"@modern-js/
|
111
|
-
"@modern-js/
|
112
|
-
"@modern-js/
|
99
|
+
"@modern-js/node-bundle-require": "2.68.12",
|
100
|
+
"@modern-js/core": "2.68.12",
|
101
|
+
"@modern-js/plugin": "2.68.12",
|
102
|
+
"@modern-js/plugin-data-loader": "2.68.12",
|
103
|
+
"@modern-js/plugin-v2": "2.68.12",
|
104
|
+
"@modern-js/plugin-i18n": "2.68.12",
|
105
|
+
"@modern-js/server-core": "2.68.12",
|
106
|
+
"@modern-js/rsbuild-plugin-esbuild": "2.68.12",
|
107
|
+
"@modern-js/types": "2.68.12",
|
108
|
+
"@modern-js/prod-server": "2.68.12",
|
109
|
+
"@modern-js/server": "2.68.12",
|
110
|
+
"@modern-js/utils": "2.68.12",
|
111
|
+
"@modern-js/server-utils": "2.68.12",
|
112
|
+
"@modern-js/uni-builder": "2.68.12"
|
113
113
|
},
|
114
114
|
"devDependencies": {
|
115
115
|
"@rsbuild/plugin-webpack-swc": "1.1.2",
|
@@ -120,9 +120,9 @@
|
|
120
120
|
"ts-node": "^10.9.1",
|
121
121
|
"tsconfig-paths": "^4.2.0",
|
122
122
|
"typescript": "^5",
|
123
|
-
"webpack": "^5.101.
|
124
|
-
"@scripts/
|
125
|
-
"@scripts/
|
123
|
+
"webpack": "^5.101.3",
|
124
|
+
"@scripts/jest-config": "2.66.0",
|
125
|
+
"@scripts/build": "2.66.0"
|
126
126
|
},
|
127
127
|
"peerDependencies": {
|
128
128
|
"ts-node": "^10.7.0",
|