@moneko/core 3.26.3 → 3.26.5
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/lib/bin/build-app.mjs +1 -1
- package/lib/bin/build.mjs +1 -1
- package/lib/bin/changelog.mjs +3 -3
- package/lib/bin/eslint.mjs +1 -1
- package/lib/bin/git-hooks.mjs +1 -1
- package/lib/bin/index.mjs +1 -1
- package/lib/bin/lessc.mjs +1 -1
- package/lib/bin/runlint.mjs +2 -2
- package/lib/bin/start.mjs +1 -1
- package/lib/bin/stylelint.mjs +1 -1
- package/lib/bin/utils/bundle-app.mjs +1 -1
- package/lib/bin/utils/config.mjs +1 -1
- package/lib/bin/utils/setup-swcrc.mjs +1 -1
- package/lib/build/server.mjs +1 -1
- package/lib/build.mjs +1 -1
- package/lib/commom/has-pkg.mjs +1 -0
- package/lib/commom/os-tmp-dir.mjs +1 -0
- package/lib/commom/parse-module-meta.mjs +1 -0
- package/lib/{paths.d.mts → commom/paths.d.mts} +0 -4
- package/lib/commom/paths.mjs +1 -0
- package/lib/common.mjs +1 -1
- package/lib/config.mjs +1 -1
- package/lib/dev/config.mjs +3 -3
- package/lib/dev/json-schema.d.mts +3 -0
- package/lib/dev/json-schema.mjs +1 -0
- package/lib/dev/mock.mjs +1 -1
- package/lib/dev/proxy.d.mts +1 -1
- package/lib/dev.mjs +1 -1
- package/lib/index.d.mts +13 -13
- package/lib/index.mjs +1 -1
- package/lib/loader/css-in-js-minify.cjs +1 -1
- package/lib/loader/css-in-js-minify.d.cts +1 -0
- package/lib/loader/lightning-css/codegen.cjs +20 -0
- package/lib/loader/lightning-css/codegen.d.cts +35 -0
- package/lib/loader/lightning-css/loader.cjs +1 -0
- package/lib/loader/lightning-css/loader.d.cts +29 -0
- package/lib/loader/lightning-css/runtime/api.cjs +1 -0
- package/lib/loader/lightning-css/runtime/api.d.cts +1 -0
- package/lib/loader/lightning-css/runtime/get-url.cjs +1 -0
- package/lib/loader/lightning-css/runtime/get-url.d.cts +1 -0
- package/lib/loader/lightning-css/utils.cjs +1 -0
- package/lib/loader/lightning-css/utils.d.cts +16 -0
- package/lib/loader/mdx.cjs +1 -1
- package/lib/loader/react-compiler.cjs +1 -1
- package/lib/loader/solid.d.cts +1 -1
- package/lib/loader/ts-doc.cjs +1 -1
- package/lib/loader/ts-doc.d.cts +1 -1
- package/lib/module.config.mjs +2 -1
- package/lib/options/css-extract.mjs +1 -1
- package/lib/options/html-plugin-option.mjs +1 -1
- package/lib/options/modify-vars.mjs +1 -1
- package/lib/options/reslove.d.mts +0 -1
- package/lib/options/reslove.mjs +1 -1
- package/lib/options/swcrc.mjs +1 -1
- package/lib/plugin/copy.mjs +1 -1
- package/lib/plugin/exposes-declararion.mjs +1 -1
- package/lib/plugin/lightningcss-plugin.mjs +1 -1
- package/lib/plugin/module-federation.mjs +1 -1
- package/lib/plugin/override-resolve.mjs +1 -1
- package/lib/plugin/virtual-module.mjs +1 -1
- package/lib/plugins.config.mjs +1 -1
- package/lib/polyfills/polyfills.mjs +1 -1
- package/lib/polyfills/targets.mjs +1 -1
- package/lib/process-env.d.mts +1 -1
- package/lib/process-env.mjs +1 -1
- package/lib/utils/create-types.mjs +1 -1
- package/lib/utils/dts.mjs +1 -1
- package/lib/utils/fetch-module-federation-dts.mjs +1 -1
- package/lib/utils/index.d.mts +1 -1
- package/lib/utils/index.mjs +1 -1
- package/lib/utils/seo.mjs +2 -2
- package/lib/utils/vts.mjs +1 -1
- package/lib/vm/coverage.mjs +1 -1
- package/lib/vm/docs.d.mts +1 -1
- package/lib/vm/docs.mjs +1 -1
- package/lib/vm/example.d.mts +1 -1
- package/lib/vm/example.mjs +1 -1
- package/lib/vm/info.mjs +1 -1
- package/lib/vm/locales.d.mts +1 -1
- package/lib/vm/locales.mjs +2 -2
- package/lib/vm/modules.mjs +1 -1
- package/lib/vm/routes.d.mts +1 -1
- package/lib/vm/routes.mjs +1 -1
- package/lib/vm/utils.mjs +1 -1
- package/package.json +3 -3
- package/typings/global.d.ts +21 -21
- package/lib/loader/lightningcss.cjs +0 -1
- package/lib/loader/lightningcss.d.cts +0 -7
- package/lib/paths.mjs +0 -1
- package/lib/utils/has-pkg.mjs +0 -1
- package/lib/utils/os-tmp-dir.mjs +0 -1
- package/lib/utils/parse-module-meta.mjs +0 -1
- package/lib/utils/setup-env.d.mts +0 -6
- package/lib/utils/setup-env.mjs +0 -1
- /package/lib/{utils → commom}/diff-object.d.mts +0 -0
- /package/lib/{utils → commom}/diff-object.mjs +0 -0
- /package/lib/{utils → commom}/esm.d.mts +0 -0
- /package/lib/{utils → commom}/esm.mjs +0 -0
- /package/lib/{utils → commom}/get-current-time.d.mts +0 -0
- /package/lib/{utils → commom}/get-current-time.mjs +0 -0
- /package/lib/{utils → commom}/has-pkg.d.mts +0 -0
- /package/lib/{utils → commom}/log.d.mts +0 -0
- /package/lib/{utils → commom}/log.mjs +0 -0
- /package/lib/{utils → commom}/match-path.d.mts +0 -0
- /package/lib/{utils → commom}/match-path.mjs +0 -0
- /package/lib/{dev → commom}/net.d.mts +0 -0
- /package/lib/{dev → commom}/net.mjs +0 -0
- /package/lib/{utils → commom}/os-tmp-dir.d.mts +0 -0
- /package/lib/{utils → commom}/parse-module-meta.d.mts +0 -0
- /package/lib/{utils → commom}/reactive-object.d.mts +0 -0
- /package/lib/{utils → commom}/reactive-object.mjs +0 -0
- /package/lib/{rule.d.mts → commom/rule.d.mts} +0 -0
- /package/lib/{rule.mjs → commom/rule.mjs} +0 -0
- /package/lib/{bin/utils → commom}/setup-env.d.mts +0 -0
- /package/lib/{bin/utils → commom}/setup-env.mjs +0 -0
- /package/lib/{utils → commom}/sigint-exit.d.mts +0 -0
- /package/lib/{utils → commom}/sigint-exit.mjs +0 -0
package/lib/bin/build-app.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{execSync as e}from"node:child_process";import{existsSync as i,readdirSync as n,statSync as o}from"node:fs";import s from"node:path";import{argv as r}from"node:process";import{buildPlist as t,buildXml as l,createDir as a,ink as c,jsonToYaml as d,loadFileSync as p,parsePlist as m,parseXml as u,parseYaml as f,print as y,println as S,removeDir as $,saveFile as b,saveFileSync as j}from"@moneko/utils";import{bundleApk as _,bundleIOS as g}from"./utils/bundle-app.mjs";import{corePkg as w,cwd as k}from"./utils/config.mjs";import{__dirname as O}from"./file.mjs";export function copyFileSync(e,i){let n=p(e);if(null!==n){let r=i;o(i).isDirectory()&&(r=s.join(i,s.basename(e))),j(r,n)}}export function copyFolderRecursiveSync(e,i,r){let t=i;r&&(t=s.join(i,s.basename(e))),o(e).isDirectory()&&n(e).forEach(function(i){let n=s.join(e,i);o(n).isDirectory()?copyFolderRecursiveSync(n,t,!0):copyFileSync(n,t)})}export default async function A(){r.slice(3).forEach(e=>{let[i,n]=e.replace(/^--/,"").split("=");process.env[`__args__${i}__`]=n});let{CONFIG:j}=await import(`${w}/lib/config.mjs`),A=j.bundleId;A||(S(c("请配置 bundleId","red")),process.exit(1)),/(^com\.)([a-zA-Z_][a-zA-Z0-9_]*[.])*([a-zA-Z_][a-zA-Z0-9_]*)$/.test(A)&&3===A.split(".").length||(S(c("软件包名不合法","red")),process.exit(1));let N=j.bundles;N&&0!==N.length||(S(c("请配置 bundles (打包类型)","red")),process.exit(1));let x=A.split(".").splice(-1,1).join(""),h=s.join(k,"/dist"),E=`flutter create -t app --org ${A} -i swift -a kotlin ${x}`,R=s.join(k,`/${x}`),T=s.join(R,"assets/web/");e(E,{encoding:"utf-8"}),a(T),y(c("正在注册资产...","yellow"),!0),copyFolderRecursiveSync(h,T);let V=s.join(R,"pubspec.yaml"),v=JSON.parse(await f(V)||"{}"),I=[],J=(e,i="assets/web")=>{let s=n(e);!function n(r){r!=s.length&&(o(`${e}/${s[r]}`).isDirectory()&&(I.push(`${i}/${s[r]}/`),J(`${e}/${s[r]}`,`${i}/${s[r]}`)),n(r+1))}(0)};if(J(h),v.dependencies.webview_flutter_plus="^0.2.3",v.flutter.assets=["assets/web/",...I],b(V,await d(JSON.stringify(v))),y(`${c("注册资产","cyan")}: ${c("完成","cyan")}`,!0),N.includes("apk -release")||N.includes("apk -debug")){y(c("正在配置安卓权限...","yellow"),!0);let e=s.join(R,"android/app/src/main/AndroidManifest.xml"),i=JSON.parse(u(e));i.manifest.application.$["android:usesCleartextTraffic"]="true",i.manifest["uses-permission"]=[{$:{"android:name":"android.permission.INTERNET"}},{$:{"android:name":"android.permission.ACCESS_NETWORK_STATE"}},{$:{"android:name":"android.permission.WAKE_LOCK"}}],b(e,l(JSON.stringify(i)));let n=s.join(R,"android/app/build.gradle"),o=p(n)||"",r="minSdkVersion flutter.minSdkVersion";if(o?.includes(r))o=o.replace(r,"minSdkVersion 20");else{let e=o.indexOf("minSdkVersion "),i=o.substring(e,e+16);o=o.replace(i,"minSdkVersion 20")}let t="compileSdkVersion flutter.compileSdkVersion";o.includes(t)&&(o=o.replace(t,"compileSdkVersion 32")),b(n,o),y(`${c("安卓权限配置","cyan")}: ${c("完成","cyan")}`,!0)}if(N.includes("ios -release")||N.includes("ios -debug")){y(c("开始配置IOS权限","yellow"),!0);let e=s.join(R,"ios/Runner/Info.plist"),i=Object.assign(JSON.parse(await m(e)),{NSAppTransportSecurity:{NSAllowsArbitraryLoads:!0},"io.flutter.embedded_views_preview":!0});b(e,await t(JSON.stringify(i))),y(`${c("IOS权限配置","cyan")}: ${c("完成","cyan")}`,!0)}b(s.join(R,"lib/main.dart"),p(s.join(O,"./conf/bootstrap"))||"");let D=s.join(k,"./bundle/");a(D),setTimeout(()=>{N.forEach(e=>{let i=e.split(" ");"apk"===i[0]&&_(R,D,i[1]),"ios"===i[0]&&g(R,D,i[1])}),$(R),i(s.join(D,"Runner"))&&$(s.join(D,"Runner")),y(`✨ ${c("Done","green")}`,!0),process.exit(0)},1e3)}
|
package/lib/bin/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{spawn as o}from"node:child_process";import{join as e,relative as s}from"node:path";import{argv as t}from"node:process";import{deleteEmptyDirs as i,ink as r,println as n,removeDir as m,removeFile as l,scanFolderSync as c,updateFileSync as p}from"@moneko/utils";import d from"../commom/require.mjs";import f from"../commom/setup-env.mjs";import{corePkg as u,cwd as a,runtimePath as j,swcCachePath as $}from"./utils/config.mjs";import y from"./utils/setup-swcrc.mjs";import{__dirname as _}from"./file.mjs";import{lesscCommonjs as g}from"./lessc.mjs";let b={stdio:"inherit",shell:!0};async function h(){let h=t[3],x=t[4],v=t.slice(5);h||(n(r(`type: 无效值 ${r(h,"245")}`,"red")),process.exit(1));let C=!v.includes("no-docs"),w=!v.includes("no-lib"),E=!v.includes("no-es"),D=v.filter(o=>!["no-docs","no-es","no-lib"].includes(o));await f("production",h,x,D);let S=`${j} ${d.resolve(`${u}/lib/build.mjs`)}`;if("library"===h){let t=y(x),r=d.resolve("typescript/bin/tsc"),n=d.resolve("@swc/cli/bin/swc.js"),f=[w&&{type:"commonjs",dir:"lib",msg:"Convert to CommonJS"},E&&{type:"es6 -C jsc.target=es2015",dir:"es",msg:"Convert to ES Module"}].filter(Boolean),u=e(_,".types.json");f.length&&p(u,JSON.stringify({extends:s(_,e(a,"tsconfig.json")),include:[s(_,e(a,"components")),s(_,e(a,"typings"))],exclude:[s(_,e(a,"components/**/examples/*")),s(_,e(a,"components/**/__tests__/*")),s(_,e(a,"components/**/__mocks__/*"))]}));for(let s=0,p=f.length;s<p;s++){let p=e(a,`./${f[s].dir}`);m(p),o(`${j} ${n} components -d ${f[s].dir} -q --strip-leading-paths --config-file ${t} -C jsc.experimental.cacheRoot=${$} -C module.type=${f[s].type} -D --ignore "**/*.test.(js|ts)x?$"`,b).on("close",function(o){0===o&&(c(p,["README.mdx","examples","__*__"]).forEach(l),i(p),"commonjs"===f[s].type&&g())}),o(`${j} ${r} --project ${u} --outDir ${f[s].dir}`,b)}}("library"!==h||C&&"library"===h)&&o(S,b)}export default h;
|
package/lib/bin/changelog.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
2
|
-
${t.title}`),t.logs)Object.prototype.hasOwnProperty.call(t.logs,e)&&(
|
|
1
|
+
import{execSync as t}from"node:child_process";import{join as e}from"node:path";import{argv as o}from"node:process";import{updateFileSync as r}from"@moneko/utils";import s from"../commom/log.mjs";import{cwd as i}from"./utils/config.mjs";let n={feat:"✨ Features",fix:"🐛 Bug Fixes",docs:"📚 Documentation",style:"💎 Styles",refactor:"📦 Code Refactoring",perf:"🚀 Performance Improvements",test:"🚨 Tests",build:"🛠 Builds",ci:"⚙️ Continuous Integrations",chore:"♻️ Chores",revert:"🗑 Reverts"};function a(e,o){return function(t){let e=[];for(let o of t.trim().split("\n")){let[t,r,s,i,a]=o.split("|");if(a){let o=a.split(": "),l=n[o[0]];e.push({commitId:t,author:r,email:s,date:new Date(i).toLocaleString().replace(/\//g,"-"),message:l?o.slice(1).join(":"):a,type:l})}}return e}(t(`git log ${e?`${e}..`:""}${o||""} --format='%H|%an|%ae|%ad|%s'`,{encoding:"utf-8"}))}export default function l(){let n=o[3],l=["# Change log"];try{t('git show-ref --quiet --verify "refs/heads/$(git rev-parse --abbrev-ref HEAD)";');let e=t('git config --get remote.origin.url | sed "s/\\.git$//"').toString().trim(),o=function(e){let o=t("git for-each-ref --sort='v:refname' --format '%(objectname) %(refname:short) %(creatordate:iso8601)' refs/tags",{encoding:"utf-8"}),r=[],s=o.trim().split("\n");return s.forEach((t,o)=>{let[i,n,a]=t.split(" "),l=s[o-1]?.split(" ")[1],m=`## ${n}`;l&&(m=`## [${n}](${e}/compare/${l}...${n}) (${new Date(a).toLocaleDateString().replace(/\//g,"-")})`),r.push({commitId:i,tag:n,date:a,title:m,logs:{}})}),r}(e);o.forEach((t,r)=>{if(r&&a(o[r-1].tag,t.tag).forEach(t=>{if(t.type){let s=o[r].logs[t.type]||[];s.push(`- ${t.message} ([${t.commitId.substring(0,7)}](${e}/commit/${t.commitId}))`),Object.assign(o[r].logs,{[t.type]:s})}}),r===o.length-1){let s=a(t.tag);s.length&&o.push({title:"## Last",logs:{}}),s.forEach(t=>{if(t.type){let s=o[r+1].logs[t.type]||[];s.push(`- ${t.message} ([${t.commitId.substring(0,7)}](${e}/commit/${t.commitId}))`),Object.assign(o[r+1].logs,{[t.type]:s})}})}}),o.reverse().forEach(t=>{for(let e in l.push(`
|
|
2
|
+
${t.title}`),t.logs)Object.prototype.hasOwnProperty.call(t.logs,e)&&(l.push(`
|
|
3
3
|
### ${e}
|
|
4
|
-
`),t.logs[e].forEach(t=>
|
|
4
|
+
`),t.logs[e].forEach(t=>l.push(t)))})}catch(t){l.push("\n当前分支尚无任何提交\n"),s(t)}r(e(i,n),l.join("\n"))}
|
package/lib/bin/eslint.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{join as o,relative as i}from"node:path";import{argv as e}from"node:process";import t from"../commom/require.mjs";import{cachePath as m,cwd as n,runtimePath as r}from"./utils/config.mjs";import{runLint as s}from"./runlint.mjs";export default function c(){let c=e[3],l=e.slice(4),f=o(t.resolve("eslint"),"../../bin/eslint.js");s(`${r} ${f} ${i(n,c)} --config ${i(n,"eslint.config.mjs")} ${l.join(" ")} --cache --cache-location "${m}/.eslintcache"`,"eslint")}
|
package/lib/bin/git-hooks.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{argv as o}from"node:process";import{runLint as t}from"./runlint.mjs";export default function e(){let e="node_modules/.husky",i=o.slice(3).map(o=>{let t=o.split("=");return`echo
|
|
1
|
+
import{argv as o}from"node:process";import{runLint as t}from"./runlint.mjs";export default function e(){let e="node_modules/.husky",i=o.slice(3).map(o=>{let t=o.split("=");return`echo ${t[1]} > ${e}/${t[0]}`}).join(" && ");t(`git init && husky ${e} && ${i}`,"githooks",[null])}
|
package/lib/bin/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{argv as a}from"node:process";import{ink as
|
|
2
|
+
import{argv as a}from"node:process";import{ink as t,println as e}from"@moneko/utils";import i from"../commom/require.mjs";import s from"../commom/sigint-exit.mjs";import{corePkg as o}from"./utils/config.mjs";switch(a[2]){case"-v":case"--version":e(`${t(o,"blue")}: ${i(`${o}/package.json`).version}`,!0);break;case"start":(await import("./start.mjs")).default();break;case"build":(await import("./build.mjs")).default();break;case"eslint":(await import("./eslint.mjs")).default();break;case"stylelint":(await import("./stylelint.mjs")).default();break;case"githooks":(await import("./git-hooks.mjs")).default();break;case"buildApp":(await import("./build-app.mjs")).default();break;case"changelog":(await import("./changelog.mjs")).default();break;default:(await import("./help.mjs")).default()}s(()=>{process.exit(0)});
|
package/lib/bin/lessc.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{exec as e}from"node:child_process";import{join as o}from"node:path";import{loadFile as s,saveFile as t,scanFolderSync as i}from"@moneko/utils";import r from"../commom/require.mjs";import{corePkg as l,runtimePath as m}from"./utils/config.mjs";let n="";function a(s){let t=o(r.resolve("less"),"../bin/lessc");return new Promise((o,i)=>{e(`${m} ${t} --js ${n} ${s} > ${s.replace(/\.less$/g,".css")}`,function(e){if(e)return i(e);o(!0)})})}let c=/\*?\.less/g;async function f(e){let o=await s(e);o&&c.test(o)&&await t(e,o.replace(c,".css"))}export async function lesscCommonjs(){let e=i("lib",["\\.less$"]),o=(await import(`${l}/lib/options/modify-vars.mjs`)).default;for(let e in o)Object.hasOwnProperty.call(o,e)&&(n+=`--modify-var="${e}=${o[e]}" `);Promise.all(e.map(a)),e.length&&Promise.all(i("lib",["\\.js$"]).map(f))}
|
package/lib/bin/runlint.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`,0!==n.status?"red":"green")
|
|
1
|
+
import{spawnSync as t}from"node:child_process";import{ink as s,print as e}from"@moneko/utils";export const runLint=(o,r,i="inherit")=>{let l=s(r,"cyan");e(`${l}: ${s("Runing...","yellow")}`,!0);let n=t(o,{stdio:i,shell:!0}),u=s(`✨ ${0!==n.status?"Error":"Successfully"}!
|
|
2
|
+
`,0!==n.status?"red":"green");e(`${l}: ${u}`,!0),process.exit(n.status||0)};
|
package/lib/bin/start.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{spawn as o}from"node:child_process";import{argv as e}from"node:process";import{ink as m,println as i}from"@moneko/utils";import r from"../commom/require.mjs";import t from"../commom/setup-env.mjs";import{corePkg as s,runtimePath as p}from"./utils/config.mjs";async function l(){let l=e[3],n=e[4],c=e.slice(5);l||(i(m(`type: 无效值 ${m(l,"245")}`,"red")),process.exit(1));let f=c.indexOf("no-verify");-1!==f&&c.splice(f,1),await t("development",l,n,c),o(`${p} ${r.resolve(`${s}/lib/dev.mjs`)}`,{stdio:"inherit",shell:!0})}export default l;
|
package/lib/bin/stylelint.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{join as s,relative as t}from"node:path";import{argv as e}from"node:process";import o from"../commom/require.mjs";import{cachePath as i,cwd as l,runtimePath as m}from"./utils/config.mjs";import{runLint as r}from"./runlint.mjs";export default function c(){let c=e[3],n=e.slice(4),a=s(o.resolve("stylelint"),"../../bin/stylelint.mjs");r(`${m} ${a} ${t(l,c)}/**/**/**/**/*.{less,css,scss,sass,style.ts,style.js} ${n.join(" ")} --cache --cache-location "${i}/.stylelintcache" --aei`,"stylelint")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{execSync as e}from"node:child_process";import{renameSync as o}from"node:fs";import{join as n}from"node:path";import{bundleIpa as p,createDir as l,ink as i,print as t}from"@moneko/utils";export function bundleApk(p,a,u="-release"){t(i("正在编译 apk...","yellow"),!0),console.time(`bundle apk ${u}`),e(`flutter build apk -${u}`),console.timeEnd(`bundle apk ${u}`),l(a),o(n(p,`build/app/outputs/flutter-apk/app${u}.apk`),a),t(`✨ ${i("Apk 编译","cyan")}: ${i("完成","cyan")}`,!0)}export function bundleIOS(a,u,r="-release"){t(i("正在编译 ipa...","yellow"),!0),console.time(`bundle ipa ${r}`);let d=n(u,"Runner/Payload");e(`flutter build ios -${r} --no-codesign`),l(d),o(n(a,"build/ios/iphoneos/Runner.app"),d),p(n(u,"Runner"),u,r),console.timeEnd(`bundle ipa ${r}`),t(`✨ ${i("ipa 编译","cyan")}: ${i("完成","cyan")}`,!0)}
|
package/lib/bin/utils/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{dirname as e,join as o}from"node:path";let c="undefined"!=typeof Deno?"deno":"undefined"!=typeof Bun?"bun":"node",t=e(process.execPath);"win32"===process.platform&&t.includes(" ")&&(t=`"${t}"`);export const runtimePath=o(t,c);export const corePkg="@moneko/core";export const cwd=process.cwd();export const cachePath=o(cwd,"node_modules/.cache");export const swcCachePath=o(cachePath,".swc");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as e}from"node:path";import{
|
|
1
|
+
import{join as e}from"node:path";import{updateFileSync as o}from"@moneko/utils";import r from"../../commom/require.mjs";import{__dirname as s}from"../file.mjs";let m=e(s,".swcrc");export default function(e){let s="solid"===e;return o(m,JSON.stringify({$schema:"https://json.schemastore.org/swcrc",module:{type:"es6"},minify:!0,jsc:{minify:{mangle:!0,compress:!0,format:{comments:"some"}},parser:{syntax:"typescript",decorators:!0,dynamicImport:!0,tsx:!0},loose:!0,target:"es2022",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,useBuiltins:!0,refresh:"react"===e,development:!1,importSource:s?"solid-js/h":void 0}},experimental:{plugins:[[r.resolve("@moneko/transform-imports"),{"@moneko/common":{transform:"@moneko/common/lib/${member}"},lodash:{transform:"lodash/${member}"},"@ant-design/icons":{transform:"es/icons/${member}"},antd:{transform:"es/${member}",memberTransformers:["dashed_case"]},"neko-ui":{transform:"es/${member}",memberTransformers:["dashed_case"]}}],s&&[r.resolve("@moneko/jsx-dom-expressions"),{moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1}]].filter(Boolean)}},sourceMaps:!0,exclude:["__tests__/","examples/","\\.d\\.ts$"]})),m}
|
package/lib/build/server.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e
|
|
1
|
+
import{CUSTOMCONFIG as e}from"../commom/paths.mjs";import s from"../module.config.mjs";import{isLibrary as m}from"../process-env.mjs";import{resolveProgram as o}from"../utils/index.mjs";let t={name:"server",target:"node",dependencies:["client"],entry:{main:o("site/ssr.tsx")},output:{path:o(`${m?"docs":"dist"}/server`),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[chunkhash].cjs",globalObject:"global"},cache:{type:"filesystem",name:[e,process.env.NODE_ENV,"server"].filter(Boolean).join("-")},externalsPresets:{node:!0},externals:[],module:s(!0)};export default t;
|
package/lib/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{analyzeBundleSize as
|
|
1
|
+
import{relative as o}from"node:path";import{analyzeBundleSize as m,completedInfo as r,ink as t,println as i,progressBar as e}from"@moneko/utils";import n from"webpack";import{merge as s}from"webpack-merge";import a from"./build/common.mjs";import p from"./commom/paths.mjs";import l from"./plugin/done.mjs";import{empty as c}from"./utils/index.mjs";import f from"./utils/seo.mjs";import{CONFIG as u}from"./config.mjs";import d from"./module.config.mjs";let h=u.bar.name||"Build",{ProgressPlugin:g}=n,w=n(s(a,{module:d(!1),plugins:[u.done&&new l({done:u.done}),!!u.bar&&new g({handler(o,m,...r){e(o||0,1,h,r.length?`[${m}] ${r.join(" ")}`:""),1===o&&process.stdout.write("\r\x1b[2K")}})].filter(Boolean)}));async function j(){let e=await new Promise((o,m)=>{w.run((r,t)=>{r&&m(r),t?o(t):m(Error("编译过程中没有生成统计信息"))})});(e.hasErrors()||e.hasWarnings())&&function(o){let{warnings:m,errors:r}=o.compilation;m.forEach(o=>{i(t(o.message,"178"))}),r.forEach(o=>{i(t(o.message,"red"))})}(e),await new Promise(n=>{e.compilation.compiler.cache.shutdown(s=>{s&&i(t(s.toString(),"red")),m(e.compilation.outputOptions.path,["\\.js$"]),r(~~((e.endTime-e.startTime)/10)/100,o(p.programPath,e.compilation.outputOptions.path)),n()})}),u.seo&&f()}process.on("exit",c),await j();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"./require.mjs";export default function(e){try{return r.resolve(e)}catch{return!1}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function(){let e;let s="win32"===process.platform;return e=s?process.env.TEMP||process.env.TMP||`${process.env.SystemRoot||process.env.windir}\\temp`:process.env.TMPDIR||process.env.TMP||process.env.TEMP||"/tmp",(s?/[^:]\\$/:/.\/$/).test(e)&&(e=e.slice(0,-1)),e}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolve as e}from"node:path";import n from"./paths.mjs";export default function(a,o=1){let t=a.replace(/^\/|\/$/g,"").replace(/\\/g,"/"),i=t,m="index.ts",d=t.match(/(.+)\/index\.([^/]+)$/),r=t.match(/(.+)\.([^/]+)$/);return d?(i=d[1],m=`index.${d[2]}`):r&&(i=r[1],m=`index.${r[2]}`),{name:i,main:m,pkg:e(n.nodeModules,i,"package.json"),file:e(n.nodeModules,i,m),meta:`{"name":"${i}","main":"${m}","version":"0.0.${o}","description": ""}`}}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** 当前文件的绝对路径 */
|
|
2
|
-
export declare const __filename: string;
|
|
3
1
|
/** 当前文件所在目录的绝对路径 */
|
|
4
2
|
export declare const __dirname: string;
|
|
5
3
|
/** yarn 命令行参数对象,包含配置选项 */
|
|
@@ -15,8 +13,6 @@ export declare const yarnArgv: Record<string, string> & {
|
|
|
15
13
|
*/
|
|
16
14
|
export declare const CUSTOMCONFIG: string | undefined;
|
|
17
15
|
declare const paths: {
|
|
18
|
-
__dirname: string;
|
|
19
|
-
__filename: string;
|
|
20
16
|
/** node_modules 目录路径 */
|
|
21
17
|
nodeModules: string;
|
|
22
18
|
/** pnpm node_modules 目录路径 */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolve as o}from"node:path";import e from"node:url";import{fileExists as t}from"@moneko/utils";let n=JSON.parse(process.env.npm_config_argv||'{"original":[]}').original;export const __dirname=e.fileURLToPath(new URL("..",import.meta.url));export const yarnArgv={};for(let o=0,e=n.length;o<e;o++){let e=n[o].split("=");Object.assign(yarnArgv,{[e[0]]:e[1]||!0})}export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config||process.env.__args__config__;let c=process.cwd(),a=o(c,"./node_modules"),r={nodeModules:a,pnpmNodeModules:o(a,"./.pnpm/node_modules"),denoNodeModules:o(a,"./.deno"),corePath:__dirname,programPath:c,webpackCachePath:o(a,"./.cache"),lintCachePath:o(a,"./.cache"),httpCachePath:o(a,"./.cache/http"),swcCachePath:o(a,"./.cache/.swc"),configPath:o(c,"./config/index.ts"),customConfigPath:o(c,`./config/${CUSTOMCONFIG}.ts`),coveragePath:o(c,"./coverage/clover.xml"),pagesPath:o(c,"./src/pages"),componentsPath:o(c,"./components"),mockPath:o(c,"./mock")};export const config_files=[t(r.configPath)&&r.configPath,t(r.customConfigPath)&&r.customConfigPath].filter(Boolean);export const routeDir="library"===process.env.APPTYPE?r.componentsPath:r.pagesPath;export default r;
|
package/lib/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{extname as e,join as t,resolve as o}from"node:path";import a,{config_files as n,CUSTOMCONFIG as s}from"./commom/paths.mjs";import i from"./plugin/override-resolve.mjs";import{isObject as l,node_modules as r,resolveProgram as m}from"./utils/index.mjs";import{exampleModuleName as p}from"./vm/example.mjs";import c from"./vm/info.mjs";import{CONFIG as u,PUBLICPATH as d}from"./config.mjs";import h from"./plugins.config.mjs";import{isDev as f,isLibrary as g,NODE_ENV as b,PACKAGENAME as y,PACKAGEVERSION as j}from"./process-env.mjs";export const outputConfig={path:m(g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${f?"name":"contenthash"}].js`,assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[name][hash][ext]`},library:{name:`${c.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${y}`,pathinfo:f,clean:!0,publicPath:d,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"anonymous",enabledWasmLoadingTypes:["fetch"],hotUpdateChunkFilename:"[id].[fullhash].hot.js",hotUpdateMainFilename:"[runtime].[fullhash].hot.json"};let v={main:[u.polyfill&&t(a.corePath,"./polyfills/replace-children.mjs"),r("@app/entry")].filter(Boolean)};u.entry&&("string"==typeof u.entry?v={main:[u.entry]}:Object.keys(u.entry)&&(v=Object.assign(v,u.entry))),"string"==typeof v.main&&(v.main=[v.main]),u.output&&("string"==typeof u.output?outputConfig.path=u.output:Object.keys(u.output)&&Object.assign(outputConfig,u.output));let C={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:a.webpackCachePath,memoryCacheUnaffected:!0,name:`.${[s,b].filter(Boolean).join("-")}`,version:`${j}`,buildDependencies:{config:n}};!1===u.cache?C=!1:l(u.cache)&&(C=Object.assign(C,u.cache));let k=Object.assign({original:u.alias["@"],override:s&&m(s)},u.overrideResolve);export const commonConfig={name:"client",target:"web",devtool:u.devtool,entry:v,mode:f?"development":"production",stats:"errors-only",cache:C,snapshot:{immutablePaths:[/node_modules\/(?!(@app|@moneko)\/)/],managedPaths:[/^@app\/.+/,/^@moneko\/.+/],buildDependencies:{timestamp:!0,hash:!0}},infrastructureLogging:{level:"error"},externalsPresets:u.externalsPresets,plugins:h,node:{global:!1,__filename:!1,__dirname:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:u.lazyCompilation&&f&&{imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(r(p))||t.startsWith(r("@app/comment"))||t.startsWith(a.pagesPath)||t.startsWith(a.componentsPath)))}},buildHttp:l(u.buildHttp)?{allowedUris:[],lockfileLocation:o(a.httpCachePath,"http.lock"),cacheLocation:o(a.httpCachePath,"data"),upgrade:!0,...u.buildHttp}:u.buildHttp,backCompat:!0,futureDefaults:!0,css:!1,outputModule:!1},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:u.alias,modules:[a.nodeModules,a.pnpmNodeModules,a.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:[u.overrideResolve&&new i(k),...u.resolvePlugins].filter(Boolean),preferAbsolute:!0,cache:!0,fallback:{}},externals:u.externals,output:outputConfig};
|
package/lib/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{fileExists as e}from"@moneko/utils";import{merge as o}from"webpack-merge";import t from"./commom/paths.mjs";import n from"./commom/require.mjs";import s from"./commom/setup-env.mjs";import i from"./options/jsx-dom-expressions.mjs";import r from"./options/split-chunk.mjs";import{isFunction as l,resolveProgram as a}from"./utils/index.mjs";import{APPTYPE as m,FRAMEWORK as p,isDev as c,isLibrary as u,isMobile as d,jsxImportSource as f,mainDirectory as h,NODE_ENV as g,PACKAGENAME as x}from"./process-env.mjs";let v=["@app","@moneko","neko-ui",".cache/http/data","@ant-design","@antv","@antv/x6","@antv/x6-react-components","@element-plus","ant-design-vue","antd","antd-mini","antd-mobile","antd-mobile-icons","element-plus","element-ui","ng-zorro-antd","@antv","@mui","@du","ahooks","rc-queue-anim","umi","@fontsource","@fortawesome","font-pingfang-sc","font-pingfang-tc","katex","react-markdown-editor-lite","react-photo-view","schema-design"];export function getConfig(o){return delete n.cache[o],new Promise(t=>{if(e(o)){let e=n(o).default;return t(l(e)?e(process):e)}return t({})})}let[P,b,w]=await Promise.all([s(g,m,p,[]),getConfig(t.configPath),getConfig(t.customConfigPath)]),C={devtool:c?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:P,basename:"/",publicPath:"/",rem:{designSize:d?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":a(h)},moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3},htmlPluginOption:{},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:r,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:v,js:v,media:v,font:v,wasm:[]},mdx:{jsx:!1,development:c,jsxImportSource:f,providerImportSource:`@moneko/${p}/mdx`},jsxDomExpressions:i,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:!1,refresh:"solid"!==p,bundleId:"com.moneko.bid",bundles:[]};u&&(C.alias=Object.assign(C.alias,{"@pkg":t.componentsPath,[x]:t.componentsPath}));let j=C;(!1===(j=o(j,b,w)).devtool||!1===j.sourceMap)&&(j.sourceMap=!1,j.devtool=!1),j.fixBrowserRouter&&j.htmlPluginOption&&(j.htmlPluginOption.tags||(j.htmlPluginOption.tags=[]),j.htmlPluginOption.tags.push({textContent:"(function(l) {if (l.search[1] === '/' ) {var decoded = l.search.slice(1).split('&').map(function(s) {return s.replace(/~and~/g, '&')}).join('?');window.history.replaceState(null, null,l.pathname.slice(0, -1) + decoded + l.hash);}}(window.location))"}));export const CONFIG=j;export const PUBLICPATH=CONFIG.publicPath;
|
package/lib/dev/config.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`,"245");function
|
|
3
|
-
${
|
|
1
|
+
import{ink as e,print as t,println as o,termClear as r}from"@moneko/utils";import{getIPv4 as n,getPort as i}from"../commom/net.mjs";import{CONFIG as m}from"../config.mjs";let s=m.devServer.port||3e3;export const PORT=await i(s);m.devServer.port=PORT;let l="/"===m.basename?"":m.basename,$=s!==PORT&&e(`Port ${e(`${s}`,"yellow")} is in use, trying ${e(`${PORT}`,"green")} instead.
|
|
2
|
+
`,"245");function a(e){return`${m.devServer.https?"https":"http"}://${"local"===e?m.devServer.host:n()}:${PORT}${l}`}let p=e("You application is running here:","245"),c=`${e(" Local ","231",{bg:"blue"})} ${e(a("local"),"75")}
|
|
3
|
+
${e(" Network ","231",{bg:"29"})} ${e(a("net"),"green")}`;export function devLog(n,i){!n&&i&&(r(3),t([p,"",c,"",e(`Compiled successfully in ${e(`${i.endTime-i.startTime}ms`,"green")}`,"245")].join("\n"),!0),$&&o($))}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t,m){return Math.min(Math.max(e,t),m)}export function jsonSchema(t){if(void 0!==(t=function e(t){return t.allOf&&t.allOf[0]&&(t=t.allOf.reduce((t,m)=>Object.assign({},t,e(m)),t)),t}(t)).example)return t.example;if(void 0!==t.default)return t.default;if(t.oneOf&&t.oneOf[0])return jsonSchema(t.oneOf[0]);if(t.anyOf&&t.anyOf[0])return jsonSchema(t.anyOf[0]);let m=Array.isArray(t)?t[0].type:t.type;if("object"===m){let{properties:e}=t;return e?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,jsonSchema(t)])):{}}if("array"===m){let e=t,m=e.items;if(!m)return[];let n=[],i=m.oneOf&&m.oneOf[0]||m;if(m.anyOf)for(let e of m.anyOf)i=e,n.push(jsonSchema(i));let r=e.minItems||1;for(;n.length<r;)n.push(jsonSchema(i));return e.maxItems?function(e,t=1){return e.slice(0,t)}(n,e.maxItems):n}if(Array.isArray(t.enum))return t.enum[0];if("string"===m){let{format:m}=t,n={email:"user@example.com",hostname:"example.com",ipv4:"8.8.8.8",ipv6:"2001:4860:4860::8888",uri:"https://example.com/path","uri-reference":"/path#anchor","uri-template":"/path/{param}","json-pointer":"/foo/bar","date-time":new Date("1970-01-01").toJSON(),uuid:"3fa85f64-5717-4562-b3fc-2c963f66afa6",_default:"string"},i=n[m]||n._default,r=t.minLength?t.minLength:0,u=t.maxLength?t.maxLength:i.length;return i===n._default&&i.length<r?i.padEnd(r,i):i.substring(0,e(i.length,r,u))}if("number"===m){let m=t.minimum?t.minimum:-Number.MAX_VALUE,n=t.maximum?t.maximum:Number.MAX_VALUE;return t.multipleOf&&(m=Math.ceil(m/t.multipleOf)*t.multipleOf,n=Math.floor(n/t.multipleOf)*t.multipleOf),e(0,m,n)}if("integer"===m){let m=t.minimum&&t.exclusiveMinimum?t.minimum+1:t.minimum,n=t.maximum&&t.exclusiveMaximum?t.maximum-1:t.maximum,i=m||Number.MIN_SAFE_INTEGER,r=n||Number.MAX_SAFE_INTEGER;return t.multipleOf&&(i=Math.ceil(i/t.multipleOf)*t.multipleOf,r=Math.floor(r/t.multipleOf)*t.multipleOf),e(0,i,r)}return"null"===m?null:"boolean"===m||{}}
|
package/lib/dev/mock.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"node:http";import{
|
|
1
|
+
import e from"node:http";import{print as t}from"@moneko/utils";import{watch as o}from"chokidar";import r from"express";import{merge as a}from"webpack-merge";import n from"../commom/log.mjs";import s from"../commom/match-path.mjs";import c from"../commom/require.mjs";import{jsonSchema as i}from"./json-schema.mjs";function m(e,t,o){if(delete c.cache[t],o[t]){for(let r in o[t])Object.prototype.hasOwnProperty.call(o[t],r)&&(e[r]=null,delete e[r]);o[t]=null,delete o[t]}}export const yApiSchemaMock=(t,o)=>new Promise(r=>{e.get(`${t.host}/api/interface/get?id=${t.id}&token=${t.token}`,e=>{e.setEncoding("utf8");let t="";e.on("data",e=>{t+=e}),e.on("end",()=>{try{let e=JSON.parse(t);if(e?.data?.res_body_is_json_schema){let t=JSON.parse(e.data.res_body),n=i(t);void 0!==o?r(a(n,o)):r(n)}}catch(e){n(e)}})})});export const yApiMock=(t,o)=>new Promise((r,a)=>{let s=new URL(o.host),c={hostname:s.hostname,port:s.port,path:t.path.replace(new RegExp(o.pathRewrite),`/mock/${o.projectId}/`),method:t.method,headers:t.headers,query:t.query},i=e.request(c,e=>{e.setEncoding("utf8");let t="";e.on("data",e=>{t+=e}),e.on("end",()=>{try{r(JSON.parse(t))}catch(e){n(e)}})});i.on("error",e=>{a(e.message)}),i.write(JSON.stringify(t.body)),i.end()});export default(e=>{let a={},i={};return o(e).on("all",async function(e,o){switch(t("Updating mock...",!0),e){case"add":case"change":try{m(i,o,a);let e=c(o).default;a[o]=e,i=Object.assign(i,e)}catch(e){n(e)}break;case"unlink":m(i,o,a)}t("Mock update successful",!0)}),function(e,t,o){let a=`${e.method} ${e.path}`,n=Object.keys(i).filter(function(e){return RegExp(`^${e.replace(/(:\w*)[^/]/g,"((?!/).)")}*$`).test(a)});if(!i[a]&&(!n||!(n.length>0)))return o();{let c;let m=e.get("Content-Type");switch(m){case"text/plain":c=r.raw({type:"text/plain"});break;case"text/html":c=r.text({type:"text/html"});break;case"application/x-www-form-urlencoded":c=r.urlencoded({extended:!1});break;default:c=r.json()}m?.startsWith("multipart/form-data;")&&(c=r.static("./public")),c(e,t,function(){let r=i[a]||i[n[0]];if("function"==typeof r){let a=s(n[0].split(" ")[1],e.url);a&&Object.assign(e.params,a.params),r(e,t,o)}else t.json(r)})}}});
|
package/lib/dev/proxy.d.mts
CHANGED
package/lib/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e;import t from"
|
|
1
|
+
let e;import{exec as t,spawn as o}from"node:child_process";import{watchFile as r}from"node:fs";import s from"node:https";import{join as i}from"node:path";import{directoryExists as n,ink as l,loadFile as a,print as m,println as c,progressBar as p}from"@moneko/utils";import d from"express";import u from"multer";import h from"webpack";import f from"webpack-dev-middleware";import x from"webpack-hot-middleware";import{merge as y}from"webpack-merge";import{diffObject as w}from"./commom/diff-object.mjs";import g from"./commom/has-pkg.mjs";import v,{config_files as k}from"./commom/paths.mjs";import $ from"./commom/sigint-exit.mjs";import{devLog as C,PORT as b}from"./dev/config.mjs";import j from"./dev/mock.mjs";import P,{updateProxy as S}from"./dev/proxy.mjs";import A from"./options/reslove.mjs";import{empty as T,resolveProgram as E}from"./utils/index.mjs";import{commonConfig as O}from"./common.mjs";import{CONFIG as I,getConfig as M,PUBLICPATH as _}from"./config.mjs";import R from"./module.config.mjs";import{isLibrary as q,isReact as z,refresh as B}from"./process-env.mjs";let{HotModuleReplacementPlugin:D,ProgressPlugin:G,WatchIgnorePlugin:H}=h,U=!1!==I.stylelint&&g("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,L=!1!==I.eslint&&g("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,N=z&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,F=["js","jsx","ts","tsx","json","html","vue"],W=F.join(","),K=["css","scss","sass","less","ts","tsx","js","jsx"],X=K.join(","),J=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],Q=`${_.endsWith("/")?"":"/"}__hmr__`,V=new URLSearchParams({name:"client",path:Q,dynamicPublicPath:!0,timeout:2e3,reload:!B,quiet:!0,noInfo:!0,overlay:!0,autoConnect:!0}).toString(),Y=O.output.path,Z=I.bar.name||"Build",ee=y(O,{entry:{main:[`${A.hotMiddlewareClient}?${V}`]},output:{path:Y},module:R(!1),optimization:{minimize:!1,concatenateModules:!1,removeAvailableModules:!1,removeEmptyChunks:!0,providedExports:!0,usedExports:!1,sideEffects:!1,splitChunks:{chunks:"all",minChunks:1,minSize:30720,maxSize:0,maxAsyncRequests:60,maxInitialRequests:50,hidePathInfo:!1,cacheGroups:{vendors:{test:/[\\/]node_modules[\\/]/,priority:-10,reuseExistingChunk:!0},default:{minChunks:1,priority:-20,reuseExistingChunk:!0}}}},plugins:[new D,new H({paths:[/node_modules\/(?!(@app|@moneko)).+/,/\.d\.ts$/]}),N&&new N,L&&new L({fix:!0,threads:!0,files:[`${I.alias["@"]}/**/*.{${W}}`,q&&`${I.alias["@pkg"]}/**/*.{${W}}`].filter(Boolean),extensions:F,exclude:J,cache:!0,cacheLocation:`${v.lintCachePath}/.eslintcache`,lintDirtyModulesOnly:!0,overrideConfigFile:E("eslint.config.mjs"),configType:"flat"}),U&&new U({fix:!0,threads:!0,files:[`${I.alias["@"]}/**/*.{${X}}`,q&&`${I.alias["@pkg"]}/**/*.{${X}}`].filter(Boolean),extensions:K,exclude:J,cache:!0,cacheLocation:`${v.lintCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),!!I.bar&&new G({handler(e,t,...o){p(e||0,1,Z,o.length?`[${t}] ${o.join(" ")}`:""),1===e&&process.stdout.write("\r\x1b[2K")}})].filter(Boolean)}),et=h(ee);et.hooks.done.tap("client-log",e=>{C(null,e)});let eo=d(),er=u(),es={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization","Access-Control-Allow-Methods":"GET, POST, OPTIONS, DELETE, PATCH, PUT",...I.devServer.headers},ei=f(et,{writeToDisk:!1,index:"index.html",headers:e=>({...es,"Access-Control-Allow-Origin":e.headers.origin||"*","Cache-Control":"no-store, no-cache, must-revalidate, proxy-revalidate",Pragma:"no-cache",Expires:"0"}),serverSideRender:!1,lastModified:!0,publicPath:ee.output?.publicPath,cacheControl:!1,cacheImmutable:!1}),en=x(et,{log:!1,path:Q,heartbeat:2e3});eo.use(d.static(i(v.programPath,"./public"))).use(ei).use(Q,en),n(v.mockPath)&&eo.use(er.any(),j(v.mockPath)),I.proxy&&P(eo,I.proxy);let el=`${ee.output.path}/index.html`;if(eo.use((e,t,o)=>{if("GET"===e.method){let r=e.get("Accept");if(r?.includes("text/html")){let e=ei.context.outputFileSystem,o=e?.readFileSync?.(el);t.headersSent||(t.setHeader("Content-Type","text/html"),t.send(o))}else if("text/event-stream"===r&&e.url.endsWith(Q))return e.url=Q,en(e,t,o);else return o()}else{if("OPTIONS"!==e.method)return o();t.sendStatus(200)}}),I.devServer.https){let[t,o]=await Promise.all([a(I.devServer.https.key),a(I.devServer.https.cert)]);t||(c(l(`无法加载私钥。请检查路径和文件是否存在,并确保路径正确:${I.devServer.https.key}`,"red")),process.exit(1)),o||(c(l(`无法加载证书。请检查路径和文件是否存在,并确保路径正确:${I.devServer.https.cert}`,"red")),process.exit(1)),e=s.createServer({key:t,cert:o},eo)}let ea=(e||eo).listen(b,"0.0.0.0",()=>{});function em(){process.exit(0)}let ec=await Promise.all(k.map(M)),ep=y(ec[0]||{},ec[1]||{});k.forEach(function(e){r(e,async function(){let[o,r]=await Promise.all(k.map(M)),s=y(o||{},r||{}),i=w(ep,s);1===Object.keys(i).length&&"proxy"in i?(m(l(`代理更新中...`,"yellow"),!0),S(eo,s.proxy),m(l(`代理更新完成...`,"green"),!0),I.proxy=s.proxy,ep.proxy=s.proxy,ep=s):(ep=s,c(l(`检测到工程配置${l(`[${e}]`,"blue")}变更, 程序即将重启...`,"yellow"),!0),t("win32"===process.platform?`netstat -ano | findstr :${b}`:`lsof -i :${b} -t`,(e,t)=>{if(e){c(l(`查找端口 ${b} 时发生错误: ${e.message}`,"red")),c(l("请尝试手动重启程序","yellow"));return}let o=t.trim().split("\n").filter(Boolean),r=ed?o[0]?.split(/\s+/).pop()?.trim():o[0]?.trim();if(!r){c(l(`未找到占用端口 ${b} 的进程, 请尝试手动重启程序`,"yellow"));return}try{process.kill(Number(r),"SIGHUP")}catch(e){c(l(`终止进程 ${r} 时发生错误: ${e.message}`,"red"))}}))})});let ed="win32"===process.platform;process.on("SIGHUP",function(){ei.close(T),ea.close(T),ea.closeAllConnections(),function(){let e=o(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",em)}()}),process.on("exit",function(){ei.close(T),ea.close(T),ea.closeAllConnections()}),$(em);
|
package/lib/index.d.mts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { default as
|
|
5
|
-
export { default as
|
|
1
|
+
export type * from '../typings/global.js';
|
|
2
|
+
export { default as hasPkg } from './commom/has-pkg.mjs';
|
|
3
|
+
export { getIPv4, getPort } from './commom/net.mjs';
|
|
4
|
+
export { default as osTmpDir } from './commom/os-tmp-dir.mjs';
|
|
5
|
+
export { CUSTOMCONFIG, default as paths, routeDir, yarnArgv } from './commom/paths.mjs';
|
|
6
6
|
export { default as require } from './commom/require.mjs';
|
|
7
|
-
export
|
|
8
|
-
export type
|
|
9
|
-
export { type YApiOption, type YApiOptionBySchema, yApiMock, yApiSchemaMock, type RequestFormData, type ProxyFuncType, type MockConfiguration, } from './dev/mock.mjs';
|
|
7
|
+
export { default as Rule } from './commom/rule.mjs';
|
|
8
|
+
export { type MockConfiguration, type ProxyFuncType, type RequestFormData, yApiMock, type YApiOption, type YApiOptionBySchema, yApiSchemaMock, } from './dev/mock.mjs';
|
|
10
9
|
export type { ProxyConfig } from './dev/proxy.mjs';
|
|
11
|
-
export {
|
|
12
|
-
export { default as
|
|
13
|
-
export {
|
|
14
|
-
export { default as Rule } from './rule.mjs';
|
|
10
|
+
export { type JsxDomExpressions, default as jsxDomExpressions, } from './options/jsx-dom-expressions.mjs';
|
|
11
|
+
export { type OptimizationSplitChunksOptions, default as splitChunk, } from './options/split-chunk.mjs';
|
|
12
|
+
export type { OverrideResolverOption } from './plugin/override-resolve.mjs';
|
|
15
13
|
export type { VirtualModulePluginOption } from './plugin/virtual-module.mjs';
|
|
16
|
-
export
|
|
14
|
+
export { APPTYPE, coreName, FRAMEWORK, isDev, isLibrary, isMicro, mainDirectory, PACKAGENAME, PACKAGEVERSION, } from './process-env.mjs';
|
|
15
|
+
export { resolveProgram, toCamelCase } from './utils/index.mjs';
|
|
16
|
+
export type { MdxOptions } from '@moneko/mdx';
|
package/lib/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as
|
|
1
|
+
export{default as hasPkg}from"./commom/has-pkg.mjs";export{getIPv4,getPort}from"./commom/net.mjs";export{default as osTmpDir}from"./commom/os-tmp-dir.mjs";export{CUSTOMCONFIG,default as paths,routeDir,yarnArgv}from"./commom/paths.mjs";export{default as require}from"./commom/require.mjs";export{default as Rule}from"./commom/rule.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{default as jsxDomExpressions}from"./options/jsx-dom-expressions.mjs";export{default as splitChunk}from"./options/split-chunk.mjs";export{APPTYPE,coreName,FRAMEWORK,isDev,isLibrary,isMicro,mainDirectory,PACKAGENAME,PACKAGEVERSION}from"./process-env.mjs";export{resolveProgram,toCamelCase}from"./utils/index.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return o}});const e=require("@babel/core"),t=c(require("@moneko/css/babel")),r=c(require("../commom/log.mjs"));function c(e){return e&&e.__esModule?e:{default:e}}async function o(c){let o=this.async();this.cacheable&&this.cacheable();try{let r=await (0,e.transformAsync)(c,{plugins:[[t.default,{}]],sourceMaps:!!this.sourceMap});o(null,r?.code||void 0,r?.map||void 0)}catch(e){o(e),(0,r.default)(e)}}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),function(e,t){for(var o in t)Object.defineProperty(e,o,{enumerable:!0,get:t[o]})}(exports,{getExportCode:function(){return r},getImportCode:function(){return t},getModuleCode:function(){return o}});const e=require("./utils.cjs");function t(e,t){let o="";for(let r of e){let{importName:e,url:s,icss:_}=r;t.esModule?_&&t.modules?.namedExport?o+=`import ${t.modules.exportOnlyLocals?"":`${e}, `}* as ${e}_NAMED___ from ${s};
|
|
2
|
+
`:o+=`import ${e} from ${s};
|
|
3
|
+
`:o+=`var ${e} = require(${s});
|
|
4
|
+
`}return o?`// Imports
|
|
5
|
+
${o}`:""}function o(t,o,r,s,_){if(s.modules?.exportOnlyLocals===!0)return"";let l=s.sourceMap?`,${(0,e.normalizeSourceMapForRuntime)(t.map,_)}`:"",a=JSON.stringify(t.css),n=`var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(${s.sourceMap});
|
|
6
|
+
`;for(let e of o){let{url:t,media:o,dedupe:r}=e;n+=t?`___CSS_LOADER_EXPORT___.push([module.id, ${JSON.stringify(`@import url(${t});`)}${o?`, ${JSON.stringify(o)}`:""}]);
|
|
7
|
+
`:`___CSS_LOADER_EXPORT___.i(${e.importName}${o?`, ${JSON.stringify(o)}`:r?', ""':""}${r?", true":""});
|
|
8
|
+
`}for(let t of r){let{replacementName:o,importName:r,localName:_}=t;if(_)a=a.replace(RegExp(o,"g"),()=>s.modules?.namedExport?`" + ${r}_NAMED___[${JSON.stringify((0,e.camelCase)(_))}] + "`:`" + ${r}.locals[${JSON.stringify(_)}] + "`);else{let{hash:e,needQuotes:s}=t,_=[...e?[`hash: ${JSON.stringify(e)}`]:[],...s?"needQuotes: true":[]],l=_.length>0?`, { ${_.join(", ")} }`:"";n+=`var ${o} = ___CSS_LOADER_GET_URL_IMPORT___(${r}${l});
|
|
9
|
+
`,a=a.replace(RegExp(o,"g"),()=>`" + ${o} + "`)}}return`${n}// Module
|
|
10
|
+
___CSS_LOADER_EXPORT___.push([module.id, ${a}, ""${l}]);
|
|
11
|
+
`}function r(t,o,r){let s="// Exports\n",_="",l=(t,o)=>{r.modules?.namedExport?_+=`export const ${(0,e.camelCase)(t)} = ${JSON.stringify(o)};
|
|
12
|
+
`:(_&&(_+=`,
|
|
13
|
+
`),_+=` ${JSON.stringify(t)}: ${JSON.stringify(o)}`)};for(let{name:o,value:s}of t)switch(r.modules?.exportLocalsConvention){case"camelCase":{l(o,s);let t=(0,e.camelCase)(o);t!==o&&l(t,s);break}case"camelCaseOnly":l((0,e.camelCase)(o),s);break;case"dashes":{l(o,s);let t=(0,e.dashesCamelCase)(o);t!==o&&l(t,s);break}case"dashesOnly":l((0,e.dashesCamelCase)(o),s);break;default:l(o,s)}for(let t of o){let{replacementName:o,localName:s}=t;if(s){let{importName:l}=t;_=_.replace(RegExp(o,"g"),()=>r.modules?.namedExport?`" + ${l}_NAMED___[${JSON.stringify((0,e.camelCase)(s))}] + "`:r.modules?.exportOnlyLocals?`" + ${l}[${JSON.stringify(s)}] + "`:`" + ${l}.locals[${JSON.stringify(s)}] + "`)}else _=_.replace(RegExp(o,"g"),()=>`" + ${o} + "`)}return r.modules?.exportOnlyLocals?s+=r.modules.namedExport?_:`${r.esModule?"export default":"module.exports ="} {
|
|
14
|
+
${_}
|
|
15
|
+
};
|
|
16
|
+
`:(_&&(s+=r.modules?.namedExport?_:`___CSS_LOADER_EXPORT___.locals = {
|
|
17
|
+
${_}
|
|
18
|
+
};
|
|
19
|
+
`),s+=`${r.esModule?"export default":"module.exports ="} ___CSS_LOADER_EXPORT___;
|
|
20
|
+
`)}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LoaderContext } from 'webpack';
|
|
2
|
+
import type { LightningCssLoaderOption } from './loader.cjs';
|
|
3
|
+
export interface CssImport {
|
|
4
|
+
icss?: boolean;
|
|
5
|
+
importName: string;
|
|
6
|
+
url: string;
|
|
7
|
+
type?: 'url' | string;
|
|
8
|
+
index?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface CssExport {
|
|
11
|
+
name: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ApiParam {
|
|
15
|
+
url?: string;
|
|
16
|
+
importName?: string;
|
|
17
|
+
layer?: string;
|
|
18
|
+
supports?: string;
|
|
19
|
+
media?: string;
|
|
20
|
+
dedupe?: boolean;
|
|
21
|
+
index?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ApiReplacement {
|
|
24
|
+
replacementName: string;
|
|
25
|
+
localName?: string;
|
|
26
|
+
importName: string;
|
|
27
|
+
needQuotes?: boolean;
|
|
28
|
+
hash?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function getImportCode(imports: CssImport[], options: LightningCssLoaderOption): string;
|
|
31
|
+
export declare function getModuleCode(result: {
|
|
32
|
+
map: void | Uint8Array;
|
|
33
|
+
css: string;
|
|
34
|
+
}, api: ApiParam[], replacements: ApiReplacement[], options: LightningCssLoaderOption, loaderContext: LoaderContext<LightningCssLoaderOption>): string;
|
|
35
|
+
export declare function getExportCode(exports: CssExport[], replacements: ApiReplacement[], options: LightningCssLoaderOption): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return u}});const t=require("lightningcss"),r=(e=require("../../commom/log.mjs"))&&e.__esModule?e:{default:e},s=require("./codegen.cjs"),i=require("./utils.cjs");function o(e,t){return JSON.stringify(e.utils.contextify(e.context||e.rootContext,t))}const l=new TextEncoder,n={Declaration:{custom(e){if("content"===e.name&&1===e.value.length){let t=e.value[0];if("token"===t.type&&"string"===t.value.type)return[{property:e.name,raw:JSON.stringify(t.value.value.replace(/[\u4e00-\u9faF]/g,function(e){return`\\${e.charCodeAt(0).toString(16)}`}))}]}}}};async function u(e,u){let _=this.async();this.cacheable&&this.cacheable();let{implementation:a,visitor:p,rem:c,...f}=this.getOptions(),m=!!f.modules?.auto?.(this.resourcePath);if(m&&void 0===f.modules.namedExport&&(f.modules.namedExport=!0),a&&"function"!=typeof a.transform){_(TypeError(`[lightning-loader]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof a.transform}`));return}let d=[],h=[],R=[],S=[],g=[];f.modules?.exportOnlyLocals!==!0&&h.unshift({type:"api_import",importName:"___CSS_LOADER_API_IMPORT___",url:o(this,require.resolve("./runtime/api.cjs"))});let y=a?.transform?a.transform:t.transform,L=new Map,O=new Map,E=new Map,v=function(e,t,r,s,o,l){let n=new Map,u=!1,_=new Map,a=new Map,p=-1,c=-1;return{Rule:{import(s){let o;if(e.importFilter&&!e.importFilter(s.value.url,s.value.media))return s;let u=s.value.url;c++,l.set(c,u),u=`__MO_LIGHTNINGCSS_LOADER_IMPORT_URL_REPLACE_${c}__`;let _=s.value.media.mediaQueries.length?JSON.stringify(s.value.media.mediaQueries):void 0,a=(0,i.isUrlRequestable)(u);if(a){let e=u.split("!");e.length>1&&(u=e.pop(),o=e.join("!"))}if(!a)return t.push({url:u,media:_}),{type:"ignored",value:""};let p=o?`${o}!${u}`:u,f=n.get(p);if(!f){f=`___CSS_LOADER_AT_RULE_IMPORT_${n.size}___`,n.set(p,f);let t=e.urlHandler(p);r.push({type:"rule_import",importName:f,url:t})}return t.push({importName:f,media:_}),{type:"ignored",value:""}}},Url:t=>(function(t){let l,n=t.url;if(!e.urlFilter(n)||(0,i.isDataUrl)(n))return t;p++,o.set(p,n);let[,c,f]=(n=`__MO_LIGHTNINGCSS_LOADER_URL_REPLACE_${p}__`).split(/(\?)?#/,3),m=n.split("!");m.length>1&&(n=m.pop(),l=m.join("!"));let d=c?"?":"";d+=f?`#${f}`:"",u||(r.push({type:"get_url_import",importName:"___CSS_LOADER_GET_URL_IMPORT___",url:JSON.stringify(require.resolve("./runtime/get-url.cjs")),index:-1}),u=!0);let h=l?`${l}!${n}`:n,R=_.get(h);R||(R=`___CSS_LOADER_URL_IMPORT_${_.size}___`,_.set(h,R),r.push({type:"url",importName:R,url:JSON.stringify(h),index:p}));let S=JSON.stringify({newUrl:h,hash:d,needQuotes:!1}),g=a.get(S);return g||(g=`___CSS_LOADER_URL_REPLACEMENT_${a.size}___`,a.set(S,g),s.push({replacementName:g,importName:R,hash:d,needQuotes:!1})),{loc:t.loc,url:g}})(t)}}({urlHandler:e=>o(this,(0,i.getPreRequester)(this)(f.importLoaders??0)+e),urlFilter:(0,i.getFilter)(f.url,this.resourcePath),importFilter:(0,i.getFilter)(f.import,this.resourcePath),context:this.context},S,h,g,L,E),C=function({apis:e,imports:t,replacements:r,replacedUrls:s,urlHandler:i}){let o=-1,l=-1;return{Declaration:{composes(n){if("unparsed"===n.property)return;let u=n.value.from;if(u?.type!=="file")return;let _=u.value;if(!_)return;o++,s.set(o,_),_=`__MO_LIGHTNINGCSS_LOADER_ICSS_URL_REPLACE_${o}__`;let a=`___CSS_LOADER_ICSS_IMPORT_${t.length}___`;t.push({type:"icss_import",importName:a,icss:!0,url:i(_),index:o}),e.push({importName:a,dedupe:!0,index:o});let p=[];for(let e of n.value.names){l++;let t=`___CSS_LOADER_ICSS_IMPORT_${o}_REPLACEMENT_${l}___`;r.push({replacementName:t,importName:a,localName:e}),p.push(t)}return{property:"composes",value:{loc:n.value.loc,names:p,from:u}}}}}}({apis:S,imports:R,replacements:g,replacedUrls:O,urlHandler:e=>o(this,(0,i.getPreRequester)(this)(f.importLoaders)+e)});try{c&&!n.Length&&(n.Length=function(e){if("px"===e.unit)return{unit:"rem",value:e.value/16}});let{code:t,map:r,exports:o}=y({filename:this.resourcePath,code:l.encode(e),minify:!0,visitor:{...n,...v,...C,...p},cssModules:!!m&&{pattern:f.modules.localIdentName},sourceMap:this.sourceMap,inputSourceMap:this.sourceMap&&u?JSON.stringify(u):void 0,analyzeDependencies:!1,drafts:{customMedia:!0},include:1,errorRecovery:!1,unusedSymbols:[],...f}),a=t.toString();if(o){for(let e in o)if(Object.prototype.hasOwnProperty.call(o,e)){let t=o[e],r=t.name;for(let e of t.composes)r+=` ${e.name}`;d.push({name:e,value:r})}f.modules.getJSON?.({resourcePath:this.resourcePath,exports:d})}if(0!==L.size){let e=this.getResolve({conditionNames:["asset"],mainFields:["asset"],mainFiles:[],extensions:[]});for(let[t,r]of L.entries()){let[s]=r.split(/(\?)?#/,3),o=(0,i.requestify)(s,this.rootContext),l=await (0,i.resolveRequests)(e,this.context,[...new Set([o,r])]);for(let e of h)e.url=e.url.replace(`__MO_LIGHTNINGCSS_LOADER_URL_REPLACE_${t}__`,l??r)}}if(0!==E.size){let e=this.getResolve({conditionNames:["style"],extensions:[".css"],mainFields:["css","style","main","..."],mainFiles:["index","..."],restrictions:[/\.css$/i]});for(let[t,r]of E.entries()){let[s]=r.split(/(\?)?#/,3),o=(0,i.requestify)(s,this.rootContext),l=await (0,i.resolveRequests)(e,this.context,[...new Set([o,r])]);for(let e of h)e.url=e.url.replace(`__MO_LIGHTNINGCSS_LOADER_IMPORT_URL_REPLACE_${t}__`,l??r)}}if(0!==O.size){let e=this.getResolve({conditionNames:["style"],extensions:[],mainFields:["css","style","main","..."],mainFiles:["index","..."]});for(let[t,r]of O.entries()){let[s]=r.split(/(\?)?#/,3),o=(0,i.requestify)(s,this.rootContext),l=await (0,i.resolveRequests)(e,this.context,[...new Set([r,o])]);for(let e of R)e.url=e.url.replace(`__MO_LIGHTNINGCSS_LOADER_ICSS_URL_REPLACE_${t}__`,l??r)}}h.push(...R);let M=(0,s.getImportCode)(h,f),N=(0,s.getModuleCode)({css:a,map:r},S,g,f,this),x=(0,s.getExportCode)(d,g,f),P=`${M}${N}${x}`;_(null,P,r&&JSON.parse(r.toString()))}catch(e){_(e),(0,r.default)(e)}}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type CustomAtRules, type TransformOptions } from 'lightningcss';
|
|
2
|
+
import type { LoaderContext } from 'webpack';
|
|
3
|
+
type ExportLocalsConvention = 'asIs' | 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | ((name: string) => string);
|
|
4
|
+
type Mode = 'local' | 'global' | 'pure' | 'icss' | ((resourcePath: string, resourceQuery: string, resourceFragment: string) => 'local' | 'global' | 'pure' | 'icss');
|
|
5
|
+
export interface LightningCssLoaderOption extends Omit<TransformOptions<CustomAtRules>, 'filename' | 'code' | 'inputSourceMap'> {
|
|
6
|
+
rem?: boolean;
|
|
7
|
+
implementation?: typeof import('lightningcss');
|
|
8
|
+
esModule?: boolean;
|
|
9
|
+
modules?: {
|
|
10
|
+
auto?(path: string): boolean;
|
|
11
|
+
localIdentName?: string;
|
|
12
|
+
exportOnlyLocals?: boolean;
|
|
13
|
+
getJSON?(params: {
|
|
14
|
+
resourcePath: string;
|
|
15
|
+
exports: {
|
|
16
|
+
name: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}[];
|
|
19
|
+
}): void;
|
|
20
|
+
namedExport?: boolean;
|
|
21
|
+
exportLocalsConvention?: ExportLocalsConvention;
|
|
22
|
+
mode?: Mode;
|
|
23
|
+
};
|
|
24
|
+
importLoaders?: number;
|
|
25
|
+
url?: string;
|
|
26
|
+
import?(...args: unknown[]): boolean;
|
|
27
|
+
}
|
|
28
|
+
export default function LightningCssLoader(this: LoaderContext<LightningCssLoaderOption>, source: string, prevMap?: string): Promise<void>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";module.exports=function(t){let n=[];return n.toString=function(){return this.map(function(n){let o=function(t,n){let o=t[1]||"",c=t[3];if(!c)return o;if(n&&"function"==typeof btoa){let t=function(t){let n=btoa(unescape(encodeURIComponent(JSON.stringify(t))));return"/*# ".concat("sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(n)," */")}(c);return[o].concat(c.sources?.map(function(t){return"/*# sourceURL=".concat(c.sourceRoot||"").concat(t," */")})).concat([t]).join("\n")}return[o].join("\n")}(n,t);return n[2]?"@media ".concat(n[2]," {").concat(o,"}"):o}).join("")},n.i=function(t,o,c){"string"==typeof t&&(t=[[null,t,""]]);let e={};if(c)for(let t=0;t<this.length;t++){let n=this[t][0];null!==n&&(e[n]=!0)}for(let r=0;r<t.length;r++){let i=[].concat(t[r]);c&&e[i[0]]||(o&&(i[2]?i[2]="".concat(o," and ").concat(i[2]):i[2]=o),n.push(i))}},n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";module.exports=function(e,t){return(t||(t={}),"string"!=typeof(e=e&&e.__esModule?e.default:e))?e:(/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]/.test(e)||t.needQuotes)?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(exports,{camelCase:function(){return d},dashesCamelCase:function(){return h},getFilter:function(){return i},getPreRequester:function(){return u},isDataUrl:function(){return l},isUrlRequestable:function(){return s},normalizeSourceMapForRuntime:function(){return f},requestify:function(){return n},resolveRequests:function(){return o},urlToRequest:function(){return a}});const e=require("node:path"),t=require("node:url"),r=/^[A-Z]:[/\\]|^\\\\/i;function a(e,t){let a;if(""===e)return"";let o=/^[^?]*~/;if(r.test(e))a=e;else if(void 0!==t&&!1!==t&&e.startsWith("/"))switch(typeof t){case"string":a=o.test(t)?t.replace(/([^~/])$/,"$1/")+e.slice(1):t+e;break;case"boolean":a=e;break;default:throw Error(`Unexpected parameters to loader-utils 'urlToRequest': url = ${e}, root = ${t}.`)}else a=/^\.\.?\//.test(e)?e:`./${e}`;return o.test(a)&&(a=a.replace(o,"")),a}async function o(e,t,r){return e(t,r[0]).then(e=>e).catch(a=>{let[,...n]=r;if(0===n.length)throw a;return o(e,t,n)})}function n(e,r){return/^file:/i.test(e)?(0,t.fileURLToPath)(e):/^[a-z][a-z0-9+.-]*:/i.test(e)?e:"/"===e.charAt(0)?a(e,r):a(e)}function s(e){return!e.startsWith("//")&&(!!(/^file:/i.test(e)||/^[a-z][a-z0-9+.-]*:/i.test(e))||!e.startsWith("#"))}function l(e){return!!/^data:/i.test(e)}function u({loaders:e,loaderIndex:t}){let r=Object.create(null);return a=>{if(r[a])return r[a];if(!1===a)r[a]="";else{let o=e.slice(t,t+1+("number"!=typeof a?0:a)).map(e=>e.request).join("!");r[a]=`-!${o}!`}return r[a]}}function i(e,t){return(...r)=>"function"!=typeof e||e(...r,t)}const c=/^[a-z]:[/\\]|^\\\\/i,p=/^[a-z0-9+\-.]+:/i;function f(t,r){let a=t?t.toJSON():null;return a&&(delete a.file,a.sourceRoot="",a.sources=a.sources?.map(t=>{var a;if(t.startsWith("<")||"path-relative"!=("/"===t[0]?"/"===t[1]?"scheme-relative":"path-absolute":c.test(t)?"path-absolute":p.test(t)?"absolute":"path-relative"))return t;let o=(0,e.dirname)(r.resourcePath),n=(0,e.resolve)(o,t),s=(a=(0,e.relative)(r.rootContext,n),"\\"===e.sep?a.replace(/\\/g,"/"):a);return`webpack://${s}`})),JSON.stringify(a)}function h(e){return e.replace(/-+(\w)/g,(e,t)=>t.toUpperCase())}const C=(e,t)=>{let r=!1,a=!1,o=!1;for(let n=0;n<e.length;n++){let s=e[n];r&&/[\p{Lu}]/u.test(s)?(e=`${e.slice(0,n)}-${e.slice(n)}`,r=!1,o=a,a=!0,n++):a&&o&&/[\p{Ll}]/u.test(s)?(e=`${e.slice(0,n-1)}-${e.slice(n-1)}`,o=a,a=!1,r=!0):(r=s.toLocaleLowerCase(t)===s&&s.toLocaleUpperCase(t)!==s,o=a,a=s.toLocaleUpperCase(t)===s&&s.toLocaleLowerCase(t)!==s)}return e},L=e=>e.replace(/^[\p{Lu}](?![\p{Lu}])/gu,e=>e.toLowerCase()),g=(e,t)=>e.replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu,(e,r)=>r.toLocaleUpperCase(t.locale)).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,e=>e.toLocaleUpperCase(t.locale)),d=(e,t)=>{if(!("string"==typeof e||Array.isArray(e)))throw TypeError("Expected the input to be `string | string[]`");return(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},0===(e=Array.isArray(e)?e.map(e=>e.trim()).filter(e=>e.length).join("-"):e.trim()).length)?"":1===e.length?t.pascalCase?e.toLocaleUpperCase(t.locale):e.toLocaleLowerCase(t.locale):(e!==e.toLocaleLowerCase(t.locale)&&(e=C(e,t.locale)),e=e.replace(/^[_.\- ]+/,""),e=t.preserveConsecutiveUppercase?L(e):e.toLocaleLowerCase(),t.pascalCase&&(e=e.charAt(0).toLocaleUpperCase(t.locale)+e.slice(1)),g(e,t))};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LoaderContext } from 'webpack';
|
|
2
|
+
export declare function urlToRequest(e: string, i?: string | boolean): string;
|
|
3
|
+
export declare function resolveRequests(resolve: (arg0: any, arg1: any) => Promise<any>, context: any, possibleRequests: any[]): Promise<any>;
|
|
4
|
+
export declare function requestify(url: string, rootContext: string): string;
|
|
5
|
+
export declare function isUrlRequestable(url: string): boolean;
|
|
6
|
+
export declare function isDataUrl(url: string): boolean;
|
|
7
|
+
export declare function getPreRequester({ loaders, loaderIndex, }: {
|
|
8
|
+
loaders: {
|
|
9
|
+
request: unknown;
|
|
10
|
+
}[];
|
|
11
|
+
loaderIndex: number;
|
|
12
|
+
}): (number: string | false | number) => any;
|
|
13
|
+
export declare function getFilter<T>(filter: T, resourcePath: string): (...args: T[]) => any;
|
|
14
|
+
export declare function normalizeSourceMapForRuntime(map: any, loaderContext: LoaderContext<unknown>): string;
|
|
15
|
+
export declare function dashesCamelCase(str: string): string;
|
|
16
|
+
export declare const camelCase: (input: string | string[], options?: Record<string, unknown>) => string;
|