@teambit/react 0.0.731 → 0.0.734
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/plugins/index.ts +1 -1
- package/apps/web/plugins/prerender.ts +5 -13
- package/apps/web/react-app-options.ts +44 -3
- package/apps/web/react.application.ts +2 -2
- package/artifacts/env-template/public/{283.js → 149.js} +2 -2
- package/artifacts/env-template/public/{793.js → 295.js} +63 -67
- package/artifacts/env-template/public/677.js +5 -5
- package/artifacts/env-template/public/750.js +6 -6
- package/artifacts/env-template/public/927.js +34 -0
- package/artifacts/env-template/public/{764.js → 994.js} +6 -6
- package/artifacts/env-template/public/assets-manifest.json +21 -21
- package/artifacts/env-template/public/{compositions.6b3cf159178bfea8b56c.js → compositions.32c4d8736482f93f0173.js} +1 -1
- package/artifacts/env-template/public/compositions.html +1 -1
- package/artifacts/env-template/public/{overview.9a0b0150a1f48864ff88.js → overview.d5bb4ae4fedfa13c9554.js} +1 -1
- package/artifacts/env-template/public/overview.html +1 -1
- package/artifacts/env-template/public/peers.edfbd1f8ec8a3331b9ac.js +1 -0
- package/artifacts/env-template/public/{preview-root.2c1fef139790a3bc64be.js → preview-root.b22a871992aa18281157.js} +1 -1
- package/artifacts/env-template/public/service-worker.js +1 -1
- package/artifacts/env-template/public/static/css/295.e370e333.css +1 -0
- package/artifacts/preview/teambit_react_react-preview.js +2 -2
- package/{compositions-1652498684867.js → compositions-1652785756723.js} +0 -0
- package/dist/apps/web/plugins/index.d.ts +1 -1
- package/dist/apps/web/plugins/index.js +2 -2
- package/dist/apps/web/plugins/index.js.map +1 -1
- package/dist/apps/web/plugins/prerender.d.ts +1 -1
- package/dist/apps/web/plugins/prerender.js +12 -21
- package/dist/apps/web/plugins/prerender.js.map +1 -1
- package/dist/apps/web/react-app-options.d.ts +32 -2
- package/dist/apps/web/react.application.js +1 -1
- package/dist/apps/web/react.application.js.map +1 -1
- package/dist/react.env.js +2 -1
- package/dist/react.env.js.map +1 -1
- package/dist/webpack/get-exposed-rules.d.ts +2 -1
- package/dist/webpack/get-exposed-rules.js +12 -2
- package/dist/webpack/get-exposed-rules.js.map +1 -1
- package/dist/webpack/resolve-peer.d.ts +14 -0
- package/dist/webpack/resolve-peer.js +108 -0
- package/dist/webpack/resolve-peer.js.map +1 -0
- package/dist/webpack/transformers.d.ts +8 -1
- package/dist/webpack/transformers.js +34 -40
- package/dist/webpack/transformers.js.map +1 -1
- package/dist/webpack/webpack.config.base.prod.js +0 -15
- package/dist/webpack/webpack.config.base.prod.js.map +1 -1
- package/{overview-1652498684867.js → overview-1652785756723.js} +0 -0
- package/package-tar/teambit-react-0.0.734.tgz +0 -0
- package/package.json +35 -33
- package/{preview-1652498684867.js → preview-1652785756723.js} +2 -2
- package/webpack/get-exposed-rules.ts +4 -2
- package/webpack/resolve-peer.ts +60 -0
- package/webpack/transformers.ts +24 -33
- package/webpack/webpack.config.base.prod.ts +0 -9
- package/artifacts/env-template/public/307.js +0 -34
- package/artifacts/env-template/public/peers.dbfbae2daf17fd0c329d.js +0 -1
- package/artifacts/env-template/public/static/css/793.52d87d5e.css +0 -1
- package/package-tar/teambit-react-0.0.731.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { prerenderPlugin } from './prerender';
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import PrerenderSPAPlugin from 'prerender-spa-plugin-next';
|
|
2
|
+
import { PuppeteerRenderer } from '@teambit/react.modules.prerenderer-puppeteer';
|
|
3
3
|
import { ReactAppPrerenderOptions } from '../react-app-options';
|
|
4
4
|
|
|
5
|
-
export const
|
|
5
|
+
export const prerenderPlugin = (options: ReactAppPrerenderOptions) => {
|
|
6
6
|
return new PrerenderSPAPlugin({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
postProcess(renderedRoute: any) {
|
|
10
|
-
if (prerender.postProcess) return prerender.postProcess(renderedRoute, staticDir);
|
|
11
|
-
renderedRoute.outputPath = join(staticDir, `${renderedRoute.originalRoute}.html`);
|
|
12
|
-
return renderedRoute;
|
|
13
|
-
},
|
|
14
|
-
server: {
|
|
15
|
-
...prerender?.server,
|
|
16
|
-
},
|
|
7
|
+
renderer: PuppeteerRenderer,
|
|
8
|
+
...options,
|
|
17
9
|
});
|
|
18
10
|
};
|
|
@@ -3,21 +3,62 @@ import { WebpackConfigTransformer } from '@teambit/webpack';
|
|
|
3
3
|
|
|
4
4
|
import { ReactDeployContext } from './deploy-context';
|
|
5
5
|
|
|
6
|
+
type prerenderedRoute = {
|
|
7
|
+
/** The prerendered route, after following redirects */
|
|
8
|
+
route: string;
|
|
9
|
+
/** The original route passed, before redirects */
|
|
10
|
+
originalRoute: string;
|
|
11
|
+
/** The resulting HTML for the route */
|
|
12
|
+
html: string;
|
|
13
|
+
/**
|
|
14
|
+
* The path to write the rendered HTML to.
|
|
15
|
+
* This is null (automatically calculated after postProcess)
|
|
16
|
+
* unless explicitly set. */
|
|
17
|
+
outputPath?: string | null;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** https://github.com/Tofandel/prerender-spa-plugin-next */
|
|
6
21
|
export type ReactAppPrerenderOptions = {
|
|
22
|
+
/**
|
|
23
|
+
* sub folder to output the prerender, inside the webpack output folder
|
|
24
|
+
* @default '/'
|
|
25
|
+
*/
|
|
26
|
+
staticDir?: string;
|
|
27
|
+
|
|
28
|
+
/** The index file to fall back on for SPAs. */
|
|
29
|
+
indexPath?: string;
|
|
30
|
+
|
|
7
31
|
/**
|
|
8
32
|
* routes to prerender
|
|
9
33
|
*/
|
|
10
34
|
routes: string[];
|
|
35
|
+
|
|
11
36
|
/**
|
|
12
37
|
* the proxy server you want the prerender headless browser to run on
|
|
13
38
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
server?: {
|
|
40
|
+
proxy: {
|
|
41
|
+
[key: string]: {
|
|
42
|
+
/** required by HPM.
|
|
43
|
+
* @default 'http://localhost:8000/' */
|
|
44
|
+
target: string;
|
|
45
|
+
pathRewrite: { [key: string]: string };
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
16
49
|
|
|
17
50
|
/**
|
|
18
51
|
* Post processing of the prerendered html. This is useful for adding meta tags to the html or changing the file name.
|
|
19
52
|
*/
|
|
20
|
-
postProcess?: (prerenderRoute:
|
|
53
|
+
postProcess?: (prerenderRoute: prerenderedRoute) => prerenderedRoute;
|
|
54
|
+
|
|
55
|
+
/** The renderer you'd like to use to prerender the app.
|
|
56
|
+
* @default new require("@prerenderer/renderer-puppeteer").
|
|
57
|
+
*/
|
|
58
|
+
renderer?: any;
|
|
59
|
+
|
|
60
|
+
/** options to pass to the renderer class's constructor */
|
|
61
|
+
rendererOptions?: any;
|
|
21
62
|
};
|
|
22
63
|
|
|
23
64
|
export type ReactAppOptions = {
|
|
@@ -6,7 +6,7 @@ import { remove } from 'lodash';
|
|
|
6
6
|
import TerserPlugin from 'terser-webpack-plugin';
|
|
7
7
|
import { WebpackConfigTransformer } from '@teambit/webpack';
|
|
8
8
|
import { ReactEnv } from '../../react.env';
|
|
9
|
-
import {
|
|
9
|
+
import { prerenderPlugin } from './plugins';
|
|
10
10
|
import { ReactAppBuildResult } from './react-build-result';
|
|
11
11
|
import { ReactAppPrerenderOptions } from './react-app-options';
|
|
12
12
|
import { html } from '../../webpack';
|
|
@@ -105,7 +105,7 @@ export class ReactApp implements Application {
|
|
|
105
105
|
|
|
106
106
|
const defaultTransformer: WebpackConfigTransformer = (configMutator) => {
|
|
107
107
|
const config = configMutator.addTopLevel('output', { path: staticDir, publicPath: `/` });
|
|
108
|
-
if (this.prerender) config.addPlugin(
|
|
108
|
+
if (this.prerender) config.addPlugin(prerenderPlugin(this.prerender));
|
|
109
109
|
if (config.raw.optimization?.minimizer) {
|
|
110
110
|
remove(config.raw.optimization?.minimizer, (minimizer) => {
|
|
111
111
|
return minimizer.constructor.name === 'TerserPlugin';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(self.webpackChunk_teambit_legacy=self.webpackChunk_teambit_legacy||[]).push([[
|
|
1
|
+
(self.webpackChunk_teambit_legacy=self.webpackChunk_teambit_legacy||[]).push([[149],{24149:(module,__unused_webpack_exports,__webpack_require__)=>{var ___EXPOSE_LOADER_IMPORT___=__webpack_require__(73935),___EXPOSE_LOADER_GET_GLOBAL_THIS___=__webpack_require__(27672),___EXPOSE_LOADER_GLOBAL_THIS___=___EXPOSE_LOADER_GET_GLOBAL_THIS___;typeof ___EXPOSE_LOADER_GLOBAL_THIS___.ReactDom>"u"&&(___EXPOSE_LOADER_GLOBAL_THIS___.ReactDom=___EXPOSE_LOADER_IMPORT___),module.exports=___EXPOSE_LOADER_IMPORT___},45993:(module,__unused_webpack_exports,__webpack_require__)=>{var ___EXPOSE_LOADER_IMPORT___=__webpack_require__(67294),___EXPOSE_LOADER_GET_GLOBAL_THIS___=__webpack_require__(27672),___EXPOSE_LOADER_GLOBAL_THIS___=___EXPOSE_LOADER_GET_GLOBAL_THIS___;typeof ___EXPOSE_LOADER_GLOBAL_THIS___.React>"u"&&(___EXPOSE_LOADER_GLOBAL_THIS___.React=___EXPOSE_LOADER_IMPORT___),module.exports=___EXPOSE_LOADER_IMPORT___},27672:(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";module.exports=function(){if(typeof globalThis=="object")return globalThis;var g;try{g=this||new Function("return this")()}catch{if(typeof window=="object")return window;if(typeof self=="object")return self;if(typeof __webpack_require__.g<"u")return __webpack_require__.g}return g}()},27418:module=>{"use strict";/*
|
|
2
2
|
object-assign
|
|
3
3
|
(c) Sindre Sorhus
|
|
4
4
|
@license MIT
|
|
@@ -9,7 +9,7 @@ object-assign
|
|
|
9
9
|
*
|
|
10
10
|
* This source code is licensed under the MIT license found in the
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/var aa=__webpack_require__(
|
|
12
|
+
*/var aa=__webpack_require__(45993),m=__webpack_require__(27418),r=__webpack_require__(54142);function y(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!aa)throw Error(y(227));var ba=new Set,ca={};function da(a,b){ea(a,b),ea(a+"Capture",b)}function ea(a,b){for(ca[a]=b,a=0;a<b.length;a++)ba.add(b[a])}var fa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ha=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ia=Object.prototype.hasOwnProperty,ja={},ka={};function la(a){return ia.call(ka,a)?!0:ia.call(ja,a)?!1:ha.test(a)?ka[a]=!0:(ja[a]=!0,!1)}function ma(a,b,c,d){if(c!==null&&c.type===0)return!1;switch(typeof b){case"function":case"symbol":return!0;case"boolean":return d?!1:c!==null?!c.acceptsBooleans:(a=a.toLowerCase().slice(0,5),a!=="data-"&&a!=="aria-");default:return!1}}function na(a,b,c,d){if(b===null||typeof b>"u"||ma(a,b,c,d))return!0;if(d)return!1;if(c!==null)switch(c.type){case 3:return!b;case 4:return b===!1;case 5:return isNaN(b);case 6:return isNaN(b)||1>b}return!1}function B(a,b,c,d,e,f,g){this.acceptsBooleans=b===2||b===3||b===4,this.attributeName=d,this.attributeNamespace=e,this.mustUseProperty=c,this.propertyName=a,this.type=b,this.sanitizeURL=f,this.removeEmptyString=g}var D={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){D[a]=new B(a,0,!1,a,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var b=a[0];D[b]=new B(b,1,!1,a[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(a){D[a]=new B(a,2,!1,a.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){D[a]=new B(a,2,!1,a,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){D[a]=new B(a,3,!1,a.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(a){D[a]=new B(a,3,!0,a,null,!1,!1)}),["capture","download"].forEach(function(a){D[a]=new B(a,4,!1,a,null,!1,!1)}),["cols","rows","size","span"].forEach(function(a){D[a]=new B(a,6,!1,a,null,!1,!1)}),["rowSpan","start"].forEach(function(a){D[a]=new B(a,5,!1,a.toLowerCase(),null,!1,!1)});var oa=/[\-:]([a-z])/g;function pa(a){return a[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!1,!1)}),D.xlinkHref=new B("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!0,!0)});function qa(a,b,c,d){var e=D.hasOwnProperty(b)?D[b]:null,f=e!==null?e.type===0:d?!1:!(!(2<b.length)||b[0]!=="o"&&b[0]!=="O"||b[1]!=="n"&&b[1]!=="N");f||(na(b,c,e,d)&&(c=null),d||e===null?la(b)&&(c===null?a.removeAttribute(b):a.setAttribute(b,""+c)):e.mustUseProperty?a[e.propertyName]=c===null?e.type===3?!1:"":c:(b=e.attributeName,d=e.attributeNamespace,c===null?a.removeAttribute(b):(e=e.type,c=e===3||e===4&&c===!0?"":""+c,d?a.setAttributeNS(d,b,c):a.setAttribute(b,c))))}var ra=aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,sa=60103,ta=60106,ua=60107,wa=60108,xa=60114,ya=60109,za=60110,Aa=60112,Ba=60113,Ca=60120,Da=60115,Ea=60116,Fa=60121,Ga=60128,Ha=60129,Ia=60130,Ja=60131;if(typeof Symbol=="function"&&Symbol.for){var E=Symbol.for;sa=E("react.element"),ta=E("react.portal"),ua=E("react.fragment"),wa=E("react.strict_mode"),xa=E("react.profiler"),ya=E("react.provider"),za=E("react.context"),Aa=E("react.forward_ref"),Ba=E("react.suspense"),Ca=E("react.suspense_list"),Da=E("react.memo"),Ea=E("react.lazy"),Fa=E("react.block"),E("react.scope"),Ga=E("react.opaque.id"),Ha=E("react.debug_trace_mode"),Ia=E("react.offscreen"),Ja=E("react.legacy_hidden")}var Ka=typeof Symbol=="function"&&Symbol.iterator;function La(a){return a===null||typeof a!="object"?null:(a=Ka&&a[Ka]||a["@@iterator"],typeof a=="function"?a:null)}var Ma;function Na(a){if(Ma===void 0)try{throw Error()}catch(c){var b=c.stack.trim().match(/\n( *(at )?)/);Ma=b&&b[1]||""}return`
|
|
13
13
|
`+Ma+a}var Oa=!1;function Pa(a,b){if(!a||Oa)return"";Oa=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(b)if(b=function(){throw Error()},Object.defineProperty(b.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(b,[])}catch(k){var d=k}Reflect.construct(a,[],b)}else{try{b.call()}catch(k){d=k}a.call(b.prototype)}else{try{throw Error()}catch(k){d=k}a()}}catch(k){if(k&&d&&typeof k.stack=="string"){for(var e=k.stack.split(`
|
|
14
14
|
`),f=d.stack.split(`
|
|
15
15
|
`),g=e.length-1,h=f.length-1;1<=g&&0<=h&&e[g]!==f[h];)h--;for(;1<=g&&0<=h;g--,h--)if(e[g]!==f[h]){if(g!==1||h!==1)do if(g--,h--,0>h||e[g]!==f[h])return`
|