@modern-js/plugin-garfish 2.49.3-alpha.0 → 2.49.4

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.
@@ -80,7 +80,7 @@ function canContinueRender ({ dom, appName }) {
80
80
 
81
81
  function generateRouterPlugin (basename,routerConfig) {
82
82
  if (basename) {
83
- routerConfig.originBaseUrl = basename;
83
+ routerConfig.originalBaseUrl = basename;
84
84
  if (routerConfig.supportHtml5History !== false) {
85
85
  if (!routerConfig.historyOptions) {
86
86
  routerConfig.historyOptions = {
@@ -111,7 +111,7 @@ const makeRenderFunction = (code) => {
111
111
  let mountNode = rootDomInfo.mountNode;
112
112
  props = rootDomInfo.props;
113
113
  `;
114
- return inGarfishToRender + code.replace(`router(`, `generateRouterPlugin(basename,`).replace(/MOUNT_ID/g, "mountNode").replace(`createApp({`, "createApp({ props,").replace(`bootstrap(AppWrapper, mountNode, root`, "bootstrap(AppWrapper, mountNode, root = IS_REACT18 ? ReactDOM.createRoot(mountNode) : null").replace(`customBootstrap(AppWrapper`, "customBootstrap(AppWrapper, mountNode");
114
+ return inGarfishToRender + code.replace(`router(`, `generateRouterPlugin(basename,`).replace(/MOUNT_ID/g, "mountNode").replace(`createApp({`, "createApp({ props,").replace(`bootstrap(AppWrapper, mountNode, root`, "bootstrap(AppWrapper, mountNode, root = IS_REACT18 ? ReactDOM.createRoot(mountNode) : null").replace(`customBootstrap(AppWrapper`, "customBootstrap(AppWrapper, mountNode").replace(/customBootstrap\((.*)\)/g, "customBootstrap($1, props)");
115
115
  };
116
116
  function getRuntimeConfig(config) {
117
117
  var _config_runtime;
@@ -1,9 +1,9 @@
1
1
  var makeProvider = function() {
2
- return "\nexport const provider = function ({basename, dom}) {\n return {\n render({basename, dom, props, appName}) {\n render({ props, basename, dom, appName });\n },\n destroy({ dom }) {\n const node = dom.querySelector('#' + MOUNT_ID) || dom;\n\n if (node) {\n if (IS_REACT18) {\n root.unmount();\n } else {\n unmountComponentAtNode(node);\n }\n }\n },\n SubModuleComponent: (props) => {\n const SubApp = render({props, basename});\n\n return createPortal(<SubApp />, dom.querySelector('#' + MOUNT_ID) || dom);\n },\n jupiter_submodule_app_key: (props) => {\n const SubApp = render({props, basename});\n\n return createPortal(<SubApp />, dom.querySelector('#' + MOUNT_ID) || dom);\n }\n }\n};\n\nif (typeof __GARFISH_EXPORTS__ !== 'undefined') {\n __GARFISH_EXPORTS__.provider = provider;\n}\n\nfunction canContinueRender ({ dom, appName }) {\n var renderByGarfish =\n typeof __GARFISH_EXPORTS__ !== 'undefined'\n || typeof window !== 'undefined' && window.Garfish && window.Garfish.activeApps && window.Garfish.activeApps.some((app)=>app.appInfo.name === appName);\n let renderByProvider = dom || appName;\n if (renderByGarfish) {\n // Runs in the Garfish environment and is rendered by the provider\n if (renderByProvider) {\n return true;\n } else {\n // Runs in the Garfish environment and is not rendered by the provider\n return false;\n }\n } else {\n // Running in a non-Garfish environment\n return true;\n }\n}\n\nfunction generateRouterPlugin (basename,routerConfig) {\n if (basename) {\n routerConfig.originBaseUrl = basename;\n if (routerConfig.supportHtml5History !== false) {\n if (!routerConfig.historyOptions) {\n routerConfig.historyOptions = {\n basename: basename\n };\n } else {\n routerConfig.historyOptions.basename = basename;\n }\n }\n }\n return router(routerConfig);\n}\n\nfunction generateRootDom ({ dom, props, basename }) {\n const mountNode = dom ? (dom.querySelector('#' + MOUNT_ID) || dom) : document.getElementById(MOUNT_ID);\n const mergedProps = {\n ...props,\n basename,\n }\n return { mountNode, props: mergedProps }\n}\n";
2
+ return "\nexport const provider = function ({basename, dom}) {\n return {\n render({basename, dom, props, appName}) {\n render({ props, basename, dom, appName });\n },\n destroy({ dom }) {\n const node = dom.querySelector('#' + MOUNT_ID) || dom;\n\n if (node) {\n if (IS_REACT18) {\n root.unmount();\n } else {\n unmountComponentAtNode(node);\n }\n }\n },\n SubModuleComponent: (props) => {\n const SubApp = render({props, basename});\n\n return createPortal(<SubApp />, dom.querySelector('#' + MOUNT_ID) || dom);\n },\n jupiter_submodule_app_key: (props) => {\n const SubApp = render({props, basename});\n\n return createPortal(<SubApp />, dom.querySelector('#' + MOUNT_ID) || dom);\n }\n }\n};\n\nif (typeof __GARFISH_EXPORTS__ !== 'undefined') {\n __GARFISH_EXPORTS__.provider = provider;\n}\n\nfunction canContinueRender ({ dom, appName }) {\n var renderByGarfish =\n typeof __GARFISH_EXPORTS__ !== 'undefined'\n || typeof window !== 'undefined' && window.Garfish && window.Garfish.activeApps && window.Garfish.activeApps.some((app)=>app.appInfo.name === appName);\n let renderByProvider = dom || appName;\n if (renderByGarfish) {\n // Runs in the Garfish environment and is rendered by the provider\n if (renderByProvider) {\n return true;\n } else {\n // Runs in the Garfish environment and is not rendered by the provider\n return false;\n }\n } else {\n // Running in a non-Garfish environment\n return true;\n }\n}\n\nfunction generateRouterPlugin (basename,routerConfig) {\n if (basename) {\n routerConfig.originalBaseUrl = basename;\n if (routerConfig.supportHtml5History !== false) {\n if (!routerConfig.historyOptions) {\n routerConfig.historyOptions = {\n basename: basename\n };\n } else {\n routerConfig.historyOptions.basename = basename;\n }\n }\n }\n return router(routerConfig);\n}\n\nfunction generateRootDom ({ dom, props, basename }) {\n const mountNode = dom ? (dom.querySelector('#' + MOUNT_ID) || dom) : document.getElementById(MOUNT_ID);\n const mergedProps = {\n ...props,\n basename,\n }\n return { mountNode, props: mergedProps }\n}\n";
3
3
  };
4
4
  var makeRenderFunction = function(code) {
5
5
  var inGarfishToRender = "\n let { basename, props, dom, appName } = typeof arguments[0] === 'object' && arguments[0] || {};\n if (!canContinueRender({ dom, appName })) return null;\n const rootDomInfo = generateRootDom({dom, props, basename});\n let mountNode = rootDomInfo.mountNode;\n props = rootDomInfo.props;\n ";
6
- return inGarfishToRender + code.replace("router(", "generateRouterPlugin(basename,").replace(/MOUNT_ID/g, "mountNode").replace("createApp({", "createApp({ props,").replace("bootstrap(AppWrapper, mountNode, root", "bootstrap(AppWrapper, mountNode, root = IS_REACT18 ? ReactDOM.createRoot(mountNode) : null").replace("customBootstrap(AppWrapper", "customBootstrap(AppWrapper, mountNode");
6
+ return inGarfishToRender + code.replace("router(", "generateRouterPlugin(basename,").replace(/MOUNT_ID/g, "mountNode").replace("createApp({", "createApp({ props,").replace("bootstrap(AppWrapper, mountNode, root", "bootstrap(AppWrapper, mountNode, root = IS_REACT18 ? ReactDOM.createRoot(mountNode) : null").replace("customBootstrap(AppWrapper", "customBootstrap(AppWrapper, mountNode").replace(/customBootstrap\((.*)\)/g, "customBootstrap($1, props)");
7
7
  };
8
8
  function getRuntimeConfig(config) {
9
9
  var _config_runtime;
@@ -53,7 +53,7 @@ function canContinueRender ({ dom, appName }) {
53
53
 
54
54
  function generateRouterPlugin (basename,routerConfig) {
55
55
  if (basename) {
56
- routerConfig.originBaseUrl = basename;
56
+ routerConfig.originalBaseUrl = basename;
57
57
  if (routerConfig.supportHtml5History !== false) {
58
58
  if (!routerConfig.historyOptions) {
59
59
  routerConfig.historyOptions = {
@@ -84,7 +84,7 @@ const makeRenderFunction = (code) => {
84
84
  let mountNode = rootDomInfo.mountNode;
85
85
  props = rootDomInfo.props;
86
86
  `;
87
- return inGarfishToRender + code.replace(`router(`, `generateRouterPlugin(basename,`).replace(/MOUNT_ID/g, "mountNode").replace(`createApp({`, "createApp({ props,").replace(`bootstrap(AppWrapper, mountNode, root`, "bootstrap(AppWrapper, mountNode, root = IS_REACT18 ? ReactDOM.createRoot(mountNode) : null").replace(`customBootstrap(AppWrapper`, "customBootstrap(AppWrapper, mountNode");
87
+ return inGarfishToRender + code.replace(`router(`, `generateRouterPlugin(basename,`).replace(/MOUNT_ID/g, "mountNode").replace(`createApp({`, "createApp({ props,").replace(`bootstrap(AppWrapper, mountNode, root`, "bootstrap(AppWrapper, mountNode, root = IS_REACT18 ? ReactDOM.createRoot(mountNode) : null").replace(`customBootstrap(AppWrapper`, "customBootstrap(AppWrapper, mountNode").replace(/customBootstrap\((.*)\)/g, "customBootstrap($1, props)");
88
88
  };
89
89
  function getRuntimeConfig(config) {
90
90
  var _config_runtime;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.49.3-alpha.0",
18
+ "version": "2.49.4",
19
19
  "jsnext:source": "./src/cli/index.ts",
20
20
  "types": "./dist/types/cli/index.d.ts",
21
21
  "typesVersions": {
@@ -70,15 +70,15 @@
70
70
  "hoist-non-react-statics": "^3.3.2",
71
71
  "react-loadable": "^5.5.0",
72
72
  "@swc/helpers": "0.5.3",
73
- "@modern-js/utils": "2.49.2"
73
+ "@modern-js/utils": "2.49.4"
74
74
  },
75
75
  "peerDependencies": {
76
- "@modern-js/runtime": "^2.49.2",
76
+ "@modern-js/runtime": "^2.49.4",
77
77
  "react": ">=17",
78
78
  "react-dom": ">=17"
79
79
  },
80
80
  "devDependencies": {
81
- "@rsbuild/shared": "0.6.11",
81
+ "@rsbuild/shared": "0.6.15",
82
82
  "@testing-library/dom": "^8.14.0",
83
83
  "@testing-library/jest-dom": "^5.16.1",
84
84
  "@testing-library/react": "^13.4.0",
@@ -93,13 +93,13 @@
93
93
  "react-dom": "^18",
94
94
  "react-router-dom": "6.22.0",
95
95
  "typescript": "^5",
96
- "@modern-js/core": "2.49.2",
97
- "@modern-js/app-tools": "2.49.2",
98
- "@modern-js/runtime": "2.49.3-alpha.0",
99
- "@scripts/build": "2.49.2",
100
- "@modern-js/types": "2.49.2",
101
- "@scripts/jest-config": "2.49.2",
102
- "@modern-js/plugin-router-v5": "2.49.2"
96
+ "@modern-js/app-tools": "2.49.4",
97
+ "@modern-js/core": "2.49.4",
98
+ "@modern-js/plugin-router-v5": "2.49.4",
99
+ "@modern-js/runtime": "2.49.4",
100
+ "@scripts/build": "2.49.4",
101
+ "@modern-js/types": "2.49.4",
102
+ "@scripts/jest-config": "2.49.4"
103
103
  },
104
104
  "sideEffects": false,
105
105
  "publishConfig": {