@modern-js/app-tools 3.0.5 → 3.1.1
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/builder/shared/builderPlugins/adapterSSR.js +1 -1
- package/dist/cjs/config/default.js +1 -1
- package/dist/cjs/plugins/analyze/utils.js +6 -6
- package/dist/cjs/plugins/deploy/index.js +10 -5
- package/dist/cjs/plugins/deploy/platforms/gh-pages.js +1 -1
- package/dist/cjs/plugins/deploy/platforms/netlify.js +17 -33
- package/dist/cjs/plugins/deploy/platforms/node.js +17 -38
- package/dist/cjs/plugins/deploy/platforms/templates/netlify-entry.cjs +57 -0
- package/dist/cjs/plugins/deploy/platforms/templates/netlify-entry.mjs +59 -0
- package/dist/cjs/plugins/deploy/platforms/templates/node-entry.cjs +44 -0
- package/dist/{esm/plugins/deploy/platforms → cjs/plugins/deploy/platforms/templates}/node-entry.mjs +5 -27
- package/dist/cjs/plugins/deploy/platforms/templates/vercel-entry.cjs +56 -0
- package/dist/cjs/plugins/deploy/platforms/templates/vercel-entry.mjs +58 -0
- package/dist/cjs/plugins/deploy/platforms/vercel.js +15 -32
- package/dist/cjs/plugins/deploy/types.js +18 -0
- package/dist/cjs/plugins/deploy/utils/generator.js +104 -0
- package/dist/cjs/plugins/deploy/{utils.js → utils/index.js} +28 -24
- package/dist/cjs/utils/register.js +1 -9
- package/dist/esm/builder/generator/createCopyPattern.mjs +1 -1
- package/dist/esm/builder/index.mjs +3 -3
- package/dist/esm/builder/shared/builderPlugins/adapterBasic.mjs +2 -2
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.mjs +2 -2
- package/dist/esm/builder/shared/loaders/serverModuleLoader.mjs +1 -1
- package/dist/esm/commands/build.mjs +3 -3
- package/dist/esm/commands/dev.mjs +5 -5
- package/dist/esm/commands/serve.mjs +2 -2
- package/dist/esm/config/default.mjs +1 -1
- package/dist/esm/esm/register-esm.mjs +3 -3
- package/dist/esm/index.mjs +9 -8
- package/dist/esm/plugins/analyze/index.mjs +2 -2
- package/dist/esm/plugins/analyze/utils.mjs +2 -2
- package/dist/esm/plugins/deploy/index.mjs +10 -5
- package/dist/esm/plugins/deploy/platforms/gh-pages.mjs +1 -1
- package/dist/esm/plugins/deploy/platforms/netlify.mjs +25 -41
- package/dist/esm/plugins/deploy/platforms/node.mjs +22 -43
- package/dist/esm/plugins/deploy/platforms/templates/netlify-entry.cjs +57 -0
- package/dist/esm/plugins/deploy/platforms/templates/netlify-entry.mjs +59 -0
- package/dist/esm/plugins/deploy/platforms/templates/node-entry.cjs +44 -0
- package/dist/esm/plugins/deploy/platforms/templates/node-entry.mjs +46 -0
- package/dist/esm/plugins/deploy/platforms/templates/vercel-entry.cjs +56 -0
- package/dist/esm/plugins/deploy/platforms/templates/vercel-entry.mjs +58 -0
- package/dist/esm/plugins/deploy/platforms/vercel.mjs +28 -45
- package/dist/esm/plugins/deploy/types.mjs +0 -0
- package/dist/esm/plugins/deploy/utils/generator.mjs +48 -0
- package/dist/esm/plugins/deploy/utils/index.mjs +40 -0
- package/dist/esm/plugins/initialize/index.mjs +1 -1
- package/dist/esm/plugins/serverBuild.mjs +1 -1
- package/dist/esm/plugins/serverRuntime.mjs +1 -1
- package/dist/esm/utils/loadPlugins.mjs +4 -4
- package/dist/esm/utils/register.mjs +6 -14
- package/dist/esm-node/builder/generator/createCopyPattern.mjs +1 -1
- package/dist/esm-node/builder/index.mjs +3 -3
- package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.mjs +2 -2
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.mjs +2 -2
- package/dist/esm-node/builder/shared/loaders/serverModuleLoader.mjs +1 -1
- package/dist/esm-node/commands/build.mjs +3 -3
- package/dist/esm-node/commands/dev.mjs +5 -5
- package/dist/esm-node/commands/serve.mjs +2 -2
- package/dist/esm-node/config/default.mjs +1 -1
- package/dist/esm-node/esm/register-esm.mjs +3 -3
- package/dist/esm-node/index.mjs +9 -8
- package/dist/esm-node/plugins/analyze/index.mjs +1 -1
- package/dist/esm-node/plugins/analyze/utils.mjs +2 -2
- package/dist/esm-node/plugins/deploy/index.mjs +10 -5
- package/dist/esm-node/plugins/deploy/platforms/gh-pages.mjs +1 -1
- package/dist/esm-node/plugins/deploy/platforms/netlify.mjs +25 -44
- package/dist/esm-node/plugins/deploy/platforms/node.mjs +22 -46
- package/dist/esm-node/plugins/deploy/platforms/templates/netlify-entry.cjs +57 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/netlify-entry.mjs +59 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.cjs +44 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.mjs +46 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/vercel-entry.cjs +56 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/vercel-entry.mjs +58 -0
- package/dist/esm-node/plugins/deploy/platforms/vercel.mjs +28 -48
- package/dist/esm-node/plugins/deploy/types.mjs +1 -0
- package/dist/esm-node/plugins/deploy/utils/generator.mjs +49 -0
- package/dist/esm-node/plugins/deploy/utils/index.mjs +44 -0
- package/dist/esm-node/plugins/initialize/index.mjs +1 -1
- package/dist/esm-node/plugins/serverBuild.mjs +1 -1
- package/dist/esm-node/plugins/serverRuntime.mjs +1 -1
- package/dist/esm-node/utils/loadPlugins.mjs +4 -4
- package/dist/esm-node/utils/register.mjs +6 -14
- package/dist/types/plugins/analyze/utils.d.ts +1 -1
- package/dist/types/plugins/deploy/platforms/platform.d.ts +8 -1
- package/dist/types/plugins/deploy/platforms/templates/netlify-entry.d.cts +2 -0
- package/dist/types/plugins/deploy/platforms/templates/netlify-entry.d.mts +2 -0
- package/dist/types/plugins/deploy/platforms/templates/node-entry.d.mts +1 -0
- package/dist/types/plugins/deploy/platforms/templates/vercel-entry.d.cts +2 -0
- package/dist/types/plugins/deploy/platforms/templates/vercel-entry.d.mts +2 -0
- package/dist/types/plugins/deploy/types.d.ts +3 -0
- package/dist/types/plugins/deploy/utils/generator.d.ts +24 -0
- package/dist/types/plugins/deploy/utils/index.d.ts +16 -0
- package/package.json +13 -12
- package/rslib.config.mts +19 -0
- package/{rstest.config.ts → rstest.config.mts} +0 -4
- package/dist/cjs/plugins/deploy/platforms/netlify-entry.js +0 -36
- package/dist/cjs/plugins/deploy/platforms/netlify-handler.js +0 -89
- package/dist/cjs/plugins/deploy/platforms/node-entry.js +0 -75
- package/dist/cjs/plugins/deploy/platforms/vercel-entry.js +0 -37
- package/dist/cjs/plugins/deploy/platforms/vercel-handler.js +0 -89
- package/dist/esm/plugins/deploy/platforms/netlify-entry.mjs +0 -2
- package/dist/esm/plugins/deploy/platforms/netlify-handler.mjs +0 -85
- package/dist/esm/plugins/deploy/platforms/vercel-entry.mjs +0 -3
- package/dist/esm/plugins/deploy/platforms/vercel-handler.mjs +0 -85
- package/dist/esm/plugins/deploy/utils.mjs +0 -39
- package/dist/esm-node/plugins/deploy/platforms/netlify-entry.mjs +0 -3
- package/dist/esm-node/plugins/deploy/platforms/netlify-handler.mjs +0 -89
- package/dist/esm-node/plugins/deploy/platforms/node-entry.mjs +0 -72
- package/dist/esm-node/plugins/deploy/platforms/vercel-entry.mjs +0 -4
- package/dist/esm-node/plugins/deploy/platforms/vercel-handler.mjs +0 -89
- package/dist/esm-node/plugins/deploy/utils.mjs +0 -40
- package/dist/types/plugins/deploy/platforms/netlify-entry.d.cts +0 -2
- package/dist/types/plugins/deploy/platforms/netlify-entry.d.mts +0 -1
- package/dist/types/plugins/deploy/platforms/netlify-handler.d.cts +0 -1
- package/dist/types/plugins/deploy/platforms/vercel-entry.d.mts +0 -2
- package/dist/types/plugins/deploy/platforms/vercel-entry.d.ts +0 -2
- package/dist/types/plugins/deploy/platforms/vercel-handler.d.cts +0 -1
- package/dist/types/plugins/deploy/utils.d.ts +0 -23
- /package/dist/types/plugins/deploy/platforms/{node-entry.d.ts → templates/node-entry.d.cts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
import { loadServerPlugins } from "@modern-js/prod-server";
|
|
2
3
|
import { compatibleRequire, createDebugger, dynamicImport, getInternalPlugins, tryResolve } from "@modern-js/utils";
|
|
3
|
-
import * as __rspack_external__modern_js_prod_server_057184e2 from "@modern-js/prod-server";
|
|
4
4
|
const debug = createDebugger('load-plugins');
|
|
5
5
|
async function getServerPlugins(api, metaName = 'modern-js') {
|
|
6
6
|
const hooks = api.getHooks();
|
|
@@ -13,9 +13,9 @@ async function getServerPlugins(api, metaName = 'modern-js') {
|
|
|
13
13
|
});
|
|
14
14
|
return filtedPlugins;
|
|
15
15
|
}
|
|
16
|
-
async function
|
|
16
|
+
async function loadPlugins_loadServerPlugins(api, appDirectory, metaName) {
|
|
17
17
|
const plugins = await getServerPlugins(api, metaName);
|
|
18
|
-
const instances = await
|
|
18
|
+
const instances = await loadServerPlugins(plugins, appDirectory);
|
|
19
19
|
return instances;
|
|
20
20
|
}
|
|
21
21
|
const resolveCliPlugin = async (p, appDirectory)=>{
|
|
@@ -43,4 +43,4 @@ const loadInternalPlugins = async (appDirectory, internalPlugins)=>{
|
|
|
43
43
|
}));
|
|
44
44
|
return loadedPlugins;
|
|
45
45
|
};
|
|
46
|
-
export { getServerPlugins, loadInternalPlugins, loadServerPlugins };
|
|
46
|
+
export { getServerPlugins, loadInternalPlugins, loadPlugins_loadServerPlugins as loadServerPlugins };
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import __rslib_shim_module__ from "node:module";
|
|
2
2
|
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const checkDepExist = (dep, appDir)=>{
|
|
6
|
-
try {
|
|
7
|
-
tryResolve(dep, appDir, process.cwd());
|
|
8
|
-
return true;
|
|
9
|
-
} catch {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
3
|
+
import node_path from "node:path";
|
|
4
|
+
import { fs, getAliasConfig, isDepExists, loadFromProject, readTsConfigByFile } from "@modern-js/utils";
|
|
13
5
|
const setupTsRuntime = async (appDir, distDir, alias)=>{
|
|
14
6
|
const TS_CONFIG_FILENAME = "tsconfig.json";
|
|
15
|
-
const tsconfigPath =
|
|
7
|
+
const tsconfigPath = node_path.resolve(appDir, TS_CONFIG_FILENAME);
|
|
16
8
|
const isTsProject = await fs.pathExists(tsconfigPath);
|
|
17
|
-
const hasTsNode =
|
|
9
|
+
const hasTsNode = isDepExists(appDir, 'ts-node');
|
|
18
10
|
if (!isTsProject || !hasTsNode) return;
|
|
19
11
|
const aliasConfig = getAliasConfig(alias, {
|
|
20
12
|
appDirectory: appDir,
|
|
@@ -31,7 +23,7 @@ const setupTsRuntime = async (appDir, distDir, alias)=>{
|
|
|
31
23
|
]
|
|
32
24
|
});
|
|
33
25
|
} catch {}
|
|
34
|
-
if ('string' == typeof tsPath &&
|
|
26
|
+
if ('string' == typeof tsPath && node_path.isAbsolute(tsPath)) tsPath = node_path.relative(absoluteBaseUrl, tsPath);
|
|
35
27
|
if ('string' == typeof tsPath) tsPath = [
|
|
36
28
|
tsPath
|
|
37
29
|
];
|
|
@@ -50,7 +42,7 @@ const setupTsRuntime = async (appDir, distDir, alias)=>{
|
|
|
50
42
|
transpileOnly: true,
|
|
51
43
|
ignore: [
|
|
52
44
|
'(?:^|/)node_modules/',
|
|
53
|
-
`(?:^|/)${
|
|
45
|
+
`(?:^|/)${node_path.relative(appDir, distDir)}/`
|
|
54
46
|
],
|
|
55
47
|
...tsNodeOptions
|
|
56
48
|
});
|
|
@@ -4,7 +4,7 @@ export declare const parseModule: ({ source, filename, }: {
|
|
|
4
4
|
source: string;
|
|
5
5
|
filename: string;
|
|
6
6
|
}) => Promise<readonly [imports: readonly import("es-module-lexer").ImportSpecifier[], exports: readonly import("es-module-lexer").ExportSpecifier[], facade: boolean, hasModuleSyntax: boolean]>;
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const getServerCombinedModuleFile: (internalDirectory: string, entryName: string) => string;
|
|
8
8
|
export declare const checkIsBuildCommands: () => boolean;
|
|
9
9
|
export declare const checkIsServeCommand: () => boolean;
|
|
10
10
|
export declare const isSubDirOrEqual: (parent: string, child: string) => boolean;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { AppToolsNormalizedConfig } from '../../../types';
|
|
2
2
|
import type { AppToolsContext } from '../../../types/plugin';
|
|
3
|
-
|
|
3
|
+
import type { PluginAPI } from '../types';
|
|
4
|
+
interface CreatePresetParams {
|
|
5
|
+
appContext: AppToolsContext;
|
|
6
|
+
modernConfig: AppToolsNormalizedConfig;
|
|
7
|
+
api: PluginAPI;
|
|
8
|
+
needModernServer?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type CreatePreset = (params: CreatePresetParams) => DeployPreset;
|
|
4
11
|
type DeployPreset = {
|
|
5
12
|
prepare?: () => Promise<void>;
|
|
6
13
|
writeOutput?: () => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ProdServerOptions } from '@modern-js/prod-server';
|
|
2
|
+
import type { AppToolsNormalizedConfig } from '../../../types';
|
|
3
|
+
import type { AppToolsContext } from '../../../types/plugin';
|
|
4
|
+
export declare const serverAppContextTemplate: (appContext: AppToolsContext) => {
|
|
5
|
+
sharedDirectory: string;
|
|
6
|
+
apiDirectory: string;
|
|
7
|
+
lambdaDirectory: string;
|
|
8
|
+
metaName: string;
|
|
9
|
+
bffRuntimeFramework: string;
|
|
10
|
+
};
|
|
11
|
+
export type PluginItem = [string, Record<string, any> | undefined];
|
|
12
|
+
export declare const genPluginImportsCode: (plugins: PluginItem[], isESM?: boolean) => string;
|
|
13
|
+
export declare const getPluginsCode: (plugins: PluginItem[]) => string;
|
|
14
|
+
export declare const getServerConfigPath: (meta: string) => string;
|
|
15
|
+
export interface GenerateHandlerOptions {
|
|
16
|
+
template: string;
|
|
17
|
+
appContext: AppToolsContext;
|
|
18
|
+
config: AppToolsNormalizedConfig;
|
|
19
|
+
serverConfig?: Partial<ProdServerOptions>;
|
|
20
|
+
genAppContextTemplate?: typeof serverAppContextTemplate;
|
|
21
|
+
genPluginImports?: typeof genPluginImportsCode;
|
|
22
|
+
isESM?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare const generateHandler: ({ template, appContext, config, serverConfig: modifyServerConfig, genAppContextTemplate, genPluginImports, isESM, }: GenerateHandlerOptions) => Promise<string>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type ServerAppContext = {
|
|
2
|
+
sharedDirectory: string;
|
|
3
|
+
apiDirectory: string;
|
|
4
|
+
lambdaDirectory: string;
|
|
5
|
+
metaName: string;
|
|
6
|
+
bffRuntimeFramework: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const normalizePath: (filePath: string) => string;
|
|
9
|
+
export declare const getProjectUsage: (appDirectory: string, distDirectory: string, metaName: string) => {
|
|
10
|
+
useSSR: boolean;
|
|
11
|
+
useAPI: boolean;
|
|
12
|
+
useWebServer: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const getTemplatePath: (file: string) => string;
|
|
15
|
+
export declare const readTemplate: (file: string) => Promise<string>;
|
|
16
|
+
export declare const resolveESMDependency: (entry: string) => Promise<string | undefined>;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.
|
|
18
|
+
"version": "3.1.1",
|
|
19
19
|
"types": "./dist/types/index.d.ts",
|
|
20
20
|
"main": "./dist/cjs/index.js",
|
|
21
21
|
"exports": {
|
|
@@ -88,24 +88,25 @@
|
|
|
88
88
|
"es-module-lexer": "^1.7.0",
|
|
89
89
|
"esbuild": "0.25.5",
|
|
90
90
|
"esbuild-register": "^3.6.0",
|
|
91
|
+
"import-meta-resolve": "^4.2.0",
|
|
91
92
|
"flatted": "^3.4.0",
|
|
92
93
|
"mlly": "^1.8.0",
|
|
93
94
|
"ndepe": "^0.1.13",
|
|
94
95
|
"pkg-types": "^1.3.1",
|
|
95
96
|
"std-env": "^3.10.0",
|
|
96
|
-
"@modern-js/builder": "3.
|
|
97
|
-
"@modern-js/i18n-utils": "3.
|
|
98
|
-
"@modern-js/plugin": "3.
|
|
99
|
-
"@modern-js/plugin-data-loader": "3.
|
|
100
|
-
"@modern-js/prod-server": "3.
|
|
101
|
-
"@modern-js/server": "3.
|
|
102
|
-
"@modern-js/server-
|
|
103
|
-
"@modern-js/server-
|
|
104
|
-
"@modern-js/
|
|
105
|
-
"@modern-js/
|
|
97
|
+
"@modern-js/builder": "3.1.1",
|
|
98
|
+
"@modern-js/i18n-utils": "3.1.1",
|
|
99
|
+
"@modern-js/plugin": "3.1.1",
|
|
100
|
+
"@modern-js/plugin-data-loader": "3.1.1",
|
|
101
|
+
"@modern-js/prod-server": "3.1.1",
|
|
102
|
+
"@modern-js/server": "3.1.1",
|
|
103
|
+
"@modern-js/server-utils": "3.1.1",
|
|
104
|
+
"@modern-js/server-core": "3.1.1",
|
|
105
|
+
"@modern-js/utils": "3.1.1",
|
|
106
|
+
"@modern-js/types": "3.1.1"
|
|
106
107
|
},
|
|
107
108
|
"devDependencies": {
|
|
108
|
-
"@rslib/core": "0.
|
|
109
|
+
"@rslib/core": "0.20.0",
|
|
109
110
|
"@types/babel__traverse": "7.28.0",
|
|
110
111
|
"@types/node": "^20",
|
|
111
112
|
"ts-node": "^10.9.2",
|
package/rslib.config.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import path from 'path';
|
|
1
2
|
import { rslibConfig } from '@modern-js/rslib';
|
|
2
3
|
import { defineConfig } from '@rslib/core';
|
|
3
4
|
|
|
@@ -6,6 +7,16 @@ export default defineConfig({
|
|
|
6
7
|
lib: rslibConfig.lib?.map(libConfig => {
|
|
7
8
|
return {
|
|
8
9
|
...libConfig,
|
|
10
|
+
source: {
|
|
11
|
+
...libConfig.source,
|
|
12
|
+
entry: {
|
|
13
|
+
index: [
|
|
14
|
+
'./src/**',
|
|
15
|
+
'!src/plugins/deploy/platforms/templates/*.mjs',
|
|
16
|
+
'!src/plugins/deploy/platforms/templates/*.cjs',
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
9
20
|
output: {
|
|
10
21
|
...libConfig.output,
|
|
11
22
|
copy: [
|
|
@@ -13,6 +24,14 @@ export default defineConfig({
|
|
|
13
24
|
from: './src/esm',
|
|
14
25
|
to: './esm',
|
|
15
26
|
},
|
|
27
|
+
{
|
|
28
|
+
from: 'plugins/deploy/platforms/templates/*.cjs',
|
|
29
|
+
context: path.join(__dirname, 'src'),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
from: 'plugins/deploy/platforms/templates/*.mjs',
|
|
33
|
+
context: path.join(__dirname, 'src'),
|
|
34
|
+
},
|
|
16
35
|
],
|
|
17
36
|
},
|
|
18
37
|
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
default: ()=>external_netlify_handler_js_namespaceObject.handler
|
|
28
|
-
});
|
|
29
|
-
const external_netlify_handler_js_namespaceObject = require("./netlify-handler.js");
|
|
30
|
-
exports["default"] = __webpack_exports__["default"];
|
|
31
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
32
|
-
"default"
|
|
33
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
34
|
-
Object.defineProperty(exports, '__esModule', {
|
|
35
|
-
value: true
|
|
36
|
-
});
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
var __webpack_modules__ = {
|
|
2
|
-
"@modern-js/prod-server/netlify" (module) {
|
|
3
|
-
"use strict";
|
|
4
|
-
module.exports = require("@modern-js/prod-server/netlify");
|
|
5
|
-
},
|
|
6
|
-
"node:fs/promises" (module) {
|
|
7
|
-
"use strict";
|
|
8
|
-
module.exports = require("node:fs/promises");
|
|
9
|
-
},
|
|
10
|
-
"node:path" (module) {
|
|
11
|
-
"use strict";
|
|
12
|
-
module.exports = require("node:path");
|
|
13
|
-
},
|
|
14
|
-
"./src/plugins/deploy/platforms/netlify-handler.cjs" (module, __unused_rspack_exports, __webpack_require__) {
|
|
15
|
-
const fs = __webpack_require__("node:fs/promises");
|
|
16
|
-
const path = __webpack_require__("node:path");
|
|
17
|
-
const { createNetlifyFunction } = __webpack_require__("@modern-js/prod-server/netlify");
|
|
18
|
-
p_genPluginImportsCode;
|
|
19
|
-
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production';
|
|
20
|
-
let requestHandler = null;
|
|
21
|
-
let handlerCreationPromise = null;
|
|
22
|
-
async function loadRoutes(routeFilepath) {
|
|
23
|
-
try {
|
|
24
|
-
await fs.access(routeFilepath);
|
|
25
|
-
const content = await fs.readFile(routeFilepath, 'utf-8');
|
|
26
|
-
const routeSpec = JSON.parse(content);
|
|
27
|
-
return routeSpec.routes || [];
|
|
28
|
-
} catch (error) {
|
|
29
|
-
console.warn('route.json not found or invalid, continuing with empty routes.');
|
|
30
|
-
return [];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async function initServer() {
|
|
34
|
-
const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
|
|
35
|
-
const routes = await loadRoutes(routeFilepath);
|
|
36
|
-
const dynamicProdOptions = p_dynamicProdOptions;
|
|
37
|
-
const prodServerOptions = {
|
|
38
|
-
pwd: __dirname,
|
|
39
|
-
routes,
|
|
40
|
-
disableCustomHook: true,
|
|
41
|
-
appContext: {
|
|
42
|
-
sharedDirectory: p_sharedDirectory,
|
|
43
|
-
apiDirectory: p_apiDirectory,
|
|
44
|
-
lambdaDirectory: p_lambdaDirectory,
|
|
45
|
-
bffRuntimeFramework: p_bffRuntimeFramework
|
|
46
|
-
},
|
|
47
|
-
plugins: p_plugins,
|
|
48
|
-
serverConfigPath: p_serverDirectory,
|
|
49
|
-
...dynamicProdOptions
|
|
50
|
-
};
|
|
51
|
-
const requestHandler = await createNetlifyFunction(prodServerOptions);
|
|
52
|
-
return requestHandler;
|
|
53
|
-
}
|
|
54
|
-
async function createHandler() {
|
|
55
|
-
if (!handlerCreationPromise) handlerCreationPromise = (async ()=>{
|
|
56
|
-
try {
|
|
57
|
-
requestHandler = await initServer();
|
|
58
|
-
} catch (error) {
|
|
59
|
-
console.error('Error creating server:', error);
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
})();
|
|
63
|
-
await handlerCreationPromise;
|
|
64
|
-
return requestHandler;
|
|
65
|
-
}
|
|
66
|
-
createHandler();
|
|
67
|
-
module.exports = {
|
|
68
|
-
handler: async (request, context)=>{
|
|
69
|
-
if (!requestHandler) await createHandler();
|
|
70
|
-
return requestHandler(request, context);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
var __webpack_module_cache__ = {};
|
|
76
|
-
function __webpack_require__(moduleId) {
|
|
77
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
78
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
79
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
80
|
-
exports: {}
|
|
81
|
-
};
|
|
82
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
83
|
-
return module.exports;
|
|
84
|
-
}
|
|
85
|
-
var __webpack_exports__ = __webpack_require__("./src/plugins/deploy/platforms/netlify-handler.cjs");
|
|
86
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
87
|
-
Object.defineProperty(exports, '__esModule', {
|
|
88
|
-
value: true
|
|
89
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
var __webpack_modules__ = {
|
|
2
|
-
"@modern-js/prod-server" (module) {
|
|
3
|
-
"use strict";
|
|
4
|
-
module.exports = require("@modern-js/prod-server");
|
|
5
|
-
},
|
|
6
|
-
"node:fs/promises" (module) {
|
|
7
|
-
"use strict";
|
|
8
|
-
module.exports = require("node:fs/promises");
|
|
9
|
-
},
|
|
10
|
-
"node:path" (module) {
|
|
11
|
-
"use strict";
|
|
12
|
-
module.exports = require("node:path");
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
var __webpack_module_cache__ = {};
|
|
16
|
-
function __webpack_require__(moduleId) {
|
|
17
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
18
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
19
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
20
|
-
exports: {}
|
|
21
|
-
};
|
|
22
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
23
|
-
return module.exports;
|
|
24
|
-
}
|
|
25
|
-
var __webpack_exports__ = {};
|
|
26
|
-
(()=>{
|
|
27
|
-
const fs = __webpack_require__("node:fs/promises");
|
|
28
|
-
const path = __webpack_require__("node:path");
|
|
29
|
-
const { createProdServer } = __webpack_require__("@modern-js/prod-server");
|
|
30
|
-
p_genPluginImportsCode;
|
|
31
|
-
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production';
|
|
32
|
-
async function loadRoutes(routeFilepath) {
|
|
33
|
-
try {
|
|
34
|
-
await fs.access(routeFilepath);
|
|
35
|
-
const content = await fs.readFile(routeFilepath, 'utf-8');
|
|
36
|
-
const routeSpec = JSON.parse(content);
|
|
37
|
-
return routeSpec.routes || [];
|
|
38
|
-
} catch (error) {
|
|
39
|
-
console.warn('route.json not found or invalid, continuing with empty routes.');
|
|
40
|
-
return [];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async function main() {
|
|
44
|
-
const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
|
|
45
|
-
const routes = await loadRoutes(routeFilepath);
|
|
46
|
-
const dynamicProdOptions = p_dynamicProdOptions;
|
|
47
|
-
const prodServerOptions = {
|
|
48
|
-
pwd: __dirname,
|
|
49
|
-
routes,
|
|
50
|
-
disableCustomHook: true,
|
|
51
|
-
appContext: {
|
|
52
|
-
sharedDirectory: p_sharedDirectory,
|
|
53
|
-
apiDirectory: p_apiDirectory,
|
|
54
|
-
lambdaDirectory: p_lambdaDirectory,
|
|
55
|
-
bffRuntimeFramework: p_bffRuntimeFramework
|
|
56
|
-
},
|
|
57
|
-
plugins: p_plugins,
|
|
58
|
-
serverConfigPath: p_serverDirectory,
|
|
59
|
-
...dynamicProdOptions
|
|
60
|
-
};
|
|
61
|
-
const app = await createProdServer(prodServerOptions);
|
|
62
|
-
const port = process.env.PORT || 8080;
|
|
63
|
-
app.listen({
|
|
64
|
-
host: '::',
|
|
65
|
-
port
|
|
66
|
-
}, ()=>{
|
|
67
|
-
console.log(`\x1b[32mServer is listening on http://[::]:${port}`, '\x1b[0m');
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
main();
|
|
71
|
-
})();
|
|
72
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
73
|
-
Object.defineProperty(exports, '__esModule', {
|
|
74
|
-
value: true
|
|
75
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
default: ()=>vercel_entry
|
|
28
|
-
});
|
|
29
|
-
const external_vercel_handler_js_namespaceObject = require("./vercel-handler.js");
|
|
30
|
-
const vercel_entry = external_vercel_handler_js_namespaceObject.handler;
|
|
31
|
-
exports["default"] = __webpack_exports__["default"];
|
|
32
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
33
|
-
"default"
|
|
34
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
35
|
-
Object.defineProperty(exports, '__esModule', {
|
|
36
|
-
value: true
|
|
37
|
-
});
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
var __webpack_modules__ = {
|
|
2
|
-
"@modern-js/prod-server" (module) {
|
|
3
|
-
"use strict";
|
|
4
|
-
module.exports = require("@modern-js/prod-server");
|
|
5
|
-
},
|
|
6
|
-
"node:fs/promises" (module) {
|
|
7
|
-
"use strict";
|
|
8
|
-
module.exports = require("node:fs/promises");
|
|
9
|
-
},
|
|
10
|
-
"node:path" (module) {
|
|
11
|
-
"use strict";
|
|
12
|
-
module.exports = require("node:path");
|
|
13
|
-
},
|
|
14
|
-
"./src/plugins/deploy/platforms/vercel-handler.cjs" (module, __unused_rspack_exports, __webpack_require__) {
|
|
15
|
-
const fs = __webpack_require__("node:fs/promises");
|
|
16
|
-
const path = __webpack_require__("node:path");
|
|
17
|
-
const { createProdServer } = __webpack_require__("@modern-js/prod-server");
|
|
18
|
-
p_genPluginImportsCode;
|
|
19
|
-
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production';
|
|
20
|
-
let requestHandler = null;
|
|
21
|
-
let handlerCreationPromise = null;
|
|
22
|
-
async function loadRoutes(routeFilepath) {
|
|
23
|
-
try {
|
|
24
|
-
await fs.access(routeFilepath);
|
|
25
|
-
const content = await fs.readFile(routeFilepath, 'utf-8');
|
|
26
|
-
const routeSpec = JSON.parse(content);
|
|
27
|
-
return routeSpec.routes || [];
|
|
28
|
-
} catch (error) {
|
|
29
|
-
console.warn('route.json not found or invalid, continuing with empty routes.');
|
|
30
|
-
return [];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async function initServer() {
|
|
34
|
-
const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
|
|
35
|
-
const routes = await loadRoutes(routeFilepath);
|
|
36
|
-
const dynamicProdOptions = p_dynamicProdOptions;
|
|
37
|
-
const prodServerOptions = {
|
|
38
|
-
pwd: __dirname,
|
|
39
|
-
routes,
|
|
40
|
-
disableCustomHook: true,
|
|
41
|
-
appContext: {
|
|
42
|
-
sharedDirectory: p_sharedDirectory,
|
|
43
|
-
apiDirectory: p_apiDirectory,
|
|
44
|
-
lambdaDirectory: p_lambdaDirectory
|
|
45
|
-
},
|
|
46
|
-
plugins: p_plugins,
|
|
47
|
-
serverConfigPath: p_serverDirectory,
|
|
48
|
-
...dynamicProdOptions
|
|
49
|
-
};
|
|
50
|
-
const app = await createProdServer(prodServerOptions);
|
|
51
|
-
return app.getRequestListener();
|
|
52
|
-
}
|
|
53
|
-
async function createHandler() {
|
|
54
|
-
if (!handlerCreationPromise) handlerCreationPromise = (async ()=>{
|
|
55
|
-
try {
|
|
56
|
-
requestHandler = await initServer();
|
|
57
|
-
} catch (error) {
|
|
58
|
-
console.error('Error creating server:', error);
|
|
59
|
-
process.exit(1);
|
|
60
|
-
}
|
|
61
|
-
})();
|
|
62
|
-
await handlerCreationPromise;
|
|
63
|
-
return requestHandler;
|
|
64
|
-
}
|
|
65
|
-
createHandler();
|
|
66
|
-
const handler = async (req, res)=>{
|
|
67
|
-
if (!requestHandler) await createHandler();
|
|
68
|
-
return requestHandler(req, res);
|
|
69
|
-
};
|
|
70
|
-
module.exports = {
|
|
71
|
-
handler
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
var __webpack_module_cache__ = {};
|
|
76
|
-
function __webpack_require__(moduleId) {
|
|
77
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
78
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
79
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
80
|
-
exports: {}
|
|
81
|
-
};
|
|
82
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
83
|
-
return module.exports;
|
|
84
|
-
}
|
|
85
|
-
var __webpack_exports__ = __webpack_require__("./src/plugins/deploy/platforms/vercel-handler.cjs");
|
|
86
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
87
|
-
Object.defineProperty(exports, '__esModule', {
|
|
88
|
-
value: true
|
|
89
|
-
});
|