@moneko/core 4.0.0-bate.0 → 4.0.0-bate.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/build/common.mjs +1 -1
- package/lib/build-dev.mjs +2 -2
- package/lib/commom/parse-module-meta.d.mts +1 -9
- package/lib/commom/rule.mjs +1 -1
- package/lib/common.mjs +1 -1
- package/lib/config.mjs +1 -1
- package/lib/dev.mjs +1 -1
- 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/css-extract.d.mts +1 -3
- package/lib/plugin/css-module-dts.d.mts +5 -0
- package/lib/plugin/css-module-dts.mjs +1 -0
- package/lib/plugin/virtual-module.d.mts +1 -3
- package/lib/plugins.config.mjs +1 -1
- 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/modules.d.mts +1 -1
- package/lib/vm/modules.mjs +1 -1
- package/package.json +3 -6
- package/typings/global.d.ts +9 -7
- 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.mjs +0 -1
- package/lib/plugin/virtual-module.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.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__\/(.+)/,dev_watch_ignored:/node_modules(?![\\/]
|
|
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__\/(.+)/,dev_watch_ignored:/node_modules(?![\\/]app:)/,extract_func:/"rr\((.+?)\)rr"/g};
|
package/lib/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extname as e,join as t,resolve as
|
|
1
|
+
import{extname as e,join as t,resolve as s}from"node:path";import{argv as o}from"node:process";import a,{config_files as n,CUSTOMCONFIG as i,TMP_DIR as r}from"./commom/paths.mjs";import{OverrideResolverPlugin as l}from"./plugin/override-resolve.mjs";import{isObject as c,md5 as m,node_modules 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{isCI as g,isDev as y,isLibrary as b,NODE_ENV as j,packageJson as v}from"./process-env.mjs";export const outputConfig={path:u(b?"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 s=e(t.filename||"").substring(1);return`assets/${s}/[hash][ext]`},library:{name:`${h.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${v.name}`,pathinfo:y,clean:!0,publicPath:d.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${h.projectName}`};let C={main:["app:entry"]},P=[t(a.corePath,"./polyfills/public-path.mjs")];if(y&&d.refresh&&d.env.injectRemoteReactRefresh&&P.push(t(a.corePath,"./polyfills/inject-react-refresh.mjs")),d.polyfill&&P.push(t(a.corePath,"./polyfills/replace-children.mjs")),d.entry&&("string"==typeof d.entry?C={...C,main:[d.entry]}:Object.keys(d.entry)&&(C=Object.assign(C,d.entry))),"string"==typeof C.main?C.main=[...P,C.main]:Array.isArray(C.main)&&(C.main=[...P,...C.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 k={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:a.webpackCachePath,memoryCacheUnaffected:!y,name:m(`${i}-${j}-${o[2]}`),version:`${v.version}`,buildDependencies:{config:n},maxMemoryGenerations:1};!1===d.cache?k=!1:c(d.cache)&&(k=Object.assign(k,d.cache)),g&&(void 0===d.cache||d.cache&&!d.cache.cacheDirectory)&&(k.cacheDirectory=s(r,v.name));let x={},M={imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(p("app:example"))||t.startsWith(p("app:comment"))||t.startsWith(a.pagesPath)||t.startsWith(a.componentsPath)))}};d.lazyCompilation&&y&&"true"!==process.env.IS_BUILD?c(d.lazyCompilation)?Object.assign(x,M,d.lazyCompilation):Object.assign(x,M):x=!1;export const commonConfig={name:"client",target:"web",devtool:d.devtool,entry:C,mode:d.mode??"production",stats:"errors-only",cache:k,snapshot:{immutablePaths:[a.pnpmNodeModules,a.denoNodeModules,/node_modules\/(?!(app:)\/)/],managedPaths:[a.pnpmNodeModules,a.denoNodeModules,/node_modules\/(?!(app:)\/)/],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:!y,lazyCompilation:x,buildHttp:c(d.buildHttp)?{allowedUris:[],lockfileLocation:s(a.httpCachePath,"http.lock"),cacheLocation:s(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 l(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):[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.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 h}from"webpack-merge";import{diffObject as f}from"./commom/diff-object.mjs";import d,{config_files as u}from"./commom/paths.mjs";import g from"./commom/sigint-exit.mjs";import{devLog as w,PORT as y}from"./dev/config.mjs";import $ from"./dev/generate-progress-html.mjs";import j from"./dev/server.mjs";import v from"./options/reslove.mjs";import{ESLintPlugin as b}from"./plugin/eslint.mjs";import{StylelintPlugin as x}from"./plugin/stylelint.mjs";import{empty as C}from"./utils/index.mjs";import{CONFIG as _,getConfig as P}from"./config.mjs";import{createDevelopmentConfiguration as S}from"./create-development-configuration.mjs";import{outputFileSystem as k}from"./file-system.mjs";import{isLibrary as E,refresh as B}from"./process-env.mjs";let H=!1,I="/____progress____",O={percentage:0,info:""},T="/__hmr__",q=new URLSearchParams({name:"client",path:T.substring(1),dynamicPublicPath:!0,timeout:2e3,reload:!B,quiet:!0,noInfo:!0,overlay:!1,autoConnect:!0}).toString(),G=await S({watchOptions:{stdin:!0,aggregateTimeout:300,ignored:/node_modules\/(?!(
|
|
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 h}from"webpack-merge";import{diffObject as f}from"./commom/diff-object.mjs";import d,{config_files as u}from"./commom/paths.mjs";import g from"./commom/sigint-exit.mjs";import{devLog as w,PORT as y}from"./dev/config.mjs";import $ from"./dev/generate-progress-html.mjs";import j from"./dev/server.mjs";import v from"./options/reslove.mjs";import{ESLintPlugin as b}from"./plugin/eslint.mjs";import{StylelintPlugin as x}from"./plugin/stylelint.mjs";import{empty as C}from"./utils/index.mjs";import{CONFIG as _,getConfig as P}from"./config.mjs";import{createDevelopmentConfiguration as S}from"./create-development-configuration.mjs";import{outputFileSystem as k}from"./file-system.mjs";import{isLibrary as E,refresh as B}from"./process-env.mjs";let H=!1,I="/____progress____",O={percentage:0,info:""},T="/__hmr__",q=new URLSearchParams({name:"client",path:T.substring(1),dynamicPublicPath:!0,timeout:2e3,reload:!B,quiet:!0,noInfo:!0,overlay:!1,autoConnect:!0}).toString(),G=await S({watchOptions:{stdin:!0,aggregateTimeout:300,ignored:/node_modules\/(?!(app:)\/)/},entry:{main:[`${v.hotMiddlewareClient}?${q}`]},plugins:[new p.WatchIgnorePlugin({paths:[/node_modules\/(?!(app:)\/)/,/\.d\.ts$/]}),new p.ProgressPlugin({handler(e,t,...o){let r=o.length?`[${t}] ${o.join(" ")}`:" ";H||(O.info=r,O.percentage=e,H=1===e);let s=_.bar;if(s){let t=s.name||"Build";s.quiet?i.stdout.write(`${r}
|
|
2
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 L(e){let t=e.join(","),o=[r(d.programPath,`${_.alias["@"]}/**/*.{${t}}`).replace(/\\/g,"/")];return E&&o.push(r(d.programPath,`${_.alias["@pkg"]}/**/*.{${t}}`).replace(/\\/g,"/")),o}_.eslint&&G.plugins.push(new b({fix:!0,cache:!0,cacheLocation:`${d.lintCachePath}/.eslintcache`,cacheStrategy:"metadata",files:L(["js","jsx","ts","tsx","json","html","vue"]),..._.eslint})),_.stylelint&&G.plugins.push(new x({fix:!0,cache:!0,cacheLocation:`${d.lintCachePath}/.stylelintcache`,files:L(["css","scss","sass","less","ts","tsx","js","jsx"]),..._.stylelint}));let U=p(G);if(!U)throw Error("无法创建编译器");U.outputFileSystem=k;let F=U.watch(U.options.watchOptions,w);if(!F)throw Error("无法创建监视器");U.hooks.done.tap("client-log",e=>{w(null,e)});let N=`${_.basename}/${T}`.replace(/\/+/g,"/"),R=c(U,{log:!1,path:N,heartbeat:2e3}),J=await j({port:y,root_dir:U.options.output.path,fileSystem:U.outputFileSystem,headers:_.devServer.headers,https:_.devServer.https,host:_.devServer.host,open:_.devServer.open,basename:_.basename,onRequest(e,t){if(!t.writableEnded){if("GET"===e.method){let o=new s(`${_.devServer.https?"https":"http"}://${e.headers.host}${e.url}`);if(o.pathname===I)return t.writeHead(200,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),t.end(JSON.stringify(O)),!0;if(!H)return t.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),t.end($(I,O)),!0;if(o.pathname===N&&"text/event-stream"===e.headers.accept)return R(e,t,C),!0}return!1}}});function K(){i.exit(0)}J.on("close",()=>{F.close(C),R.close()});let M=await Promise.all(u.map(P)),W=h(M[0]||{},M[1]||{});u.forEach(function(t){o(t,async function(){var o;let[r,s]=await Promise.all(u.map(P)),l=h(r||{},s||{}),p=f(W,l);1===Object.keys(p).length&&"proxy"in p?(a(n(`代理更新中...`,"yellow"),!0),a(n(`代理更新完成...`,"green"),!0),_.proxy=l.proxy,W.proxy=l.proxy,W=l):(W=l,m(n(`检测到工程配置${n(`[${t}]`,"blue")}变更, 程序即将重启...`,"yellow"),!0),o=y,e(z?`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=z?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 z="win32"===i.platform;i.on("SIGHUP",function(){J.close(C);let e=t(i.argv[0],i.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",K)}),i.on("exit",function(){J.close(C)}),g(K);
|
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{FRAMEWORK as v,isDev as x,isLibrary as w}from"./process-env.mjs";let P={loader:s(t.corePath,"/loader/lightning-css.cjs"),options:{sourceMap:!!g.sourceMap,targets:c(),rem:!!g.rem,importLoaders:2}},_={loader:l.lessLoader,options:{sourceMap:!!g.sourceMap,lessOptions:{modifyVars:i,javascriptEnabled:!0}}},L=new Map,M=["components","example","mock","site","src","server"].map(d);function I(e){return new Promise(s=>{s([...M,t.corePath,...g.rulesInclude?.[e]?.map(e=>"string"==typeof e?function(e){if(L.has(e))return L.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),L.set(e,[s]),[s]}catch{try{let s=a.resolve(`${e}${o}package.json`).replace(`${o}package.json`,"");L.set(e,[s])}catch{L.set(e,[p(e),p(`.pnpm/${e}`)])}return L.get(e)}}(e):e).flat()||[]])})}r&&M.push(d(r)),g.overrideResolve&&g.overrideResolve.override&&M.push(g.overrideResolve.override);let O=await Promise.all([I("css"),I("js"),I("media"),I("wasm"),I("font")]),C=O[0],k=O[1],b=O[2],N=O[3],B=O[4];l.sassLoader&&(e={loader:l.sassLoader,options:{implementation:await import("sass"),sassOptions:{}}});let E=w&&x&&"true"!==process.env.IS_BUILD&&{test:n.tsdoc,include:g.alias["@pkg"],exclude:[/node_modules\/(?!(app:|@moneko)).+/,n.__tests__],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:N},{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:b},{test:n.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[hash][ext]"},include:b},{test:n.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[hash][ext]"},include:B}],S=g.prefixJsLoader.filter(Boolean)||[];"react"===v&&g.reactCompiler&&S.unshift({loader:s(t.corePath,"/loader/react-compiler.cjs"),options:{...g.reactCompiler,panicThreshold:x?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}}}[v];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:k,extractSourceMap:!0},...g.cssModules.map(e=>({test:s=>n.node_modules_css_module.test(s)&&s.includes(e),use:[P],type:"css/module"})),{test:n.css,use:[P],type:"css/auto",include:C},e&&{test:n.scss,use:[P,e],type:"css/auto",include:C},{test:n.less,use:[P,_],type:"css/auto",include:C},{test:n.markdown,use:[...S,{loader:s(t.corePath,"/loader/mdx.cjs"),options:g.mdx}].filter(Boolean),exclude:[/node_modules\/(?!(app:|@moneko)).+/]}].filter(Boolean)},...g.moduleRules].filter(Boolean)}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{saveFileSync as e}from"@moneko/utils";import{toCamelCase as s}from"../utils/index.mjs";export class CssModuleDtsPlugin{apply(t){t.hooks.compilation.tap(this.name,t=>{t.hooks.succeedModule.tap(this.name,t=>{if(t.buildMeta?.isCSSModule){let o=t.dependencies.map(e=>{if("name"in e){let t=e.name;return`export const ${s(t)}: string;`}return""}).join("\n");e(`${t.resource}.d.ts`,o)}})})}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 r}from"./plugin/html-plugin.mjs";import{ManifestPlugin as n}from"./plugin/manifest/index.mjs";import p from"./plugin/module-federation.mjs";import{customVirtualModules as s,vm as l}from"./vm/modules.mjs";import{CONFIG as a}from"./config.mjs";import{packageJson as m}from"./process-env.mjs";let c="object"==typeof a.compression?a.compression:{},h=e.experiments.schemes.VirtualUrlPlugin,u=[...p,new h(l,"app"),a.virtualModule&&new h(s,"vm"),new i(a.copy),new e.DefinePlugin({"process.env":JSON.stringify(a.env)}),new e.IgnorePlugin({resourceRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),new o,...a.plugins].filter(Boolean);if(a.compression&&u.push(new t({algorithm:a.devServer.https?"brotli":"gzip",test:/\.(js|css|html|svg|ttf|woff|woff2|png|jpg|jpeg)$/,...c})),a.manifest&&u.push(new n(a.manifest)),a.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:m.description,keywords:Array.isArray(m.keywords)?m.keywords.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};a.seo&&(e.relCanonical={rel:"canonical",href:`https://${a.seo.domain}${a.basename}`}),a.htmlPluginOption.meta&&Object.assign(e,a.htmlPluginOption.meta),u.push(new r({...a.htmlPluginOption,meta:e}))}if(a.fixBrowserRouter){let e=a.basename.split("/").filter(Boolean).length,t=`${Array(e).fill("..").join("/")+(e?"/":"")}404.html`,i=a.fixBrowserRouter.pathSegmentsToKeep??e;u.push(new r({filename:a.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>`}))}a.sourceMap&&u.push(new e.SourceMapDevToolPlugin(a.sourceMap));export default u;
|
package/lib/vm/docs.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{sep as e}from"node:path";import{loadFile as t,scanFolderSync as o}from"@moneko/utils";import m from"../commom/reactive-object.mjs";import r from"../commom/rule.mjs";import{CONFIG as a}from"../config.mjs";import{FRAMEWORK as n,framework as p,isLibrary as l,isReact as s,isSolid as c}from"../process-env.mjs";import i from"./generate-doc.mjs";let f={react:"createElement",solid:"createComponent"}[n];export const docs=new m({"app:docs":"export default {}"});export const comment=new m({});export const getCommentPath=function(){let e=/\/(.+?)\.tsx?$/,t=a.alias["@pkg"]?.length;return o=>o.substring(t).replace(/\\/g,"/").replace(e,"app:comment/$1.txt")}();if(l&&!1!==a.htmlPluginOption){let m={},n=`import { ${f}${c?",Dynamic":""} } from "${p}${c?"/web":""}";import SuspenseComp from "app:suspense";function call_then(res) {return {default: ${s?"() =>":""}${f}(${c?"Dynamic":"'div'"}, {${c?"innerHTML: res.default, component: 'div', class: 'n-md-box' ":"dangerouslySetInnerHTML: {__html:res.default}, className: 'n-md-box'"} })};}`;comment.on("change",(t,o)=>{((t,o)=>{let a=t.replace(/app:comment[/\\]/,"").split(e),p=a.pop(),l=a.join("/");m[l]||(m[l]={}),o?m[l][p]&&delete m[l][p]:m[l][p]=`rr(() => ${f}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${t}' */ '${t}').then(call_then)}))rr`;let s={};for(let e in m)Object.prototype.hasOwnProperty.call(m,e)&&(s[e]=Object.values(m[e]));docs.setData("app:docs",`${n}export default ${JSON.stringify(s).replace(r.extract_func,"$1")}`)})(t,o?.length<0)});let l=o(a.alias["@pkg"],["\\.tsx?$"]).filter(e=>!/(^|\/)\.[^\\/\\.]|\.test\./i.test(e)),d=await Promise.all(l.map(async e=>({data:await t(e),file:e})));for(let e=0;e<d.length;e++){let t=d[e];t.data&&comment.setData(getCommentPath(t.file),i(t.data,t.file))}}
|
package/lib/vm/example.d.mts
CHANGED
package/lib/vm/example.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateExample as e}from"@moneko/mdx";import
|
|
1
|
+
import{generateExample as e}from"@moneko/mdx";import t from"../commom/paths.mjs";import o from"../commom/reactive-object.mjs";import r from"../commom/rule.mjs";import{CONFIG as m}from"../config.mjs";import{isDev as p,isLibrary as n}from"../process-env.mjs";import{watchFiles as a}from"./utils.mjs";function l(){if(!n||!1===m.htmlPluginOption)return{};let o=JSON.parse(e(t.componentsPath,"app:example/","6")),p={};for(let e in o)Object.prototype.hasOwnProperty.call(o,e)&&Object.assign(p,{[e]:`rr(() => import('${e}'))rr`});let a={...o,"app:example":`export default ${JSON.stringify(p).replace(r.extract_func,"$1")}`},l={};for(let e in a)Object.prototype.hasOwnProperty.call(a,e)&&(l[e]=a[e]);return l}export const examples=new o(l());export function generatorExample(){let e=l();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&examples.setData(t,e[t])}n&&p&&!1!==m.htmlPluginOption&&"true"!==process.env.IS_BUILD&&a(t.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorExample);
|
package/lib/vm/modules.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import webpack from 'webpack';
|
|
2
2
|
type VirtualModules = ConstructorParameters<typeof webpack.experiments.schemes.VirtualUrlPlugin>[0];
|
|
3
|
-
export declare const vm_schema = "app";
|
|
4
3
|
export declare const vm: VirtualModules;
|
|
4
|
+
export declare const customVirtualModules: VirtualModules;
|
|
5
5
|
export {};
|
package/lib/vm/modules.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as e}from"node:path";import{getAppEntry as t,getAppFallback as o,getAppMdxScope as r,getAppMergeRouter as
|
|
1
|
+
import{join as e}from"node:path";import{getAppEntry as t,getAppFallback as o,getAppMdxScope as r,getAppMergeRouter as m,getAppNormalizeCss as s,getAppPrefixRouter as a,getAppRem as p,getAppSuspense as c}from"@moneko/mdx";import{updateFileSync as l}from"@moneko/utils";import i from"../commom/has-pkg.mjs";import n from"../commom/paths.mjs";import u from"../commom/reactive-object.mjs";import f from"../commom/require.mjs";import{CONFIG as d}from"../config.mjs";import v from"../plugin/module-federation.mjs";import{APPTYPE as j,FRAMEWORK as x,isLibrary as g}from"../process-env.mjs";import y from"../utils/create-types.mjs";import{generateDeclaration as D}from"../utils/dts.mjs";import{node_modules as h,transformModule as k}from"../utils/index.mjs";import b from"./coverage.mjs";import{comment as M,docs as P}from"./docs.mjs";import{examples as z}from"./example.mjs";import C from"./info.mjs";import{locales as O}from"./locales.mjs";import w from"./render-app.mjs";import{route as V}from"./routes.mjs";let $=i(e(d.alias["@"],"./mdx-scope.tsx"))||i(e(d.alias["@"],"./mdx-scope.ts")),q=new u({});q.on("change",()=>{l(h("@types/$vm/index.d.ts"),Object.values(q.data).join("\n"))});export const vm={env:{source:()=>{let e="app:env",t=k(d.env);return q.setData(e,y(e,D(t,e))),t}},info:{source:t=>{let o="app:info",r=e(n.programPath,"package.json");t.addDependency(r),delete f.cache[r];let m=k({...f(r),...C});return q.setData(o,y(o,D(m,o))),m}},render:{type:".tsx",source:()=>"react"===x?w:""},entry:{type:".tsx",source:()=>{let o="app:entry",r=t(e(d.alias["@"],"./index.ts"),!!v.length,!!d.rem,!!d.normalizeCss,j,x);return q.setData(o,y(o,D(r,o))),r}},fallback:{source:()=>{let e="app:fallback",t=o(d.fallbackCompPath);return q.setData(e,y(e,D(t,e))),t}},"merge-router":m(),"prefix-router":a(),suspense:{type:".tsx",source:()=>c(j,x)},routes:{type:".ts",source:e=>(e.addContextDependency(n.pagesPath),V.getData("app:routes"))},locals:{type:".ts",source:()=>O.getData("app:locales")}};if(d.normalizeCss&&(vm.normalize={type:".css",source:s}),d.rem&&(vm.rem=p(d.rem?.designSize||1680)),g){for(let e of(vm.coverage={source:e=>(e.addDependency(n.coveragePath),b(n.coveragePath))},vm["mdx-scope"]={type:".ts",source:()=>{let e="app:mdx-scope",t=$?r($):"export default {}";return q.setData(e,y(e,D(t,e))),t}},vm.docs={source:()=>P.getData("app:docs")},z))vm[e[0].replace("app:","")]={type:".tsx",source:()=>z.getData(e[0])};for(let e of P)vm[e[0].replace("app:","")]={type:".tsx",source:()=>P.getData(e[0])};for(let e of M)vm[e[0].replace("app:","")]={type:".txt",source:()=>M.getData(e[0])}}export const customVirtualModules={};for(let e in d.virtualModule){if(!Object.hasOwn(d.virtualModule,e))continue;let t=k(d.virtualModule[e]);customVirtualModules[e]=t;let o=`vm:${e}`;q.setData(o,y(o,D(t,o)))}
|
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.1",
|
|
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.0
|
|
133
|
+
"@moneko/mdx": "1.0.0",
|
|
134
134
|
"@moneko/raw-import": "1.1.1",
|
|
135
135
|
"@moneko/request": "1.6.2",
|
|
136
136
|
"@moneko/stylelint": "1.6.0",
|
|
@@ -147,14 +147,11 @@
|
|
|
147
147
|
"lightningcss": "1.30.2",
|
|
148
148
|
"marked-completed": "1.2.14",
|
|
149
149
|
"memfs": "4.50.0",
|
|
150
|
-
"mini-css-extract-plugin": "2.9.4",
|
|
151
|
-
"style-loader": "4.0.0",
|
|
152
150
|
"swc-loader": "0.2.6",
|
|
153
151
|
"typescript": "5.9.3",
|
|
154
152
|
"webpack": "5.102.1",
|
|
155
153
|
"webpack-hot-middleware": "2.26.1",
|
|
156
|
-
"webpack-merge": "6.0.1"
|
|
157
|
-
"webpack-virtual-modules": "0.6.2"
|
|
154
|
+
"webpack-merge": "6.0.1"
|
|
158
155
|
},
|
|
159
156
|
"devDependencies": {
|
|
160
157
|
"@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{};
|