@bleedingdev/modern-js-app-tools-extensions 3.9.0-ultramodern.20 → 3.9.0-ultramodern.22
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/build-config/build-environment.js +36 -15
- package/dist/cjs/cloudflare-builder.js +1 -0
- package/dist/cjs/templates/cloudflare-entry.001-bootstrap-security.mjs +0 -3
- package/dist/esm/build-config/build-environment.mjs +37 -16
- package/dist/esm/cloudflare-builder.mjs +1 -0
- package/dist/esm/templates/cloudflare-entry.001-bootstrap-security.mjs +0 -3
- package/dist/esm-node/build-config/build-environment.mjs +37 -16
- package/dist/esm-node/cloudflare-builder.mjs +1 -0
- package/dist/esm-node/templates/cloudflare-entry.001-bootstrap-security.mjs +0 -3
- package/package.json +17 -17
- package/src/build-config/build-environment.ts +80 -27
- package/src/cloudflare-builder.ts +3 -0
- package/src/templates/cloudflare-entry.001-bootstrap-security.mjs +0 -3
|
@@ -31,23 +31,50 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
31
31
|
getBuildConfigEnvironment: ()=>getBuildConfigEnvironment,
|
|
32
32
|
resolveEffectTsgoCompiler: ()=>resolveEffectTsgoCompiler
|
|
33
33
|
});
|
|
34
|
-
const external_node_child_process_namespaceObject = require("node:child_process");
|
|
35
34
|
const external_node_crypto_namespaceObject = require("node:crypto");
|
|
36
35
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
37
36
|
const external_node_module_namespaceObject = require("node:module");
|
|
38
37
|
const external_node_os_namespaceObject = require("node:os");
|
|
39
38
|
const external_node_path_namespaceObject = require("node:path");
|
|
40
39
|
const EFFECT_TSGO_PACKAGE = '@effect/tsgo';
|
|
41
|
-
const
|
|
40
|
+
const NATIVE_TYPESCRIPT_PACKAGES = [
|
|
41
|
+
"typescript",
|
|
42
|
+
"@typescript/native"
|
|
43
|
+
];
|
|
42
44
|
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.';
|
|
43
45
|
const executableEffectTsgoCompilers = new Map();
|
|
44
|
-
function
|
|
46
|
+
function readJson(fileName) {
|
|
47
|
+
return JSON.parse((0, external_node_fs_namespaceObject.readFileSync)(fileName, 'utf-8'));
|
|
48
|
+
}
|
|
49
|
+
function resolvePackageVersion(packageRequire, packageName) {
|
|
50
|
+
let packageJsonPath;
|
|
51
|
+
try {
|
|
52
|
+
packageJsonPath = packageRequire.resolve(`${packageName}/package.json`);
|
|
53
|
+
} catch {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const { version } = readJson(packageJsonPath);
|
|
57
|
+
return 'string' == typeof version ? {
|
|
58
|
+
packageJsonPath,
|
|
59
|
+
version
|
|
60
|
+
} : void 0;
|
|
61
|
+
}
|
|
62
|
+
function resolveEffectTsgoTypeScriptArtifact(from) {
|
|
45
63
|
const projectRequire = (0, external_node_module_namespaceObject.createRequire)(from);
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
64
|
+
const effectTsgoPackageJsonPath = projectRequire.resolve(`${EFFECT_TSGO_PACKAGE}/package.json`);
|
|
65
|
+
const platformTarget = `${process.platform}-${process.arch}`;
|
|
66
|
+
const effectTsgoPlatformPackageJsonPath = (0, external_node_module_namespaceObject.createRequire)(effectTsgoPackageJsonPath).resolve(`${EFFECT_TSGO_PACKAGE}-${platformTarget}/package.json`);
|
|
67
|
+
const upstream = readJson((0, external_node_path_namespaceObject.join)((0, external_node_path_namespaceObject.dirname)(effectTsgoPlatformPackageJsonPath), 'lib', 'upstream.json'));
|
|
68
|
+
const packagedTypeScriptVersions = upstream.components?.typescript ?? {};
|
|
69
|
+
for (const packageName of NATIVE_TYPESCRIPT_PACKAGES){
|
|
70
|
+
const typescript = resolvePackageVersion(projectRequire, packageName);
|
|
71
|
+
const major = typescript && /^\s*(\d+)/u.exec(typescript.version);
|
|
72
|
+
if (!typescript || !major || Number(major[1]) < 7) continue;
|
|
73
|
+
const typescriptPlatform = resolvePackageVersion((0, external_node_module_namespaceObject.createRequire)(typescript.packageJsonPath), `@typescript/typescript-${platformTarget}`);
|
|
74
|
+
if (!typescriptPlatform || !Object.hasOwn(packagedTypeScriptVersions, typescriptPlatform.version)) break;
|
|
75
|
+
return (0, external_node_path_namespaceObject.join)((0, external_node_path_namespaceObject.dirname)(effectTsgoPlatformPackageJsonPath), 'artifacts', "typescript", typescriptPlatform.version, 'win32' === process.platform ? 'tsc.exe' : 'tsc');
|
|
76
|
+
}
|
|
77
|
+
throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
51
78
|
}
|
|
52
79
|
function resolveExecutableEffectTsgoCompiler(compilerPath) {
|
|
53
80
|
if ('win32' === process.platform) return compilerPath;
|
|
@@ -108,13 +135,7 @@ function resolveEffectTsgoCompiler(options) {
|
|
|
108
135
|
throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
109
136
|
}
|
|
110
137
|
try {
|
|
111
|
-
|
|
112
|
-
resolveEffectTsgoCli(options.from),
|
|
113
|
-
'get-exe-path'
|
|
114
|
-
], {
|
|
115
|
-
encoding: 'utf-8'
|
|
116
|
-
}).trim();
|
|
117
|
-
if (compiler) return resolveExecutableEffectTsgoCompiler(compiler);
|
|
138
|
+
return resolveExecutableEffectTsgoCompiler(resolveEffectTsgoTypeScriptArtifact(options.from));
|
|
118
139
|
} catch {}
|
|
119
140
|
throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
120
141
|
}
|
|
@@ -476,6 +476,7 @@ const createCloudflareBundlerChain = (appContext, workerEntryNames)=>{
|
|
|
476
476
|
chain.output.module(true).library({
|
|
477
477
|
type: 'module'
|
|
478
478
|
}).publicPath('/').chunkFormat('module').chunkLoading('import').workerChunkLoading('import');
|
|
479
|
+
chain.node.set('__dirname', 'mock').set('__filename', 'mock');
|
|
479
480
|
for (const condition of [
|
|
480
481
|
'workerd',
|
|
481
482
|
'worker',
|
|
@@ -24,9 +24,6 @@ const ASSET_CORS_HEADERS = {
|
|
|
24
24
|
'access-control-allow-origin': '*',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
globalThis.__dirname ??= '/';
|
|
28
|
-
globalThis.__filename ??= '/index.js';
|
|
29
|
-
|
|
30
27
|
function getAllowedAppCorsOrigin(request) {
|
|
31
28
|
if (APP_CORS_ALLOWED_ORIGINS.length === 0) {
|
|
32
29
|
return null;
|
|
@@ -1,20 +1,47 @@
|
|
|
1
|
-
import { execFileSync } from "node:child_process";
|
|
2
1
|
import { createHash } from "node:crypto";
|
|
3
2
|
import { accessSync, chmodSync, constants, lstatSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
4
3
|
import { createRequire } from "node:module";
|
|
5
4
|
import { tmpdir } from "node:os";
|
|
6
|
-
import { basename, dirname, join
|
|
5
|
+
import { basename, dirname, join } from "node:path";
|
|
7
6
|
const EFFECT_TSGO_PACKAGE = '@effect/tsgo';
|
|
8
|
-
const
|
|
7
|
+
const NATIVE_TYPESCRIPT_PACKAGES = [
|
|
8
|
+
"typescript",
|
|
9
|
+
"@typescript/native"
|
|
10
|
+
];
|
|
9
11
|
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.';
|
|
10
12
|
const executableEffectTsgoCompilers = new Map();
|
|
11
|
-
function
|
|
13
|
+
function readJson(fileName) {
|
|
14
|
+
return JSON.parse(readFileSync(fileName, 'utf-8'));
|
|
15
|
+
}
|
|
16
|
+
function resolvePackageVersion(packageRequire, packageName) {
|
|
17
|
+
let packageJsonPath;
|
|
18
|
+
try {
|
|
19
|
+
packageJsonPath = packageRequire.resolve(`${packageName}/package.json`);
|
|
20
|
+
} catch {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const { version } = readJson(packageJsonPath);
|
|
24
|
+
return 'string' == typeof version ? {
|
|
25
|
+
packageJsonPath,
|
|
26
|
+
version
|
|
27
|
+
} : void 0;
|
|
28
|
+
}
|
|
29
|
+
function resolveEffectTsgoTypeScriptArtifact(from) {
|
|
12
30
|
const projectRequire = createRequire(from);
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
31
|
+
const effectTsgoPackageJsonPath = projectRequire.resolve(`${EFFECT_TSGO_PACKAGE}/package.json`);
|
|
32
|
+
const platformTarget = `${process.platform}-${process.arch}`;
|
|
33
|
+
const effectTsgoPlatformPackageJsonPath = createRequire(effectTsgoPackageJsonPath).resolve(`${EFFECT_TSGO_PACKAGE}-${platformTarget}/package.json`);
|
|
34
|
+
const upstream = readJson(join(dirname(effectTsgoPlatformPackageJsonPath), 'lib', 'upstream.json'));
|
|
35
|
+
const packagedTypeScriptVersions = upstream.components?.typescript ?? {};
|
|
36
|
+
for (const packageName of NATIVE_TYPESCRIPT_PACKAGES){
|
|
37
|
+
const typescript = resolvePackageVersion(projectRequire, packageName);
|
|
38
|
+
const major = typescript && /^\s*(\d+)/u.exec(typescript.version);
|
|
39
|
+
if (!typescript || !major || Number(major[1]) < 7) continue;
|
|
40
|
+
const typescriptPlatform = resolvePackageVersion(createRequire(typescript.packageJsonPath), `@typescript/typescript-${platformTarget}`);
|
|
41
|
+
if (!typescriptPlatform || !Object.hasOwn(packagedTypeScriptVersions, typescriptPlatform.version)) break;
|
|
42
|
+
return join(dirname(effectTsgoPlatformPackageJsonPath), 'artifacts', "typescript", typescriptPlatform.version, 'win32' === process.platform ? 'tsc.exe' : 'tsc');
|
|
43
|
+
}
|
|
44
|
+
throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
18
45
|
}
|
|
19
46
|
function resolveExecutableEffectTsgoCompiler(compilerPath) {
|
|
20
47
|
if ('win32' === process.platform) return compilerPath;
|
|
@@ -75,13 +102,7 @@ function resolveEffectTsgoCompiler(options) {
|
|
|
75
102
|
throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
76
103
|
}
|
|
77
104
|
try {
|
|
78
|
-
|
|
79
|
-
resolveEffectTsgoCli(options.from),
|
|
80
|
-
'get-exe-path'
|
|
81
|
-
], {
|
|
82
|
-
encoding: 'utf-8'
|
|
83
|
-
}).trim();
|
|
84
|
-
if (compiler) return resolveExecutableEffectTsgoCompiler(compiler);
|
|
105
|
+
return resolveExecutableEffectTsgoCompiler(resolveEffectTsgoTypeScriptArtifact(options.from));
|
|
85
106
|
} catch {}
|
|
86
107
|
throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
87
108
|
}
|
|
@@ -423,6 +423,7 @@ const createCloudflareBundlerChain = (appContext, workerEntryNames)=>{
|
|
|
423
423
|
chain.output.module(true).library({
|
|
424
424
|
type: 'module'
|
|
425
425
|
}).publicPath('/').chunkFormat('module').chunkLoading('import').workerChunkLoading('import');
|
|
426
|
+
chain.node.set('__dirname', 'mock').set('__filename', 'mock');
|
|
426
427
|
for (const condition of [
|
|
427
428
|
'workerd',
|
|
428
429
|
'worker',
|
|
@@ -24,9 +24,6 @@ const ASSET_CORS_HEADERS = {
|
|
|
24
24
|
'access-control-allow-origin': '*',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
globalThis.__dirname ??= '/';
|
|
28
|
-
globalThis.__filename ??= '/index.js';
|
|
29
|
-
|
|
30
27
|
function getAllowedAppCorsOrigin(request) {
|
|
31
28
|
if (APP_CORS_ALLOWED_ORIGINS.length === 0) {
|
|
32
29
|
return null;
|
|
@@ -1,21 +1,48 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { execFileSync } from "node:child_process";
|
|
3
2
|
import { createHash } from "node:crypto";
|
|
4
3
|
import { accessSync, chmodSync, constants, lstatSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
5
4
|
import { createRequire } from "node:module";
|
|
6
5
|
import { tmpdir } from "node:os";
|
|
7
|
-
import { basename, dirname, join
|
|
6
|
+
import { basename, dirname, join } from "node:path";
|
|
8
7
|
const EFFECT_TSGO_PACKAGE = '@effect/tsgo';
|
|
9
|
-
const
|
|
8
|
+
const NATIVE_TYPESCRIPT_PACKAGES = [
|
|
9
|
+
"typescript",
|
|
10
|
+
"@typescript/native"
|
|
11
|
+
];
|
|
10
12
|
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.';
|
|
11
13
|
const executableEffectTsgoCompilers = new Map();
|
|
12
|
-
function
|
|
14
|
+
function readJson(fileName) {
|
|
15
|
+
return JSON.parse(readFileSync(fileName, 'utf-8'));
|
|
16
|
+
}
|
|
17
|
+
function resolvePackageVersion(packageRequire, packageName) {
|
|
18
|
+
let packageJsonPath;
|
|
19
|
+
try {
|
|
20
|
+
packageJsonPath = packageRequire.resolve(`${packageName}/package.json`);
|
|
21
|
+
} catch {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const { version } = readJson(packageJsonPath);
|
|
25
|
+
return 'string' == typeof version ? {
|
|
26
|
+
packageJsonPath,
|
|
27
|
+
version
|
|
28
|
+
} : void 0;
|
|
29
|
+
}
|
|
30
|
+
function resolveEffectTsgoTypeScriptArtifact(from) {
|
|
13
31
|
const projectRequire = createRequire(from);
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
32
|
+
const effectTsgoPackageJsonPath = projectRequire.resolve(`${EFFECT_TSGO_PACKAGE}/package.json`);
|
|
33
|
+
const platformTarget = `${process.platform}-${process.arch}`;
|
|
34
|
+
const effectTsgoPlatformPackageJsonPath = createRequire(effectTsgoPackageJsonPath).resolve(`${EFFECT_TSGO_PACKAGE}-${platformTarget}/package.json`);
|
|
35
|
+
const upstream = readJson(join(dirname(effectTsgoPlatformPackageJsonPath), 'lib', 'upstream.json'));
|
|
36
|
+
const packagedTypeScriptVersions = upstream.components?.typescript ?? {};
|
|
37
|
+
for (const packageName of NATIVE_TYPESCRIPT_PACKAGES){
|
|
38
|
+
const typescript = resolvePackageVersion(projectRequire, packageName);
|
|
39
|
+
const major = typescript && /^\s*(\d+)/u.exec(typescript.version);
|
|
40
|
+
if (!typescript || !major || Number(major[1]) < 7) continue;
|
|
41
|
+
const typescriptPlatform = resolvePackageVersion(createRequire(typescript.packageJsonPath), `@typescript/typescript-${platformTarget}`);
|
|
42
|
+
if (!typescriptPlatform || !Object.hasOwn(packagedTypeScriptVersions, typescriptPlatform.version)) break;
|
|
43
|
+
return join(dirname(effectTsgoPlatformPackageJsonPath), 'artifacts', "typescript", typescriptPlatform.version, 'win32' === process.platform ? 'tsc.exe' : 'tsc');
|
|
44
|
+
}
|
|
45
|
+
throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
19
46
|
}
|
|
20
47
|
function resolveExecutableEffectTsgoCompiler(compilerPath) {
|
|
21
48
|
if ('win32' === process.platform) return compilerPath;
|
|
@@ -76,13 +103,7 @@ function resolveEffectTsgoCompiler(options) {
|
|
|
76
103
|
throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
77
104
|
}
|
|
78
105
|
try {
|
|
79
|
-
|
|
80
|
-
resolveEffectTsgoCli(options.from),
|
|
81
|
-
'get-exe-path'
|
|
82
|
-
], {
|
|
83
|
-
encoding: 'utf-8'
|
|
84
|
-
}).trim();
|
|
85
|
-
if (compiler) return resolveExecutableEffectTsgoCompiler(compiler);
|
|
106
|
+
return resolveExecutableEffectTsgoCompiler(resolveEffectTsgoTypeScriptArtifact(options.from));
|
|
86
107
|
} catch {}
|
|
87
108
|
throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
88
109
|
}
|
|
@@ -424,6 +424,7 @@ const createCloudflareBundlerChain = (appContext, workerEntryNames)=>{
|
|
|
424
424
|
chain.output.module(true).library({
|
|
425
425
|
type: 'module'
|
|
426
426
|
}).publicPath('/').chunkFormat('module').chunkLoading('import').workerChunkLoading('import');
|
|
427
|
+
chain.node.set('__dirname', 'mock').set('__filename', 'mock');
|
|
427
428
|
for (const condition of [
|
|
428
429
|
'workerd',
|
|
429
430
|
'worker',
|
|
@@ -24,9 +24,6 @@ const ASSET_CORS_HEADERS = {
|
|
|
24
24
|
'access-control-allow-origin': '*',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
globalThis.__dirname ??= '/';
|
|
28
|
-
globalThis.__filename ??= '/index.js';
|
|
29
|
-
|
|
30
27
|
function getAllowedAppCorsOrigin(request) {
|
|
31
28
|
if (APP_CORS_ALLOWED_ORIGINS.length === 0) {
|
|
32
29
|
return null;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "packages/solutions/app-tools-extensions"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"version": "3.9.0-ultramodern.
|
|
14
|
+
"version": "3.9.0-ultramodern.22",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"src"
|
|
@@ -153,16 +153,16 @@
|
|
|
153
153
|
"@babel/parser": "^8.0.6",
|
|
154
154
|
"@babel/traverse": "^8.0.6",
|
|
155
155
|
"@loadable/component": "5.16.7",
|
|
156
|
-
"@modern-js/backend-federation-contracts": "npm:@bleedingdev/modern-js-backend-federation-contracts@3.9.0-ultramodern.
|
|
157
|
-
"@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.0-ultramodern.
|
|
158
|
-
"@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.9.0-ultramodern.
|
|
159
|
-
"@modern-js/runtime-renderer-extensions": "npm:@bleedingdev/modern-js-runtime-renderer-extensions@3.9.0-ultramodern.
|
|
160
|
-
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.0-ultramodern.
|
|
161
|
-
"@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.
|
|
162
|
-
"@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.
|
|
163
|
-
"@modern-js/surface-resolution": "npm:@bleedingdev/modern-js-surface-resolution@3.9.0-ultramodern.
|
|
164
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.
|
|
165
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.
|
|
156
|
+
"@modern-js/backend-federation-contracts": "npm:@bleedingdev/modern-js-backend-federation-contracts@3.9.0-ultramodern.22",
|
|
157
|
+
"@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.9.0-ultramodern.22",
|
|
158
|
+
"@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.9.0-ultramodern.22",
|
|
159
|
+
"@modern-js/runtime-renderer-extensions": "npm:@bleedingdev/modern-js-runtime-renderer-extensions@3.9.0-ultramodern.22",
|
|
160
|
+
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.0-ultramodern.22",
|
|
161
|
+
"@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.22",
|
|
162
|
+
"@modern-js/server-runtime-extensions": "npm:@bleedingdev/modern-js-server-runtime-extensions@3.9.0-ultramodern.22",
|
|
163
|
+
"@modern-js/surface-resolution": "npm:@bleedingdev/modern-js-surface-resolution@3.9.0-ultramodern.22",
|
|
164
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.22",
|
|
165
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.22",
|
|
166
166
|
"@swc/helpers": "^0.5.23",
|
|
167
167
|
"@vercel/nft": "^1.11.0",
|
|
168
168
|
"compression-webpack-plugin": "^12.0.0",
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
"std-env": "4.2.0"
|
|
171
171
|
},
|
|
172
172
|
"peerDependencies": {
|
|
173
|
-
"@rsbuild/core": "2.2.
|
|
173
|
+
"@rsbuild/core": "2.2.10",
|
|
174
174
|
"react": "^19.2.8"
|
|
175
175
|
},
|
|
176
176
|
"peerDependenciesMeta": {
|
|
@@ -179,13 +179,13 @@
|
|
|
179
179
|
}
|
|
180
180
|
},
|
|
181
181
|
"devDependencies": {
|
|
182
|
-
"@modern-js/bff-effect": "npm:@bleedingdev/modern-js-bff-effect@3.9.0-ultramodern.
|
|
183
|
-
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.
|
|
184
|
-
"@modern-js/plugin-bff-extensions": "npm:@bleedingdev/modern-js-plugin-bff-extensions@3.9.0-ultramodern.
|
|
185
|
-
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.
|
|
182
|
+
"@modern-js/bff-effect": "npm:@bleedingdev/modern-js-bff-effect@3.9.0-ultramodern.22",
|
|
183
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.22",
|
|
184
|
+
"@modern-js/plugin-bff-extensions": "npm:@bleedingdev/modern-js-plugin-bff-extensions@3.9.0-ultramodern.22",
|
|
185
|
+
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.9.0-ultramodern.22",
|
|
186
186
|
"@module-federation/modern-js-v3": "2.9.2",
|
|
187
187
|
"@module-federation/runtime-tools": "2.9.2",
|
|
188
|
-
"@rsbuild/core": "2.2.
|
|
188
|
+
"@rsbuild/core": "2.2.10",
|
|
189
189
|
"@rslib/core": "1.0.2",
|
|
190
190
|
"@scripts/rstest-config": "2.66.0",
|
|
191
191
|
"@types/babel__traverse": "7.28.0",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { execFileSync } from 'node:child_process';
|
|
2
1
|
import { createHash } from 'node:crypto';
|
|
3
2
|
import {
|
|
4
3
|
accessSync,
|
|
@@ -14,37 +13,97 @@ import {
|
|
|
14
13
|
} from 'node:fs';
|
|
15
14
|
import { createRequire } from 'node:module';
|
|
16
15
|
import { tmpdir } from 'node:os';
|
|
17
|
-
import { basename, dirname, join
|
|
16
|
+
import { basename, dirname, join } from 'node:path';
|
|
18
17
|
import type { URL } from 'node:url';
|
|
19
18
|
|
|
20
19
|
const EFFECT_TSGO_PACKAGE = '@effect/tsgo';
|
|
21
|
-
|
|
20
|
+
/** Native TypeScript packages, in the order Effect TS-Go discovers them. */
|
|
21
|
+
const NATIVE_TYPESCRIPT_PACKAGES = ['typescript', '@typescript/native'];
|
|
22
22
|
const EFFECT_TSGO_RESOLUTION_ERROR =
|
|
23
23
|
'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.';
|
|
24
24
|
const executableEffectTsgoCompilers = new Map<string, string>();
|
|
25
25
|
|
|
26
26
|
type PackageJson = {
|
|
27
|
-
|
|
27
|
+
version?: unknown;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
type EffectTsgoUpstreamManifest = {
|
|
31
|
+
components?: {
|
|
32
|
+
typescript?: Record<string, unknown>;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
function readJson<T>(fileName: string): T {
|
|
37
|
+
return JSON.parse(readFileSync(fileName, 'utf-8')) as T;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function resolvePackageVersion(
|
|
41
|
+
packageRequire: NodeJS.Require,
|
|
42
|
+
packageName: string,
|
|
43
|
+
): { packageJsonPath: string; version: string } | undefined {
|
|
44
|
+
let packageJsonPath: string;
|
|
45
|
+
try {
|
|
46
|
+
packageJsonPath = packageRequire.resolve(`${packageName}/package.json`);
|
|
47
|
+
} catch {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const { version } = readJson<PackageJson>(packageJsonPath);
|
|
51
|
+
return typeof version === 'string' ? { packageJsonPath, version } : undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Resolves only the TypeScript component packaged by Effect TS-Go.
|
|
56
|
+
*
|
|
57
|
+
* `effect-tsgo get-exe-path` discovers every integration before selecting the
|
|
58
|
+
* TypeScript one, so an installed Oxlint makes it fail on Linux musl. The
|
|
59
|
+
* TypeScript artifact itself is platform-neutral across libc: the
|
|
60
|
+
* `@effect/tsgo-<platform>-<arch>` package lists it in `lib/upstream.json`
|
|
61
|
+
* under `components.typescript` and ships it at
|
|
62
|
+
* `artifacts/typescript/<version>/tsc`, keyed by the installed
|
|
63
|
+
* `@typescript/typescript-<platform>-<arch>` version.
|
|
64
|
+
*/
|
|
65
|
+
function resolveEffectTsgoTypeScriptArtifact(from: string | URL): string {
|
|
31
66
|
const projectRequire = createRequire(from);
|
|
32
|
-
const
|
|
67
|
+
const effectTsgoPackageJsonPath = projectRequire.resolve(
|
|
33
68
|
`${EFFECT_TSGO_PACKAGE}/package.json`,
|
|
34
69
|
);
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
70
|
+
const platformTarget = `${process.platform}-${process.arch}`;
|
|
71
|
+
const effectTsgoPlatformPackageJsonPath = createRequire(
|
|
72
|
+
effectTsgoPackageJsonPath,
|
|
73
|
+
).resolve(`${EFFECT_TSGO_PACKAGE}-${platformTarget}/package.json`);
|
|
74
|
+
const upstream = readJson<EffectTsgoUpstreamManifest>(
|
|
75
|
+
join(dirname(effectTsgoPlatformPackageJsonPath), 'lib', 'upstream.json'),
|
|
76
|
+
);
|
|
77
|
+
const packagedTypeScriptVersions = upstream.components?.typescript ?? {};
|
|
78
|
+
|
|
79
|
+
for (const packageName of NATIVE_TYPESCRIPT_PACKAGES) {
|
|
80
|
+
const typescript = resolvePackageVersion(projectRequire, packageName);
|
|
81
|
+
const major = typescript && /^\s*(\d+)/u.exec(typescript.version);
|
|
82
|
+
if (!typescript || !major || Number(major[1]) < 7) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const typescriptPlatform = resolvePackageVersion(
|
|
87
|
+
createRequire(typescript.packageJsonPath),
|
|
88
|
+
`@typescript/typescript-${platformTarget}`,
|
|
89
|
+
);
|
|
90
|
+
if (
|
|
91
|
+
!typescriptPlatform ||
|
|
92
|
+
!Object.hasOwn(packagedTypeScriptVersions, typescriptPlatform.version)
|
|
93
|
+
) {
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return join(
|
|
98
|
+
dirname(effectTsgoPlatformPackageJsonPath),
|
|
99
|
+
'artifacts',
|
|
100
|
+
'typescript',
|
|
101
|
+
typescriptPlatform.version,
|
|
102
|
+
process.platform === 'win32' ? 'tsc.exe' : 'tsc',
|
|
103
|
+
);
|
|
45
104
|
}
|
|
46
105
|
|
|
47
|
-
|
|
106
|
+
throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
48
107
|
}
|
|
49
108
|
|
|
50
109
|
function resolveExecutableEffectTsgoCompiler(compilerPath: string): string {
|
|
@@ -143,17 +202,11 @@ export function resolveEffectTsgoCompiler(
|
|
|
143
202
|
}
|
|
144
203
|
|
|
145
204
|
try {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
{ encoding: 'utf-8' },
|
|
150
|
-
).trim();
|
|
151
|
-
|
|
152
|
-
if (compiler) {
|
|
153
|
-
return resolveExecutableEffectTsgoCompiler(compiler);
|
|
154
|
-
}
|
|
205
|
+
return resolveExecutableEffectTsgoCompiler(
|
|
206
|
+
resolveEffectTsgoTypeScriptArtifact(options.from),
|
|
207
|
+
);
|
|
155
208
|
} catch {
|
|
156
|
-
// Use one stable error for package, platform-
|
|
209
|
+
// Use one stable error for package, platform-package, and artifact failures.
|
|
157
210
|
}
|
|
158
211
|
|
|
159
212
|
throw new Error(EFFECT_TSGO_RESOLUTION_ERROR);
|
|
@@ -842,6 +842,9 @@ const createCloudflareBundlerChain = (
|
|
|
842
842
|
.chunkFormat('module')
|
|
843
843
|
.chunkLoading('import')
|
|
844
844
|
.workerChunkLoading('import');
|
|
845
|
+
// workerd has no `__dirname` / `__filename`, so CommonJS dependencies get
|
|
846
|
+
// Rspack's compile-time mock instead of runtime identifiers.
|
|
847
|
+
chain.node.set('__dirname', 'mock').set('__filename', 'mock');
|
|
845
848
|
|
|
846
849
|
for (const condition of [
|
|
847
850
|
'workerd',
|
|
@@ -24,9 +24,6 @@ const ASSET_CORS_HEADERS = {
|
|
|
24
24
|
'access-control-allow-origin': '*',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
globalThis.__dirname ??= '/';
|
|
28
|
-
globalThis.__filename ??= '/index.js';
|
|
29
|
-
|
|
30
27
|
function getAllowedAppCorsOrigin(request) {
|
|
31
28
|
if (APP_CORS_ALLOWED_ORIGINS.length === 0) {
|
|
32
29
|
return null;
|