@moneko/core 4.0.0-bate.0 → 4.0.0-bate.2
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/build/common.mjs +1 -1
- package/lib/build-dev.mjs +2 -2
- package/lib/commom/rule.d.mts +0 -1
- package/lib/commom/rule.mjs +1 -1
- package/lib/common.mjs +1 -1
- package/lib/config.mjs +1 -1
- package/lib/dev/mock.d.mts +3 -6
- package/lib/dev/mock.mjs +1 -1
- package/lib/dev/server.mjs +1 -1
- package/lib/dev.mjs +2 -2
- package/lib/index.d.mts +0 -1
- package/lib/loader/lightning-css.cjs +1 -0
- package/lib/loader/lightning-css.d.cts +6 -0
- package/lib/loader/ts-doc.cjs +1 -1
- package/lib/module.config.mjs +1 -2
- package/lib/options/reslove.d.mts +0 -1
- package/lib/options/reslove.mjs +1 -1
- package/lib/options/split-chunk.mjs +1 -1
- package/lib/plugin/css-module-dts.d.mts +5 -0
- package/lib/plugin/css-module-dts.mjs +1 -0
- package/lib/plugins.config.mjs +1 -1
- package/lib/process-env.d.mts +5 -0
- package/lib/process-env.mjs +1 -1
- package/lib/vm/docs.d.mts +1 -3
- package/lib/vm/docs.mjs +1 -1
- package/lib/vm/example.d.mts +0 -1
- package/lib/vm/example.mjs +1 -1
- package/lib/vm/info.d.mts +11 -1
- package/lib/vm/locales.d.mts +1 -4
- package/lib/vm/locales.mjs +2 -2
- package/lib/vm/modules.d.mts +5 -2
- package/lib/vm/modules.mjs +1 -1
- package/lib/vm/render-app.d.mts +2 -2
- package/lib/vm/render-app.mjs +8 -8
- package/lib/vm/routes.d.mts +0 -5
- package/lib/vm/routes.mjs +1 -1
- package/package.json +3 -7
- package/typings/global.d.ts +9 -7
- package/lib/commom/parse-module-meta.d.mts +0 -9
- package/lib/commom/parse-module-meta.mjs +0 -1
- package/lib/loader/lightning-css/codegen.cjs +0 -20
- package/lib/loader/lightning-css/codegen.d.cts +0 -35
- package/lib/loader/lightning-css/loader.cjs +0 -1
- package/lib/loader/lightning-css/loader.d.cts +0 -29
- package/lib/loader/lightning-css/runtime/api.cjs +0 -1
- package/lib/loader/lightning-css/runtime/api.d.cts +0 -1
- package/lib/loader/lightning-css/runtime/get-url.cjs +0 -1
- package/lib/loader/lightning-css/runtime/get-url.d.cts +0 -1
- package/lib/loader/lightning-css/utils.cjs +0 -1
- package/lib/loader/lightning-css/utils.d.cts +0 -16
- package/lib/options/css-extract.d.mts +0 -3
- package/lib/options/css-extract.mjs +0 -1
- package/lib/plugin/virtual-module.d.mts +0 -3
- package/lib/plugin/virtual-module.mjs +0 -1
- package/lib/vm/utils.d.mts +0 -1
- package/lib/vm/utils.mjs +0 -1
package/lib/build/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"
|
|
1
|
+
import e from"webpack";import{merge as i}from"webpack-merge";import{commonConfig as n}from"../common.mjs";import{CONFIG as r}from"../config.mjs";import{LightningCssMinifyPlugin as t}from"../plugin/lightningcss-plugin.mjs";import{SwcMinifyPlugin as m}from"../plugin/swc-minify-plugin.mjs";import{getLightningCssTargets as l}from"../polyfills/targets.mjs";import{isDev as s,isReact as p,refresh as o}from"../process-env.mjs";let a=[];r.minifier&&(a.push(new m(r.minifier)),a.push(new t({targets:l()})));let u={maxAssetSize:256e3,maxEntrypointSize:256e3,assetFilter:e=>!e.endsWith(".map")&&!e.endsWith("ce28377f3a428346.js"),...r.performance},h=i(n,{performance:r.performance&&u,optimization:{splitChunks:r.splitChunk,runtimeChunk:r.runtimeChunk,minimize:a.length>0,minimizer:a,chunkIds:"deterministic",moduleIds:"deterministic",concatenateModules:!0,emitOnErrors:!1,removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,sideEffects:!0,providedExports:!0,flagIncludedChunks:!0,innerGraph:!1,mangleExports:"deterministic",portableRecords:!0,realContentHash:!1}});if(s&&o&&(h.plugins.push(new e.HotModuleReplacementPlugin),p)){let e=(await import("@pmmmwh/react-refresh-webpack-plugin")).default;h.plugins.push(new e({overlay:!1}))}if(r.splitChunk&&h.plugins?.push(new e.optimize.MinChunkSizePlugin({minChunkSize:r.minChunkSize||1e3})),r.bundleAnalyzer){let e=(await import("webpack-bundle-analyzer")).BundleAnalyzerPlugin;h.plugins?.push(new e({analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1,defaultSizes:"gzip",logLevel:"silent",...r.bundleAnalyzer}))}export default h;
|
package/lib/build-dev.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{relative as o}from"node:path";import r from"node:process";import{analyzeBundleSize as t,completedInfo as
|
|
2
|
-
`):(
|
|
1
|
+
import{relative as o}from"node:path";import r from"node:process";import{analyzeBundleSize as t,completedInfo as i,ink as e,println as m,progressBar as a}from"@moneko/utils";import n from"webpack";import s from"./commom/paths.mjs";import{empty as l}from"./utils/index.mjs";import{CONFIG as p}from"./config.mjs";import{createDevelopmentConfiguration as c}from"./create-development-configuration.mjs";let u=await c({});if(p.bar){let o=p.bar,t=o.name||"Build";u.plugins.push(new n.ProgressPlugin({handler(i,e,...m){let n=m.length?`[${e}] ${m.join(" ")}`:" ";o.quiet?r.stdout.write(`${n}
|
|
2
|
+
`):(a(i||0,1,{msg:n,name:t,barColor:o.barColor,nameColor:o.nameColor,barBgColor:o.barBgColor,msgColor:o.msgColor}),1===i&&r.stdout.write("\r\x1b[2K"))}}))}let g=n(u);async function f(){let r=await new Promise((o,r)=>{g?.run((t,i)=>{t&&r(t),i?o(i):r(Error("编译过程中没有生成统计信息"))})});(r.hasErrors()||r.hasWarnings())&&function(o){let{warnings:r,errors:t}=o.compilation;r.forEach(o=>{m(e(o.message,"178"))}),t.forEach(o=>{m(e(o.message,"red"))})}(r),await new Promise(a=>{r.compilation.compiler.cache.shutdown(n=>{n&&m(e(n.toString(),"red")),t(r.compilation.outputOptions.path,["\\.js$"]),i(~~((r.endTime-r.startTime)/10)/100,o(s.programPath,r.compilation.outputOptions.path)),a()})})}r.on("exit",l),await f();
|
package/lib/commom/rule.d.mts
CHANGED
package/lib/commom/rule.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default{js:/\.(cj|mj|t|j)s(|x)$/i,css:/\.css$/i,less:/\.less$/i,scss:/\.(sa|sc)ss$/i,wasm:/\.wasm$/i,txt:/\.txt$/i,image:/\.(gif|png|jpe?g|webp|svg|ico)$/i,video:/\.(webm|mp4|ogv)$/i,font:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,markdown:/\.mdx?$/i,tsdoc:/^(?![._]).*(?<!\.test)\.(tsx?)$/,css_module:/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,node_modules_css_module:/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,node_modules:/node_modules/,__tests__:/(.+)\/__tests__\/(.+)/,
|
|
1
|
+
export default{js:/\.(cj|mj|t|j)s(|x)$/i,css:/\.css$/i,less:/\.less$/i,scss:/\.(sa|sc)ss$/i,wasm:/\.wasm$/i,txt:/\.txt$/i,image:/\.(gif|png|jpe?g|webp|svg|ico)$/i,video:/\.(webm|mp4|ogv)$/i,font:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,markdown:/\.mdx?$/i,tsdoc:/^(?![._]).*(?<!\.test)\.(tsx?)$/,css_module:/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,node_modules_css_module:/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,node_modules:/[\\/]node_modules[\\/]/,__tests__:/(.+)\/__tests__\/(.+)/,extract_func:/"rr\((.+?)\)rr"/g};
|
package/lib/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extname as e,join as t,resolve as o}from"node:path";import{argv as s}from"node:process";import a,{config_files as n,CUSTOMCONFIG as i,TMP_DIR as r}from"./commom/paths.mjs";import{OverrideResolverPlugin as
|
|
1
|
+
import{extname as e,join as t,resolve as o}from"node:path";import{argv as s}from"node:process";import a,{config_files as n,CUSTOMCONFIG as i,TMP_DIR as r}from"./commom/paths.mjs";import l from"./commom/rule.mjs";import{OverrideResolverPlugin as m}from"./plugin/override-resolve.mjs";import{isObject as c,md5 as p,resolveProgram as u}from"./utils/index.mjs";import h from"./vm/info.mjs";import{CONFIG as d}from"./config.mjs";import f from"./plugins.config.mjs";import{app_schema as g,docs_schema as y,isCI as b,isDev as j,isLibrary as v,NODE_ENV as C,packageJson as P}from"./process-env.mjs";export const outputConfig={path:u(v?"docs":"dist"),filename:e=>e.filename?.includes(".worker")?"worker/[name].js":"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",cssFilename:"style/[contenthash].css",cssChunkFilename:"style/[contenthash].chunk.css",assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[hash][ext]`},library:{name:`${h.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${P.name}`,pathinfo:j,clean:!0,publicPath:d.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${h.projectName}`};let k={main:[`${g}:entry`]},x=[t(a.corePath,"./polyfills/public-path.mjs")];if(j&&x.push(`${g}:mock`),j&&d.refresh&&d.env.injectRemoteReactRefresh&&x.push(t(a.corePath,"./polyfills/inject-react-refresh.mjs")),d.polyfill&&x.push(t(a.corePath,"./polyfills/replace-children.mjs")),d.entry&&("string"==typeof d.entry?k={...k,main:[d.entry]}:Object.keys(d.entry)&&(k=Object.assign(k,d.entry))),"string"==typeof k.main?k.main=[...x,k.main]:Array.isArray(k.main)&&(k.main=[...x,...k.main]),d.output){if("string"==typeof d.output)outputConfig.path=d.output;else if(Object.keys(d.output)){let e=d.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof d.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let M={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:a.webpackCachePath,memoryCacheUnaffected:!j,name:p(`${i}-${C}-${s[2]}`),version:`${P.version}`,buildDependencies:{config:n},maxMemoryGenerations:1};!1===d.cache?M=!1:c(d.cache)&&(M=Object.assign(M,d.cache)),b&&(void 0===d.cache||d.cache&&!d.cache.cacheDirectory)&&(M.cacheDirectory=o(r,P.name));let $={},w={imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.includes(`${y}:example`)||t.includes(`${y}:comment`)||t.startsWith(a.pagesPath)||t.startsWith(a.componentsPath)))}};d.lazyCompilation&&j&&"true"!==process.env.IS_BUILD?c(d.lazyCompilation)?Object.assign($,w,d.lazyCompilation):Object.assign($,w):$=!1;export const commonConfig={name:"client",target:"web",devtool:d.devtool,entry:k,mode:d.mode??"production",stats:"errors-only",cache:M,snapshot:{immutablePaths:[a.pnpmNodeModules,a.denoNodeModules,l.node_modules],managedPaths:[a.pnpmNodeModules,a.denoNodeModules,l.node_modules],resolveBuildDependencies:{timestamp:!0,hash:!0},resolve:{timestamp:!0,hash:!0},module:{timestamp:!0,hash:!0},buildDependencies:{timestamp:!0,hash:!0},contextModule:{timestamp:!0,hash:!0}},infrastructureLogging:{level:"error"},externalsPresets:d.externalsPresets,plugins:f,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!j,lazyCompilation:$,buildHttp:c(d.buildHttp)?{allowedUris:[],lockfileLocation:o(a.httpCachePath,"http.lock"),cacheLocation:o(a.httpCachePath,"data"),upgrade:!0,...d.buildHttp}:d.buildHttp,backCompat:!0,futureDefaults:!0,css:!0,outputModule:!1},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:d.alias,modules:[a.nodeModules,a.pnpmNodeModules,a.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:d.resolvePlugins,preferAbsolute:!0,cache:!0,fallback:{}},externals:d.externals,output:outputConfig,recordsPath:d.recordsPath?t(a.programPath,d.recordsPath):t(a.webpackCachePath,"records.json")};d.overrideResolve&&commonConfig.resolve.plugins.push(new m(Object.assign({original:d.alias["@"],override:i&&u(i)},d.overrideResolve)));
|
package/lib/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as e,relative as o}from"node:path";import t from"node:process";import{merge as a}from"webpack-merge";import n from"./commom/paths.mjs";import s from"./commom/setup-env.mjs";import r from"./options/jsx-dom-expressions.mjs";import i from"./options/split-chunk.mjs";import{getConfigWithTypescript as l,isFunction as m,node_modules as p,resolveProgram as c}from"./utils/index.mjs";import{APPTYPE as u,FRAMEWORK as d,frameworkVersion as f,isCI as h,isDev as g,isLibrary as v,isMobile as x,isReact as P,jsxImportSource as b,mainDirectory as C,NODE_ENV as j,PACKAGENAME as k}from"./process-env.mjs";let w=[
|
|
1
|
+
import{join as e,relative as o}from"node:path";import t from"node:process";import{merge as a}from"webpack-merge";import n from"./commom/paths.mjs";import s from"./commom/setup-env.mjs";import r from"./options/jsx-dom-expressions.mjs";import i from"./options/split-chunk.mjs";import{getConfigWithTypescript as l,isFunction as m,node_modules as p,resolveProgram as c}from"./utils/index.mjs";import{APPTYPE as u,FRAMEWORK as d,frameworkVersion as f,isCI as h,isDev as g,isLibrary as v,isMobile as x,isReact as P,jsxImportSource as b,mainDirectory as C,NODE_ENV as j,PACKAGENAME as k}from"./process-env.mjs";let w=[/(app|vm|docs|example):[a-zA-Z_0-9]/,"@moneko","neko-ui",".cache/http/data","@element-plus","ant-design-vue","element-plus","element-ui","ng-zorro-antd","@mui","@du","@fontsource","@fortawesome","font-pingfang-sc","font-pingfang-tc","katex","react-markdown-editor-lite","react-photo-view","schema-design","monaco-editor"];export async function getConfig(e){let o=l(e).default;return(m(o)?await o(t):o)??{}}let I=await s(j,u,d,[],"true"===t.env.IS_BUILD),[O,S]=await Promise.all([getConfig(n.configPath),getConfig(n.customConfigPath)]),y={mode:j,strict:!1,devtool:"true"!==t.env.IS_BUILD&&g?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:"",namespace:k,moduleFilenameTemplate:"moneko://[namespace]/[resource-path]?[loaders]",fallbackModuleFilenameTemplate:"moneko://[namespace]/[resource-path]?[loaders]"},env:I,basename:"/",publicPath:"auto",rem:{designSize:x?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:Object.assign({"@":c(C)},P&&f<18?{"react/package.json":p("react/package.json"),"react/jsx-runtime":p("react/jsx-runtime.js"),"react/jsx-dev-runtime":p("react/jsx-dev-runtime.js")}:{}),moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3,open:!0},htmlPluginOption:{title:k.toLocaleUpperCase(),favicon:o(n.programPath,`${n.corePath}/options/favicon.ico`)},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:i,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:w,js:w,media:w,font:w,wasm:[]},mdx:{jsx:!1,development:g,jsxImportSource:b,providerImportSource:`@moneko/${d}/mdx`},jsxDomExpressions:r,bar:{name:"Client",nameColor:"68",msgColor:"242",barBgColor:"15",barColor:"69",quiet:h},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:!1,refresh:"solid"!==d,bundleId:"com.moneko.bid",bundles:[],stylelint:{},eslint:{lintDirtyModulesOnly:!1},minChunkSize:1e3,compression:"true"!==t.env.IS_BUILD,manifest:{filename:"site.webmanifest"},corepack:!0,reactJsxRuntime:"automatic"};v&&(y.alias=Object.assign(y.alias,{"@pkg":n.componentsPath,[k]:n.componentsPath}));let M=y;(!1===(M=a(M,O,S)).devtool||!1===M.sourceMap)&&(M.sourceMap=!1,M.devtool=!1),"true"===t.env.CODESPACES&&(M.devServer.https=!1),!1===M.devServer.https&&"darwin"===t.platform&&(M.devServer.open=!1),M.htmlPluginOption&&(M.htmlPluginOption.tags||(M.htmlPluginOption.tags=[]),M.fixBrowserRouter&&M.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))"}),M.manifest&&(M.manifest.publicPath||(M.manifest.publicPath=M.basename),M.htmlPluginOption.tags.push({href:e(M.manifest.publicPath,M.manifest.filename).replaceAll(/\\/g,"/"),tag:"link",rel:"manifest"})));export const CONFIG=M;export const PUBLICPATH="auto"===CONFIG.publicPath?"":CONFIG.publicPath;
|
package/lib/dev/mock.d.mts
CHANGED
|
@@ -53,13 +53,10 @@ export type YApiOption = {
|
|
|
53
53
|
* @returns {Promise} data
|
|
54
54
|
*/
|
|
55
55
|
export declare const yApiMock: (req: RequestFormData, yapi: YApiOption) => Promise<Any>;
|
|
56
|
-
export
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
export declare const oldMock: MockConfiguration;
|
|
60
|
-
export declare let nextMock: MockConfiguration;
|
|
56
|
+
export declare const updateMocks: () => {} | undefined;
|
|
57
|
+
export declare let mocks: MockConfiguration;
|
|
61
58
|
export declare function containMockUrl(url: string): string | undefined;
|
|
62
|
-
declare const setupMock: (
|
|
59
|
+
declare const setupMock: () => ((req: RequestFormData, res: ServerResponse<IncomingMessage> & {
|
|
63
60
|
req: IncomingMessage;
|
|
64
61
|
}) => boolean | (http.ServerResponse<http.IncomingMessage> & {
|
|
65
62
|
req: IncomingMessage;
|
package/lib/dev/mock.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"node:http";import{StringDecoder as t}from"node:string_decoder";import{URL as r}from"node:url";import{directoryExists as o,ink as n,print as a}from"@moneko/utils";import{
|
|
1
|
+
import e from"node:http";import{StringDecoder as t}from"node:string_decoder";import{URL as r}from"node:url";import{directoryExists as o,ink as n,print as a,scanFolderSync as c}from"@moneko/utils";import{merge as i}from"webpack-merge";import s from"../commom/log.mjs";import m from"../commom/match-path.mjs";import d from"../commom/paths.mjs";import l,{METHOD_COLOR as p}from"../commom/print-log.mjs";import u from"../commom/require.mjs";import{jsonSchema as f}from"./json-schema.mjs";function h(e){return!["GET","HEAD","OPTIONS"].includes(e.method?.toUpperCase()||"")}export function cacheBody(e){if(!e._bodyCached&&h(e)&&!e.readableEnded){e._bodyCached=!0;try{let t=[],r=e.on.bind(e),o=e.emit.bind(e),n=!1;e.on=function(e,o){return"data"!==e||n||(n=!0,r("data",e=>{t.push(e)})),r(e,o)};let a=!1;e.emit=function(r,...n){return"end"===r&&!a&&(a=!0,t.length>0&&(e._dataChunks=t)),o.call(this,r,...n)}}catch(e){s(e)}}}function g(e,r){try{let o=Buffer.concat(e);if(r.includes("application/json")){let e=new t("utf-8").write(o);return JSON.parse(e)}if(r.includes("application/octet-stream")||r.startsWith("image/"));else if(r.includes("text/"))return o.toString("utf-8");else if(r.includes("application/x-www-form-urlencoded"))return Object.fromEntries(new URLSearchParams(o.toString("utf8")));return o}catch(e){return s(e),null}}async function y(e){return new Promise(t=>{if(!h(e))return void t(null);let r=e.headers["content-type"]||"",o=e.headers["content-length"],n=e.headers["transfer-encoding"],a=[];return void 0!==e._dataChunks?void t(g(e._dataChunks,r)):o||n?void(e.on("data",e=>{a.push(e)}),e.on("end",()=>{t(g(a,r))}),e.on("error",e=>{t(null),s(e)})):void t(null)})}export const yApiSchemaMock=(t,r)=>new Promise(o=>{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=f(t);void 0!==r?o(i(n,r)):o(n)}}catch(e){s(e)}})})});export const yApiMock=(t,o)=>new Promise((n,a)=>{let c=new r(o.host),i={hostname:c.hostname,port:c.port,path:t.url?.replace(new RegExp(o.pathRewrite),`/mock/${o.projectId}/`),method:t.method,headers:t.headers,query:Object.fromEntries(c.searchParams)},m=e.request(i,e=>{e.setEncoding("utf8");let t="";e.on("data",e=>{t+=e}),e.on("end",()=>{try{n(JSON.parse(t))}catch(e){s(e)}})});m.on("error",e=>{a(e.message)}),m.write(JSON.stringify(t.body)),m.end()});export const updateMocks=()=>{if(!o(d.mockPath))return{};let e={},t=c(d.mockPath,["\\.(t|j)s$"]);a(n("Updating mock...","245"),!0),t.forEach(t=>{try{delete u.cache[t],e[t]=u(t).default}catch(e){s(e)}}),a(n("Mock update successful","245"),!0),mocks=e};export let mocks={};export function containMockUrl(e){return Object.keys(mocks).find(t=>RegExp(`^${t.replace(/(:\w*)[^/]/g,"((?!/).)")}*$`).test(e))}export default(()=>{if(o(d.mockPath))return updateMocks(),(e,t)=>{if(t.writableEnded)return t;let o=new r(`http://localhost:3000${e.url}`),n=e.method||"GET",a=`${n} ${o.pathname}`,c=containMockUrl(a)||a,i=mocks[c];if(i){if(l(n,o.pathname,{note:"MOCK",labelAlign:"center",labelLen:8,labelForegroundColor:p[n].fg,labelBackgroundColor:p[n].bg}),t.send=e=>t.end("string"==typeof e?e:JSON.stringify(e)),t.writeHead(200,{"Content-Type":e.headers["content-type"]}),"function"==typeof i){let r=m(c.split(" ")[1],o.pathname);o.searchParams&&Object.assign(e,{query:Object.fromEntries(o.searchParams)}),r&&Object.assign(e,{params:r.params}),e.body=y(e);try{i(e,t)}catch(e){s(e)}return!0}return t.end("string"==typeof i?i:JSON.stringify(i)),!0}return!1}});
|
package/lib/dev/server.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createServer as e}from"node:http";import{createServer as t}from"node:https";import{platform as o}from"node:os";import{extname as r,join as n,sep as i}from"node:path";import{env as s}from"node:process";import{ink as a,println as m}from"@moneko/utils";import{CA_ORGANIZATION as
|
|
1
|
+
import{createServer as e}from"node:http";import{createServer as t}from"node:https";import{platform as o}from"node:os";import{extname as r,join as n,sep as i}from"node:path";import{env as s}from"node:process";import{ink as a,println as m}from"@moneko/utils";import{CA_ORGANIZATION as l,isCertificateInstalled as p}from"../commom/ca.mjs";import c from"../commom/mime.mjs";import d from"../commom/open.mjs";import{CONFIG as C}from"../config.mjs";import f from"../dev/get-cert.mjs";import{setupProxy as h}from"../dev/proxy.mjs";import u,{cacheBody as A}from"./mock.mjs";let E={"Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"Authorization, Content-Type, Accept, X-Requested-With, Origin, DNT, User-Agent, Cache-Control, X-CSRF-Token, X-API-Key, X-Client-Version, X-Device-ID, Content-Language, Accept-Language, X-Custom-Header, X-Mx-ReqToken, Keep-Alive, If-Modified-Since","Access-Control-Allow-Methods":"GET, DELETE, HEAD, OPTIONS, POST, PUT, PATCH, PURGE, LINK, UNLINK, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK, REPORT, SEARCH, CONNECT, TRACE","Access-Control-Allow-Origin":"*","Cache-Control":"no-store, no-cache, must-revalidate, proxy-revalidate",Pragma:"no-cache",Expires:"0"};async function y(y){let T=n(y.root_dir,"index.html"),g=u();function w(e,t,o){let n=e.headers["accept-encoding"],i=n?.includes("br"),s=`${o}.${i?"br":"gz"}`,a=y.fileSystem.existsSync(s);a&&t.setHeader("Content-Encoding",i?"br":"gzip");let m=y.fileSystem.createReadStream(a?s:o,{autoClose:!0});m.on("open",()=>{t.writeHead(200,Object.assign({},E,y.headers,{"Access-Control-Allow-Origin":e.headers.origin??"*","Content-Type":c[r(o)]||"application/octet-stream"}))}),m.on("error",e=>{switch(m.readable=!0,e.code){case"ENOENT":t.writeHead(301,{Location:"/index.html"}),t.end();break;case"EACCES":t.writeHead(403,{"Content-Type":"text/plain"}),t.end(`Forbidden: ${e.message}`);break;default:t.writeHead(500,{"Content-Type":"text/plain"}),t.end(`Internal Server Error: ${e.message}`)}}),m.pipe(t)}async function O(e,t){if(A(e),!(y.onRequest&&y.onRequest(e,t))){if(!(C.proxy&&await h(e,t,C.proxy)||t.writableEnded||g&&g(e,t))&&!t.writableEnded){if("GET"===e.method){let o="/"===e.url?T:decodeURIComponent(n(y.root_dir,e.url.replace(y.basename??"/","/")));if(y.fileSystem.existsSync(o))return w(e,t,o)}if(e.headers.accept?.includes("text/html"))return w(e,t,T);t.writeHead(404,{"Content-Type":"text/plain"}),t.end("File Not Found")}}}let x=y.https?t(await f(y.host,!0===y.https?{install:!0}:y.https),O):e(O);if(x.listen(y.port),y.https&&!await p(l)&&"darwin"===o()){let e=s.npm_execpath?.split(i).pop()?.split(".").shift()||"npm",t=s.npm_lifecycle_event??"start",o=`> sudo ${e} ${t}`;m(a("⚠️ 未检测到本地 SSL 证书,请通过以下命令重启项目以安装证书: ","yellow")),m(a(o,"yellow")),m("")}return y.open&&d(`${y.https?"https:":"http:"}//${y.host}:${y.port}${"/"===y.basename?"":y.basename}`),x}export default y;
|
package/lib/dev.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{exec as e,spawn as t}from"node:child_process";import{watchFile as o}from"node:fs";import{relative as r}from"node:path";import i from"node:process";import{URL as s}from"node:url";import{ink as n,print as a,println as m,progressBar as l}from"@moneko/utils";import p from"webpack";import c from"webpack-hot-middleware";import{merge as
|
|
2
|
-
`):(l(e||0,1,{msg:r,name:t,barColor:s.barColor,nameColor:s.nameColor,barBgColor:s.barBgColor,msgColor:s.msgColor}),1===e&&i.stdout.write("\r\x1b[2K"))}}})]});function
|
|
1
|
+
import{exec as e,spawn as t}from"node:child_process";import{watchFile as o}from"node:fs";import{relative as r}from"node:path";import i from"node:process";import{URL as s}from"node:url";import{ink as n,print as a,println as m,progressBar as l}from"@moneko/utils";import p from"webpack";import c from"webpack-hot-middleware";import{merge as f}from"webpack-merge";import{diffObject as h}from"./commom/diff-object.mjs";import d,{config_files as u}from"./commom/paths.mjs";import g from"./commom/rule.mjs";import w from"./commom/sigint-exit.mjs";import{devLog as y,PORT as $}from"./dev/config.mjs";import j from"./dev/generate-progress-html.mjs";import v from"./dev/server.mjs";import b from"./options/reslove.mjs";import{ESLintPlugin as x}from"./plugin/eslint.mjs";import{StylelintPlugin as C}from"./plugin/stylelint.mjs";import{empty as _}from"./utils/index.mjs";import{CONFIG as P,getConfig as S}from"./config.mjs";import{createDevelopmentConfiguration as k}from"./create-development-configuration.mjs";import{outputFileSystem as E}from"./file-system.mjs";import{isLibrary as B,refresh as H}from"./process-env.mjs";let I=!1,O="/____progress____",T={percentage:0,info:""},q="/__hmr__",G=new URLSearchParams({name:"client",path:q.substring(1),dynamicPublicPath:!0,timeout:2e3,reload:!H,quiet:!0,noInfo:!0,overlay:!1,autoConnect:!0}).toString(),L=await k({watchOptions:{stdin:!0,aggregateTimeout:300,ignored:g.node_modules},entry:{main:[`${b.hotMiddlewareClient}?${G}`]},plugins:[new p.WatchIgnorePlugin({paths:[g.node_modules,/\.d\.ts$/]}),new p.ProgressPlugin({handler(e,t,...o){let r=o.length?`[${t}] ${o.join(" ")}`:" ";I||(T.info=r,T.percentage=e,I=1===e);let s=P.bar;if(s){let t=s.name||"Build";s.quiet?i.stdout.write(`${r}
|
|
2
|
+
`):(l(e||0,1,{msg:r,name:t,barColor:s.barColor,nameColor:s.nameColor,barBgColor:s.barBgColor,msgColor:s.msgColor}),1===e&&i.stdout.write("\r\x1b[2K"))}}})]});function U(e){let t=e.join(","),o=[r(d.programPath,`${P.alias["@"]}/**/*.{${t}}`).replace(/\\/g,"/")];return B&&o.push(r(d.programPath,`${P.alias["@pkg"]}/**/*.{${t}}`).replace(/\\/g,"/")),o}P.eslint&&L.plugins.push(new x({fix:!0,cache:!0,cacheLocation:`${d.lintCachePath}/.eslintcache`,cacheStrategy:"metadata",files:U(["js","jsx","ts","tsx","json","html","vue"]),...P.eslint})),P.stylelint&&L.plugins.push(new C({fix:!0,cache:!0,cacheLocation:`${d.lintCachePath}/.stylelintcache`,files:U(["css","scss","sass","less","ts","tsx","js","jsx"]),...P.stylelint}));let F=p(L);if(!F)throw Error("无法创建编译器");F.outputFileSystem=E;let N=F.watch(F.options.watchOptions,y);if(!N)throw Error("无法创建监视器");F.hooks.done.tap("client-log",e=>{y(null,e)});let R=`${P.basename}/${q}`.replace(/\/+/g,"/"),J=c(F,{log:!1,path:R,heartbeat:2e3}),K=await v({port:$,root_dir:F.options.output.path,fileSystem:F.outputFileSystem,headers:P.devServer.headers,https:P.devServer.https,host:P.devServer.host,open:P.devServer.open,basename:P.basename,onRequest(e,t){if(!t.writableEnded){if("GET"===e.method){let o=new s(`${P.devServer.https?"https":"http"}://${e.headers.host}${e.url}`);if(o.pathname===O)return t.writeHead(200,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),t.end(JSON.stringify(T)),!0;if(!I)return t.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),t.end(j(O,T)),!0;if(o.pathname===R&&"text/event-stream"===e.headers.accept)return J(e,t,_),!0}return!1}}});function M(){i.exit(0)}K.on("close",()=>{N.close(_),J.close()});let W=await Promise.all(u.map(S)),z=f(W[0]||{},W[1]||{});u.forEach(function(t){o(t,async function(){var o;let[r,s]=await Promise.all(u.map(S)),l=f(r||{},s||{}),p=h(z,l);1===Object.keys(p).length&&"proxy"in p?(a(n(`代理更新中...`,"yellow"),!0),a(n(`代理更新完成...`,"green"),!0),P.proxy=l.proxy,z.proxy=l.proxy,z=l):(z=l,m(n(`检测到工程配置${n(`[${t}]`,"blue")}变更, 程序即将重启...`,"yellow"),!0),o=$,e(A?`netstat -ano | findstr :${o}`:`lsof -i :${o} -t`,(e,t)=>{if(e){m(n(`查找端口 ${o} 时发生错误: ${e.message}`,"red")),m(n("请尝试手动重启程序","yellow"));return}let r=t.trim().replace(/\r\n/g,"\n").split("\n").filter(Boolean),s=A?r[0]?.split(/\s+/).pop()?.trim():r[0]?.trim();if(!s)return void m(n(`未找到占用端口 ${o} 的进程, 请尝试手动重启程序`,"yellow"));try{i.kill(Number(s),"SIGHUP")}catch(e){m(n(`终止进程 ${s} 时发生错误: ${e.message}`,"red"))}}))})});let A="win32"===i.platform;i.on("SIGHUP",function(){K.close(_);let e=t(i.argv[0],i.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",M)}),i.on("exit",function(){K.close(_)}),w(M);
|
package/lib/index.d.mts
CHANGED
|
@@ -19,7 +19,6 @@ export type { CompressionPluginOptions } from './plugin/compression.mjs';
|
|
|
19
19
|
export type { HtmlMeta, HtmlPluginOption } from './plugin/html-plugin.mjs';
|
|
20
20
|
export * from './plugin/manifest/index.mjs';
|
|
21
21
|
export type { OverrideResolverOption } from './plugin/override-resolve.mjs';
|
|
22
|
-
export type { VirtualModulePluginOption } from './plugin/virtual-module.mjs';
|
|
23
22
|
export { APPTYPE, coreName, FRAMEWORK, isCI, isDev, isLibrary, isMicro, mainDirectory, packageJson, PACKAGENAME, } from './process-env.mjs';
|
|
24
23
|
export { type AlgorithmIdentifier, digest, md5, node_modules, resolveProgram, toCamelCase, } from './utils/index.mjs';
|
|
25
24
|
export * from '@moneko/mdx';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return r}});const e=require("lightningcss"),t=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 r(r,i){let a=this.async();this.cacheable&&this.cacheable();let{visitor:o,rem:u,...s}=this.getOptions();try{u&&!n.Length&&(n.Length=function(e){if("px"===e.unit)return{unit:"rem",value:e.value/16}});let c=(0,e.transform)({filename:this.resourcePath,code:t.encode(r),minify:!0,visitor:{...n,...o},cssModules:!1,sourceMap:this.sourceMap,inputSourceMap:this.sourceMap&&i?JSON.stringify(i):void 0,analyzeDependencies:!1,drafts:{customMedia:!0},include:1,errorRecovery:!1,unusedSymbols:[],...s});a(null,c.code,c.map&&JSON.parse(c.map.toString()))}catch(e){a(e),log(e)}}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type CustomAtRules, type TransformOptions } from 'lightningcss';
|
|
2
|
+
import type { LoaderContext } from 'webpack';
|
|
3
|
+
export interface LightningCssLoaderOption extends Omit<TransformOptions<CustomAtRules>, 'filename' | 'code' | 'inputSourceMap' | 'cssModules'> {
|
|
4
|
+
rem?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export default function LightningCssLoader(this: LoaderContext<LightningCssLoaderOption>, source: string, prevMap?: string): Promise<void>;
|
package/lib/loader/ts-doc.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return
|
|
1
|
+
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return i}});const t=require("fs"),r=(e=require("../commom/log.mjs"))&&e.__esModule?e:{default:e},s={};function i(e){let i=this.resourcePath;if(i.endsWith(".d.ts"))return e;this.cacheable&&this.cacheable();try{let r=(0,t.statSync)(i).mtime.getTime();if(s[i]!==r){Object.assign(s,{[i]:r});let{comment:t,generateDoc:a,getCommentPath:c}=this.getOptions();t.setData(c(i),a(e,i))}}catch(e){(0,r.default)(e)}return e}
|
package/lib/module.config.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
let e;import{join as s,sep as o}from"node:path";import
|
|
2
|
-
`)}:void 0},importLoaders:2}},k={loader:d.lessLoader,options:{sourceMap:!!P.sourceMap,lessOptions:{modifyVars:c,javascriptEnabled:!0}}},I=new Map;function C(e){if(I.has(e))return I.get(e);try{let s,t=i.resolve(e).split(o),r=t.lastIndexOf("node_modules");return s=-1!==r?t.slice(0,r).join(o):t.join(o),I.set(e,[s]),[s]}catch{try{let s=i.resolve(`${e}${o}package.json`).replace(`${o}package.json`,"");I.set(e,[s])}catch{I.set(e,[f(e),f(`.pnpm/${e}`)])}return I.get(e)}}let $=[...P.cssModules,`@moneko/${L}`,"neko-ui"].map(C).flat(),b=["components","example","mock","site","src","server"].map(h);function B(e){return new Promise(s=>{s([...b,r.corePath,...P.rulesInclude?.[e]?.map(C).flat()||[]])})}a&&b.push(h(a)),P.overrideResolve&&P.overrideResolve.override&&b.push(P.overrideResolve.override);let J=await Promise.all([B("css"),B("js"),B("media"),B("wasm"),B("font")]),N=J[0],W=J[1],D=J[2],E=J[3],R=J[4];d.sassLoader&&(e={loader:d.sassLoader,options:{implementation:await import("sass"),sassOptions:{}}});let S=M&&_&&"true"!==process.env.IS_BUILD&&{test:m.tsdoc,include:P.alias["@pkg"],exclude:[/node_modules\/(?!(@app|@moneko)).+/,m.__tests__],enforce:"pre",loader:s(r.corePath,"/loader/ts-doc.cjs"),options:{comment:g,generateDoc:x,getCommentPath:v}},U=w.library?.type==="umd"&&!1===P.htmlPluginOption,z=[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename(e){let s=e.filename;return s&&s.toLocaleLowerCase().endsWith("wasm?url")?"wasm/[hash][ext]":"assets/[hash][ext]"}}},{test:m.wasm,type:"webassembly/async",include:E},{test:m.txt,type:"asset/source"},{test:m.image,type:"asset",dependency:{not:["url"]},parser:{dataUrlCondition:U?()=>!0:{maxSize:4096}},generator:{filename:e=>e.filename?.toLocaleLowerCase().endsWith(".svg")?"assets/svg/[hash][ext]":"assets/images/[hash][ext]",dataUrl:(e,s)=>s.filename.toLocaleLowerCase().endsWith(".svg")?y(e.toString()):e},include:D},{test:m.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[hash][ext]"},include:D},{test:m.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[hash][ext]"},include:R}],Q=P.prefixJsLoader.filter(Boolean)||[];"react"===L&&P.reactCompiler&&Q.unshift({loader:s(r.corePath,"/loader/react-compiler.cjs"),options:{panicThreshold:_?void 0:"NONE",...P.reactCompiler}}),P.cssInJs&&"object"==typeof P.cssInJs.minify&&Q.unshift({loader:s(r.corePath,"/loader/css-in-js-minify.cjs"),options:Object.assign({moduleName:"@moneko/css",allowFuncs:["css","injectGlobal"]},P.cssInJs.minify)});let q=new n({});q.on("change",(e,s)=>{t(e,s)});export default(o=>{let t={react:{loader:d.swcLoader,options:p(o)},solid:{loader:s(r.corePath,"/loader/solid.cjs"),options:{jsxOptions:P.jsxDomExpressions,refresh:P.refresh}}}[L];return{parser:{javascript:{commonjsMagicComments:!0,dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,importMeta:!0,importMetaContext:!0}},noParse:P.noParse,rules:[!1!==P.htmlPluginOption&&S,{oneOf:[...z,{test:m.js,use:[...Q,t].filter(Boolean),include:W},{test:m.css,use:[l,O],include:N},e&&{test:m.scss,use:[l,O,e],include:N},{test:m.less,use:[l,O,k],include:N},{test:m.markdown,use:[...Q,{loader:s(r.corePath,"/loader/mdx.cjs"),options:P.mdx}].filter(Boolean),exclude:[/node_modules\/(?!(@app|@moneko)).+/]}].filter(Boolean)},...P.moduleRules].filter(Boolean)}});
|
|
1
|
+
let e;import{join as s,sep as o}from"node:path";import t,{CUSTOMCONFIG as r}from"./commom/paths.mjs";import a from"./commom/require.mjs";import n from"./commom/rule.mjs";import i from"./options/modify-vars.mjs";import l from"./options/reslove.mjs";import m from"./options/swcrc.mjs";import{getLightningCssTargets as c}from"./polyfills/targets.mjs";import{node_modules as p,resolveProgram as d}from"./utils/index.mjs";import u from"./utils/svg-to-data-uri.mjs";import{comment as f,getCommentPath as h}from"./vm/docs.mjs";import y from"./vm/generate-doc.mjs";import{outputConfig as j}from"./common.mjs";import{CONFIG as g}from"./config.mjs";import{app_schema as v,FRAMEWORK as x,isDev as w,isLibrary as P,virtual_schema as _}from"./process-env.mjs";let L={loader:s(t.corePath,"/loader/lightning-css.cjs"),options:{sourceMap:!!g.sourceMap,targets:c(),rem:!!g.rem,importLoaders:2}},M={loader:l.lessLoader,options:{sourceMap:!!g.sourceMap,lessOptions:{modifyVars:i,javascriptEnabled:!0}}},I=new Map,O=["components","example","mock","site","src","server"].map(d);function C(e){return new Promise(s=>{s([...O,t.corePath,...g.rulesInclude?.[e]?.map(e=>"string"==typeof e?function(e){if(I.has(e))return I.get(e);try{let s,t=a.resolve(e).split(o),r=t.lastIndexOf("node_modules");return s=-1!==r?t.slice(0,r).join(o):t.join(o),I.set(e,[s]),[s]}catch{try{let s=a.resolve(`${e}${o}package.json`).replace(`${o}package.json`,"");I.set(e,[s])}catch{I.set(e,[p(e),p(`.pnpm/${e}`)])}return I.get(e)}}(e):e).flat()||[]])})}r&&O.push(d(r)),g.overrideResolve&&g.overrideResolve.override&&O.push(g.overrideResolve.override);let $=await Promise.all([C("css"),C("js"),C("media"),C("wasm"),C("font")]),b=$[0],N=$[1],W=$[2],k=$[3],B=$[4];l.sassLoader&&(e={loader:l.sassLoader,options:{implementation:await import("sass"),sassOptions:{}}});let E=P&&w&&"true"!==process.env.IS_BUILD&&{test:n.tsdoc,include:g.alias["@pkg"],exclude:[n.node_modules,n.__tests__,e=>e.startsWith(`${v}:`)||e.startsWith(`${_}:`)],enforce:"pre",loader:s(t.corePath,"/loader/ts-doc.cjs"),options:{comment:f,generateDoc:y,getCommentPath:h}},J=j.library?.type==="umd"&&!1===g.htmlPluginOption,R=[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename(e){let s=e.filename;return s&&s.toLocaleLowerCase().endsWith("wasm?url")?"wasm/[hash][ext]":"assets/[hash][ext]"}}},{test:n.wasm,type:"webassembly/async",include:k},{test:n.txt,type:"asset/source"},{test:n.image,type:"asset",dependency:{not:["url"]},parser:{dataUrlCondition:J?()=>!0:{maxSize:4096}},generator:{filename:e=>e.filename?.toLocaleLowerCase().endsWith(".svg")?"assets/svg/[hash][ext]":"assets/images/[hash][ext]",dataUrl:(e,s)=>s.filename.toLocaleLowerCase().endsWith(".svg")?u(e.toString()):e},include:W},{test:n.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[hash][ext]"},include:W},{test:n.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[hash][ext]"},include:B}],S=g.prefixJsLoader.filter(Boolean)||[];"react"===x&&g.reactCompiler&&S.unshift({loader:s(t.corePath,"/loader/react-compiler.cjs"),options:{...g.reactCompiler,panicThreshold:w?void 0:"NONE"}}),g.cssInJs&&"object"==typeof g.cssInJs.minify&&S.unshift({loader:s(t.corePath,"/loader/css-in-js-minify.cjs"),options:Object.assign({moduleName:"@moneko/css",allowFuncs:["css","injectGlobal"]},g.cssInJs.minify)});export default(o=>{let r={react:{loader:l.swcLoader,options:m(o)},solid:{loader:s(t.corePath,"/loader/solid.cjs"),options:{jsxOptions:g.jsxDomExpressions,refresh:g.refresh}}}[x];return{generator:{"css/auto":{exportsOnly:!1,exportsConvention:"camel-case-only",localIdentName:"[uniqueName]_[id]_[local]",esModule:!0},"css/module":{exportsOnly:!1,exportsConvention:"camel-case-only",localIdentName:"[uniqueName]_[id]_[local]",esModule:!0}},parser:{javascript:{commonjsMagicComments:!0,dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,importMeta:!0,importMetaContext:!0},css:{import:!0,namedExports:!0,url:!0},json:{exportsDepth:1}},noParse:g.noParse,rules:[!1!==g.htmlPluginOption&&E,{oneOf:[...R,{test:n.js,use:[...S,r].filter(Boolean),include:N,extractSourceMap:!0},...g.cssModules.map(e=>({test:s=>n.node_modules_css_module.test(s)&&s.includes(e),use:[L],type:"css/module"})),{test:n.css,use:[L],type:"css/auto",include:b},e&&{test:n.scss,use:[L,e],type:"css/auto",include:b},{test:n.less,use:[L,M],type:"css/auto",include:b},{test:n.markdown,use:[...S,{loader:s(t.corePath,"/loader/mdx.cjs"),options:g.mdx}].filter(Boolean),exclude:[n.node_modules,e=>e.startsWith(`${v}:`)||e.startsWith(`${_}:`)]}].filter(Boolean)},...g.moduleRules].filter(Boolean)}});
|
package/lib/options/reslove.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"../commom/has-pkg.mjs";import e from"../commom/require.mjs";let r={sassLoader:o("sass-loader"),lessLoader:e.resolve("less-loader"),swcLoader:e.resolve("swc-loader"),transformImports:o("@moneko/transform-imports"),rawImport:o("@moneko/raw-import"),hotMiddlewareClient:e.resolve("webpack-hot-middleware/client.js")};export default r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let
|
|
1
|
+
import e from"../commom/rule.mjs";let n=function(){let e={priority:-10,reuseExistingChunk:!0};return function(n){return{...e,test:n}}}(),i={chunks:"all",minChunks:1,minSize:2e4,maxSize:25e4,enforceSizeThreshold:5e4,maxAsyncRequests:30,maxInitialRequests:30,minRemainingSize:0,hidePathInfo:!0,cacheGroups:{json:{type:"json"},CHANGELOG:n(/CHANGELOG\.md/),site:n(/site/),vendors:{test:e.node_modules,priority:-10,reuseExistingChunk:!0},"monaco-editor":{test:/[\\/]node_modules[\\/]monaco-editor/,name:"monaco-editor",chunks:"all"},common:{minChunks:2,priority:-20,reuseExistingChunk:!0}}};export default i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{saveFileSync as s}from"@moneko/utils";import{toCamelCase as e}from"../utils/index.mjs";export class CssModuleDtsPlugin{apply(o){o.hooks.compilation.tap(this.name,o=>{o.hooks.succeedModule.tap(this.name,o=>{if(o.buildMeta?.isCSSModule){let t=o.dependencies.map(s=>"name"in s?`export const ${e(s.name)}: string;`:"").join("\n");s(`${o.resource}.d.ts`,t)}})})}constructor(){this.name="CssModuleDtsPlugin"}}
|
package/lib/plugins.config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"webpack";import{CompressionPlugin as t}from"./plugin/compression.mjs";import{CopyPlugin as i}from"./plugin/copy.mjs";import{
|
|
1
|
+
import e from"webpack";import{CompressionPlugin as t}from"./plugin/compression.mjs";import{CopyPlugin as i}from"./plugin/copy.mjs";import{CssModuleDtsPlugin as o}from"./plugin/css-module-dts.mjs";import{HtmlPlugin as n}from"./plugin/html-plugin.mjs";import{ManifestPlugin as r}from"./plugin/manifest/index.mjs";import p from"./plugin/module-federation.mjs";import{app_vm as s,docs_vm as l,example_vm as a,scope_vm as m,virtual_vm as c}from"./vm/modules.mjs";import{CONFIG as h}from"./config.mjs";import{app_schema as u,docs_schema as g,example_schema as f,isLibrary as d,packageJson as w,scope_schema as j,virtual_schema as b}from"./process-env.mjs";let y="object"==typeof h.compression?h.compression:{},v=e.experiments.schemes.VirtualUrlPlugin,x=[...p,new v(s,u),d&&new v(l,g),d&&new v(a,f),d&&new v(m,j),h.virtualModule&&new v(c,b),new i(h.copy),new e.DefinePlugin({"process.env":JSON.stringify(h.env)}),new e.IgnorePlugin({resourceRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),new o,...h.plugins].filter(Boolean);if(h.compression&&x.push(new t({algorithm:h.devServer.https?"brotli":"gzip",test:/\.(js|css|html|svg|ttf|woff|woff2|png|jpg|jpeg)$/,...y})),h.manifest&&x.push(new r(h.manifest)),h.htmlPluginOption){let e={charset:"UTF-8","X-UA-Compatible":{"http-equiv":"X-UA-Compatible",content:"IE=edge,Chrome=1"},HandheldFriendly:"true",MobileOptimized:"320","screen-orientation":"portrait","x5-orientation":"portrait",browsermode:"application","x5-page-mode":"app","msapplication-tap-highlight":"no","mobile-web-app-capable":"yes",renderer:"webkit",description:w.description,keywords:Array.isArray(w.keywords)?w.keywords.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};h.seo&&(e.relCanonical={rel:"canonical",href:`https://${h.seo.domain}${h.basename}`}),h.htmlPluginOption.meta&&Object.assign(e,h.htmlPluginOption.meta),x.push(new n({...h.htmlPluginOption,meta:e}))}if(h.fixBrowserRouter){let e=h.basename.split("/").filter(Boolean).length,t=`${Array(e).fill("..").join("/")+(e?"/":"")}404.html`,i=h.fixBrowserRouter.pathSegmentsToKeep??e;x.push(new n({filename:h.fixBrowserRouter.path??t,inject:!1,templateContent:()=>`<html lang="en"><head><title>Redirect</title><script>const pathKeep = ${i};const l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}))}h.sourceMap&&x.push(new e.SourceMapDevToolPlugin(h.sourceMap));export default x;
|
package/lib/process-env.d.mts
CHANGED
|
@@ -9,6 +9,11 @@ export declare const isMobile: boolean;
|
|
|
9
9
|
export declare const isReact: boolean;
|
|
10
10
|
export declare const isSolid: boolean;
|
|
11
11
|
export declare const SSR: boolean;
|
|
12
|
+
export declare const app_schema = "app";
|
|
13
|
+
export declare const virtual_schema = "vm";
|
|
14
|
+
export declare const docs_schema = "docs";
|
|
15
|
+
export declare const example_schema = "example";
|
|
16
|
+
export declare const scope_schema = "scope";
|
|
12
17
|
/** 项目主要文件夹 */
|
|
13
18
|
export declare const mainDirectory: 'site' | 'src';
|
|
14
19
|
export declare const jsxImportSource: string;
|
package/lib/process-env.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"node:process";import
|
|
1
|
+
import o from"node:process";import e from"./commom/has-pkg.mjs";import r from"./commom/is-ci-environment.mjs";import s from"./commom/require.mjs";export const IS_WINDOW="win32"===o.platform;export const APPTYPE=o.env.APPTYPE;export const FRAMEWORK=o.env.FRAMEWORK;export const NODE_ENV=o.env.NODE_ENV;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const SSR="true"===o.env.SSR;export const app_schema="app";export const virtual_schema="vm";export const docs_schema="docs";export const example_schema="example";export const scope_schema="scope";export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const framework={react:"react",solid:"solid-js"}[FRAMEWORK];export const frameworkVersionStr=framework?s(`${framework}/package.json`).version:19;export const frameworkVersion=parseFloat(frameworkVersionStr);export const packageJson=s(`${o.cwd()}/package.json`);delete packageJson.scripts;export const PACKAGENAME=packageJson.name;export const coreName="@moneko/core";export const isDev="development"===NODE_ENV;export const refresh=!!(isDev&&(e("solid-refresh")||e("react-refresh")));export const isCI=r();
|
package/lib/vm/docs.d.mts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import ReactiveObject from '../commom/reactive-object.mjs';
|
|
2
|
-
export declare const docs: ReactiveObject<{
|
|
3
|
-
'app:docs': string;
|
|
4
|
-
}>;
|
|
5
2
|
export declare const comment: ReactiveObject<Record<string, string>>;
|
|
6
3
|
export declare const getCommentPath: (file: string) => string;
|
|
4
|
+
export declare const getDocs: () => string;
|
package/lib/vm/docs.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{sep as e}from"node:path";import t from"../commom/reactive-object.mjs";import o from"../commom/rule.mjs";import{CONFIG as r}from"../config.mjs";import{app_schema as n,docs_schema as m,FRAMEWORK as c,framework as s,isLibrary as p,isReact as a,isSolid as l}from"../process-env.mjs";let i={react:"createElement",solid:"createComponent"}[c];export const comment=new t({});export const getCommentPath=function(){let e=/\/(.+?)\.tsx?$/,t=`${m}:comment/$1.txt`,o=r.alias["@pkg"]?.length;return r=>r.substring(o).replace(/\\/g,"/").replace(e,t)}();export const getDocs=()=>{let t=`import { ${i}${l?",Dynamic":""} } from "${s}${l?"/web":""}";import SuspenseComp from "${n}:suspense";function call_then(res) {return {default: ${a?"() =>":""}${i}(${l?"Dynamic":"'div'"}, {${l?"innerHTML: res.default, component: 'div', class: 'n-md-box' ":"dangerouslySetInnerHTML: {__html:res.default}, className: 'n-md-box'"} })};}`,r={};Object.keys(comment.data).forEach(t=>{let o=t.replace(/docs:comment[/\\]/,"").split(e),n=o.pop(),m=o.join("/");r[m]||(r[m]={}),r[m][n]=`rr(() => ${i}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${t}' */ '${t}').then(call_then)}))rr`});let m={};for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(m[e]=Object.values(r[e]));return`${t}export default ${JSON.stringify(m).replace(o.extract_func,"$1")}`};p&&!1!==r.htmlPluginOption&&comment.on("change",()=>{getDocs()});
|
package/lib/vm/example.d.mts
CHANGED
package/lib/vm/example.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateExample as
|
|
1
|
+
import{generateExample as o}from"@moneko/mdx";import m from"../commom/paths.mjs";import t from"../commom/reactive-object.mjs";import{CONFIG as e}from"../config.mjs";import{example_schema as r,isLibrary as n}from"../process-env.mjs";function p(){return n&&!1!==e.htmlPluginOption?JSON.parse(o(m.componentsPath,`${r}:`,"6")):{}}export const examples=new t(p());export function generatorExample(){let o=p();for(let m in o)Object.hasOwn(o,m)&&examples.setData(m,o[m])}
|
package/lib/vm/info.d.mts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
declare const app:
|
|
1
|
+
declare const app: {
|
|
2
|
+
projectName: string;
|
|
3
|
+
ssr: boolean;
|
|
4
|
+
base: string;
|
|
5
|
+
type: import("../index.mjs").AppType;
|
|
6
|
+
routerMode: "browser" | "hash" | "memory";
|
|
7
|
+
prefixCls: string | undefined;
|
|
8
|
+
theme: import("../index.mjs").Theme | undefined;
|
|
9
|
+
frameworkVersion: string;
|
|
10
|
+
framework: "react" | "solid-js";
|
|
11
|
+
};
|
|
2
12
|
export default app;
|
package/lib/vm/locales.d.mts
CHANGED
package/lib/vm/locales.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{basename as e,join as t}from"node:path";import{directoryExists as a,scanFolderSync as o}from"@moneko/utils";import
|
|
2
|
-
export function template(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(e)};const _res = ${JSON.stringify(t)};const resources = deepFreeze(_res);${
|
|
1
|
+
import{basename as e,join as t}from"node:path";import{directoryExists as a,scanFolderSync as o}from"@moneko/utils";import l from"../commom/log.mjs";import r from"../commom/require.mjs";import{CONFIG as n}from"../config.mjs";import{FRAMEWORK as c}from"../process-env.mjs";export function generateLocales(){let s=t(n.alias["@"],"./locales"),g={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},i={react:'let storageKey="localizable.language",language=localStorage.getItem(storageKey)||navigator.language,{translation:a,...defaultLocale}=Object.assign({title:"简体中文",language:navigator.language,translation:{}},resources[language]||resources[navigator.language]),localizable=sso({lang:defaultLocale,t:a});export function setLang(a){let{translation:e,...l}=resources[a]||{};e&&(localizable.lang=l,localizable.t=e,localStorage.setItem(storageKey,l.language))}export default localizable;',solid:'let locale=createRoot(()=>{let e="localizable.language",a=localStorage.getItem(e)||navigator.language,{translation:l,...o}=Object.assign({title:"简体中文",language:navigator.language,translation:{}},resources[a]||resources[navigator.language]),[n,c]=createStore({lang:o,t:l});return createEffect(()=>{let a=resources[n.lang.language]?.translation;a&&(c("t",a),localStorage.setItem(e,n.lang.language))}),{localizable:n,setLocalizable:c,setLang:function(e){let{translation:a,...l}=resources[e]||{};a&&c("lang",l)}}},getOwner());export const setLocalizable=locale.setLocalizable;export const t=locale.localizable.t;export const lang=locale.localizable.lang;export const setLang=locale.setLang;'}[c];function u(e,t){return`${g[c]}
|
|
2
|
+
export function template(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(e)};const _res = ${JSON.stringify(t)};const resources = deepFreeze(_res);${i}`}if(a(s)&&!1!==n.htmlPluginOption){let t={};o(s,[".ts$"]).filter(e=>!/^\..*|\.d\.ts$/.test(e)).forEach(a=>{let o=e(a).replace(/\.[^.]+$/,"");try{delete r.cache[a],Object.assign(t,{[o]:r(a).default})}catch(e){Object.assign(t,{[o]:{}}),l(e)}});let a=[],n={};for(let e in t){if(!Object.hasOwn(t,e))continue;let{language:o=e,title:l=o,icon:r,translation:c={}}=t[e];a.push({language:o,title:l,icon:r}),n[o]={language:o,title:l,icon:r,translation:c}}return u(a,n)}return u([],{})}
|
package/lib/vm/modules.d.mts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import webpack from 'webpack';
|
|
2
2
|
type VirtualModules = ConstructorParameters<typeof webpack.experiments.schemes.VirtualUrlPlugin>[0];
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
3
|
+
export declare const app_vm: VirtualModules;
|
|
4
|
+
export declare const docs_vm: VirtualModules;
|
|
5
|
+
export declare const example_vm: VirtualModules;
|
|
6
|
+
export declare const scope_vm: VirtualModules;
|
|
7
|
+
export declare const virtual_vm: VirtualModules;
|
|
5
8
|
export {};
|
package/lib/vm/modules.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as e}from"node:path";import{getAppEntry as
|
|
1
|
+
import{join as e}from"node:path";import{getAppEntry as o,getAppFallback as t,getAppMergeRouter as r,getAppNormalizeCss as m,getAppPrefixRouter as s,getAppRem as a,getAppScope as c,getAppSuspense as n}from"@moneko/mdx";import{updateFileSync as p}from"@moneko/utils";import l from"../commom/has-pkg.mjs";import i,{routeDir as d}from"../commom/paths.mjs";import u from"../commom/reactive-object.mjs";import f from"../commom/require.mjs";import v from"../commom/rule.mjs";import{CONFIG as x}from"../config.mjs";import{updateMocks as j}from"../dev/mock.mjs";import g from"../plugin/module-federation.mjs";import{app_schema as y,APPTYPE as D,docs_schema as h,example_schema as $,FRAMEWORK as _,isLibrary as k,virtual_schema as b}from"../process-env.mjs";import C from"../utils/create-types.mjs";import{generateDeclaration as O}from"../utils/dts.mjs";import{md5 as P,node_modules as z,transformModule as w}from"../utils/index.mjs";import M from"./coverage.mjs";import{comment as S,getDocs as q}from"./docs.mjs";import{examples as E,generatorExample as J}from"./example.mjs";import N from"./info.mjs";import{generateLocales as A}from"./locales.mjs";import B from"./render-app.mjs";import{getRouter as F}from"./routes.mjs";let G=new u({});G.on("change",()=>{p(z(`@types/$${y}/index.d.ts`),Object.values(G.data).join("\n"))});export const app_vm={mock:{source:e=>(e.addContextDependency(i.mockPath),j(),"export default null;")},env:{source:()=>{let e=`${y}:env`,o=w(x.env);return G.setData(e,C(e,O(o,e))),o}},info:{source:o=>{let t=`${y}:info`,r=e(i.programPath,"package.json");o.addDependency(r),delete f.cache[r];let m=w({...f(r),...N});return G.setData(t,C(t,O(m,t))),m}},render:{type:".tsx",source:()=>"react"===_?B:""},entry:{type:".tsx",source:()=>{let t=`${y}:entry`,r=o(e(x.alias["@"],"./index.ts"),!!g.length,!!x.rem,!!x.normalizeCss,D,_);return G.setData(t,C(t,O(r,t))),r}},fallback:{source:()=>{let e=`${y}:fallback`,o=t(x.fallbackCompPath);return G.setData(e,C(e,O(o,e))),o}},"merge-router":r(),"prefix-router":s(),suspense:{type:".tsx",source:()=>n(D,_)},routes:{source:e=>(e.addContextDependency(d),F())},locals:{source:o=>{let t=e(x.alias["@"],"./locales");return o.addContextDependency(t),A()}}};x.normalizeCss&&(app_vm.normalize={type:".css",source:m}),x.rem&&(app_vm.rem=a(x.rem?.designSize||1680));export const docs_vm={};export const example_vm={};export const scope_vm={};if(k){for(let o of(scope_vm.components={source:()=>{let o=!1,t=e(x.alias["@"],"./scope.tsx"),r=e(x.alias["@"],"./scope.ts");return l(t)?o=t:l(r)&&(o=r),o?c(o,"@/scope"):"export defatlu {}"}},docs_vm.coverage={source:e=>(e.addDependency(i.coveragePath),M(i.coveragePath))},docs_vm.docs={source:()=>q()},docs_vm.example={source:e=>{e.addContextDependency(i.componentsPath),J();let o={};return Object.keys(E.data).forEach(e=>{Object.assign(o,{[e]:`rr(() => import('${e}'))rr`})}),`export default ${JSON.stringify(o).replace(v.extract_func,"$1")}`}},S))docs_vm[o[0].replace(`${h}:`,"")]={type:".txt",source:()=>S.getData(o[0]),version:()=>P(S.getData(o[0]))};for(let e of(E.on("change",e=>{example_vm[e.replace(`${$}:`,"")]={source:o=>(o.addDependency(e),E.getData(e))}}),E))example_vm[e[0].replace(`${$}:`,"")]={source:()=>E.getData(e[0]),version:()=>P(E.getData(e[0]))}}export const virtual_vm={};let H=new u({});for(let e in H.on("change",()=>{p(z(`@types/$${b}/index.d.ts`),Object.values(H.data).join("\n"))}),x.virtualModule){if(!Object.hasOwn(x.virtualModule,e))continue;let o=w(x.virtualModule[e]);virtual_vm[e]=o;let t=`${b}:${e}`;H.setData(t,C(t,O(o,t)))}
|
package/lib/vm/render-app.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default
|
|
1
|
+
declare const code: string;
|
|
2
|
+
export default code;
|
package/lib/vm/render-app.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{CONFIG as e}from"../config.mjs";import{
|
|
2
|
-
import ReactDOM from '${
|
|
1
|
+
import{CONFIG as e}from"../config.mjs";import{app_schema as r,APPTYPE as t,frameworkVersion as o,isDev as n}from"../process-env.mjs";let a=o<18,c="hash"===e.routerMode,s=c?"HashRouter":"BrowserRouter",m=e.strict?"StrictMode":"",p=`<${m}><${s} basename={${c?'"/"':"basename"}} window={window}><ErrorBoundary><App /></ErrorBoundary></${s}></${m}>`,i=n&&e.refresh&&e.env.injectRemoteReactRefresh?"window.__REACT_DEVTOOLS_GLOBAL_HOOK__.inject(ReactDOM);":"",u=`
|
|
2
|
+
import ReactDOM from '${a?"react-dom":"react-dom/client"}';
|
|
3
3
|
import React, { StrictMode, type ReactElement } from 'react';
|
|
4
4
|
import { ErrorBoundary } from '@moneko/react';
|
|
5
|
-
import routes from '
|
|
6
|
-
import { ${
|
|
5
|
+
import routes from '${r}:routes';
|
|
6
|
+
import { ${s}, useRoutes } from 'react-router-dom';
|
|
7
7
|
|
|
8
|
-
${
|
|
8
|
+
${i}
|
|
9
9
|
type RenderAppProps = {
|
|
10
10
|
container?: HTMLElement;
|
|
11
11
|
basename?: string;
|
|
@@ -23,8 +23,8 @@ export function App(props: RenderAppProps) {
|
|
|
23
23
|
function renderApp(props: RenderAppProps = {}) {
|
|
24
24
|
const { container, basename = "${e.basename}", language, ...args } = props;
|
|
25
25
|
const _container = container?.querySelector('#root') || document.getElementById('root');
|
|
26
|
-
${"micro"===
|
|
27
|
-
${
|
|
26
|
+
${"micro"===t?"window.mainApp = { ...args, container: _container as HTMLElement };":""}
|
|
27
|
+
${a?`ReactDOM.${n?"render":"hydrate"}(${p}, _container);return () => ReactDOM.unmountComponentAtNode(_container as Element);`:`const instance = ReactDOM.createRoot(_container as HTMLElement);instance.render(${p});return instance.unmount;`}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export default renderApp;`;export default
|
|
30
|
+
export default renderApp;`;export default u;
|
package/lib/vm/routes.d.mts
CHANGED
package/lib/vm/routes.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateRouter as o}from"@moneko/mdx";import{routeDir as
|
|
1
|
+
import{generateRouter as o}from"@moneko/mdx";import{routeDir as m}from"../commom/paths.mjs";import{CONFIG as r}from"../config.mjs";import{FRAMEWORK as t,isLibrary as e}from"../process-env.mjs";let i=e?"@pkg":"@/pages";export function getRouter(){return!1===r.htmlPluginOption?"":o(m,`${r.alias["@"]}/router/index.ts`,t,i,e,"6")}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "4.0.0-bate.
|
|
3
|
+
"version": "4.0.0-bate.2",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
"dependencies": {
|
|
131
131
|
"@moneko/convert": "1.1.3",
|
|
132
132
|
"@moneko/eslint": "1.9.14",
|
|
133
|
-
"@moneko/mdx": "1.0.
|
|
133
|
+
"@moneko/mdx": "1.0.2",
|
|
134
134
|
"@moneko/raw-import": "1.1.1",
|
|
135
135
|
"@moneko/request": "1.6.2",
|
|
136
136
|
"@moneko/stylelint": "1.6.0",
|
|
@@ -138,7 +138,6 @@
|
|
|
138
138
|
"@moneko/utils": "0.3.3",
|
|
139
139
|
"@swc/core": "1.13.5",
|
|
140
140
|
"browserslist": "4.27.0",
|
|
141
|
-
"chokidar": "4.0.3",
|
|
142
141
|
"core-js": "3.46.0",
|
|
143
142
|
"core-js-compat": "3.46.0",
|
|
144
143
|
"husky": "9.1.7",
|
|
@@ -147,14 +146,11 @@
|
|
|
147
146
|
"lightningcss": "1.30.2",
|
|
148
147
|
"marked-completed": "1.2.14",
|
|
149
148
|
"memfs": "4.50.0",
|
|
150
|
-
"mini-css-extract-plugin": "2.9.4",
|
|
151
|
-
"style-loader": "4.0.0",
|
|
152
149
|
"swc-loader": "0.2.6",
|
|
153
150
|
"typescript": "5.9.3",
|
|
154
151
|
"webpack": "5.102.1",
|
|
155
152
|
"webpack-hot-middleware": "2.26.1",
|
|
156
|
-
"webpack-merge": "6.0.1"
|
|
157
|
-
"webpack-virtual-modules": "0.6.2"
|
|
153
|
+
"webpack-merge": "6.0.1"
|
|
158
154
|
},
|
|
159
155
|
"devDependencies": {
|
|
160
156
|
"@moneko/css": "1.2.0",
|
package/typings/global.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
RuleSetRule,
|
|
13
13
|
WebpackPluginInstance,
|
|
14
14
|
SourceMapDevToolPlugin,
|
|
15
|
+
RuleSetConditionAbsolute,
|
|
15
16
|
} from 'webpack';
|
|
16
17
|
|
|
17
18
|
import type { CopyPluginOption } from '../lib/plugin/copy.mjs';
|
|
@@ -27,11 +28,12 @@ import type { ReactCompilerOption } from '../lib/loader/react-compiler.cjs';
|
|
|
27
28
|
import type { CompressionPluginOptions } from '../lib/plugin/compression.mjs';
|
|
28
29
|
import type { JsxDomExpressions } from '../lib/options/jsx-dom-expressions.mjs';
|
|
29
30
|
import type { ProxyConfig } from '../lib/dev/proxy.mjs';
|
|
30
|
-
import type { VirtualModulePluginOption } from '../lib/plugin/virtual-module.mjs';
|
|
31
31
|
import type { OverrideResolverOption } from '../lib/plugin/override-resolve.mjs';
|
|
32
32
|
import type { OptimizationSplitChunksOptions } from '../lib/options/split-chunk.mjs';
|
|
33
33
|
import type { HtmlPluginOption } from '../lib/plugin/html-plugin.mjs';
|
|
34
|
-
|
|
34
|
+
export interface VirtualModulePluginOption {
|
|
35
|
+
[key: string]: string | object;
|
|
36
|
+
}
|
|
35
37
|
export type { MiniCssExtractPluginOptions, SwcMinifyOptions, TerserMinifyOptions };
|
|
36
38
|
export type MinifierType = 'swc' | 'terser';
|
|
37
39
|
export declare type AppType = 'mobile' | 'site' | 'backstage' | 'micro' | 'library';
|
|
@@ -63,11 +65,11 @@ export type DevtoolOption =
|
|
|
63
65
|
| 'hidden-cheap-module-source-map'
|
|
64
66
|
| 'hidden-source-map';
|
|
65
67
|
export type RulesInclude = {
|
|
66
|
-
css?:
|
|
67
|
-
js?:
|
|
68
|
-
media?:
|
|
69
|
-
font?:
|
|
70
|
-
wasm?:
|
|
68
|
+
css?: RuleSetConditionAbsolute[];
|
|
69
|
+
js?: RuRuleSetConditionAbsolute[];
|
|
70
|
+
media?: RuleSetConditionAbsolute[];
|
|
71
|
+
font?: RuleSetConditionAbsolute[];
|
|
72
|
+
wasm?: RuleSetConditionAbsolute[];
|
|
71
73
|
};
|
|
72
74
|
export interface Theme {
|
|
73
75
|
primaryColor?: string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{resolve as e}from"node:path";import s from"./paths.mjs";export default function(n,t=1){let i=n.replace(/^\/|\/$/g,"").replace(/\\/g,"/"),a=i,d="index.ts",m=i.match(/(.+)\/index\.([^/]+)$/),o=i.match(/(.+)\.([^/]+)$/);m?(a=m[1],d=`index.${m[2]}`):o&&(a=o[1],d=`index.${o[2]}`);let p=!!(a.endsWith("@app/rem")||a.endsWith("app:rem"))||JSON.stringify(["*.css","*.less","*.scss","*.sass"]);return{name:a,main:d,pkg:e(s.nodeModules,a,"package.json"),file:e(s.nodeModules,a,d),meta:`{"name":"${a}","main":"${d}","version":"0.0.${t}","description": "","sideEffects": ${p}}`}}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=exports,r={get getExportCode(){return l},get getImportCode(){return s},get getModuleCode(){return _}};for(var t in r)Object.defineProperty(e,t,{enumerable:!0,get:Object.getOwnPropertyDescriptor(r,t).get});const o=require("./utils.cjs");function s(e,r){let t="";for(let o of e){let{importName:e,url:s,icss:_}=o;r.esModule?_&&r.modules?.namedExport?t+=`import ${r.modules.exportOnlyLocals?"":`${e}, `}* as ${e}_NAMED___ from ${s};
|
|
2
|
-
`:t+=`import ${e} from ${s};
|
|
3
|
-
`:t+=`var ${e} = require(${s});
|
|
4
|
-
`}return t?`// Imports
|
|
5
|
-
${t}`:""}function _(e,r,t,s,_){if(s.modules?.exportOnlyLocals===!0)return"";let l=s.sourceMap?`,${(0,o.normalizeSourceMapForRuntime)(e.map,_)}`:"",a=JSON.stringify(e.css),n=`var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(${s.sourceMap});
|
|
6
|
-
`;for(let e of r){let{url:r,media:t,dedupe:o}=e;n+=r?`___CSS_LOADER_EXPORT___.push([module.id, ${JSON.stringify(`@import url(${r});`)}${t?`, ${JSON.stringify(t)}`:""}]);
|
|
7
|
-
`:`___CSS_LOADER_EXPORT___.i(${e.importName}${t?`, ${JSON.stringify(t)}`:o?', ""':""}${o?", true":""});
|
|
8
|
-
`}for(let e of t){let{replacementName:r,importName:t,localName:_}=e;if(_)a=a.replace(RegExp(r,"g"),()=>s.modules?.namedExport?`" + ${t}_NAMED___[${JSON.stringify((0,o.camelCase)(_))}] + "`:`" + ${t}.locals[${JSON.stringify(_)}] + "`);else{let{hash:o,needQuotes:s}=e,_=[...o?[`hash: ${JSON.stringify(o)}`]:[],...s?"needQuotes: true":[]],l=_.length>0?`, { ${_.join(", ")} }`:"";n+=`var ${r} = ___CSS_LOADER_GET_URL_IMPORT___(${t}${l});
|
|
9
|
-
`,a=a.replace(RegExp(r,"g"),()=>`" + ${r} + "`)}}return`${n}// Module
|
|
10
|
-
___CSS_LOADER_EXPORT___.push([module.id, ${a}, ""${l}]);
|
|
11
|
-
`}function l(e,r,t){let s="// Exports\n",_="",l=(e,r)=>{t.modules?.namedExport?_+=`export const ${(0,o.camelCase)(e)} = ${JSON.stringify(r)};
|
|
12
|
-
`:(_&&(_+=`,
|
|
13
|
-
`),_+=` ${JSON.stringify(e)}: ${JSON.stringify(r)}`)};for(let{name:r,value:s}of e)switch(t.modules?.exportLocalsConvention){case"camelCase":{l(r,s);let e=(0,o.camelCase)(r);e!==r&&l(e,s);break}case"camelCaseOnly":l((0,o.camelCase)(r),s);break;case"dashes":{l(r,s);let e=(0,o.dashesCamelCase)(r);e!==r&&l(e,s);break}case"dashesOnly":l((0,o.dashesCamelCase)(r),s);break;default:l(r,s)}for(let e of r){let{replacementName:r,localName:s}=e;if(s){let{importName:l}=e;_=_.replace(RegExp(r,"g"),()=>t.modules?.namedExport?`" + ${l}_NAMED___[${JSON.stringify((0,o.camelCase)(s))}] + "`:t.modules?.exportOnlyLocals?`" + ${l}[${JSON.stringify(s)}] + "`:`" + ${l}.locals[${JSON.stringify(s)}] + "`)}else _=_.replace(RegExp(r,"g"),()=>`" + ${r} + "`)}return t.modules?.exportOnlyLocals?s+=t.modules.namedExport?_:`${t.esModule?"export default":"module.exports ="} {
|
|
14
|
-
${_}
|
|
15
|
-
};
|
|
16
|
-
`:(_&&(s+=t.modules?.namedExport?_:`___CSS_LOADER_EXPORT___.locals = {
|
|
17
|
-
${_}
|
|
18
|
-
};
|
|
19
|
-
`),s+=`${t.esModule?"export default":"module.exports ="} ___CSS_LOADER_EXPORT___;
|
|
20
|
-
`)}
|
|
@@ -1,35 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return _}});const t=require("lightningcss"),r=(e=require("../../commom/log.mjs"))&&e.__esModule?e:{default:e},s=require("../../process-env.mjs"),i=require("./codegen.cjs"),o=require("./utils.cjs");function l(e,t){return JSON.stringify(e.utils.contextify(e.context||e.rootContext,t))}const n=new TextEncoder,u={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 _(e,_){let a=this.async();this.cacheable&&this.cacheable();let{implementation:p,visitor:c,rem:f,...m}=this.getOptions(),d=!!m.modules?.auto?.(this.resourcePath);if(d&&void 0===m.modules.namedExport&&(m.modules.namedExport=!0),p&&"function"!=typeof p.transform)return void a(TypeError(`[lightning-loader]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof p.transform}`));let h=[],R=[],S=[],g=[],L=[];m.modules?.exportOnlyLocals!==!0&&R.unshift({type:"api_import",importName:"___CSS_LOADER_API_IMPORT___",url:l(this,require.resolve("./runtime/api.cjs"))});let O=p?.transform?p.transform:t.transform,y=new Map,E=new Map,v=new Map,C=function(e,t,r,s,i,l){let n=new Map,u=!1,_=new Map,a=new Map,p=-1,c=-1;return{Rule:{import(s){let i;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,o.isUrlRequestable)(u);if(a){let e=u.split("!");e.length>1&&(u=e.pop(),i=e.join("!"))}if(!a)return t.push({url:u,media:_}),{type:"ignored",value:""};let p=i?`${i}!${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)||n.startsWith("#")||(0,o.isDataUrl)(n))return t;p++,i.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=>l(this,(0,o.getPreRequester)(this)(m.importLoaders??0)+e),urlFilter:(0,o.getFilter)(m.url,this.resourcePath),importFilter:(0,o.getFilter)(m.import,this.resourcePath),context:this.context},g,R,L,y,v),M=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:g,imports:S,replacements:L,replacedUrls:E,urlHandler:e=>l(this,(0,o.getPreRequester)(this)(m.importLoaders)+e)});try{f&&!u.Length&&(u.Length=function(e){if("px"===e.unit)return{unit:"rem",value:e.value/16}});let{code:t,map:r,exports:l}=O({filename:this.resourcePath,code:n.encode(e),minify:!0,visitor:{...u,...C,...M,...c},cssModules:!!d&&{pattern:m.modules.localIdentName},sourceMap:this.sourceMap,inputSourceMap:this.sourceMap&&_?JSON.stringify(_):void 0,analyzeDependencies:!1,drafts:{customMedia:!0},include:1,errorRecovery:!1,unusedSymbols:[],...m}),p=t.toString();if(l){for(let e in l)if(Object.prototype.hasOwnProperty.call(l,e)){let t=l[e],r=t.name;for(let e of t.composes)r+=` ${e.name}`;h.push({name:e,value:r})}m.modules.getJSON?.({resourcePath:this.resourcePath,exports:h})}if(0!==y.size)if(s.IS_WINDOW)for(let[e,t]of y.entries())for(let r of R)r.url=r.url.replace(`__MO_LIGHTNINGCSS_LOADER_URL_REPLACE_${e}__`,t);else{let e=this.getResolve({conditionNames:["asset"],mainFields:["asset"],mainFiles:[],extensions:[]});for(let[t,r]of y.entries()){let[s,,]=r.split(/(\?)?#/,3),i=(0,o.requestify)(s,this.rootContext),l=await (0,o.resolveRequests)(e,this.context,[...new Set([i,r])]);for(let e of R)e.url=e.url.replace(`__MO_LIGHTNINGCSS_LOADER_URL_REPLACE_${t}__`,l??r)}}if(0!==v.size){let e=this.getResolve({conditionNames:["style"],extensions:[".css"],mainFields:["css","style","main","..."],mainFiles:["index","..."],restrictions:[/\.css$/i]});for(let[t,r]of v.entries()){let[s,,]=r.split(/(\?)?#/,3),i=(0,o.requestify)(s,this.rootContext),l=await (0,o.resolveRequests)(e,this.context,[...new Set([i,r])]);for(let e of R)e.url=e.url.replace(`__MO_LIGHTNINGCSS_LOADER_IMPORT_URL_REPLACE_${t}__`,l??r)}}if(0!==E.size){let e=this.getResolve({conditionNames:["style"],extensions:[],mainFields:["css","style","main","..."],mainFiles:["index","..."]});for(let[t,r]of E.entries()){let[s,,]=r.split(/(\?)?#/,3),i=(0,o.requestify)(s,this.rootContext),l=await (0,o.resolveRequests)(e,this.context,[...new Set([r,i])]);for(let e of S)e.url=e.url.replace(`__MO_LIGHTNINGCSS_LOADER_ICSS_URL_REPLACE_${t}__`,l??r)}}R.push(...S);let N=(0,i.getImportCode)(R,m),I=(0,i.getModuleCode)({css:p,map:r},g,L,m,this),P=(0,i.getExportCode)(h,L,m);a(null,`${N}${I}${P}`,r&&JSON.parse(r.toString()))}catch(e){a(e),(0,r.default)(e)}}
|
|
@@ -1,29 +0,0 @@
|
|
|
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 {};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";module.exports=function(e,a){if(a||(a={}),"string"!=typeof(e=e&&e.__esModule?e.default:e))return"Buffer"===e.type&&e.data?`data:${function(e){let a=(function(e,a=0){return e.slice(a,16).map(e=>e.toString(16).padStart(2,"0")).join("")})(e,0).toLowerCase();for(let[e,f]of Object.entries({"0001000000":"font/ttf","4f54544f":"font/otf","774f4646":"font/woff","774f4632":"font/woff2","89504e470d0a1a0a":"image/png",ffd8ffe0:"image/jpeg",ffd8ffdb:"image/jpeg",ffd8ffee:"image/jpeg",ffd8ffe000104a4649460001:"image/jpeg","ffd8ffe1????457869660000":"image/jpeg","0000000c4a584c200d0a870a":"image/jxl","474946383761":"image/gif","474946383961":"image/gif","49492a00":"image/tif","49492b00":"image/tif","4d4d002a":"image/tiff","4d4d002b":"image/tiff","52494646????????57454250":"image/webp","424d":"image/bmp","00000100":"image/x-icon","69636e73":"image/x-icns","6674797068656963":"image/heic","667479706d":"image/heic",ff4fff51:"image/jp2","0000000c6a5020200d0a870a":"image/jp2","667479704d534e56":"video/mp4","6674797069736f6d":"video/mp4","1a45dfa3":"video/webm","52494646????????41564920":"video/avi","000001ba":"video/mpeg","000001b3":"video/mpeg","464c56":"video/x-flv",494433:"audio/mpeg","4f676753":"audio/ogg","52494646????????57415645":"audio/wav","664c6143":"audio/flac","4d546864":"audio/midi","3026b2758e66cf11a6d900aa0062ce6c":"application/x-ms-asf"}))if(a.startsWith(e))return f;return"unknown"}(e.data)};base64,${btoa(Array.from(e.data,e=>String.fromCharCode(e)).join(""))}`:e;return(/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),a.hash&&(e+=a.hash),/["'() \t\n]/.test(e)||a.needQuotes)?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=exports,t={get camelCase(){return d},get dashesCamelCase(){return L},get getFilter(){return f},get getPreRequester(){return p},get isDataUrl(){return c},get isUrlRequestable(){return i},get normalizeSourceMapForRuntime(){return C},get requestify(){return u},get resolveRequests(){return n},get urlToRequest(){return l}};for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,r).get});const a=require("node:path"),s=require("node:url"),o=/^[A-Z]:[/\\]|^\\\\/i;function l(e,t){let r;if(""===e)return"";let a=/^[^?]*~/;if(o.test(e))r=e;else if(void 0!==t&&!1!==t&&e.startsWith("/"))switch(typeof t){case"string":r=a.test(t)?t.replace(/([^~/])$/,"$1/")+e.slice(1):t+e;break;case"boolean":r=e;break;default:throw Error(`Unexpected parameters to loader-utils 'urlToRequest': url = ${e}, root = ${t}.`)}else r=/^\.\.?\//.test(e)?e:`./${e}`;return a.test(r)&&(r=r.replace(a,"")),r}async function n(e,t,r){return e(t,r[0]).then(e=>e).catch(a=>{let[,...s]=r;if(0===s.length)throw a;return n(e,t,s)})}function u(e,t){return/^file:/i.test(e)?(0,s.fileURLToPath)(e):/^[a-z][a-z0-9+.-]*:/i.test(e)?e:"/"===e.charAt(0)?l(e,t):l(e)}function i(e){return!(e.startsWith("//")||/^(https?:)?\/\//.test(e))&&(!!(/^file:/i.test(e)||/^[a-z][a-z0-9+.-]*:/i.test(e))||!e.startsWith("#"))}function c(e){return!!/^data:/i.test(e)}function p({loaders:e,loaderIndex:t}){let r=Object.create(null);return a=>{if(r[a])return r[a];if(!1===a)r[a]="";else{let s=e.slice(t,t+1+("number"!=typeof a?0:a)).map(e=>e.request).join("!");r[a]=`-!${s}!`}return r[a]}}function f(e,t){return(...r)=>"function"!=typeof e||e(...r,t)}const g=/^[a-z]:[/\\]|^\\\\/i,h=/^[a-z0-9+\-.]+:/i;function C(e,t){let r=e?e.toJSON():null;return r&&(delete r.file,r.sourceRoot="",r.sources=r.sources?.map(e=>{var r,s;if(e.startsWith("<")||"path-relative"!=("/"===(s=e)[0]?"/"===s[1]?"scheme-relative":"path-absolute":g.test(s)?"path-absolute":h.test(s)?"absolute":"path-relative"))return e;let o=(0,a.dirname)(t.resourcePath),l=(0,a.resolve)(o,e),n=(r=(0,a.relative)(t.rootContext,l),"\\"===a.sep?r.replace(/\\/g,"/"):r);return`moneko://${n}`})),JSON.stringify(r)}function L(e){return e.replace(/-+(\w)/g,(e,t)=>t.toUpperCase())}const d=(e,t)=>{let r,a;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=((e,t)=>{let r=!1,a=!1,s=!1;for(let o=0;o<e.length;o++){let l=e[o];r&&/[\p{Lu}]/u.test(l)?(e=`${e.slice(0,o)}-${e.slice(o)}`,r=!1,s=a,a=!0,o++):a&&s&&/[\p{Ll}]/u.test(l)?(e=`${e.slice(0,o-1)}-${e.slice(o-1)}`,s=a,a=!1,r=!0):(r=l.toLocaleLowerCase(t)===l&&l.toLocaleUpperCase(t)!==l,s=a,a=l.toLocaleUpperCase(t)===l&&l.toLocaleLowerCase(t)!==l)}return e})(e,t.locale)),e=e.replace(/^[_.\- ]+/,""),e=t.preserveConsecutiveUppercase?e.replace(/^[\p{Lu}](?![\p{Lu}])/gu,e=>e.toLowerCase()):e.toLocaleLowerCase(),t.pascalCase&&(e=e.charAt(0).toLocaleUpperCase(t.locale)+e.slice(1)),r=e,a=t,r.replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu,(e,t)=>t.toLocaleUpperCase(a.locale)).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,e=>e.toLocaleUpperCase(a.locale)))};
|
|
@@ -1,16 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import o from"mini-css-extract-plugin";import{CONFIG as r,PUBLICPATH as t}from"../config.mjs";import{isDev as e,isMicro as m}from"../process-env.mjs";import s from"./reslove.mjs";let i=m?t:"../",p={loader:o.loader,options:{publicPath:"/"!==i?i:"../",...r.cssExtract}};e&&(p=s.styleLoader);export default p;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{};
|
package/lib/vm/utils.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function watchFiles(root: string, ignored?: RegExp, call?: VoidFunction): void;
|
package/lib/vm/utils.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{watch as i}from"chokidar";import o from"../commom/sigint-exit.mjs";import{empty as t}from"../utils/index.mjs";export function watchFiles(n,r,e=t){let m=i(n,{ignored:(i,o)=>{if(o)return!o.isDirectory()&&r?.test(i)},persistent:!0,ignoreInitial:!0});m.on("add",e).on("change",e).on("unlink",e),o(function(){m.unwatch(n),m.close()})}
|