@teambit/react 0.0.738 → 0.0.739
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/apps/web/compute-results.ts +18 -0
- package/apps/web/react.application.ts +14 -4
- package/artifacts/env-template/public/{756.js → 786.js} +3 -3
- package/artifacts/env-template/public/assets-manifest.json +8 -8
- package/artifacts/env-template/public/{compositions.eb4e1edea0a4802cad5a.js → compositions.0d00c6a0c95a1629320f.js} +1 -1
- package/artifacts/env-template/public/compositions.html +1 -1
- package/artifacts/env-template/public/{overview.37b3198678667237c71a.js → overview.dc235d0310255cf655ab.js} +1 -1
- package/artifacts/env-template/public/overview.html +1 -1
- package/artifacts/env-template/public/{preview-root.0a3624f6e3564141db0b.js → preview-root.4217408043b19c8465c0.js} +1 -1
- package/artifacts/env-template/public/service-worker.js +1 -1
- package/artifacts/preview/teambit_react_react-preview.js +2 -2
- package/{compositions-1653227849497.js → compositions-1653362849981.js} +0 -0
- package/dist/apps/web/compute-results.d.ts +7 -0
- package/dist/apps/web/compute-results.js +21 -0
- package/dist/apps/web/compute-results.js.map +1 -0
- package/dist/apps/web/react.application.d.ts +1 -0
- package/dist/apps/web/react.application.js +25 -7
- package/dist/apps/web/react.application.js.map +1 -1
- package/dist/react.env.d.ts +4 -2
- package/dist/react.env.js +10 -29
- package/dist/react.env.js.map +1 -1
- package/dist/react.main.runtime.d.ts +3 -2
- package/dist/react.main.runtime.js +13 -3
- package/dist/react.main.runtime.js.map +1 -1
- package/dist/webpack/webpack.config.base.prod.d.ts +1 -1
- package/dist/webpack/webpack.config.base.prod.js +1 -13
- package/dist/webpack/webpack.config.base.prod.js.map +1 -1
- package/{overview-1653227849497.js → overview-1653362849981.js} +0 -0
- package/package-tar/teambit-react-0.0.739.tgz +0 -0
- package/package.json +26 -33
- package/{preview-1653227849497.js → preview-1653362849981.js} +2 -2
- package/webpack/webpack.config.base.prod.ts +1 -5
- package/dist/webpack/get-exposed-rules.d.ts +0 -3
- package/dist/webpack/get-exposed-rules.js +0 -60
- package/dist/webpack/get-exposed-rules.js.map +0 -1
- package/dist/webpack/get-externals.d.ts +0 -1
- package/dist/webpack/get-externals.js +0 -42
- package/dist/webpack/get-externals.js.map +0 -1
- package/dist/webpack/resolve-peer.d.ts +0 -14
- package/dist/webpack/resolve-peer.js +0 -108
- package/dist/webpack/resolve-peer.js.map +0 -1
- package/dist/webpack/transformers.d.ts +0 -10
- package/dist/webpack/transformers.js +0 -66
- package/dist/webpack/transformers.js.map +0 -1
- package/package-tar/teambit-react-0.0.738.tgz +0 -0
- package/webpack/get-exposed-rules.ts +0 -14
- package/webpack/get-externals.ts +0 -8
- package/webpack/resolve-peer.ts +0 -60
- package/webpack/transformers.ts +0 -37
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BundlerResult } from '@teambit/bundler';
|
|
2
|
+
import { ReactAppBuildResult } from './react-build-result';
|
|
3
|
+
|
|
4
|
+
type resultsOptions = {
|
|
5
|
+
publicDir: string;
|
|
6
|
+
};
|
|
7
|
+
export async function computeResults(
|
|
8
|
+
results: BundlerResult[],
|
|
9
|
+
{ publicDir }: resultsOptions
|
|
10
|
+
): Promise<ReactAppBuildResult> {
|
|
11
|
+
const result = results[0];
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
publicDir,
|
|
15
|
+
errors: result.errors,
|
|
16
|
+
warnings: result.warnings,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -11,6 +11,7 @@ import { ReactAppBuildResult } from './react-build-result';
|
|
|
11
11
|
import { ReactAppPrerenderOptions } from './react-app-options';
|
|
12
12
|
import { html } from '../../webpack';
|
|
13
13
|
import { ReactDeployContext } from '.';
|
|
14
|
+
import { computeResults } from './compute-results';
|
|
14
15
|
|
|
15
16
|
export class ReactApp implements Application {
|
|
16
17
|
constructor(
|
|
@@ -35,7 +36,7 @@ export class ReactApp implements Application {
|
|
|
35
36
|
await this.devServer.listen(port);
|
|
36
37
|
return port;
|
|
37
38
|
}
|
|
38
|
-
const devServerContext = this.getDevServerContext(context);
|
|
39
|
+
const devServerContext = await this.getDevServerContext(context);
|
|
39
40
|
const devServer = this.reactEnv.getDevServer(devServerContext, [
|
|
40
41
|
(configMutator) =>
|
|
41
42
|
configMutator.addTopLevel('devServer', {
|
|
@@ -70,8 +71,9 @@ export class ReactApp implements Application {
|
|
|
70
71
|
html: htmlConfig,
|
|
71
72
|
});
|
|
72
73
|
const bundler = await this.getBundler(context);
|
|
73
|
-
await bundler.run();
|
|
74
|
-
|
|
74
|
+
const bundleResult = await bundler.run();
|
|
75
|
+
|
|
76
|
+
return computeResults(bundleResult, { publicDir: `${this.getPublicDir()}/${this.dir}` });
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
private getBundler(context: AppBuildContext) {
|
|
@@ -93,6 +95,8 @@ export class ReactApp implements Application {
|
|
|
93
95
|
components: [capsule?.component],
|
|
94
96
|
entries,
|
|
95
97
|
outputPath,
|
|
98
|
+
hostDependencies: await this.getPeers(),
|
|
99
|
+
aliasHostDependencies: true,
|
|
96
100
|
},
|
|
97
101
|
],
|
|
98
102
|
entry: [],
|
|
@@ -177,13 +181,19 @@ export class ReactApp implements Application {
|
|
|
177
181
|
return join(this.applicationType, this.name);
|
|
178
182
|
}
|
|
179
183
|
|
|
180
|
-
private getDevServerContext(context: AppContext): DevServerContext {
|
|
184
|
+
private async getDevServerContext(context: AppContext): Promise<DevServerContext> {
|
|
181
185
|
return Object.assign(context, {
|
|
182
186
|
entry: this.entry,
|
|
183
187
|
rootPath: '',
|
|
184
188
|
publicPath: `public/${this.name}`,
|
|
185
189
|
title: this.name,
|
|
186
190
|
favicon: this.favicon,
|
|
191
|
+
hostDependencies: await this.getPeers(),
|
|
192
|
+
aliasHostDependencies: true,
|
|
187
193
|
});
|
|
188
194
|
}
|
|
195
|
+
|
|
196
|
+
private getPeers(): Promise<string[]> {
|
|
197
|
+
return this.reactEnv.getPeerDependenciesList();
|
|
198
|
+
}
|
|
189
199
|
}
|