@ecopages/react 0.2.0-beta.7 → 0.2.0-beta.8
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecopages/react",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.8",
|
|
4
4
|
"description": "React integration for Ecopages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ecopages",
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
"directory": "packages/integrations/react"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@ecopages/core": "0.2.0-beta.
|
|
72
|
+
"@ecopages/core": "0.2.0-beta.8",
|
|
73
73
|
"@types/react": "^19",
|
|
74
74
|
"@types/react-dom": "^19",
|
|
75
75
|
"react": "^19",
|
|
76
76
|
"react-dom": "^19"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@ecopages/file-system": "0.2.0-beta.
|
|
79
|
+
"@ecopages/file-system": "0.2.0-beta.8",
|
|
80
80
|
"@ecopages/logger": "^0.2.3",
|
|
81
81
|
"@mdx-js/mdx": "^3.1.1",
|
|
82
82
|
"oxc-parser": "^0.124.0",
|
package/src/react.plugin.js
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
IntegrationPlugin
|
|
3
3
|
} from "@ecopages/core/plugins/integration-plugin";
|
|
4
4
|
import { Logger } from "@ecopages/logger";
|
|
5
|
+
import path from "node:path";
|
|
5
6
|
import { REACT_PLUGIN_NAME } from "./react.constants.js";
|
|
6
7
|
import { ReactRenderer } from "./react-renderer.js";
|
|
7
8
|
import { ReactHmrStrategy } from "./react-hmr-strategy.js";
|
|
@@ -129,6 +130,9 @@ class ReactPlugin extends IntegrationPlugin {
|
|
|
129
130
|
return;
|
|
130
131
|
}
|
|
131
132
|
this.runtimeBundleService.setRootDir(this.appConfig?.rootDir);
|
|
133
|
+
this.runtimeBundleService.setWorkDir(
|
|
134
|
+
this.appConfig?.absolutePaths?.workDir ?? (this.appConfig?.rootDir ? path.join(this.appConfig.rootDir, this.appConfig.workDir ?? ".eco") : void 0)
|
|
135
|
+
);
|
|
132
136
|
this.integrationDependencies.unshift(...this.runtimeBundleService.getDependencies());
|
|
133
137
|
this.runtimeDependenciesInitialized = true;
|
|
134
138
|
}
|
|
@@ -22,12 +22,14 @@ export type ReactRuntimeImports = {
|
|
|
22
22
|
export interface ReactRuntimeBundleServiceConfig {
|
|
23
23
|
routerAdapter?: ReactRouterAdapter;
|
|
24
24
|
rootDir?: string;
|
|
25
|
+
workDir?: string;
|
|
25
26
|
}
|
|
26
27
|
type RuntimeMode = 'development' | 'production';
|
|
27
28
|
export declare class ReactRuntimeBundleService {
|
|
28
29
|
private readonly config;
|
|
29
30
|
constructor(config: ReactRuntimeBundleServiceConfig);
|
|
30
31
|
setRootDir(rootDir: string | undefined): void;
|
|
32
|
+
setWorkDir(workDir: string | undefined): void;
|
|
31
33
|
private get isDevelopment();
|
|
32
34
|
private getCurrentRuntimeMode;
|
|
33
35
|
private createRuntimeDefines;
|
|
@@ -39,7 +41,9 @@ export declare class ReactRuntimeBundleService {
|
|
|
39
41
|
getRuntimeImports(mode?: RuntimeMode): ReactRuntimeImports;
|
|
40
42
|
getRuntimeAliasMap(mode?: RuntimeMode): Record<string, string>;
|
|
41
43
|
getRuntimeManifest(mode?: RuntimeMode): BrowserRuntimeManifest;
|
|
42
|
-
getDependencies(
|
|
44
|
+
getDependencies(options?: {
|
|
45
|
+
modes?: RuntimeMode[];
|
|
46
|
+
}): AssetDefinition[];
|
|
43
47
|
createRuntimeAliasPlugin(mode?: RuntimeMode): EcoBuildPlugin;
|
|
44
48
|
}
|
|
45
49
|
export {};
|
|
@@ -18,6 +18,9 @@ class ReactRuntimeBundleService {
|
|
|
18
18
|
setRootDir(rootDir) {
|
|
19
19
|
this.config.rootDir = rootDir;
|
|
20
20
|
}
|
|
21
|
+
setWorkDir(workDir) {
|
|
22
|
+
this.config.workDir = workDir;
|
|
23
|
+
}
|
|
21
24
|
get isDevelopment() {
|
|
22
25
|
return process.env.NODE_ENV === "development";
|
|
23
26
|
}
|
|
@@ -83,9 +86,10 @@ class ReactRuntimeBundleService {
|
|
|
83
86
|
getRuntimeManifest(mode = this.getCurrentRuntimeMode()) {
|
|
84
87
|
return buildReactRuntimeManifest(this.getRuntimeImports(mode));
|
|
85
88
|
}
|
|
86
|
-
getDependencies() {
|
|
89
|
+
getDependencies(options) {
|
|
87
90
|
const dependencies = [];
|
|
88
|
-
|
|
91
|
+
const modes = options?.modes ?? [this.getCurrentRuntimeMode()];
|
|
92
|
+
for (const mode of modes) {
|
|
89
93
|
const reactVendorImportRewritePlugin = this.createReactVendorImportRewritePlugin(mode);
|
|
90
94
|
const reactDomRuntimeInteropPlugin = createReactDomRuntimeInteropPlugin({
|
|
91
95
|
reactSpecifier: buildBrowserRuntimeAssetUrl(this.getReactVendorFileName(mode))
|
|
@@ -117,6 +121,7 @@ class ReactRuntimeBundleService {
|
|
|
117
121
|
fileName: this.getReactVendorFileName(mode),
|
|
118
122
|
cacheDirName: `ecopages-react-runtime-${mode}`,
|
|
119
123
|
rootDir: this.config.rootDir,
|
|
124
|
+
workDir: this.config.workDir,
|
|
120
125
|
bundleOptions: {
|
|
121
126
|
define: this.createRuntimeDefines(mode),
|
|
122
127
|
excludeAppBuildPlugins: [DEFAULT_BROWSER_RUNTIME_PLUGIN_NAME]
|
|
@@ -128,6 +133,7 @@ class ReactRuntimeBundleService {
|
|
|
128
133
|
fileName: this.getReactDomVendorFileName(mode),
|
|
129
134
|
cacheDirName: `ecopages-react-runtime-${mode}`,
|
|
130
135
|
rootDir: this.config.rootDir,
|
|
136
|
+
workDir: this.config.workDir,
|
|
131
137
|
bundleOptions: {
|
|
132
138
|
define: this.createRuntimeDefines(mode),
|
|
133
139
|
excludeAppBuildPlugins: [DEFAULT_BROWSER_RUNTIME_PLUGIN_NAME],
|