@bleedingdev/modern-js-ultramodern-app-tools 0.0.0 → 3.9.0-ultramodern.10
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/dist/cjs/native-composition/index.js +131 -0
- package/dist/cjs/native-composition/preset.js +178 -0
- package/dist/cjs/native-composition/release-envelope-plugin.js +44 -0
- package/dist/cjs/native-composition/router-integration-plugin.js +55 -0
- package/dist/cjs/native-composition/router-runtime.js +66 -0
- package/dist/cjs/native-composition/rsc-disabled-plugin.js +117 -0
- package/dist/cjs/native-composition/server-plugin.js +50 -0
- package/dist/cjs/native-composition/ssr-integration-plugin.js +145 -0
- package/dist/cjs/native-composition/types.js +18 -0
- package/dist/esm/native-composition/index.mjs +71 -0
- package/dist/esm/native-composition/preset.mjs +126 -0
- package/dist/esm/native-composition/release-envelope-plugin.mjs +6 -0
- package/dist/esm/native-composition/router-integration-plugin.mjs +17 -0
- package/dist/esm/native-composition/router-runtime.mjs +26 -0
- package/dist/esm/native-composition/rsc-disabled-plugin.mjs +79 -0
- package/dist/esm/native-composition/server-plugin.mjs +1 -0
- package/dist/esm/native-composition/ssr-integration-plugin.mjs +104 -0
- package/dist/esm/native-composition/types.mjs +0 -0
- package/dist/esm-node/native-composition/index.mjs +72 -0
- package/dist/esm-node/native-composition/preset.mjs +127 -0
- package/dist/esm-node/native-composition/release-envelope-plugin.mjs +7 -0
- package/dist/esm-node/native-composition/router-integration-plugin.mjs +18 -0
- package/dist/esm-node/native-composition/router-runtime.mjs +27 -0
- package/dist/esm-node/native-composition/rsc-disabled-plugin.mjs +81 -0
- package/dist/esm-node/native-composition/server-plugin.mjs +2 -0
- package/dist/esm-node/native-composition/ssr-integration-plugin.mjs +105 -0
- package/dist/esm-node/native-composition/types.mjs +1 -0
- package/dist/types/native-composition/index.d.ts +6 -0
- package/dist/types/native-composition/preset.d.ts +86 -0
- package/dist/types/native-composition/release-envelope-plugin.d.ts +2 -0
- package/dist/types/native-composition/router-integration-plugin.d.ts +3 -0
- package/dist/types/native-composition/router-runtime.d.ts +4 -0
- package/dist/types/native-composition/rsc-disabled-plugin.d.ts +2 -0
- package/dist/types/native-composition/server-plugin.d.ts +1 -0
- package/dist/types/native-composition/ssr-integration-plugin.d.ts +7 -0
- package/dist/types/native-composition/types.d.ts +24 -0
- package/dist/types-esm/native-composition/index.d.mts +6 -0
- package/dist/types-esm/native-composition/preset.d.mts +86 -0
- package/dist/types-esm/native-composition/release-envelope-plugin.d.mts +2 -0
- package/dist/types-esm/native-composition/router-integration-plugin.d.mts +3 -0
- package/dist/types-esm/native-composition/router-runtime.d.mts +4 -0
- package/dist/types-esm/native-composition/rsc-disabled-plugin.d.mts +2 -0
- package/dist/types-esm/native-composition/server-plugin.d.mts +1 -0
- package/dist/types-esm/native-composition/ssr-integration-plugin.d.mts +7 -0
- package/dist/types-esm/native-composition/types.d.mts +24 -0
- package/package.json +100 -5
- package/src/native-composition/index.ts +92 -0
- package/src/native-composition/preset.ts +338 -0
- package/src/native-composition/release-envelope-plugin.ts +6 -0
- package/src/native-composition/router-integration-plugin.ts +20 -0
- package/src/native-composition/router-runtime.ts +28 -0
- package/src/native-composition/rsc-disabled-plugin.ts +117 -0
- package/src/native-composition/server-plugin.ts +1 -0
- package/src/native-composition/ssr-integration-plugin.ts +244 -0
- package/src/native-composition/types.ts +32 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-present Modern.js
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
+
return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
|
+
}();
|
|
5
|
+
var __webpack_require__ = {};
|
|
6
|
+
(()=>{
|
|
7
|
+
__webpack_require__.n = (module)=>{
|
|
8
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
9
|
+
__webpack_require__.d(getter, {
|
|
10
|
+
a: getter
|
|
11
|
+
});
|
|
12
|
+
return getter;
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
17
|
+
var define = (defs, kind)=>{
|
|
18
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
[kind]: defs[key]
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
define(getters, "get");
|
|
24
|
+
define(values, "value");
|
|
25
|
+
};
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
29
|
+
})();
|
|
30
|
+
(()=>{
|
|
31
|
+
__webpack_require__.r = (exports1)=>{
|
|
32
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
33
|
+
value: 'Module'
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
36
|
+
value: true
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
var __webpack_exports__ = {};
|
|
41
|
+
__webpack_require__.r(__webpack_exports__);
|
|
42
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
43
|
+
createPresetUltramodernConfig: ()=>external_preset_js_namespaceObject.createPresetUltramodernConfig,
|
|
44
|
+
presetUltramodern: ()=>external_preset_js_namespaceObject.presetUltramodern,
|
|
45
|
+
ultramodernAppTools: ()=>ultramodernAppTools,
|
|
46
|
+
ultramodernReleaseEnvelopePlugin: ()=>external_release_envelope_plugin_js_namespaceObject.ultramodernReleaseEnvelopePlugin
|
|
47
|
+
});
|
|
48
|
+
const app_tools_namespaceObject = require("@modern-js/app-tools");
|
|
49
|
+
const backend_federation_build_namespaceObject = require("@modern-js/app-tools-extensions/backend-federation-build");
|
|
50
|
+
var backend_federation_build_default = /*#__PURE__*/ __webpack_require__.n(backend_federation_build_namespaceObject);
|
|
51
|
+
const cloudflare_builder_namespaceObject = require("@modern-js/app-tools-extensions/cloudflare-builder");
|
|
52
|
+
const plugin_namespaceObject = require("@modern-js/app-tools-extensions/deploy-output/plugin");
|
|
53
|
+
const policy_defaults_namespaceObject = require("@modern-js/app-tools-extensions/policy-defaults");
|
|
54
|
+
const runtime_package_resolution_namespaceObject = require("@modern-js/app-tools-extensions/runtime-package-resolution");
|
|
55
|
+
const i18n_integration_namespaceObject = require("@modern-js/i18n-integration");
|
|
56
|
+
const external_release_envelope_plugin_js_namespaceObject = require("./release-envelope-plugin.js");
|
|
57
|
+
const external_router_integration_plugin_js_namespaceObject = require("./router-integration-plugin.js");
|
|
58
|
+
const external_rsc_disabled_plugin_js_namespaceObject = require("./rsc-disabled-plugin.js");
|
|
59
|
+
const external_ssr_integration_plugin_js_namespaceObject = require("./ssr-integration-plugin.js");
|
|
60
|
+
const external_preset_js_namespaceObject = require("./preset.js");
|
|
61
|
+
const ultramodernAppTools = ()=>({
|
|
62
|
+
name: '@modern-js/ultramodern-app-tools',
|
|
63
|
+
usePlugins: [
|
|
64
|
+
(0, app_tools_namespaceObject.appTools)(),
|
|
65
|
+
(0, i18n_integration_namespaceObject.ultramodernI18nIntegrationPlugin)(),
|
|
66
|
+
(0, external_router_integration_plugin_js_namespaceObject.ultramodernRouterIntegrationPlugin)(),
|
|
67
|
+
(0, external_ssr_integration_plugin_js_namespaceObject.ultramodernSSRIntegrationPlugin)(),
|
|
68
|
+
backend_federation_build_default()(),
|
|
69
|
+
(0, cloudflare_builder_namespaceObject.createCloudflareBuilderPlugin)(),
|
|
70
|
+
(0, plugin_namespaceObject.createDeployOutputAliasesPlugin)(),
|
|
71
|
+
(0, external_release_envelope_plugin_js_namespaceObject.ultramodernReleaseEnvelopePlugin)()
|
|
72
|
+
],
|
|
73
|
+
setup (api) {
|
|
74
|
+
const runtimeModuleDirectories = (0, runtime_package_resolution_namespaceObject.collectRuntimePackageModuleDirectories)([
|
|
75
|
+
policy_defaults_namespaceObject.RENDERER_EXTENSIONS_PACKAGE,
|
|
76
|
+
'@modern-js/i18n-integration'
|
|
77
|
+
], __rslib_import_meta_url__);
|
|
78
|
+
api.modifyResolvedConfig((config)=>{
|
|
79
|
+
const builderPlugins = [
|
|
80
|
+
...config.builderPlugins ?? [],
|
|
81
|
+
...runtimeModuleDirectories.length > 0 ? [
|
|
82
|
+
(0, runtime_package_resolution_namespaceObject.createRuntimePackageResolutionPlugin)(runtimeModuleDirectories)
|
|
83
|
+
] : [],
|
|
84
|
+
...config.server?.rsc ? [] : [
|
|
85
|
+
(0, external_rsc_disabled_plugin_js_namespaceObject.rscDisabledRuntimePlugin)()
|
|
86
|
+
]
|
|
87
|
+
];
|
|
88
|
+
return {
|
|
89
|
+
...config,
|
|
90
|
+
builderPlugins
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
api._internalServerPlugins(({ plugins })=>{
|
|
94
|
+
const name = '@modern-js/ultramodern-app-tools/server-plugin';
|
|
95
|
+
const renamed = plugins.map((plugin)=>plugin.name === policy_defaults_namespaceObject.SERVER_EXTENSIONS_PLUGIN_NAME ? {
|
|
96
|
+
...plugin,
|
|
97
|
+
name
|
|
98
|
+
} : plugin);
|
|
99
|
+
if (!renamed.some((plugin)=>plugin.name === name)) renamed.push({
|
|
100
|
+
name
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
plugins: renamed
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
api._internalRuntimePlugins(({ entrypoint, plugins })=>{
|
|
107
|
+
if (!plugins.some((plugin)=>plugin.path === policy_defaults_namespaceObject.RENDERER_EXTENSIONS_PACKAGE)) plugins.push({
|
|
108
|
+
name: 'rendererHead',
|
|
109
|
+
path: policy_defaults_namespaceObject.RENDERER_EXTENSIONS_PACKAGE,
|
|
110
|
+
config: {}
|
|
111
|
+
});
|
|
112
|
+
return {
|
|
113
|
+
entrypoint,
|
|
114
|
+
plugins
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
exports.createPresetUltramodernConfig = __webpack_exports__.createPresetUltramodernConfig;
|
|
120
|
+
exports.presetUltramodern = __webpack_exports__.presetUltramodern;
|
|
121
|
+
exports.ultramodernAppTools = __webpack_exports__.ultramodernAppTools;
|
|
122
|
+
exports.ultramodernReleaseEnvelopePlugin = __webpack_exports__.ultramodernReleaseEnvelopePlugin;
|
|
123
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
124
|
+
"createPresetUltramodernConfig",
|
|
125
|
+
"presetUltramodern",
|
|
126
|
+
"ultramodernAppTools",
|
|
127
|
+
"ultramodernReleaseEnvelopePlugin"
|
|
128
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
129
|
+
Object.defineProperty(exports, '__esModule', {
|
|
130
|
+
value: true
|
|
131
|
+
});
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.r = (exports1)=>{
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
30
|
+
value: 'Module'
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
33
|
+
value: true
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
var __webpack_exports__ = {};
|
|
38
|
+
__webpack_require__.r(__webpack_exports__);
|
|
39
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
createPresetUltramodernConfig: ()=>createPresetUltramodernConfig,
|
|
41
|
+
presetUltramodern: ()=>presetUltramodern
|
|
42
|
+
});
|
|
43
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
44
|
+
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
45
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
46
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
47
|
+
const plugin_namespaceObject = require("@modern-js/app-tools-extensions/build-config/precompress/plugin");
|
|
48
|
+
const config_namespaceObject = require("@modern-js/app-tools-extensions/config");
|
|
49
|
+
const native_type_checker_namespaceObject = require("@modern-js/app-tools-extensions/native-type-checker");
|
|
50
|
+
const release_identity_namespaceObject = require("@modern-js/app-tools-extensions/release-identity");
|
|
51
|
+
const cli_namespaceObject = require("@modern-js/plugin/cli");
|
|
52
|
+
const core_namespaceObject = require("@rsbuild/core");
|
|
53
|
+
const DEFAULT_OTLP_ENDPOINT = 'http://127.0.0.1:4318/v1/logs';
|
|
54
|
+
const DEFAULT_VICTORIA_METRICS_ENDPOINT = 'http://127.0.0.1:8428/api/v1/import/prometheus';
|
|
55
|
+
const resolveReactRouterPackageDir = (appDirectory)=>{
|
|
56
|
+
const resolveNodeModulePackageJson = (packageName, fromDirectory)=>{
|
|
57
|
+
let currentDirectory = external_node_path_default().resolve(fromDirectory);
|
|
58
|
+
while(true){
|
|
59
|
+
const packageJson = external_node_path_default().join(currentDirectory, 'node_modules', packageName, 'package.json');
|
|
60
|
+
if (external_node_fs_default().existsSync(packageJson)) return external_node_fs_default().realpathSync(packageJson);
|
|
61
|
+
const parentDirectory = external_node_path_default().dirname(currentDirectory);
|
|
62
|
+
if (parentDirectory === currentDirectory) return;
|
|
63
|
+
currentDirectory = parentDirectory;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const reactRouterPackageJson = resolveNodeModulePackageJson('react-router', appDirectory);
|
|
67
|
+
if (reactRouterPackageJson) return external_node_path_default().dirname(reactRouterPackageJson);
|
|
68
|
+
const reactRouterDomPackageJson = resolveNodeModulePackageJson('react-router-dom', appDirectory);
|
|
69
|
+
if (!reactRouterDomPackageJson) return;
|
|
70
|
+
const nestedReactRouterPackageJson = resolveNodeModulePackageJson('react-router', external_node_path_default().dirname(reactRouterDomPackageJson));
|
|
71
|
+
if (nestedReactRouterPackageJson) return external_node_path_default().dirname(nestedReactRouterPackageJson);
|
|
72
|
+
};
|
|
73
|
+
const setReactRouterBridgeSafeAliases = (chain, { isProd })=>{
|
|
74
|
+
const chainContext = chain.get('context');
|
|
75
|
+
const appDirectory = 'string' == typeof chainContext && chainContext.length > 0 ? chainContext : process.cwd();
|
|
76
|
+
const reactRouterPackageDir = resolveReactRouterPackageDir(appDirectory);
|
|
77
|
+
if (!reactRouterPackageDir) return;
|
|
78
|
+
const productionEntry = external_node_path_default().join(reactRouterPackageDir, 'dist/production/index.mjs');
|
|
79
|
+
const developmentEntry = external_node_path_default().join(reactRouterPackageDir, 'dist/development/index.mjs');
|
|
80
|
+
chain.resolve.alias.set('react-router$', isProd ? productionEntry : developmentEntry);
|
|
81
|
+
chain.resolve.alias.set('react-router/dist/production/index.js', productionEntry);
|
|
82
|
+
chain.resolve.alias.set('react-router/dist/development/index.js', developmentEntry);
|
|
83
|
+
};
|
|
84
|
+
const createPresetUltramodernConfig = (options = {})=>{
|
|
85
|
+
const { appId = 'app', deliveryUnit, enableBffRequestId = true, enableTelemetry = true, enableTelemetryExporters, otlpEndpoint = process.env.MODERN_TELEMETRY_OTLP_ENDPOINT, victoriaMetricsEndpoint = process.env.MODERN_TELEMETRY_VICTORIA_ENDPOINT, telemetryFailLoudStartup = false, enableModuleFederationSSR = true } = options;
|
|
86
|
+
const server = {};
|
|
87
|
+
const releaseIdentity = deliveryUnit ? (0, release_identity_namespaceObject.resolveUltramodernReleaseIdentity)({
|
|
88
|
+
generationBuildMarker: deliveryUnit.buildMarker,
|
|
89
|
+
unitId: deliveryUnit.unitId
|
|
90
|
+
}) : void 0;
|
|
91
|
+
const bundledReleaseIdentity = releaseIdentity ? {
|
|
92
|
+
...releaseIdentity,
|
|
93
|
+
releaseVersion: deliveryUnit.version
|
|
94
|
+
} : void 0;
|
|
95
|
+
if (enableTelemetry) {
|
|
96
|
+
server.telemetry = {
|
|
97
|
+
enabled: true,
|
|
98
|
+
failLoudStartup: telemetryFailLoudStartup
|
|
99
|
+
};
|
|
100
|
+
if (false !== enableTelemetryExporters) {
|
|
101
|
+
const exporters = {};
|
|
102
|
+
if (true === enableTelemetryExporters || otlpEndpoint) exporters.otlp = {
|
|
103
|
+
enabled: true,
|
|
104
|
+
endpoint: otlpEndpoint || DEFAULT_OTLP_ENDPOINT
|
|
105
|
+
};
|
|
106
|
+
if (true === enableTelemetryExporters || victoriaMetricsEndpoint) exporters.victoriaMetrics = {
|
|
107
|
+
enabled: true,
|
|
108
|
+
endpoint: victoriaMetricsEndpoint || DEFAULT_VICTORIA_METRICS_ENDPOINT
|
|
109
|
+
};
|
|
110
|
+
if (Object.keys(exporters).length > 0) server.telemetry.exporters = exporters;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (enableModuleFederationSSR) server.ssr = {
|
|
114
|
+
mode: 'stream',
|
|
115
|
+
moduleFederationAppSSR: true
|
|
116
|
+
};
|
|
117
|
+
const presetConfig = {
|
|
118
|
+
output: {
|
|
119
|
+
precompress: true
|
|
120
|
+
},
|
|
121
|
+
server,
|
|
122
|
+
source: {
|
|
123
|
+
reactCompiler: true,
|
|
124
|
+
...deliveryUnit ? {
|
|
125
|
+
globalVars: {
|
|
126
|
+
ULTRAMODERN_BUILD_MARKER: releaseIdentity?.buildMarker,
|
|
127
|
+
ULTRAMODERN_RELEASE_VERSION: deliveryUnit.version,
|
|
128
|
+
ULTRAMODERN_SOURCE_REVISION: releaseIdentity?.sourceRevision
|
|
129
|
+
}
|
|
130
|
+
} : {}
|
|
131
|
+
},
|
|
132
|
+
tools: {
|
|
133
|
+
bundlerChain: (chain, utils)=>{
|
|
134
|
+
setReactRouterBridgeSafeAliases(chain, utils);
|
|
135
|
+
(0, native_type_checker_namespaceObject.configureUltramodernTypeChecker)(chain, utils.CHAIN_ID.PLUGIN.TS_CHECKER, (from)=>(0, config_namespaceObject.resolveEffectTsgoCompiler)({
|
|
136
|
+
from
|
|
137
|
+
}));
|
|
138
|
+
},
|
|
139
|
+
lightningcssLoader: true,
|
|
140
|
+
...bundledReleaseIdentity ? {
|
|
141
|
+
rspack: (config)=>{
|
|
142
|
+
config.plugins ??= [];
|
|
143
|
+
config.plugins.push(new core_namespaceObject.rspack.BannerPlugin({
|
|
144
|
+
banner: `void ${JSON.stringify(bundledReleaseIdentity.buildMarker)};void ${JSON.stringify(bundledReleaseIdentity.sourceRevision)};void ${JSON.stringify(bundledReleaseIdentity.releaseVersion)};`,
|
|
145
|
+
raw: true,
|
|
146
|
+
stage: core_namespaceObject.rspack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE,
|
|
147
|
+
test: /\.(?:c|m)?js$/u
|
|
148
|
+
}));
|
|
149
|
+
return config;
|
|
150
|
+
}
|
|
151
|
+
} : {}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
if (enableBffRequestId) presetConfig.bff = {
|
|
155
|
+
requestId: appId
|
|
156
|
+
};
|
|
157
|
+
return presetConfig;
|
|
158
|
+
};
|
|
159
|
+
const presetUltramodern = (config, options = {})=>{
|
|
160
|
+
const merged = (0, cli_namespaceObject.mergeConfig)([
|
|
161
|
+
createPresetUltramodernConfig(options),
|
|
162
|
+
config
|
|
163
|
+
]);
|
|
164
|
+
merged.builderPlugins = [
|
|
165
|
+
(0, plugin_namespaceObject.builderPluginAdapterPrecompress)(merged.output?.precompress),
|
|
166
|
+
...merged.builderPlugins ?? []
|
|
167
|
+
];
|
|
168
|
+
return merged;
|
|
169
|
+
};
|
|
170
|
+
exports.createPresetUltramodernConfig = __webpack_exports__.createPresetUltramodernConfig;
|
|
171
|
+
exports.presetUltramodern = __webpack_exports__.presetUltramodern;
|
|
172
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
173
|
+
"createPresetUltramodernConfig",
|
|
174
|
+
"presetUltramodern"
|
|
175
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
176
|
+
Object.defineProperty(exports, '__esModule', {
|
|
177
|
+
value: true
|
|
178
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
ultramodernReleaseEnvelopePlugin: ()=>ultramodernReleaseEnvelopePlugin
|
|
32
|
+
});
|
|
33
|
+
const target_namespaceObject = require("@modern-js/app-tools-extensions/deploy-output/target");
|
|
34
|
+
const plugin_namespaceObject = require("@modern-js/app-tools-extensions/release-envelope/plugin");
|
|
35
|
+
const ultramodernReleaseEnvelopePlugin = ()=>(0, plugin_namespaceObject.createUltramodernReleaseEnvelopePlugin)({
|
|
36
|
+
resolveDeployTarget: target_namespaceObject.resolveDeployTarget
|
|
37
|
+
});
|
|
38
|
+
exports.ultramodernReleaseEnvelopePlugin = __webpack_exports__.ultramodernReleaseEnvelopePlugin;
|
|
39
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
40
|
+
"ultramodernReleaseEnvelopePlugin"
|
|
41
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
42
|
+
Object.defineProperty(exports, '__esModule', {
|
|
43
|
+
value: true
|
|
44
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
const ultramodernRouterIntegrationPlugin = ()=>({
|
|
31
|
+
name: '@modern-js/ultramodern-router-integration',
|
|
32
|
+
pre: [
|
|
33
|
+
'@modern-js/plugin-router',
|
|
34
|
+
'@modern-js/plugin-tanstack'
|
|
35
|
+
],
|
|
36
|
+
setup (api) {
|
|
37
|
+
api._internalRuntimePlugins(({ entrypoint, plugins })=>({
|
|
38
|
+
entrypoint,
|
|
39
|
+
plugins: plugins.map((plugin)=>'@modern-js/runtime/router/internal' === plugin.path ? {
|
|
40
|
+
...plugin,
|
|
41
|
+
path: '@modern-js/ultramodern-app-tools/router-runtime'
|
|
42
|
+
} : plugin)
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
47
|
+
ultramodernRouterIntegrationPlugin: ultramodernRouterIntegrationPlugin
|
|
48
|
+
});
|
|
49
|
+
exports.ultramodernRouterIntegrationPlugin = __webpack_exports__.ultramodernRouterIntegrationPlugin;
|
|
50
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
51
|
+
"ultramodernRouterIntegrationPlugin"
|
|
52
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
53
|
+
Object.defineProperty(exports, '__esModule', {
|
|
54
|
+
value: true
|
|
55
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
default: ()=>router_runtime,
|
|
32
|
+
routerPlugin: ()=>routerPlugin
|
|
33
|
+
});
|
|
34
|
+
const internal_namespaceObject = require("@modern-js/runtime/router/internal");
|
|
35
|
+
const router_provider_namespaceObject = require("@modern-js/runtime-extensions/router-provider");
|
|
36
|
+
const router_state_plugin_namespaceObject = require("@modern-js/runtime-extensions/router-state-plugin");
|
|
37
|
+
const createProvider = (0, router_provider_namespaceObject.createRouterPlugin)({
|
|
38
|
+
defaultProvider: {
|
|
39
|
+
name: 'react-router',
|
|
40
|
+
factory: internal_namespaceObject.routerPlugin
|
|
41
|
+
},
|
|
42
|
+
registryHooks: internal_namespaceObject.routerProviderRegistryHooks
|
|
43
|
+
});
|
|
44
|
+
const routerPlugin = (config)=>{
|
|
45
|
+
const state = (0, router_state_plugin_namespaceObject.createRouterStatePlugin)({
|
|
46
|
+
registryHooks: internal_namespaceObject.routerProviderRegistryHooks
|
|
47
|
+
});
|
|
48
|
+
const provider = createProvider(config);
|
|
49
|
+
return {
|
|
50
|
+
...provider,
|
|
51
|
+
setup (api) {
|
|
52
|
+
state.setup?.(api);
|
|
53
|
+
return provider.setup?.(api);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const router_runtime = routerPlugin;
|
|
58
|
+
exports["default"] = __webpack_exports__["default"];
|
|
59
|
+
exports.routerPlugin = __webpack_exports__.routerPlugin;
|
|
60
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
61
|
+
"default",
|
|
62
|
+
"routerPlugin"
|
|
63
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
64
|
+
Object.defineProperty(exports, '__esModule', {
|
|
65
|
+
value: true
|
|
66
|
+
});
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
const disabledRuntimeModules = {
|
|
31
|
+
'react-server-dom-rspack/client.browser': './rscDisabledClientBrowserRuntime',
|
|
32
|
+
'react-server-dom-rspack/client.edge': './rscDisabledClientEdgeRuntime',
|
|
33
|
+
'react-server-dom-rspack/client.node': './rscDisabledClientNodeRuntime',
|
|
34
|
+
'react-server-dom-rspack/server.edge': './rscDisabledServerEdgeRuntime',
|
|
35
|
+
'react-server-dom-rspack/server.node': './rscDisabledServerNodeRuntime'
|
|
36
|
+
};
|
|
37
|
+
const disabledRuntimeRequests = Object.keys(disabledRuntimeModules);
|
|
38
|
+
function aliasMatchesRequest(aliasName, request) {
|
|
39
|
+
const exact = aliasName.endsWith('$');
|
|
40
|
+
const normalizedName = exact ? aliasName.slice(0, -1) : aliasName;
|
|
41
|
+
return exact ? normalizedName === request : request === normalizedName || request.startsWith(`${normalizedName}/`);
|
|
42
|
+
}
|
|
43
|
+
function objectAliasMatchesDisabledRuntime(aliasName) {
|
|
44
|
+
return disabledRuntimeRequests.some((request)=>aliasMatchesRequest(aliasName, request));
|
|
45
|
+
}
|
|
46
|
+
function arrayAliasMatchesDisabledRuntime(alias) {
|
|
47
|
+
const aliasName = `${alias.name}${alias.onlyModule ? '$' : ''}`;
|
|
48
|
+
return objectAliasMatchesDisabledRuntime(aliasName);
|
|
49
|
+
}
|
|
50
|
+
function normalizeArrayAliases(aliases) {
|
|
51
|
+
const normalized = {};
|
|
52
|
+
for (const alias of aliases){
|
|
53
|
+
if (arrayAliasMatchesDisabledRuntime(alias)) continue;
|
|
54
|
+
const aliasName = `${alias.name}${alias.onlyModule ? '$' : ''}`;
|
|
55
|
+
const existing = normalized[aliasName];
|
|
56
|
+
if (void 0 === existing) {
|
|
57
|
+
normalized[aliasName] = alias.alias;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
normalized[aliasName] = [
|
|
61
|
+
...Array.isArray(existing) ? existing : [
|
|
62
|
+
existing
|
|
63
|
+
],
|
|
64
|
+
...Array.isArray(alias.alias) ? alias.alias : [
|
|
65
|
+
alias.alias
|
|
66
|
+
]
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
return normalized;
|
|
70
|
+
}
|
|
71
|
+
function resolveDisabledRuntimeModules() {
|
|
72
|
+
return Object.fromEntries(Object.entries(disabledRuntimeModules).map(([request, moduleRequest])=>[
|
|
73
|
+
`${request}$`,
|
|
74
|
+
require.resolve(`@modern-js/runtime-extensions/rsc-disabled/${moduleRequest.slice(2)}`)
|
|
75
|
+
]));
|
|
76
|
+
}
|
|
77
|
+
function applyDisabledRuntimeAliases(config, disabledAliases) {
|
|
78
|
+
config.resolve ??= {};
|
|
79
|
+
if (Array.isArray(config.resolve.alias)) config.resolve.alias = {
|
|
80
|
+
...disabledAliases,
|
|
81
|
+
...normalizeArrayAliases(config.resolve.alias)
|
|
82
|
+
};
|
|
83
|
+
else config.resolve.alias = {
|
|
84
|
+
...disabledAliases,
|
|
85
|
+
...Object.fromEntries(Object.entries(config.resolve.alias ?? {}).filter(([aliasName])=>!objectAliasMatchesDisabledRuntime(aliasName)))
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function rscDisabledRuntimePlugin() {
|
|
89
|
+
return {
|
|
90
|
+
name: 'builder:rsc-disabled-runtime',
|
|
91
|
+
setup (api) {
|
|
92
|
+
const disabledAliases = resolveDisabledRuntimeModules();
|
|
93
|
+
api.modifyRspackConfig({
|
|
94
|
+
order: 'post',
|
|
95
|
+
handler (config) {
|
|
96
|
+
applyDisabledRuntimeAliases(config, disabledAliases);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
api.onBeforeCreateCompiler({
|
|
100
|
+
order: 'post',
|
|
101
|
+
handler ({ bundlerConfigs }) {
|
|
102
|
+
for (const config of bundlerConfigs)applyDisabledRuntimeAliases(config, disabledAliases);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
109
|
+
rscDisabledRuntimePlugin: ()=>rscDisabledRuntimePlugin
|
|
110
|
+
});
|
|
111
|
+
exports.rscDisabledRuntimePlugin = __webpack_exports__.rscDisabledRuntimePlugin;
|
|
112
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
113
|
+
"rscDisabledRuntimePlugin"
|
|
114
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
115
|
+
Object.defineProperty(exports, '__esModule', {
|
|
116
|
+
value: true
|
|
117
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.r = (exports1)=>{
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
30
|
+
value: 'Module'
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
33
|
+
value: true
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
var __webpack_exports__ = {};
|
|
38
|
+
__webpack_require__.r(__webpack_exports__);
|
|
39
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
default: ()=>server_plugin_default()
|
|
41
|
+
});
|
|
42
|
+
const server_plugin_namespaceObject = require("@modern-js/server-runtime-extensions/server-plugin");
|
|
43
|
+
var server_plugin_default = /*#__PURE__*/ __webpack_require__.n(server_plugin_namespaceObject);
|
|
44
|
+
exports["default"] = __webpack_exports__["default"];
|
|
45
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
46
|
+
"default"
|
|
47
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
48
|
+
Object.defineProperty(exports, '__esModule', {
|
|
49
|
+
value: true
|
|
50
|
+
});
|