@flatjs/evolve 3.0.0-next.7 → 3.0.1
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
|
-
import{existsSync,readFileSync}from"node:fs";import{isAbsolute,join}from"node:path";import{ensureSlash,urlJoin}from"@flatjs/common";import{parseTemplate}from"@hyperse/html-webpack-plugin-loader";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";import{getHtmlPluginConfig}from"../../helpers/get-html-plugin-config.js";import{getPackageDir}from"../../helpers/get-pacakge-dir.js";import{getRuntimeCDNBase}from"../../helpers/get-runtime-cdn-base.js";import{normalizeEvolveEntryName}from"../../helpers/normalize-entry-map.js";import{normalizePageProxy}from"../../helpers/normalize-page-proxy.js";import{normalizeTemplateInjectTokens}from"../../helpers/normalize-template-inject-tokens.js";import{injectFederationScripts}from"../../helpers/script-injects.js";import{ErrorModuleParser}from"./error-module-parser.js";import{getBundleAsset}from"./get-bundle-asset.js";import{getDevServerHostUri}from"./get-dev-server-host-uri.js";import{getHmrRuntimeChunks}from"./get-hmr-runtime-chunks.js";import{getNormalizedEntryName}from"./get-normalized-entry-name.js";export const getPageModuleHtml=async(e,t,r,o,
|
1
|
+
import{existsSync,readFileSync}from"node:fs";import{isAbsolute,join}from"node:path";import{ensureSlash,urlJoin}from"@flatjs/common";import{parseTemplate}from"@hyperse/html-webpack-plugin-loader";import{allowPx2remForModule}from"../../helpers/allow-px2rem-for-module.js";import{getHtmlPluginConfig}from"../../helpers/get-html-plugin-config.js";import{getPackageDir}from"../../helpers/get-pacakge-dir.js";import{getRuntimeCDNBase}from"../../helpers/get-runtime-cdn-base.js";import{normalizeEvolveEntryName}from"../../helpers/normalize-entry-map.js";import{normalizePageProxy}from"../../helpers/normalize-page-proxy.js";import{normalizeTemplateInjectTokens}from"../../helpers/normalize-template-inject-tokens.js";import{injectFederationScripts}from"../../helpers/script-injects.js";import{ErrorModuleParser}from"./error-module-parser.js";import{getBundleAsset}from"./get-bundle-asset.js";import{getDevServerHostUri}from"./get-dev-server-host-uri.js";import{getHmrRuntimeChunks}from"./get-hmr-runtime-chunks.js";import{getNormalizedEntryName}from"./get-normalized-entry-name.js";export const getPageModuleHtml=async(e,t,r,o,n)=>{const{entryMap:s,projectVirtualPath:i}=n,l=Object.keys(s).sort((e,t)=>t.length-e.length),a=getPackageDir(),m=l.find(e=>{const r=normalizeEvolveEntryName(e,i);return ensureSlash(t.path.replace(/^\//,""),!0).startsWith(ensureSlash(r,!0))});if(!m){const e=readFileSync(join(a,"./templates/module-404.html"),"utf-8");return new ErrorModuleParser(e,{title:"404 Not Found",errorMeta:[{name:"@flatjs/evolve workspace",value:a},{name:"served entry names",value:JSON.stringify(l)},{name:"module path",value:`${t.path}`}]}).serialize()}const p=s[m],u=p.options,d=getDevServerHostUri(e,m,r),c=u?.templatePath||"./templates/module.html",g=join(n.projectCwd,"./templates/module.html"),h=readFileSync(isAbsolute(c)?c:existsSync(g)?g:join(a,"./templates/module.html"),"utf-8"),f=n.devServer,v=f?.defaultServeGlobalData?await f.defaultServeGlobalData(p,r):{},j={mode:"development",envCdn:urlJoin(r,["public"])},y=getNormalizedEntryName(m,i,e,f),S=normalizePageProxy(f?.pageProxy||"/pages"),P=normalizeTemplateInjectTokens(j,u),H=parseTemplate(h);H.upsertTitleTag(getHtmlPluginConfig("title",j,u?.title));const b=P.favicon;b&&H.upsertFaviconTag(b.href,b.rel,b.attributes);const z=P.headMetaTags||[];H.upsertHeadMetaTags(z);const w=P.headStyles||[],C=getBundleAsset(d,y,".css");w.push({id:C,href:C,position:"end"}),H.upsertHeadStyles(w);const k=P.headScripts||[];getHmrRuntimeChunks(e,m,y,p,n,d).forEach(e=>{k.unshift({id:e,src:e,position:"end"})}),H.upsertHeadScripts(k);const N=P.headInlineScripts||[];allowPx2remForModule([m,p],n)&&N.push({id:"viewport",content:getHtmlPluginConfig("viewport",j,u?.viewport),position:"end"});const E=getRuntimeCDNBase(n.multiHtmlCdn,n.multiHtmlCdnEnvResolver||function cdnResolver(){});N.push({id:"flatjsMultiCdn",content:E,position:"end"});const M=injectFederationScripts({me:[urlJoin(r,["public"])]},n.multiHtmlCdnEnvResolver);N.push({id:"evolveFetchMicroWidgets",content:M,position:"end"});const T={hostUrl:r,apiBase:urlJoin(r,[o]),virtualPath:join(S,i),moduleName:m.replace(i,"").replace(/^\//,""),...v,...u?.serveGlobalData||{}};N.push({id:"globalData",content:`window.GLOBAL=${JSON.stringify(T)}`,position:"end"}),H.upsertHeadInlineScripts(N);const x=P.headInlineStyles||[];H.upsertHeadInlineStyles(x);const D=P.bodyScripts||[],F=getBundleAsset(d,y,".js");return D.push({id:F,src:F,position:"end"}),H.upsertBodyScripts(D),H.serialize()};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flatjs/evolve",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.1",
|
4
4
|
"license": "MIT",
|
5
5
|
"type": "module",
|
6
6
|
"exports": {
|
@@ -49,25 +49,25 @@
|
|
49
49
|
"@babel/core": "^7.27.4",
|
50
50
|
"@clack/prompts": "^0.11.0",
|
51
51
|
"@discoveryjs/json-ext": "0.6.3",
|
52
|
-
"@flatjs/babel-plugin-import": "2.2.9
|
53
|
-
"@flatjs/common": "2.2.4
|
54
|
-
"@flatjs/evolve-preset-babel": "2.2.4
|
55
|
-
"@flatjs/forge-postcss-plugin-pixel": "2.2.4
|
56
|
-
"@flatjs/forge-ts-checker": "1.1.2
|
57
|
-
"@flatjs/graph": "2.2.9
|
58
|
-
"@flatjs/mock": "2.4.1
|
59
|
-
"@flatjs/swc-plugin-import": "1.0.0
|
52
|
+
"@flatjs/babel-plugin-import": "2.2.9",
|
53
|
+
"@flatjs/common": "2.2.4",
|
54
|
+
"@flatjs/evolve-preset-babel": "2.2.4",
|
55
|
+
"@flatjs/forge-postcss-plugin-pixel": "2.2.4",
|
56
|
+
"@flatjs/forge-ts-checker": "1.1.2",
|
57
|
+
"@flatjs/graph": "2.2.9",
|
58
|
+
"@flatjs/mock": "2.4.1",
|
59
|
+
"@flatjs/swc-plugin-import": "1.0.0",
|
60
60
|
"@hyperse/config-loader": "^1.0.5",
|
61
61
|
"@hyperse/html-webpack-plugin-loader": "^1.0.6",
|
62
|
-
"@hyperse/inspector": "^1.1.
|
63
|
-
"@hyperse/inspector-babel-plugin": "^1.1.
|
64
|
-
"@hyperse/inspector-common": "^1.1.
|
65
|
-
"@hyperse/inspector-middleware": "^1.1.
|
66
|
-
"@hyperse/inspector-swc-plugin": "^1.1.
|
62
|
+
"@hyperse/inspector": "^1.1.13",
|
63
|
+
"@hyperse/inspector-babel-plugin": "^1.1.7",
|
64
|
+
"@hyperse/inspector-common": "^1.1.4",
|
65
|
+
"@hyperse/inspector-middleware": "^1.1.7",
|
66
|
+
"@hyperse/inspector-swc-plugin": "^1.1.9",
|
67
67
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.6.0",
|
68
|
-
"@rsdoctor/rspack-plugin": "^1.1.
|
69
|
-
"@rspack/core": "
|
70
|
-
"@rspack/dev-server": "
|
68
|
+
"@rsdoctor/rspack-plugin": "^1.1.6",
|
69
|
+
"@rspack/core": "~1.4.2",
|
70
|
+
"@rspack/dev-server": "~1.1.3",
|
71
71
|
"@rspack/plugin-react-refresh": "^1.4.3",
|
72
72
|
"@swc/helpers": "^0.5.17",
|
73
73
|
"@types/babel__core": "^7.20.5",
|
@@ -105,7 +105,7 @@
|
|
105
105
|
"webpack-sources": "^3.3.2"
|
106
106
|
},
|
107
107
|
"devDependencies": {
|
108
|
-
"@flatjs/testing": "2.2.4
|
108
|
+
"@flatjs/testing": "2.2.4",
|
109
109
|
"@hyperse/eslint-config-hyperse": "^1.4.5",
|
110
110
|
"@swc/core": "1.12.1",
|
111
111
|
"@types/express": "5.0.3",
|