@teambit/react 0.0.627 → 0.0.632
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/__compositions-1643167379538.js +7 -0
- package/__overview-1643167379538.js +7 -0
- package/__preview-1643167379538.js +2 -0
- package/apps/web/deploy-context.ts +4 -0
- package/apps/web/index.ts +3 -0
- package/apps/web/react-app-options.ts +3 -3
- package/apps/web/react-build-result.ts +9 -0
- package/apps/web/react.application.ts +32 -34
- package/artifacts/env-template/public/141.js +1 -0
- package/artifacts/env-template/public/181.js +1 -0
- package/artifacts/env-template/public/283.js +1 -0
- package/artifacts/env-template/public/287.js +1 -0
- package/artifacts/env-template/public/664.js +128 -0
- package/artifacts/env-template/public/848.js +1 -0
- package/artifacts/env-template/public/assets-manifest.json +74 -0
- package/artifacts/env-template/public/compositions.caead6f32bec9cbd6ead.js +1 -0
- package/artifacts/env-template/public/compositions.html +2 -0
- package/artifacts/env-template/public/overview.5c43dbd0addbccdea70c.js +1 -0
- package/artifacts/env-template/public/overview.html +2 -0
- package/artifacts/env-template/public/peers.23d97726152f744ec115.js +1 -0
- package/artifacts/env-template/public/preview-root.344bfad0432988cf6b3e.js +1 -0
- package/artifacts/env-template/public/runtime.js +1 -0
- package/artifacts/env-template/public/service-worker.js +1 -0
- package/artifacts/env-template/public/static/css/664.50460623.css +1 -0
- package/artifacts/env-template/public/static/css/compositions.cd8be53f.css +1 -0
- package/artifacts/env-template/public/static/css/overview.71e25e30.css +1 -0
- package/artifacts/env-template/public/static/css/previewRoot.5ad41161.css +1 -0
- package/artifacts/env-template/public/workbox-ca45de73.js +1 -0
- package/artifacts/preview/teambit_react_react-preview.js +1 -0
- package/dist/apps/web/deploy-context.d.ts +3 -0
- package/dist/apps/web/deploy-context.js +3 -0
- package/dist/apps/web/deploy-context.js.map +1 -0
- package/dist/apps/web/index.d.ts +3 -0
- package/dist/apps/web/index.js +23 -0
- package/dist/apps/web/index.js.map +1 -0
- package/dist/apps/web/react-app-options.d.ts +2 -3
- package/dist/apps/web/react-app-options.js +0 -10
- package/dist/apps/web/react-app-options.js.map +1 -1
- package/dist/apps/web/react-build-result.d.ts +8 -0
- package/dist/apps/web/react-build-result.js +3 -0
- package/dist/apps/web/react-build-result.js.map +1 -0
- package/dist/apps/web/react.application.d.ts +7 -7
- package/dist/apps/web/react.application.js +41 -29
- package/dist/apps/web/react.application.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react.env.d.ts +10 -1
- package/dist/react.env.js +60 -8
- package/dist/react.env.js.map +1 -1
- package/dist/react.main.runtime.js +11 -11
- package/dist/react.main.runtime.js.map +1 -1
- package/dist/templates/react-app/files/app-root.js +7 -1
- package/dist/templates/react-app/files/app-root.js.map +1 -1
- package/dist/templates/react-app/files/compositions.js +1 -1
- package/dist/templates/react-app/files/compositions.js.map +1 -1
- package/dist/templates/workspace-common/files/workspace-config.js +1 -1
- package/dist/templates/workspace-common/files/workspace-config.js.map +1 -1
- package/dist/webpack/get-exposed-rules.d.ts +2 -0
- package/dist/webpack/get-exposed-rules.js +50 -0
- package/dist/webpack/get-exposed-rules.js.map +1 -0
- package/dist/webpack/get-externals.d.ts +1 -0
- package/dist/webpack/get-externals.js +42 -0
- package/dist/webpack/get-externals.js.map +1 -0
- package/dist/webpack/html.d.ts +2 -0
- package/dist/webpack/html.js +31 -0
- package/dist/webpack/html.js.map +1 -0
- package/dist/webpack/index.d.ts +1 -0
- package/dist/webpack/index.js +23 -0
- package/dist/webpack/index.js.map +1 -0
- package/dist/webpack/transformers.d.ts +2 -0
- package/dist/webpack/transformers.js +19 -0
- package/dist/webpack/transformers.js.map +1 -0
- package/dist/webpack/webpack.config.base.js +3 -5
- package/dist/webpack/webpack.config.base.js.map +1 -1
- package/dist/webpack/webpack.config.base.prod.d.ts +1 -1
- package/dist/webpack/webpack.config.base.prod.js +101 -80
- package/dist/webpack/webpack.config.base.prod.js.map +1 -1
- package/package-tar/teambit-react-0.0.632.tgz +0 -0
- package/package.json +38 -36
- package/templates/react-app/files/app-root.ts +7 -1
- package/templates/react-app/files/compositions.ts +1 -1
- package/templates/workspace-common/files/workspace-config.ts +1 -1
- package/webpack/get-exposed-rules.ts +12 -0
- package/webpack/get-externals.ts +8 -0
- package/webpack/html.ts +22 -0
- package/webpack/index.ts +1 -0
- package/webpack/transformers.ts +12 -0
- package/webpack/webpack.config.base.prod.ts +99 -81
- package/webpack/webpack.config.base.ts +3 -5
- package/package-tar/teambit-react-0.0.627.tgz +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
import { linkModules } from '/home/circleci/bit/bit/node_modules/@teambit/preview/dist/preview.preview.runtime.js';
|
|
3
|
+
import harmony from '/home/circleci/bit/bit/node_modules/@teambit/harmony/dist/index.js';
|
|
4
|
+
const defaultModule = require('/home/circleci/bit/bit/node_modules/@teambit/react/dist/mount.js');
|
|
5
|
+
linkModules('compositions', defaultModule, true, {
|
|
6
|
+
|
|
7
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
import { linkModules } from '/home/circleci/bit/bit/node_modules/@teambit/preview/dist/preview.preview.runtime.js';
|
|
3
|
+
import harmony from '/home/circleci/bit/bit/node_modules/@teambit/harmony/dist/index.js';
|
|
4
|
+
const defaultModule = require('/home/circleci/bit/bit/node_modules/@teambit/react.ui.docs-app/dist/index.js');
|
|
5
|
+
linkModules('overview', defaultModule, true, {
|
|
6
|
+
|
|
7
|
+
});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.react_react@0.0.632/dist/react.composition.js')]
|
|
2
|
+
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.react_react@0.0.632/dist/react.docs.mdx')]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Bundler, DevServer } from '@teambit/bundler';
|
|
2
|
-
import { DeployContext } from '@teambit/application';
|
|
3
|
-
import { Capsule } from '@teambit/isolator';
|
|
4
2
|
import { WebpackConfigTransformer } from '@teambit/webpack';
|
|
5
3
|
|
|
4
|
+
import { ReactDeployContext } from './deploy-context';
|
|
5
|
+
|
|
6
6
|
export type ReactAppOptions = {
|
|
7
7
|
/**
|
|
8
8
|
* name of the application.
|
|
@@ -45,7 +45,7 @@ export type ReactAppOptions = {
|
|
|
45
45
|
/**
|
|
46
46
|
* deploy function.
|
|
47
47
|
*/
|
|
48
|
-
deploy?: (context:
|
|
48
|
+
deploy?: (context: ReactDeployContext) => Promise<void>;
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* ranges of ports to use to run the app server.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppBuildResult } from '@teambit/application';
|
|
2
|
+
|
|
3
|
+
export type ReactAppBuildResult = {
|
|
4
|
+
/**
|
|
5
|
+
* the directory which includes the built application public assets.
|
|
6
|
+
* when using ssr, public dir is undefined.
|
|
7
|
+
*/
|
|
8
|
+
publicDir?: string;
|
|
9
|
+
} & AppBuildResult;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { join, basename } from 'path';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ArtifactDefinition, BuildContext } from '@teambit/builder';
|
|
5
|
-
import { Bundler, DevServer, BundlerResult, BundlerContext, DevServerContext } from '@teambit/bundler';
|
|
2
|
+
import { Application, AppContext, AppBuildContext } from '@teambit/application';
|
|
3
|
+
import { Bundler, DevServer, BundlerContext, DevServerContext, BundlerHtmlConfig } from '@teambit/bundler';
|
|
6
4
|
import { Port } from '@teambit/toolbox.network.get-port';
|
|
7
5
|
import { WebpackConfigTransformer } from '@teambit/webpack';
|
|
8
6
|
import { ReactEnv } from '../../react.env';
|
|
9
7
|
import { prerenderSPAPlugin } from './plugins';
|
|
8
|
+
import { ReactAppBuildResult } from './react-build-result';
|
|
9
|
+
import { html } from '../../webpack';
|
|
10
|
+
import { ReactDeployContext } from '.';
|
|
10
11
|
|
|
11
12
|
export class ReactApp implements Application {
|
|
12
13
|
constructor(
|
|
@@ -18,10 +19,11 @@ export class ReactApp implements Application {
|
|
|
18
19
|
readonly bundler?: Bundler,
|
|
19
20
|
readonly devServer?: DevServer,
|
|
20
21
|
readonly transformers?: WebpackConfigTransformer[],
|
|
21
|
-
readonly deploy?: (context:
|
|
22
|
+
readonly deploy?: (context: ReactDeployContext) => Promise<void>
|
|
22
23
|
) {}
|
|
23
24
|
|
|
24
25
|
readonly applicationType = 'react-common-js';
|
|
26
|
+
readonly dir = 'public';
|
|
25
27
|
async run(context: AppContext): Promise<number> {
|
|
26
28
|
const [from, to] = this.portRange;
|
|
27
29
|
const port = await Port.getPort(from, to);
|
|
@@ -49,36 +51,33 @@ export class ReactApp implements Application {
|
|
|
49
51
|
return port;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
async build(context:
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
globPatterns: [`${this.getPublicDir()}/**`],
|
|
66
|
-
};
|
|
67
|
-
});
|
|
68
|
-
return _globs.filter((glob) => !!glob) as ArtifactDefinition[];
|
|
54
|
+
async build(context: AppBuildContext): Promise<ReactAppBuildResult> {
|
|
55
|
+
const htmlConfig: BundlerHtmlConfig[] = [
|
|
56
|
+
{
|
|
57
|
+
title: context.name,
|
|
58
|
+
templateContent: html(context.name),
|
|
59
|
+
minify: false,
|
|
60
|
+
// filename: ''.html`,
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
Object.assign(context, { html: htmlConfig });
|
|
64
|
+
const bundler = await this.getBundler(context);
|
|
65
|
+
await bundler.run();
|
|
66
|
+
return { publicDir: `${this.getPublicDir()}/${this.dir}` };
|
|
69
67
|
}
|
|
70
68
|
|
|
71
|
-
private getBundler(context:
|
|
69
|
+
private getBundler(context: AppBuildContext) {
|
|
72
70
|
if (this.bundler) return this.bundler;
|
|
73
|
-
return this.getDefaultBundler(context
|
|
71
|
+
return this.getDefaultBundler(context);
|
|
74
72
|
}
|
|
75
|
-
private async getDefaultBundler(context:
|
|
73
|
+
private async getDefaultBundler(context: AppBuildContext) {
|
|
74
|
+
const { capsule } = context;
|
|
76
75
|
const reactEnv: ReactEnv = context.env;
|
|
77
76
|
const publicDir = this.getPublicDir();
|
|
78
77
|
const outputPath = join(capsule.path, publicDir);
|
|
79
78
|
const { distDir } = reactEnv.getCompiler();
|
|
80
79
|
const entries = this.entry.map((entry) => require.resolve(`${capsule.path}/${distDir}/${basename(entry)}`));
|
|
81
|
-
const staticDir = join(outputPath,
|
|
80
|
+
const staticDir = join(outputPath, this.dir);
|
|
82
81
|
|
|
83
82
|
const bundlerContext: BundlerContext = Object.assign(context, {
|
|
84
83
|
targets: [
|
|
@@ -92,14 +91,13 @@ export class ReactApp implements Application {
|
|
|
92
91
|
rootPath: '/',
|
|
93
92
|
});
|
|
94
93
|
|
|
95
|
-
const
|
|
96
|
-
(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
]);
|
|
94
|
+
const defaultTransformer: WebpackConfigTransformer = (configMutator) => {
|
|
95
|
+
const config = configMutator.addTopLevel('output', { path: staticDir, publicPath: `/` });
|
|
96
|
+
if (this.prerenderRoutes) config.addPlugin(prerenderSPAPlugin(this.prerenderRoutes, staticDir));
|
|
97
|
+
return config;
|
|
98
|
+
};
|
|
99
|
+
const transformers = [defaultTransformer, ...(this.transformers ?? [])];
|
|
100
|
+
const bundler: Bundler = await reactEnv.getBundler(bundlerContext, transformers);
|
|
103
101
|
return bundler;
|
|
104
102
|
}
|
|
105
103
|
|