@bleedingdev/modern-js-app-tools 3.9.0-ultramodern.2 → 3.9.0-ultramodern.21
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/generator/createCopyPattern.js +2 -1
- package/dist/cjs/builder/generator/index.js +0 -1
- package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +2 -1
- package/dist/cjs/builder/shared/builderPlugins/index.js +4 -11
- package/dist/cjs/builder/shared/lazyCompilation.js +26 -0
- package/dist/cjs/commands/index.js +6 -2
- package/dist/cjs/compat/hooks.js +1 -1
- package/dist/cjs/config/index.js +4 -11
- package/dist/cjs/index.js +70 -87
- package/dist/cjs/plugins/analyze/getFileSystemEntry.js +1 -1
- package/dist/cjs/plugins/analyze/getServerRoutes.js +1 -1
- package/dist/cjs/plugins/analyze/utils.js +2 -2
- package/dist/cjs/plugins/deploy/index.js +7 -28
- package/dist/cjs/plugins/deploy/platforms/netlify.js +2 -1
- package/dist/cjs/plugins/deploy/platforms/node.js +12 -16
- package/dist/cjs/plugins/deploy/platforms/vercel.js +2 -1
- package/dist/cjs/plugins/deploy/utils/generator.js +1 -1
- package/dist/cjs/plugins/deploy/utils/index.js +15 -12
- package/dist/cjs/plugins/initialize/index.js +3 -1
- package/dist/cjs/plugins/serverBuild.js +2 -3
- package/dist/cjs/{plugins/backendFederationBuild.js → server-plugin.js} +4 -7
- package/dist/cjs/utils/loadPlugins.js +1 -6
- package/dist/esm/builder/generator/createCopyPattern.mjs +2 -1
- package/dist/esm/builder/generator/index.mjs +1 -2
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.mjs +2 -1
- package/dist/esm/builder/shared/builderPlugins/index.mjs +0 -1
- package/dist/esm/builder/shared/lazyCompilation.mjs +14 -1
- package/dist/esm/commands/index.mjs +6 -2
- package/dist/esm/compat/hooks.mjs +1 -1
- package/dist/esm/config/index.mjs +0 -1
- package/dist/esm/index.mjs +9 -6
- package/dist/esm/plugins/analyze/getFileSystemEntry.mjs +1 -1
- package/dist/esm/plugins/analyze/getServerRoutes.mjs +1 -1
- package/dist/esm/plugins/analyze/utils.mjs +2 -2
- package/dist/esm/plugins/deploy/index.mjs +5 -21
- package/dist/esm/plugins/deploy/platforms/netlify.mjs +2 -1
- package/dist/esm/plugins/deploy/platforms/node.mjs +12 -16
- package/dist/esm/plugins/deploy/platforms/vercel.mjs +2 -1
- package/dist/esm/plugins/deploy/utils/generator.mjs +1 -1
- package/dist/esm/plugins/deploy/utils/index.mjs +17 -14
- package/dist/esm/plugins/initialize/index.mjs +3 -1
- package/dist/esm/plugins/serverBuild.mjs +2 -3
- package/dist/esm/server-plugin.mjs +1 -0
- package/dist/esm/utils/loadPlugins.mjs +2 -7
- package/dist/esm-node/builder/generator/createCopyPattern.mjs +2 -1
- package/dist/esm-node/builder/generator/index.mjs +1 -2
- package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.mjs +2 -1
- package/dist/esm-node/builder/shared/builderPlugins/index.mjs +0 -1
- package/dist/esm-node/builder/shared/lazyCompilation.mjs +14 -1
- package/dist/esm-node/commands/index.mjs +6 -2
- package/dist/esm-node/compat/hooks.mjs +1 -1
- package/dist/esm-node/config/index.mjs +0 -1
- package/dist/esm-node/index.mjs +9 -6
- package/dist/esm-node/plugins/analyze/getFileSystemEntry.mjs +1 -1
- package/dist/esm-node/plugins/analyze/getServerRoutes.mjs +1 -1
- package/dist/esm-node/plugins/analyze/utils.mjs +2 -2
- package/dist/esm-node/plugins/deploy/index.mjs +5 -21
- package/dist/esm-node/plugins/deploy/platforms/netlify.mjs +2 -1
- package/dist/esm-node/plugins/deploy/platforms/node.mjs +12 -16
- package/dist/esm-node/plugins/deploy/platforms/vercel.mjs +2 -1
- package/dist/esm-node/plugins/deploy/utils/generator.mjs +1 -1
- package/dist/esm-node/plugins/deploy/utils/index.mjs +17 -15
- package/dist/esm-node/plugins/initialize/index.mjs +3 -1
- package/dist/esm-node/plugins/serverBuild.mjs +2 -3
- package/dist/esm-node/server-plugin.mjs +2 -0
- package/dist/esm-node/utils/loadPlugins.mjs +2 -7
- package/dist/types/builder/shared/builderPlugins/index.d.ts +0 -1
- package/dist/types/builder/shared/lazyCompilation.d.ts +15 -0
- package/dist/types/config/index.d.ts +0 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/plugins/deploy/index.d.ts +1 -4
- package/dist/types/plugins/deploy/utils/generator.d.ts +1 -1
- package/dist/types/plugins/deploy/utils/index.d.ts +1 -1
- package/dist/types/server-plugin.d.ts +10 -0
- package/dist/types/types/config/output.d.ts +0 -9
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/plugin.d.ts +58 -2
- package/dist/types/utils/initAppContext.d.ts +3 -2
- package/docs/apis/app/commands.md +1 -0
- package/docs/configure/app/bff/effect.md +34 -36
- package/docs/configure/app/source/react-compiler.md +2 -0
- package/docs/guides/advanced-features/bff/data-platform.md +2 -2
- package/docs/guides/advanced-features/bff/frameworks.md +36 -24
- package/docs/guides/advanced-features/bff/function.md +2 -2
- package/docs/guides/advanced-features/bff/operators.md +17 -17
- package/docs/guides/basic-features/render/ssr-cache.md +14 -1
- package/docs/guides/get-started/quick-start.md +2 -6
- package/docs/guides/get-started/ultramodern.md +14 -97
- package/docs/llms.txt +3 -3
- package/docs/plugin/server-plugins/api.md +1 -0
- package/package.json +38 -36
- package/dist/cjs/builder/shared/builderPlugins/adapterPrecompress.js +0 -125
- package/dist/cjs/config/build-environment.js +0 -268
- package/dist/cjs/config/public.js +0 -46
- package/dist/cjs/plugins/backend-federation/codegen.js +0 -256
- package/dist/cjs/plugins/backend-federation/config.js +0 -204
- package/dist/cjs/plugins/backend-federation/emit.js +0 -150
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +0 -62
- package/dist/cjs/plugins/deploy/utils/npmAliases.js +0 -226
- package/dist/cjs/plugins/ultramodernReleaseEnvelope.js +0 -44
- package/dist/cjs/presetUltramodern.js +0 -168
- package/dist/cjs/types/config/precompress.js +0 -18
- package/dist/esm/builder/shared/builderPlugins/adapterPrecompress.mjs +0 -77
- package/dist/esm/config/build-environment.mjs +0 -224
- package/dist/esm/config/public.mjs +0 -1
- package/dist/esm/plugins/backend-federation/codegen.mjs +0 -205
- package/dist/esm/plugins/backend-federation/config.mjs +0 -128
- package/dist/esm/plugins/backend-federation/emit.mjs +0 -99
- package/dist/esm/plugins/backendFederationBuild.mjs +0 -1
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +0 -1
- package/dist/esm/plugins/deploy/utils/npmAliases.mjs +0 -174
- package/dist/esm/plugins/ultramodernReleaseEnvelope.mjs +0 -6
- package/dist/esm/presetUltramodern.mjs +0 -112
- package/dist/esm/types/config/precompress.mjs +0 -0
- package/dist/esm-node/builder/shared/builderPlugins/adapterPrecompress.mjs +0 -78
- package/dist/esm-node/config/build-environment.mjs +0 -225
- package/dist/esm-node/config/public.mjs +0 -2
- package/dist/esm-node/plugins/backend-federation/codegen.mjs +0 -206
- package/dist/esm-node/plugins/backend-federation/config.mjs +0 -129
- package/dist/esm-node/plugins/backend-federation/emit.mjs +0 -100
- package/dist/esm-node/plugins/backendFederationBuild.mjs +0 -2
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +0 -2
- package/dist/esm-node/plugins/deploy/utils/npmAliases.mjs +0 -175
- package/dist/esm-node/plugins/ultramodernReleaseEnvelope.mjs +0 -7
- package/dist/esm-node/presetUltramodern.mjs +0 -113
- package/dist/esm-node/types/config/precompress.mjs +0 -1
- package/dist/types/builder/shared/builderPlugins/adapterPrecompress.d.ts +0 -3
- package/dist/types/config/build-environment.d.ts +0 -22
- package/dist/types/config/public.d.ts +0 -2
- package/dist/types/plugins/backend-federation/codegen.d.ts +0 -86
- package/dist/types/plugins/backend-federation/config.d.ts +0 -103
- package/dist/types/plugins/backend-federation/emit.d.ts +0 -13
- package/dist/types/plugins/backendFederationBuild.d.ts +0 -2
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts +0 -1
- package/dist/types/plugins/deploy/utils/npmAliases.d.ts +0 -14
- package/dist/types/plugins/ultramodernReleaseEnvelope.d.ts +0 -3
- package/dist/types/presetUltramodern.d.ts +0 -87
- package/dist/types/types/config/precompress.d.ts +0 -20
|
@@ -1,268 +0,0 @@
|
|
|
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
|
-
getBuildConfigEnvironment: ()=>getBuildConfigEnvironment,
|
|
32
|
-
resolveEffectTsgoCompiler: ()=>resolveEffectTsgoCompiler,
|
|
33
|
-
withBuildConfigEnvironment: ()=>withBuildConfigEnvironment
|
|
34
|
-
});
|
|
35
|
-
const external_node_child_process_namespaceObject = require("node:child_process");
|
|
36
|
-
const external_node_crypto_namespaceObject = require("node:crypto");
|
|
37
|
-
const external_node_fs_namespaceObject = require("node:fs");
|
|
38
|
-
const external_node_module_namespaceObject = require("node:module");
|
|
39
|
-
const external_node_os_namespaceObject = require("node:os");
|
|
40
|
-
const external_node_path_namespaceObject = require("node:path");
|
|
41
|
-
const EFFECT_TSGO_PACKAGE = '@effect/tsgo';
|
|
42
|
-
const EFFECT_TSGO_BIN = 'effect-tsgo';
|
|
43
|
-
const EFFECT_TSGO_RESOLUTION_ERROR = 'Unable to resolve the Effect TS-Go compiler. Install "@effect/tsgo" and a native TypeScript backend for this build config, or set EFFECT_TSGO_BIN.';
|
|
44
|
-
const executableEffectTsgoCompilers = new Map();
|
|
45
|
-
const BUILD_CONFIG_ENVIRONMENT_PLUGIN = 'ModernJsBuildConfigEnvironmentLeasePlugin';
|
|
46
|
-
const ENVIRONMENT_LEASE_REGISTRY_KEY = Symbol.for('@modern-js/app-tools/build-config-environment-lease-registry/v1');
|
|
47
|
-
const ENVIRONMENT_LEASE_REGISTRY_BRAND = Symbol.for('@modern-js/app-tools/build-config-environment-lease-registry-brand/v1');
|
|
48
|
-
const LIFECYCLE_HOOK_NAMES = [
|
|
49
|
-
'run',
|
|
50
|
-
'watchRun',
|
|
51
|
-
'afterDone',
|
|
52
|
-
'failed',
|
|
53
|
-
'shutdown',
|
|
54
|
-
'watchClose'
|
|
55
|
-
];
|
|
56
|
-
function restoreEnvironment(name, value) {
|
|
57
|
-
if (void 0 === value) delete process.env[name];
|
|
58
|
-
else process.env[name] = value;
|
|
59
|
-
}
|
|
60
|
-
function createEnvironmentLeaseRegistry() {
|
|
61
|
-
const environmentLeases = new Map();
|
|
62
|
-
return Object.freeze({
|
|
63
|
-
acquire (name, value) {
|
|
64
|
-
let lease = environmentLeases.get(name);
|
|
65
|
-
if (lease) {
|
|
66
|
-
if (lease.value !== value) throw new Error(`Build config environment "${name}" already has an active lease for a different value.`);
|
|
67
|
-
if (process.env[name] !== lease.value) throw new Error(`Build config environment lease for "${name}" lost ownership before another lease was acquired.`);
|
|
68
|
-
} else {
|
|
69
|
-
lease = {
|
|
70
|
-
originalValue: process.env[name],
|
|
71
|
-
owners: new Set(),
|
|
72
|
-
value
|
|
73
|
-
};
|
|
74
|
-
process.env[name] = value;
|
|
75
|
-
environmentLeases.set(name, lease);
|
|
76
|
-
}
|
|
77
|
-
const owner = Symbol(name);
|
|
78
|
-
lease.owners.add(owner);
|
|
79
|
-
let released = false;
|
|
80
|
-
return ()=>{
|
|
81
|
-
if (released) return;
|
|
82
|
-
if (environmentLeases.get(name) !== lease || !lease.owners.has(owner)) throw new Error(`Build config environment lease for "${name}" cannot be restored because its ownership record was lost.`);
|
|
83
|
-
released = true;
|
|
84
|
-
const lostOwnership = process.env[name] !== lease.value;
|
|
85
|
-
lease.owners.delete(owner);
|
|
86
|
-
if (0 === lease.owners.size) {
|
|
87
|
-
environmentLeases.delete(name);
|
|
88
|
-
restoreEnvironment(name, lease.originalValue);
|
|
89
|
-
} else if (lostOwnership) process.env[name] = lease.value;
|
|
90
|
-
if (lostOwnership) throw new Error(`Build config environment lease for "${name}" lost ownership before restoration.`);
|
|
91
|
-
};
|
|
92
|
-
},
|
|
93
|
-
brand: ENVIRONMENT_LEASE_REGISTRY_BRAND
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
function getEnvironmentLeaseRegistry() {
|
|
97
|
-
const descriptor = Object.getOwnPropertyDescriptor(process, ENVIRONMENT_LEASE_REGISTRY_KEY);
|
|
98
|
-
if (descriptor) {
|
|
99
|
-
const registry = descriptor.value;
|
|
100
|
-
if (descriptor.configurable || descriptor.enumerable || descriptor.writable || registry?.brand !== ENVIRONMENT_LEASE_REGISTRY_BRAND || 'function' != typeof registry.acquire) throw new Error('The process-global build config environment lease registry is occupied by an incompatible value.');
|
|
101
|
-
return registry;
|
|
102
|
-
}
|
|
103
|
-
const registry = createEnvironmentLeaseRegistry();
|
|
104
|
-
Object.defineProperty(process, ENVIRONMENT_LEASE_REGISTRY_KEY, {
|
|
105
|
-
configurable: false,
|
|
106
|
-
enumerable: false,
|
|
107
|
-
value: registry,
|
|
108
|
-
writable: false
|
|
109
|
-
});
|
|
110
|
-
return registry;
|
|
111
|
-
}
|
|
112
|
-
function acquireEnvironmentLease(name, value) {
|
|
113
|
-
return getEnvironmentLeaseRegistry().acquire(name, value);
|
|
114
|
-
}
|
|
115
|
-
function releaseAfterFailure(release, originalError) {
|
|
116
|
-
try {
|
|
117
|
-
release();
|
|
118
|
-
} catch (restorationError) {
|
|
119
|
-
throw new AggregateError([
|
|
120
|
-
originalError,
|
|
121
|
-
restorationError
|
|
122
|
-
], 'Build config environment setup and restoration both failed.');
|
|
123
|
-
}
|
|
124
|
-
throw originalError;
|
|
125
|
-
}
|
|
126
|
-
class BuildConfigEnvironmentLeasePlugin {
|
|
127
|
-
apply(compiler) {
|
|
128
|
-
const hooks = compiler.hooks;
|
|
129
|
-
try {
|
|
130
|
-
const lifecycleHooks = {};
|
|
131
|
-
for (const hookName of LIFECYCLE_HOOK_NAMES){
|
|
132
|
-
const hook = hooks[hookName];
|
|
133
|
-
if (!hook || 'function' != typeof hook.tap) throw new Error(`Rspack does not expose the "${hookName}" lifecycle hook required to restore build config environment leases.`);
|
|
134
|
-
lifecycleHooks[hookName] = hook;
|
|
135
|
-
}
|
|
136
|
-
let mode = 'pending';
|
|
137
|
-
const modeTap = {
|
|
138
|
-
name: BUILD_CONFIG_ENVIRONMENT_PLUGIN,
|
|
139
|
-
stage: Number.MIN_SAFE_INTEGER
|
|
140
|
-
};
|
|
141
|
-
const releaseTap = {
|
|
142
|
-
name: BUILD_CONFIG_ENVIRONMENT_PLUGIN,
|
|
143
|
-
stage: Number.MAX_SAFE_INTEGER
|
|
144
|
-
};
|
|
145
|
-
const releaseAfterOneShot = ()=>{
|
|
146
|
-
if ('watch' !== mode && true !== compiler.watchMode) this.release();
|
|
147
|
-
};
|
|
148
|
-
lifecycleHooks.run.tap(modeTap, ()=>{
|
|
149
|
-
mode = 'run';
|
|
150
|
-
});
|
|
151
|
-
lifecycleHooks.watchRun.tap(modeTap, ()=>{
|
|
152
|
-
mode = 'watch';
|
|
153
|
-
});
|
|
154
|
-
lifecycleHooks.afterDone.tap(releaseTap, releaseAfterOneShot);
|
|
155
|
-
lifecycleHooks.failed.tap(releaseTap, releaseAfterOneShot);
|
|
156
|
-
lifecycleHooks.shutdown.tap(releaseTap, this.release);
|
|
157
|
-
lifecycleHooks.watchClose.tap(releaseTap, this.release);
|
|
158
|
-
} catch (error) {
|
|
159
|
-
releaseAfterFailure(this.release, error);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
constructor(release){
|
|
163
|
-
this.release = release;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function resolveEffectTsgoCli(from) {
|
|
167
|
-
const projectRequire = (0, external_node_module_namespaceObject.createRequire)(from);
|
|
168
|
-
const packageJsonPath = projectRequire.resolve(`${EFFECT_TSGO_PACKAGE}/package.json`);
|
|
169
|
-
const packageJson = JSON.parse((0, external_node_fs_namespaceObject.readFileSync)(packageJsonPath, 'utf-8'));
|
|
170
|
-
const bin = 'string' == typeof packageJson.bin ? packageJson.bin : packageJson.bin?.[EFFECT_TSGO_BIN];
|
|
171
|
-
if (!bin) throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
172
|
-
return (0, external_node_path_namespaceObject.resolve)((0, external_node_path_namespaceObject.dirname)(packageJsonPath), bin);
|
|
173
|
-
}
|
|
174
|
-
function resolveExecutableEffectTsgoCompiler(compilerPath) {
|
|
175
|
-
if ('win32' === process.platform) return compilerPath;
|
|
176
|
-
const sourcePath = (0, external_node_fs_namespaceObject.realpathSync)(compilerPath);
|
|
177
|
-
const source = (0, external_node_fs_namespaceObject.lstatSync)(sourcePath);
|
|
178
|
-
if (!source.isFile()) throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
179
|
-
try {
|
|
180
|
-
(0, external_node_fs_namespaceObject.accessSync)(sourcePath, external_node_fs_namespaceObject.constants.X_OK);
|
|
181
|
-
return compilerPath;
|
|
182
|
-
} catch {}
|
|
183
|
-
const cachedCompiler = executableEffectTsgoCompilers.get(sourcePath);
|
|
184
|
-
if (cachedCompiler) try {
|
|
185
|
-
(0, external_node_fs_namespaceObject.accessSync)(cachedCompiler, external_node_fs_namespaceObject.constants.X_OK);
|
|
186
|
-
return cachedCompiler;
|
|
187
|
-
} catch {
|
|
188
|
-
executableEffectTsgoCompilers.delete(sourcePath);
|
|
189
|
-
}
|
|
190
|
-
const compilerBytes = (0, external_node_fs_namespaceObject.readFileSync)(sourcePath);
|
|
191
|
-
const compilerDigest = (0, external_node_crypto_namespaceObject.createHash)('sha256').update(compilerBytes).digest('hex');
|
|
192
|
-
const compilerDirectory = (0, external_node_path_namespaceObject.join)((0, external_node_os_namespaceObject.tmpdir)(), 'modern-js', 'effect-tsgo', compilerDigest);
|
|
193
|
-
(0, external_node_fs_namespaceObject.mkdirSync)(compilerDirectory, {
|
|
194
|
-
recursive: true,
|
|
195
|
-
mode: 448
|
|
196
|
-
});
|
|
197
|
-
const executableCompiler = (0, external_node_path_namespaceObject.join)(compilerDirectory, (0, external_node_path_namespaceObject.basename)(sourcePath));
|
|
198
|
-
try {
|
|
199
|
-
(0, external_node_fs_namespaceObject.accessSync)(executableCompiler, external_node_fs_namespaceObject.constants.X_OK);
|
|
200
|
-
} catch {
|
|
201
|
-
const temporaryCompiler = (0, external_node_path_namespaceObject.join)(compilerDirectory, `.${(0, external_node_path_namespaceObject.basename)(sourcePath)}.${process.pid}.tmp`);
|
|
202
|
-
(0, external_node_fs_namespaceObject.rmSync)(temporaryCompiler, {
|
|
203
|
-
force: true
|
|
204
|
-
});
|
|
205
|
-
try {
|
|
206
|
-
(0, external_node_fs_namespaceObject.writeFileSync)(temporaryCompiler, compilerBytes, {
|
|
207
|
-
flag: 'wx',
|
|
208
|
-
mode: 448
|
|
209
|
-
});
|
|
210
|
-
(0, external_node_fs_namespaceObject.chmodSync)(temporaryCompiler, 448);
|
|
211
|
-
(0, external_node_fs_namespaceObject.renameSync)(temporaryCompiler, executableCompiler);
|
|
212
|
-
} finally{
|
|
213
|
-
(0, external_node_fs_namespaceObject.rmSync)(temporaryCompiler, {
|
|
214
|
-
force: true
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
(0, external_node_fs_namespaceObject.accessSync)(executableCompiler, external_node_fs_namespaceObject.constants.X_OK);
|
|
219
|
-
executableEffectTsgoCompilers.set(sourcePath, executableCompiler);
|
|
220
|
-
return executableCompiler;
|
|
221
|
-
}
|
|
222
|
-
function getBuildConfigEnvironment(name) {
|
|
223
|
-
return process.env[name];
|
|
224
|
-
}
|
|
225
|
-
function withBuildConfigEnvironment(name, value, setup) {
|
|
226
|
-
return async (config, ...args)=>{
|
|
227
|
-
const release = acquireEnvironmentLease(name, value);
|
|
228
|
-
try {
|
|
229
|
-
const configured = await setup(config, ...args) ?? config;
|
|
230
|
-
configured.plugins = [
|
|
231
|
-
...configured.plugins ?? [],
|
|
232
|
-
new BuildConfigEnvironmentLeasePlugin(release)
|
|
233
|
-
];
|
|
234
|
-
return configured;
|
|
235
|
-
} catch (error) {
|
|
236
|
-
releaseAfterFailure(release, error);
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
function resolveEffectTsgoCompiler(options) {
|
|
241
|
-
const configuredCompiler = getBuildConfigEnvironment('EFFECT_TSGO_BIN')?.trim();
|
|
242
|
-
if (configuredCompiler) try {
|
|
243
|
-
return resolveExecutableEffectTsgoCompiler(configuredCompiler);
|
|
244
|
-
} catch {
|
|
245
|
-
throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
246
|
-
}
|
|
247
|
-
try {
|
|
248
|
-
const compiler = (0, external_node_child_process_namespaceObject.execFileSync)(process.execPath, [
|
|
249
|
-
resolveEffectTsgoCli(options.from),
|
|
250
|
-
'get-exe-path'
|
|
251
|
-
], {
|
|
252
|
-
encoding: 'utf-8'
|
|
253
|
-
}).trim();
|
|
254
|
-
if (compiler) return resolveExecutableEffectTsgoCompiler(compiler);
|
|
255
|
-
} catch {}
|
|
256
|
-
throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
257
|
-
}
|
|
258
|
-
exports.getBuildConfigEnvironment = __webpack_exports__.getBuildConfigEnvironment;
|
|
259
|
-
exports.resolveEffectTsgoCompiler = __webpack_exports__.resolveEffectTsgoCompiler;
|
|
260
|
-
exports.withBuildConfigEnvironment = __webpack_exports__.withBuildConfigEnvironment;
|
|
261
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
262
|
-
"getBuildConfigEnvironment",
|
|
263
|
-
"resolveEffectTsgoCompiler",
|
|
264
|
-
"withBuildConfigEnvironment"
|
|
265
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
266
|
-
Object.defineProperty(exports, '__esModule', {
|
|
267
|
-
value: true
|
|
268
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
getBuildConfigEnvironment: ()=>external_build_environment_js_namespaceObject.getBuildConfigEnvironment,
|
|
32
|
-
resolveEffectTsgoCompiler: ()=>external_build_environment_js_namespaceObject.resolveEffectTsgoCompiler,
|
|
33
|
-
withBuildConfigEnvironment: ()=>external_build_environment_js_namespaceObject.withBuildConfigEnvironment
|
|
34
|
-
});
|
|
35
|
-
const external_build_environment_js_namespaceObject = require("./build-environment.js");
|
|
36
|
-
exports.getBuildConfigEnvironment = __webpack_exports__.getBuildConfigEnvironment;
|
|
37
|
-
exports.resolveEffectTsgoCompiler = __webpack_exports__.resolveEffectTsgoCompiler;
|
|
38
|
-
exports.withBuildConfigEnvironment = __webpack_exports__.withBuildConfigEnvironment;
|
|
39
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
40
|
-
"getBuildConfigEnvironment",
|
|
41
|
-
"resolveEffectTsgoCompiler",
|
|
42
|
-
"withBuildConfigEnvironment"
|
|
43
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
44
|
-
Object.defineProperty(exports, '__esModule', {
|
|
45
|
-
value: true
|
|
46
|
-
});
|
|
@@ -1,256 +0,0 @@
|
|
|
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
|
-
createBackendManifest: ()=>createBackendManifest,
|
|
41
|
-
createBackendRemoteEntrySource: ()=>createBackendRemoteEntrySource
|
|
42
|
-
});
|
|
43
|
-
const external_node_path_namespaceObject = require("node:path");
|
|
44
|
-
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
45
|
-
const universal_namespaceObject = require("@modern-js/utils/universal");
|
|
46
|
-
const external_esbuild_namespaceObject = require("esbuild");
|
|
47
|
-
const external_config_js_namespaceObject = require("./config.js");
|
|
48
|
-
const createRelativeImportSpecifier = (fromDirectory, toFile)=>{
|
|
49
|
-
const relativePath = (0, external_config_js_namespaceObject.normalizeRelativePath)(external_node_path_default().relative(fromDirectory, toFile));
|
|
50
|
-
return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;
|
|
51
|
-
};
|
|
52
|
-
const createPublicPath = (containerEntry, fallbackPort)=>{
|
|
53
|
-
try {
|
|
54
|
-
return new URL('.', containerEntry).href;
|
|
55
|
-
} catch {
|
|
56
|
-
const slashIndex = containerEntry.lastIndexOf('/');
|
|
57
|
-
if (slashIndex >= 0) return containerEntry.slice(0, slashIndex + 1);
|
|
58
|
-
return `http://localhost:${fallbackPort}/`;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const createBackendRemoteEntrySource = async (workspaceRoot, app, effectApiPath, entryPath)=>{
|
|
62
|
-
const effectApiSpecifier = createRelativeImportSpecifier(external_node_path_default().dirname(effectApiPath), effectApiPath);
|
|
63
|
-
const containerMetadata = {
|
|
64
|
-
buildVersion: app.buildVersion,
|
|
65
|
-
expose: universal_namespaceObject.BACKEND_FEDERATION_EFFECT_EXPOSE,
|
|
66
|
-
name: app.backendName,
|
|
67
|
-
packageName: app.packageName,
|
|
68
|
-
remoteType: app.remoteType,
|
|
69
|
-
source: (0, external_config_js_namespaceObject.normalizeRelativePath)(external_node_path_default().relative(workspaceRoot, effectApiPath)),
|
|
70
|
-
version: app.version,
|
|
71
|
-
...app.unitId ? {
|
|
72
|
-
unitId: app.unitId
|
|
73
|
-
} : {},
|
|
74
|
-
...app.sourceRevision ? {
|
|
75
|
-
sourceRevision: app.sourceRevision
|
|
76
|
-
} : {}
|
|
77
|
-
};
|
|
78
|
-
const compatibility = {
|
|
79
|
-
build: app.buildVersion,
|
|
80
|
-
contractVersion: universal_namespaceObject.BACKEND_FEDERATION_CONTRACT_VERSION,
|
|
81
|
-
nodeAdapterVersion: universal_namespaceObject.BACKEND_FEDERATION_NODE_ADAPTER_VERSION,
|
|
82
|
-
packageName: app.packageName,
|
|
83
|
-
...app.unitId ? {
|
|
84
|
-
unitId: app.unitId
|
|
85
|
-
} : {},
|
|
86
|
-
...app.sourceRevision ? {
|
|
87
|
-
sourceRevision: app.sourceRevision
|
|
88
|
-
} : {}
|
|
89
|
-
};
|
|
90
|
-
const source = `// Generated by Modern.js backend federation build.
|
|
91
|
-
import * as exposedNamespace from ${JSON.stringify(effectApiSpecifier)};
|
|
92
|
-
|
|
93
|
-
const exposedModule = {
|
|
94
|
-
...exposedNamespace,
|
|
95
|
-
backendFederationContract: {
|
|
96
|
-
...(exposedNamespace.backendFederationContract ?? {}),
|
|
97
|
-
compatibility: {
|
|
98
|
-
...(exposedNamespace.backendFederationContract?.compatibility ?? {}),
|
|
99
|
-
...${JSON.stringify(compatibility)},
|
|
100
|
-
},
|
|
101
|
-
name: ${JSON.stringify(app.backendName)},
|
|
102
|
-
role: 'microvertical-server',
|
|
103
|
-
runtimeFramework: 'effect',
|
|
104
|
-
strictEffectApproach: true,
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
const exposedModules = {
|
|
108
|
-
${JSON.stringify(universal_namespaceObject.BACKEND_FEDERATION_EFFECT_EXPOSE)}: () => Promise.resolve(exposedModule),
|
|
109
|
-
};
|
|
110
|
-
const __modernjsBackendFederation = ${JSON.stringify(containerMetadata)};
|
|
111
|
-
|
|
112
|
-
function init() {}
|
|
113
|
-
|
|
114
|
-
function get(id) {
|
|
115
|
-
const load = exposedModules[id];
|
|
116
|
-
if (!load) {
|
|
117
|
-
throw new Error(\`Unexpected backend federation expose: \${id}\`);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return async () => load();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
module.exports = { __modernjsBackendFederation, get, init };
|
|
124
|
-
`;
|
|
125
|
-
const result = await (0, external_esbuild_namespaceObject.build)({
|
|
126
|
-
absWorkingDir: external_node_path_default().dirname(effectApiPath),
|
|
127
|
-
bundle: true,
|
|
128
|
-
format: 'cjs',
|
|
129
|
-
logLevel: 'silent',
|
|
130
|
-
platform: 'node',
|
|
131
|
-
stdin: {
|
|
132
|
-
contents: source,
|
|
133
|
-
loader: 'ts',
|
|
134
|
-
resolveDir: external_node_path_default().dirname(effectApiPath),
|
|
135
|
-
sourcefile: external_node_path_default().basename(entryPath)
|
|
136
|
-
},
|
|
137
|
-
target: 'node20',
|
|
138
|
-
write: false
|
|
139
|
-
});
|
|
140
|
-
const output = result.outputFiles[0];
|
|
141
|
-
if (!output) throw new Error('[backend-federation-build] CommonJS backend federation container emitted no output.');
|
|
142
|
-
return output.text;
|
|
143
|
-
};
|
|
144
|
-
const createBackendManifest = (workspaceRoot, distDirectory, app, entryIntegrity)=>{
|
|
145
|
-
const sourceModule = `${app.directory}/api/effect-api.ts`;
|
|
146
|
-
const publicPath = createPublicPath(app.containerEntry, app.port);
|
|
147
|
-
const manifest = {
|
|
148
|
-
schemaVersion: 1,
|
|
149
|
-
id: app.backendName,
|
|
150
|
-
name: app.backendName,
|
|
151
|
-
version: app.version,
|
|
152
|
-
buildVersion: app.buildVersion,
|
|
153
|
-
metaData: {
|
|
154
|
-
name: app.backendName,
|
|
155
|
-
type: 'backend',
|
|
156
|
-
buildInfo: {
|
|
157
|
-
buildVersion: app.buildVersion,
|
|
158
|
-
buildName: app.packageName
|
|
159
|
-
},
|
|
160
|
-
remoteEntry: {
|
|
161
|
-
name: universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE,
|
|
162
|
-
path: '',
|
|
163
|
-
type: app.remoteType
|
|
164
|
-
},
|
|
165
|
-
globalName: app.backendName,
|
|
166
|
-
publicPath,
|
|
167
|
-
ssrRemoteEntry: {
|
|
168
|
-
name: universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE,
|
|
169
|
-
path: '',
|
|
170
|
-
type: app.remoteType
|
|
171
|
-
},
|
|
172
|
-
ssrPublicPath: publicPath
|
|
173
|
-
},
|
|
174
|
-
entry: {
|
|
175
|
-
...entryIntegrity,
|
|
176
|
-
file: universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE,
|
|
177
|
-
path: (0, external_config_js_namespaceObject.normalizeRelativePath)(external_node_path_default().relative(workspaceRoot, external_node_path_default().join(distDirectory, universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE))),
|
|
178
|
-
type: app.remoteType,
|
|
179
|
-
url: app.containerEntry
|
|
180
|
-
},
|
|
181
|
-
exposes: [
|
|
182
|
-
{
|
|
183
|
-
id: `${app.backendName}:${universal_namespaceObject.BACKEND_FEDERATION_EFFECT_EXPOSE}`,
|
|
184
|
-
name: universal_namespaceObject.BACKEND_FEDERATION_EFFECT_EXPOSE,
|
|
185
|
-
path: '',
|
|
186
|
-
assets: {
|
|
187
|
-
js: {
|
|
188
|
-
async: [],
|
|
189
|
-
sync: [
|
|
190
|
-
universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE
|
|
191
|
-
]
|
|
192
|
-
},
|
|
193
|
-
css: {
|
|
194
|
-
async: [],
|
|
195
|
-
sync: []
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
],
|
|
200
|
-
shared: [],
|
|
201
|
-
backendFederation: {
|
|
202
|
-
role: 'microvertical-server',
|
|
203
|
-
appId: app.id,
|
|
204
|
-
name: app.backendName,
|
|
205
|
-
runtimeFramework: 'effect',
|
|
206
|
-
strictEffectApproach: true,
|
|
207
|
-
contractVersion: universal_namespaceObject.BACKEND_FEDERATION_CONTRACT_VERSION,
|
|
208
|
-
nodeAdapterVersion: universal_namespaceObject.BACKEND_FEDERATION_NODE_ADAPTER_VERSION,
|
|
209
|
-
remoteType: app.remoteType,
|
|
210
|
-
expose: universal_namespaceObject.BACKEND_FEDERATION_EFFECT_EXPOSE,
|
|
211
|
-
manifestUrl: app.manifestUrl,
|
|
212
|
-
containerEntry: app.containerEntry,
|
|
213
|
-
source: {
|
|
214
|
-
module: sourceModule
|
|
215
|
-
},
|
|
216
|
-
readinessPath: `${app.apiPrefix}/${app.apiStem}/readiness`,
|
|
217
|
-
openapiPath: `${app.apiPrefix}/openapi.json`,
|
|
218
|
-
...app.deliveryUnit ? {
|
|
219
|
-
deliveryUnit: app.deliveryUnit
|
|
220
|
-
} : {},
|
|
221
|
-
versionBoundary: {
|
|
222
|
-
invariant: 'web-and-api-same-build',
|
|
223
|
-
packageName: app.packageName,
|
|
224
|
-
version: app.version,
|
|
225
|
-
buildVersion: app.buildVersion,
|
|
226
|
-
...app.uiManifestUrl ? {
|
|
227
|
-
uiManifestUrl: app.uiManifestUrl
|
|
228
|
-
} : {},
|
|
229
|
-
...app.deliveryUnit ? {
|
|
230
|
-
deliveryUnit: {
|
|
231
|
-
unitId: app.deliveryUnit.unitId,
|
|
232
|
-
buildMarker: app.deliveryUnit.buildMarker,
|
|
233
|
-
sourceRevision: app.deliveryUnit.sourceRevision
|
|
234
|
-
}
|
|
235
|
-
} : {}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
const validation = (0, universal_namespaceObject.validateBackendFederationManifest)(manifest, {
|
|
240
|
-
path: 'backendFederationManifest',
|
|
241
|
-
requireEffectExpose: true,
|
|
242
|
-
requireEffectRuntime: true,
|
|
243
|
-
requireVersionFields: true
|
|
244
|
-
});
|
|
245
|
-
if (!validation.ok) throw new Error(`[backend-federation-build] Invalid backend federation manifest: ${(0, universal_namespaceObject.formatBackendFederationValidationErrors)(validation.errors)}.`);
|
|
246
|
-
return manifest;
|
|
247
|
-
};
|
|
248
|
-
exports.createBackendManifest = __webpack_exports__.createBackendManifest;
|
|
249
|
-
exports.createBackendRemoteEntrySource = __webpack_exports__.createBackendRemoteEntrySource;
|
|
250
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
251
|
-
"createBackendManifest",
|
|
252
|
-
"createBackendRemoteEntrySource"
|
|
253
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
254
|
-
Object.defineProperty(exports, '__esModule', {
|
|
255
|
-
value: true
|
|
256
|
-
});
|