@teambit/react 0.0.529 → 0.0.530
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["react.application.ts"],"names":["ReactApp","constructor","name","entry","portRange","reactEnv","deploy","prerenderRoutes","run","context","devServerContext","getDevServerContext","devServer","getDevServer","configMutator","addTopLevel","historyApiFallback","index","disableDotRule","raw","output","publicPath","from","to","port","Port","getPort","listen","build","aspectId","appCapsule","env","publicDir","outputPath","path","distDir","getCompiler","entries","map","require","resolve","bundlerContext","Object","assign","targets","components","component","rootPath","bundler","getBundler","addPlugin","PrerenderSPAPlugin","staticDir","routes","postProcess","renderedRoute","originalRoute","deployContext","applicationType","title"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAKA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGO,MAAMA,QAAN,CAAsC;AAC3CC,EAAAA,WAAW,CACAC,IADA,EAEAC,KAFA,EAGAC,SAHA,EAIDC,QAJC,EAKAC,MALA,EAMAC,eANA,EAOT;AAAA,SANSL,IAMT,GANSA,IAMT;AAAA,SALSC,KAKT,GALSA,KAKT;AAAA,SAJSC,SAIT,GAJSA,SAIT;AAAA,SAHQC,QAGR,GAHQA,QAGR;AAAA,SAFSC,MAET,GAFSA,MAET;AAAA,SADSC,eACT,GADSA,eACT;AAAA,6DAEgB,OAFhB;
|
|
1
|
+
{"version":3,"sources":["react.application.ts"],"names":["ReactApp","constructor","name","entry","portRange","reactEnv","deploy","prerenderRoutes","run","context","devServerContext","getDevServerContext","devServer","getDevServer","configMutator","addTopLevel","historyApiFallback","index","disableDotRule","raw","output","publicPath","from","to","port","Port","getPort","listen","build","aspectId","appCapsule","env","publicDir","outputPath","path","distDir","getCompiler","entries","map","require","resolve","bundlerContext","Object","assign","targets","components","component","rootPath","bundler","getBundler","addPlugin","PrerenderSPAPlugin","staticDir","routes","postProcess","renderedRoute","originalRoute","deployContext","applicationType","title"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAKA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGO,MAAMA,QAAN,CAAsC;AAC3CC,EAAAA,WAAW,CACAC,IADA,EAEAC,KAFA,EAGAC,SAHA,EAIDC,QAJC,EAKAC,MALA,EAMAC,eANA,EAOT;AAAA,SANSL,IAMT,GANSA,IAMT;AAAA,SALSC,KAKT,GALSA,KAKT;AAAA,SAJSC,SAIT,GAJSA,SAIT;AAAA,SAHQC,QAGR,GAHQA,QAGR;AAAA,SAFSC,MAET,GAFSA,MAET;AAAA,SADSC,eACT,GADSA,eACT;AAAA,6DAEgB,OAFhB;AAAE;;AAIK,QAAHC,GAAG,CAACC,OAAD,EAAuC;AAC9C,UAAMC,gBAAgB,GAAG,KAAKC,mBAAL,CAAyBF,OAAzB,CAAzB;AACA,UAAMG,SAAS,GAAG,KAAKP,QAAL,CAAcQ,YAAd,CAA2BH,gBAA3B,EAA6C,CAC5DI,aAAD,IAAmB;AACjB;AACAA,MAAAA,aAAa,CAACC,WAAd,CAA0B,WAA1B,EAAuC;AACrCC,QAAAA,kBAAkB,EAAE;AAClBC,UAAAA,KAAK,EAAE,aADW;AAElBC,UAAAA,cAAc,EAAE;AAFE;AADiB,OAAvC;AAOA,UAAI,CAACJ,aAAa,CAACK,GAAd,CAAkBC,MAAvB,EAA+BN,aAAa,CAACK,GAAd,CAAkBC,MAAlB,GAA2B,EAA3B;AAC/BN,MAAAA,aAAa,CAACK,GAAd,CAAkBC,MAAlB,CAAyBC,UAAzB,GAAsC,GAAtC;AAEA,aAAOP,aAAP;AACD,KAd4D,CAA7C,CAAlB;AAgBA,UAAM,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A,IAAI,EAAE,kBAAKD,UAAL,EAAiB,QAAjB,CAAR;AAAoCZ,QAAAA,UAAU,EAAG;AAAjD,OAApC;AACAP,MAAAA,aAAa,CAACoC,SAAd,CACE,KAAIC,6BAAJ,EAAuB;AACrBC,QAAAA,SAAS,EAAE,kBAAKnB,UAAL,EAAiB,QAAjB,CADU;AAErBoB,QAAAA,MAAM,EAAE,KAAK9C,eAFQ;;AAGrB+C,QAAAA,WAAW,CAACC,aAAD,EAAgB;AACzBA,UAAAA,aAAa,CAACtB,UAAd,GAA2B,kBAAKA,UAAL,EAAiB,QAAjB,EAA4B,GAAEsB,aAAa,CAACC,aAAc,OAA1D,CAA3B;AACA,iBAAOD,aAAP;AACD;;AANoB,OAAvB,CADF;AAUA,aAAOzC,aAAP;AACD,KAdgE,CAApC,CAA/B;AAgBA,UAAMkC,OAAO,CAACxC,GAAR,EAAN;AACA,UAAMiD,aAAa,GAAGf,MAAM,CAACC,MAAP,CAAclC,OAAd,EAAuB;AAC3CiD,MAAAA,eAAe,EAAE,KAAKA,eADqB;AAE3C7B,MAAAA,QAF2C;AAG3CG,MAAAA,SAAS,EAAE,kBAAKF,UAAU,CAACI,IAAhB,EAAsBF,SAAtB,EAAiC,QAAjC;AAHgC,KAAvB,CAAtB;AAKA,WAAOyB,aAAP;AACD;;AAEO9C,EAAAA,mBAAmB,CAACF,OAAD,EAAwC;AACjE,WAAOiC,MAAM,CAACC,MAAP,CAAclC,OAAd,EAAuB;AAC5BN,MAAAA,KAAK,EAAE,KAAKA,KADgB;AAE5B4C,MAAAA,QAAQ,EAAE,EAFkB;AAG5B1B,MAAAA,UAAU,EAAG,UAAS,KAAKnB,IAAK,EAHJ;AAI5ByD,MAAAA,KAAK,EAAE,KAAKzD;AAJgB,KAAvB,CAAP;AAMD;;AArF0C","sourcesContent":["import PrerenderSPAPlugin from '@dreysolano/prerender-spa-plugin';\nimport { join, basename } from 'path';\nimport { Capsule } from '@teambit/isolator';\nimport { Application, AppContext, DeployContext } from '@teambit/application';\nimport { BuildContext } from '@teambit/builder';\nimport { Bundler, BundlerContext, DevServerContext } from '@teambit/bundler';\nimport { Port } from '@teambit/toolbox.network.get-port';\nimport { ReactEnv } from './react.env';\n\nexport class ReactApp implements Application {\n constructor(\n readonly name: string,\n readonly entry: string[],\n readonly portRange: number[],\n private reactEnv: ReactEnv,\n readonly deploy?: (context: DeployContext) => Promise<void>,\n readonly prerenderRoutes?: string[]\n ) {}\n\n applicationType = 'react';\n\n async run(context: AppContext): Promise<number> {\n const devServerContext = this.getDevServerContext(context);\n const devServer = this.reactEnv.getDevServer(devServerContext, [\n (configMutator) => {\n // configMutator.addTopLevel('output', { publicPath: `/public/${this.name}` });\n configMutator.addTopLevel('devServer', {\n historyApiFallback: {\n index: '/index.html',\n disableDotRule: true,\n },\n });\n\n if (!configMutator.raw.output) configMutator.raw.output = {};\n configMutator.raw.output.publicPath = '/';\n\n return configMutator;\n },\n ]);\n const [from, to] = this.portRange;\n const port = await Port.getPort(from, to);\n await devServer.listen(port);\n return port;\n }\n\n async build(context: BuildContext, aspectId: string, appCapsule: Capsule): Promise<DeployContext> {\n const reactEnv: ReactEnv = context.env;\n const publicDir = join('applications', this.name, 'build');\n const outputPath = join(appCapsule.path, publicDir);\n const { distDir } = reactEnv.getCompiler();\n const entries = this.entry.map((entry) => require.resolve(`${appCapsule.path}/${distDir}/${basename(entry)}`));\n const bundlerContext: BundlerContext = Object.assign(context, {\n targets: [\n {\n components: [appCapsule?.component],\n entries,\n outputPath,\n },\n ],\n entry: [],\n rootPath: '/',\n });\n const bundler: Bundler = await reactEnv.getBundler(bundlerContext, [\n (configMutator) => {\n configMutator.addTopLevel('output', { path: join(outputPath, 'public'), publicPath: `/` });\n configMutator.addPlugin(\n new PrerenderSPAPlugin({\n staticDir: join(outputPath, 'public'),\n routes: this.prerenderRoutes,\n postProcess(renderedRoute) {\n renderedRoute.outputPath = join(outputPath, 'public', `${renderedRoute.originalRoute}.html`);\n return renderedRoute;\n },\n })\n );\n return configMutator;\n },\n ]);\n await bundler.run();\n const deployContext = Object.assign(context, {\n applicationType: this.applicationType,\n aspectId,\n publicDir: join(appCapsule.path, publicDir, 'public'),\n });\n return deployContext;\n }\n\n private getDevServerContext(context: AppContext): DevServerContext {\n return Object.assign(context, {\n entry: this.entry,\n rootPath: '',\n publicPath: `public/${this.name}`,\n title: this.name,\n });\n }\n}\n"]}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.530",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/react/react",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.react",
|
|
8
8
|
"name": "react",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.530"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"react-error-boundary": "^3.0.0",
|
|
@@ -79,44 +79,44 @@
|
|
|
79
79
|
"@teambit/react.instructions.react.adding-compositions": "0.0.6",
|
|
80
80
|
"@teambit/react.instructions.react.adding-tests": "0.0.6",
|
|
81
81
|
"@teambit/design.ui.pages.standalone-not-found-page": "0.0.354",
|
|
82
|
-
"@teambit/preview": "0.0.
|
|
83
|
-
"@teambit/react.ui.error-fallback": "0.0.
|
|
84
|
-
"@teambit/react.ui.loader-fallback": "0.0.
|
|
85
|
-
"@teambit/compositions.ui.hooks.use-composition": "0.0.
|
|
82
|
+
"@teambit/preview": "0.0.530",
|
|
83
|
+
"@teambit/react.ui.error-fallback": "0.0.72",
|
|
84
|
+
"@teambit/react.ui.loader-fallback": "0.0.51",
|
|
85
|
+
"@teambit/compositions.ui.hooks.use-composition": "0.0.126",
|
|
86
86
|
"@teambit/design.ui.input.option-button": "0.0.26",
|
|
87
87
|
"@teambit/design.ui.tooltip": "0.0.352",
|
|
88
|
-
"@teambit/application": "0.0.
|
|
89
|
-
"@teambit/bundler": "0.0.
|
|
90
|
-
"@teambit/builder": "0.0.
|
|
91
|
-
"@teambit/isolator": "0.0.
|
|
92
|
-
"@teambit/toolbox.network.get-port": "0.0.
|
|
93
|
-
"@teambit/compiler": "0.0.
|
|
94
|
-
"@teambit/component.modules.component-url": "0.0.
|
|
95
|
-
"@teambit/component": "0.0.
|
|
96
|
-
"@teambit/envs": "0.0.
|
|
97
|
-
"@teambit/eslint": "0.0.
|
|
98
|
-
"@teambit/formatter": "0.0.
|
|
99
|
-
"@teambit/jest": "0.0.
|
|
100
|
-
"@teambit/linter": "0.0.
|
|
101
|
-
"@teambit/pkg": "0.0.
|
|
102
|
-
"@teambit/prettier": "0.0.
|
|
103
|
-
"@teambit/react.babel.bit-react-transformer": "0.0.
|
|
104
|
-
"@teambit/schema": "0.0.
|
|
105
|
-
"@teambit/tester": "0.0.
|
|
106
|
-
"@teambit/typescript": "0.0.
|
|
107
|
-
"@teambit/webpack": "0.0.
|
|
108
|
-
"@teambit/workspace": "0.0.
|
|
88
|
+
"@teambit/application": "0.0.172",
|
|
89
|
+
"@teambit/bundler": "0.0.530",
|
|
90
|
+
"@teambit/builder": "0.0.530",
|
|
91
|
+
"@teambit/isolator": "0.0.530",
|
|
92
|
+
"@teambit/toolbox.network.get-port": "0.0.76",
|
|
93
|
+
"@teambit/compiler": "0.0.530",
|
|
94
|
+
"@teambit/component.modules.component-url": "0.0.81",
|
|
95
|
+
"@teambit/component": "0.0.530",
|
|
96
|
+
"@teambit/envs": "0.0.530",
|
|
97
|
+
"@teambit/eslint": "0.0.530",
|
|
98
|
+
"@teambit/formatter": "0.0.81",
|
|
99
|
+
"@teambit/jest": "0.0.530",
|
|
100
|
+
"@teambit/linter": "0.0.530",
|
|
101
|
+
"@teambit/pkg": "0.0.530",
|
|
102
|
+
"@teambit/prettier": "0.0.81",
|
|
103
|
+
"@teambit/react.babel.bit-react-transformer": "0.0.454",
|
|
104
|
+
"@teambit/schema": "0.0.530",
|
|
105
|
+
"@teambit/tester": "0.0.530",
|
|
106
|
+
"@teambit/typescript": "0.0.530",
|
|
107
|
+
"@teambit/webpack": "0.0.530",
|
|
108
|
+
"@teambit/workspace": "0.0.530",
|
|
109
109
|
"@teambit/cli": "0.0.380",
|
|
110
|
-
"@teambit/dependency-resolver": "0.0.
|
|
111
|
-
"@teambit/generator": "0.0.
|
|
112
|
-
"@teambit/graphql": "0.0.
|
|
113
|
-
"@teambit/react.ui.highlighter-provider": "0.0.
|
|
114
|
-
"@teambit/compositions": "0.0.
|
|
115
|
-
"@teambit/ui": "0.0.
|
|
116
|
-
"@teambit/react.eslint-config-bit-react": "0.0.
|
|
117
|
-
"@teambit/mdx.modules.mdx-loader": "0.0.
|
|
118
|
-
"@teambit/webpack.modules.generate-style-loaders": "0.0.
|
|
119
|
-
"@teambit/webpack.modules.style-regexps": "0.0.
|
|
110
|
+
"@teambit/dependency-resolver": "0.0.530",
|
|
111
|
+
"@teambit/generator": "0.0.530",
|
|
112
|
+
"@teambit/graphql": "0.0.530",
|
|
113
|
+
"@teambit/react.ui.highlighter-provider": "0.0.134",
|
|
114
|
+
"@teambit/compositions": "0.0.530",
|
|
115
|
+
"@teambit/ui": "0.0.530",
|
|
116
|
+
"@teambit/react.eslint-config-bit-react": "0.0.449",
|
|
117
|
+
"@teambit/mdx.modules.mdx-loader": "0.0.450",
|
|
118
|
+
"@teambit/webpack.modules.generate-style-loaders": "0.0.66",
|
|
119
|
+
"@teambit/webpack.modules.style-regexps": "0.0.95",
|
|
120
120
|
"@teambit/component-id": "0.0.370",
|
|
121
121
|
"@teambit/config": "0.0.391"
|
|
122
122
|
},
|
|
@@ -133,10 +133,10 @@
|
|
|
133
133
|
"@types/mocha": "5.2.7",
|
|
134
134
|
"@types/testing-library__jest-dom": "5.9.5",
|
|
135
135
|
"@types/jest": "^26.0.0",
|
|
136
|
-
"@teambit/react.aspect-docs.react": "0.0.
|
|
136
|
+
"@teambit/react.aspect-docs.react": "0.0.90"
|
|
137
137
|
},
|
|
138
138
|
"peerDependencies": {
|
|
139
|
-
"@teambit/legacy": "1.0.
|
|
139
|
+
"@teambit/legacy": "1.0.163",
|
|
140
140
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
141
141
|
"react": "^16.8.0 || ^17.0.0"
|
|
142
142
|
},
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
"@types/jest": "^26.0.0"
|
|
199
199
|
},
|
|
200
200
|
"peerDependencies": {
|
|
201
|
-
"@teambit/legacy": "1.0.
|
|
201
|
+
"@teambit/legacy": "1.0.163",
|
|
202
202
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
203
203
|
"react": "^16.8.0 || ^17.0.0"
|
|
204
204
|
}
|
package/react.application.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import PrerenderSPAPlugin from '@dreysolano/prerender-spa-plugin'
|
|
1
|
+
import PrerenderSPAPlugin from '@dreysolano/prerender-spa-plugin';
|
|
2
2
|
import { join, basename } from 'path';
|
|
3
3
|
import { Capsule } from '@teambit/isolator';
|
|
4
4
|
import { Application, AppContext, DeployContext } from '@teambit/application';
|
|
@@ -15,7 +15,7 @@ export class ReactApp implements Application {
|
|
|
15
15
|
private reactEnv: ReactEnv,
|
|
16
16
|
readonly deploy?: (context: DeployContext) => Promise<void>,
|
|
17
17
|
readonly prerenderRoutes?: string[]
|
|
18
|
-
) {
|
|
18
|
+
) {}
|
|
19
19
|
|
|
20
20
|
applicationType = 'react';
|
|
21
21
|
|
|
@@ -63,14 +63,16 @@ export class ReactApp implements Application {
|
|
|
63
63
|
const bundler: Bundler = await reactEnv.getBundler(bundlerContext, [
|
|
64
64
|
(configMutator) => {
|
|
65
65
|
configMutator.addTopLevel('output', { path: join(outputPath, 'public'), publicPath: `/` });
|
|
66
|
-
configMutator.addPlugin(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
renderedRoute
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
configMutator.addPlugin(
|
|
67
|
+
new PrerenderSPAPlugin({
|
|
68
|
+
staticDir: join(outputPath, 'public'),
|
|
69
|
+
routes: this.prerenderRoutes,
|
|
70
|
+
postProcess(renderedRoute) {
|
|
71
|
+
renderedRoute.outputPath = join(outputPath, 'public', `${renderedRoute.originalRoute}.html`);
|
|
72
|
+
return renderedRoute;
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
);
|
|
74
76
|
return configMutator;
|
|
75
77
|
},
|
|
76
78
|
]);
|
|
Binary file
|