@moneko/core 3.26.2 → 3.26.3-beta.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/bin/build-app.d.mts +16 -1
- package/lib/bin/build-app.mjs +1 -1
- package/lib/bin/build.d.mts +2 -1
- package/lib/bin/build.mjs +1 -1
- package/lib/bin/changelog.d.mts +1 -1
- package/lib/bin/changelog.mjs +3 -3
- package/lib/bin/eslint.d.mts +1 -1
- package/lib/bin/eslint.mjs +1 -1
- package/lib/bin/file.d.mts +0 -15
- package/lib/bin/file.mjs +1 -1
- package/lib/bin/git-hooks.d.mts +1 -1
- package/lib/bin/git-hooks.mjs +1 -1
- package/lib/bin/help.d.mts +2 -0
- package/lib/bin/help.mjs +36 -0
- package/lib/bin/index.d.mts +1 -8
- package/lib/bin/index.mjs +1 -1
- package/lib/bin/lessc.mjs +1 -1
- package/lib/bin/runlint.d.mts +1 -1
- package/lib/bin/runlint.mjs +2 -2
- package/lib/bin/start.d.mts +2 -1
- package/lib/bin/start.mjs +1 -1
- package/lib/bin/stylelint.d.mts +1 -1
- package/lib/bin/stylelint.mjs +1 -1
- package/lib/bin/utils/bundle-app.mjs +1 -1
- package/lib/bin/utils/config.d.mts +0 -1
- package/lib/bin/utils/config.mjs +1 -1
- package/lib/bin/utils/setup-swcrc.d.mts +1 -1
- package/lib/bin/utils/setup-swcrc.mjs +1 -1
- package/lib/build/server.mjs +1 -1
- package/lib/build.mjs +1 -1
- package/lib/{utils → commom}/has-pkg.mjs +1 -1
- package/lib/commom/net.mjs +1 -0
- package/lib/commom/os-tmp-dir.mjs +1 -0
- package/lib/commom/parse-module-meta.mjs +1 -0
- package/lib/{paths.d.mts → commom/paths.d.mts} +2 -4
- package/lib/commom/paths.mjs +1 -0
- package/lib/{utils → commom}/reactive-object.d.mts +1 -1
- package/lib/commom/reactive-object.mjs +1 -0
- package/lib/commom/require.mjs +1 -0
- package/lib/common.mjs +1 -1
- package/lib/config.mjs +1 -1
- package/lib/dev/config.mjs +3 -3
- package/lib/dev/json-schema.d.mts +3 -0
- package/lib/dev/json-schema.mjs +1 -0
- package/lib/dev/mock.mjs +1 -1
- package/lib/dev/proxy.d.mts +1 -1
- package/lib/dev.mjs +1 -1
- package/lib/index.d.mts +14 -14
- package/lib/index.mjs +1 -1
- package/lib/loader/css-in-js-minify.cjs +1 -1
- package/lib/loader/css-in-js-minify.d.cts +1 -0
- package/lib/loader/lightning-css/codegen.cjs +20 -0
- package/lib/loader/lightning-css/codegen.d.cts +35 -0
- package/lib/loader/lightning-css/loader.cjs +1 -0
- package/lib/loader/lightning-css/loader.d.cts +29 -0
- package/lib/loader/lightning-css/runtime/api.cjs +1 -0
- package/lib/loader/lightning-css/runtime/get-url.cjs +1 -0
- package/lib/loader/lightning-css/runtime/get-url.d.cts +1 -0
- package/lib/loader/lightning-css/utils.cjs +1 -0
- package/lib/loader/lightning-css/utils.d.cts +16 -0
- package/lib/loader/mdx.cjs +1 -1
- package/lib/loader/react-compiler.cjs +1 -1
- package/lib/loader/solid.d.cts +1 -1
- package/lib/loader/ts-doc.cjs +1 -1
- package/lib/loader/ts-doc.d.cts +1 -1
- package/lib/module.config.mjs +2 -1
- package/lib/options/css-extract.mjs +1 -1
- package/lib/options/html-plugin-option.mjs +1 -1
- package/lib/options/modify-vars.mjs +1 -1
- package/lib/options/reslove.d.mts +0 -1
- package/lib/options/reslove.mjs +1 -1
- package/lib/options/swcrc.mjs +1 -1
- package/lib/plugin/copy.mjs +1 -1
- package/lib/plugin/exposes-declararion.mjs +1 -1
- package/lib/plugin/lightningcss-plugin.mjs +1 -1
- package/lib/plugin/module-federation.mjs +1 -1
- package/lib/plugin/override-resolve.mjs +1 -1
- package/lib/plugin/virtual-module.mjs +1 -1
- package/lib/plugins.config.mjs +1 -1
- package/lib/polyfills/polyfills.mjs +1 -1
- package/lib/polyfills/targets.mjs +1 -1
- package/lib/process-env.d.mts +1 -1
- package/lib/process-env.mjs +1 -1
- package/lib/utils/create-types.mjs +1 -1
- package/lib/utils/dts.mjs +1 -1
- package/lib/utils/fetch-module-federation-dts.mjs +1 -1
- package/lib/utils/index.d.mts +1 -1
- package/lib/utils/index.mjs +1 -1
- package/lib/utils/run.mjs +1 -1
- package/lib/utils/seo.mjs +2 -2
- package/lib/utils/vts.mjs +1 -1
- package/lib/vm/coverage.mjs +1 -1
- package/lib/vm/docs.d.mts +1 -1
- package/lib/vm/docs.mjs +1 -1
- package/lib/vm/example.d.mts +1 -1
- package/lib/vm/example.mjs +1 -1
- package/lib/vm/generate-doc.mjs +1 -1
- package/lib/vm/info.mjs +1 -1
- package/lib/vm/locales.d.mts +1 -1
- package/lib/vm/locales.mjs +2 -2
- package/lib/vm/modules.mjs +1 -1
- package/lib/vm/routes.d.mts +1 -1
- package/lib/vm/routes.mjs +1 -1
- package/lib/vm/utils.mjs +1 -1
- package/package.json +3 -4
- package/typings/global.d.ts +21 -21
- package/lib/bin/version.mjs +0 -1
- package/lib/dev/net.mjs +0 -1
- package/lib/loader/lightningcss.cjs +0 -1
- package/lib/loader/lightningcss.d.cts +0 -7
- package/lib/paths.mjs +0 -1
- package/lib/utils/os-tmp-dir.mjs +0 -1
- package/lib/utils/parse-module-meta.mjs +0 -1
- package/lib/utils/print.d.mts +0 -2
- package/lib/utils/print.mjs +0 -2
- package/lib/utils/reactive-object.mjs +0 -1
- package/lib/utils/require.mjs +0 -1
- package/lib/utils/setup-env.d.mts +0 -6
- package/lib/utils/setup-env.mjs +0 -1
- /package/lib/{utils → commom}/diff-object.d.mts +0 -0
- /package/lib/{utils → commom}/diff-object.mjs +0 -0
- /package/lib/{utils → commom}/esm.d.mts +0 -0
- /package/lib/{utils → commom}/esm.mjs +0 -0
- /package/lib/{utils → commom}/get-current-time.d.mts +0 -0
- /package/lib/{utils → commom}/get-current-time.mjs +0 -0
- /package/lib/{utils → commom}/has-pkg.d.mts +0 -0
- /package/lib/{utils → commom}/log.d.mts +0 -0
- /package/lib/{utils → commom}/log.mjs +0 -0
- /package/lib/{utils → commom}/match-path.d.mts +0 -0
- /package/lib/{utils → commom}/match-path.mjs +0 -0
- /package/lib/{dev → commom}/net.d.mts +0 -0
- /package/lib/{utils → commom}/os-tmp-dir.d.mts +0 -0
- /package/lib/{utils → commom}/parse-module-meta.d.mts +0 -0
- /package/lib/{utils → commom}/require.d.mts +0 -0
- /package/lib/{rule.d.mts → commom/rule.d.mts} +0 -0
- /package/lib/{rule.mjs → commom/rule.mjs} +0 -0
- /package/lib/{bin/utils → commom}/setup-env.d.mts +0 -0
- /package/lib/{bin/utils → commom}/setup-env.mjs +0 -0
- /package/lib/{utils → commom}/sigint-exit.d.mts +0 -0
- /package/lib/{utils → commom}/sigint-exit.mjs +0 -0
- /package/lib/{bin/version.d.mts → loader/lightning-css/runtime/api.d.cts} +0 -0
package/lib/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as
|
|
1
|
+
export{default as hasPkg}from"./commom/has-pkg.mjs";export{getIPv4,getPort}from"./commom/net.mjs";export{default as osTmpDir}from"./commom/os-tmp-dir.mjs";export{CUSTOMCONFIG,default as paths,routeDir,yarnArgv}from"./commom/paths.mjs";export{default as require}from"./commom/require.mjs";export{default as Rule}from"./commom/rule.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{default as jsxDomExpressions}from"./options/jsx-dom-expressions.mjs";export{default as splitChunk}from"./options/split-chunk.mjs";export{APPTYPE,coreName,FRAMEWORK,isDev,isLibrary,isMicro,mainDirectory,PACKAGENAME,PACKAGEVERSION}from"./process-env.mjs";export{resolveProgram,toCamelCase}from"./utils/index.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return o}});const e=require("@babel/core"),t=c(require("@moneko/css/babel")),r=c(require("../commom/log.mjs"));function c(e){return e&&e.__esModule?e:{default:e}}async function o(c){let o=this.async();this.cacheable&&this.cacheable();try{let r=await (0,e.transformAsync)(c,{plugins:[[t.default,{}]],sourceMaps:!!this.sourceMap});o(null,r?.code||void 0,r?.map||void 0)}catch(e){o(e),(0,r.default)(e)}}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),function(e,t){for(var o in t)Object.defineProperty(e,o,{enumerable:!0,get:t[o]})}(exports,{getExportCode:function(){return r},getImportCode:function(){return t},getModuleCode:function(){return o}});const e=require("./utils.cjs");function t(e,t){let o="";for(let r of e){let{importName:e,url:s,icss:_}=r;t.esModule?_&&t.modules?.namedExport?o+=`import ${t.modules.exportOnlyLocals?"":`${e}, `}* as ${e}_NAMED___ from ${s};
|
|
2
|
+
`:o+=`import ${e} from ${s};
|
|
3
|
+
`:o+=`var ${e} = require(${s});
|
|
4
|
+
`}return o?`// Imports
|
|
5
|
+
${o}`:""}function o(t,o,r,s,_){if(s.modules?.exportOnlyLocals===!0)return"";let l=s.sourceMap?`,${(0,e.normalizeSourceMapForRuntime)(t.map,_)}`:"",a=JSON.stringify(t.css),n=`var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(${s.sourceMap});
|
|
6
|
+
`;for(let e of o){let{url:t,media:o,dedupe:r}=e;n+=t?`___CSS_LOADER_EXPORT___.push([module.id, ${JSON.stringify(`@import url(${t});`)}${o?`, ${JSON.stringify(o)}`:""}]);
|
|
7
|
+
`:`___CSS_LOADER_EXPORT___.i(${e.importName}${o?`, ${JSON.stringify(o)}`:r?', ""':""}${r?", true":""});
|
|
8
|
+
`}for(let t of r){let{replacementName:o,importName:r,localName:_}=t;if(_)a=a.replace(RegExp(o,"g"),()=>s.modules?.namedExport?`" + ${r}_NAMED___[${JSON.stringify((0,e.camelCase)(_))}] + "`:`" + ${r}.locals[${JSON.stringify(_)}] + "`);else{let{hash:e,needQuotes:s}=t,_=[...e?[`hash: ${JSON.stringify(e)}`]:[],...s?"needQuotes: true":[]],l=_.length>0?`, { ${_.join(", ")} }`:"";n+=`var ${o} = ___CSS_LOADER_GET_URL_IMPORT___(${r}${l});
|
|
9
|
+
`,a=a.replace(RegExp(o,"g"),()=>`" + ${o} + "`)}}return`${n}// Module
|
|
10
|
+
___CSS_LOADER_EXPORT___.push([module.id, ${a}, ""${l}]);
|
|
11
|
+
`}function r(t,o,r){let s="// Exports\n",_="",l=(t,o)=>{r.modules?.namedExport?_+=`export const ${(0,e.camelCase)(t)} = ${JSON.stringify(o)};
|
|
12
|
+
`:(_&&(_+=`,
|
|
13
|
+
`),_+=` ${JSON.stringify(t)}: ${JSON.stringify(o)}`)};for(let{name:o,value:s}of t)switch(r.modules?.exportLocalsConvention){case"camelCase":{l(o,s);let t=(0,e.camelCase)(o);t!==o&&l(t,s);break}case"camelCaseOnly":l((0,e.camelCase)(o),s);break;case"dashes":{l(o,s);let t=(0,e.dashesCamelCase)(o);t!==o&&l(t,s);break}case"dashesOnly":l((0,e.dashesCamelCase)(o),s);break;default:l(o,s)}for(let t of o){let{replacementName:o,localName:s}=t;if(s){let{importName:l}=t;_=_.replace(RegExp(o,"g"),()=>r.modules?.namedExport?`" + ${l}_NAMED___[${JSON.stringify((0,e.camelCase)(s))}] + "`:r.modules?.exportOnlyLocals?`" + ${l}[${JSON.stringify(s)}] + "`:`" + ${l}.locals[${JSON.stringify(s)}] + "`)}else _=_.replace(RegExp(o,"g"),()=>`" + ${o} + "`)}return r.modules?.exportOnlyLocals?s+=r.modules.namedExport?_:`${r.esModule?"export default":"module.exports ="} {
|
|
14
|
+
${_}
|
|
15
|
+
};
|
|
16
|
+
`:(_&&(s+=r.modules?.namedExport?_:`___CSS_LOADER_EXPORT___.locals = {
|
|
17
|
+
${_}
|
|
18
|
+
};
|
|
19
|
+
`),s+=`${r.esModule?"export default":"module.exports ="} ___CSS_LOADER_EXPORT___;
|
|
20
|
+
`)}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LoaderContext } from 'webpack';
|
|
2
|
+
import type { LightningCssLoaderOption } from './loader.cjs';
|
|
3
|
+
export interface CssImport {
|
|
4
|
+
icss?: boolean;
|
|
5
|
+
importName: string;
|
|
6
|
+
url: string;
|
|
7
|
+
type?: 'url' | string;
|
|
8
|
+
index?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface CssExport {
|
|
11
|
+
name: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ApiParam {
|
|
15
|
+
url?: string;
|
|
16
|
+
importName?: string;
|
|
17
|
+
layer?: string;
|
|
18
|
+
supports?: string;
|
|
19
|
+
media?: string;
|
|
20
|
+
dedupe?: boolean;
|
|
21
|
+
index?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ApiReplacement {
|
|
24
|
+
replacementName: string;
|
|
25
|
+
localName?: string;
|
|
26
|
+
importName: string;
|
|
27
|
+
needQuotes?: boolean;
|
|
28
|
+
hash?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function getImportCode(imports: CssImport[], options: LightningCssLoaderOption): string;
|
|
31
|
+
export declare function getModuleCode(result: {
|
|
32
|
+
map: void | Uint8Array;
|
|
33
|
+
css: string;
|
|
34
|
+
}, api: ApiParam[], replacements: ApiReplacement[], options: LightningCssLoaderOption, loaderContext: LoaderContext<LightningCssLoaderOption>): string;
|
|
35
|
+
export declare function getExportCode(exports: CssExport[], replacements: ApiReplacement[], options: LightningCssLoaderOption): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return u}});const t=require("lightningcss"),r=(e=require("../../commom/log.mjs"))&&e.__esModule?e:{default:e},s=require("./codegen.cjs"),i=require("./utils.cjs");function o(e,t){return JSON.stringify(e.utils.contextify(e.context||e.rootContext,t))}const l=new TextEncoder,n={Declaration:{custom(e){if("content"===e.name&&1===e.value.length){let t=e.value[0];if("token"===t.type&&"string"===t.value.type)return[{property:e.name,raw:JSON.stringify(t.value.value.replace(/[\u4e00-\u9faF]/g,function(e){return`\\${e.charCodeAt(0).toString(16)}`}))}]}}}};async function u(e,u){let _=this.async();this.cacheable&&this.cacheable();let{implementation:a,visitor:p,rem:c,...f}=this.getOptions(),m=!!f.modules?.auto?.(this.resourcePath);if(m&&void 0===f.modules.namedExport&&(f.modules.namedExport=!0),a&&"function"!=typeof a.transform){_(TypeError(`[lightning-loader]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof a.transform}`));return}let d=[],h=[],R=[],S=[],g=[];f.modules?.exportOnlyLocals!==!0&&h.unshift({type:"api_import",importName:"___CSS_LOADER_API_IMPORT___",url:o(this,require.resolve("./runtime/api.cjs"))});let y=a?.transform?a.transform:t.transform,L=new Map,O=new Map,E=new Map,v=function(e,t,r,s,o,l){let n=new Map,u=!1,_=new Map,a=new Map,p=-1,c=-1;return{Rule:{import(s){let o;if(e.importFilter&&!e.importFilter(s.value.url,s.value.media))return s;let u=s.value.url;c++,l.set(c,u),u=`__MO_LIGHTNINGCSS_LOADER_IMPORT_URL_REPLACE_${c}__`;let _=s.value.media.mediaQueries.length?JSON.stringify(s.value.media.mediaQueries):void 0,a=(0,i.isUrlRequestable)(u);if(a){let e=u.split("!");e.length>1&&(u=e.pop(),o=e.join("!"))}if(!a)return t.push({url:u,media:_}),{type:"ignored",value:""};let p=o?`${o}!${u}`:u,f=n.get(p);if(!f){f=`___CSS_LOADER_AT_RULE_IMPORT_${n.size}___`,n.set(p,f);let t=e.urlHandler(p);r.push({type:"rule_import",importName:f,url:t})}return t.push({importName:f,media:_}),{type:"ignored",value:""}}},Url:t=>(function(t){let l,n=t.url;if(!e.urlFilter(n)||(0,i.isDataUrl)(n))return t;p++,o.set(p,n);let[,c,f]=(n=`__MO_LIGHTNINGCSS_LOADER_URL_REPLACE_${p}__`).split(/(\?)?#/,3),m=n.split("!");m.length>1&&(n=m.pop(),l=m.join("!"));let d=c?"?":"";d+=f?`#${f}`:"",u||(r.push({type:"get_url_import",importName:"___CSS_LOADER_GET_URL_IMPORT___",url:JSON.stringify(require.resolve("./runtime/get-url.cjs")),index:-1}),u=!0);let h=l?`${l}!${n}`:n,R=_.get(h);R||(R=`___CSS_LOADER_URL_IMPORT_${_.size}___`,_.set(h,R),r.push({type:"url",importName:R,url:JSON.stringify(h),index:p}));let S=JSON.stringify({newUrl:h,hash:d,needQuotes:!1}),g=a.get(S);return g||(g=`___CSS_LOADER_URL_REPLACEMENT_${a.size}___`,a.set(S,g),s.push({replacementName:g,importName:R,hash:d,needQuotes:!1})),{loc:t.loc,url:g}})(t)}}({urlHandler:e=>o(this,(0,i.getPreRequester)(this)(f.importLoaders??0)+e),urlFilter:(0,i.getFilter)(f.url,this.resourcePath),importFilter:(0,i.getFilter)(f.import,this.resourcePath),context:this.context},S,h,g,L,E),C=function({apis:e,imports:t,replacements:r,replacedUrls:s,urlHandler:i}){let o=-1,l=-1;return{Declaration:{composes(n){if("unparsed"===n.property)return;let u=n.value.from;if(u?.type!=="file")return;let _=u.value;if(!_)return;o++,s.set(o,_),_=`__MO_LIGHTNINGCSS_LOADER_ICSS_URL_REPLACE_${o}__`;let a=`___CSS_LOADER_ICSS_IMPORT_${t.length}___`;t.push({type:"icss_import",importName:a,icss:!0,url:i(_),index:o}),e.push({importName:a,dedupe:!0,index:o});let p=[];for(let e of n.value.names){l++;let t=`___CSS_LOADER_ICSS_IMPORT_${o}_REPLACEMENT_${l}___`;r.push({replacementName:t,importName:a,localName:e}),p.push(t)}return{property:"composes",value:{loc:n.value.loc,names:p,from:u}}}}}}({apis:S,imports:R,replacements:g,replacedUrls:O,urlHandler:e=>o(this,(0,i.getPreRequester)(this)(f.importLoaders)+e)});try{c&&!n.Length&&(n.Length=function(e){if("px"===e.unit)return{unit:"rem",value:e.value/16}});let{code:t,map:r,exports:o}=y({filename:this.resourcePath,code:l.encode(e),minify:!0,visitor:{...n,...v,...C,...p},cssModules:!!m&&{pattern:f.modules.localIdentName},sourceMap:this.sourceMap,inputSourceMap:this.sourceMap&&u?JSON.stringify(u):void 0,analyzeDependencies:!1,drafts:{customMedia:!0},include:1,errorRecovery:!1,unusedSymbols:[],...f}),a=t.toString();if(o){for(let e in o)if(Object.prototype.hasOwnProperty.call(o,e)){let t=o[e],r=t.name;for(let e of t.composes)r+=` ${e.name}`;d.push({name:e,value:r})}f.modules.getJSON?.({resourcePath:this.resourcePath,exports:d})}if(0!==L.size){let e=this.getResolve({conditionNames:["asset"],mainFields:["asset"],mainFiles:[],extensions:[]});for(let[t,r]of L.entries()){let[s]=r.split(/(\?)?#/,3),o=(0,i.requestify)(s,this.rootContext),l=await (0,i.resolveRequests)(e,this.context,[...new Set([o,r])]);for(let e of h)e.url=e.url.replace(`__MO_LIGHTNINGCSS_LOADER_URL_REPLACE_${t}__`,l??r)}}if(0!==E.size){let e=this.getResolve({conditionNames:["style"],extensions:[".css"],mainFields:["css","style","main","..."],mainFiles:["index","..."],restrictions:[/\.css$/i]});for(let[t,r]of E.entries()){let[s]=r.split(/(\?)?#/,3),o=(0,i.requestify)(s,this.rootContext),l=await (0,i.resolveRequests)(e,this.context,[...new Set([o,r])]);for(let e of h)e.url=e.url.replace(`__MO_LIGHTNINGCSS_LOADER_IMPORT_URL_REPLACE_${t}__`,l??r)}}if(0!==O.size){let e=this.getResolve({conditionNames:["style"],extensions:[],mainFields:["css","style","main","..."],mainFiles:["index","..."]});for(let[t,r]of O.entries()){let[s]=r.split(/(\?)?#/,3),o=(0,i.requestify)(s,this.rootContext),l=await (0,i.resolveRequests)(e,this.context,[...new Set([r,o])]);for(let e of R)e.url=e.url.replace(`__MO_LIGHTNINGCSS_LOADER_ICSS_URL_REPLACE_${t}__`,l??r)}}h.push(...R);let M=(0,s.getImportCode)(h,f),N=(0,s.getModuleCode)({css:a,map:r},S,g,f,this),x=(0,s.getExportCode)(d,g,f),P=`${M}${N}${x}`;_(null,P,r&&JSON.parse(r.toString()))}catch(e){_(e),(0,r.default)(e)}}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type CustomAtRules, type TransformOptions } from 'lightningcss';
|
|
2
|
+
import type { LoaderContext } from 'webpack';
|
|
3
|
+
type ExportLocalsConvention = 'asIs' | 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | ((name: string) => string);
|
|
4
|
+
type Mode = 'local' | 'global' | 'pure' | 'icss' | ((resourcePath: string, resourceQuery: string, resourceFragment: string) => 'local' | 'global' | 'pure' | 'icss');
|
|
5
|
+
export interface LightningCssLoaderOption extends Omit<TransformOptions<CustomAtRules>, 'filename' | 'code' | 'inputSourceMap'> {
|
|
6
|
+
rem?: boolean;
|
|
7
|
+
implementation?: typeof import('lightningcss');
|
|
8
|
+
esModule?: boolean;
|
|
9
|
+
modules?: {
|
|
10
|
+
auto?(path: string): boolean;
|
|
11
|
+
localIdentName?: string;
|
|
12
|
+
exportOnlyLocals?: boolean;
|
|
13
|
+
getJSON?(params: {
|
|
14
|
+
resourcePath: string;
|
|
15
|
+
exports: {
|
|
16
|
+
name: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}[];
|
|
19
|
+
}): void;
|
|
20
|
+
namedExport?: boolean;
|
|
21
|
+
exportLocalsConvention?: ExportLocalsConvention;
|
|
22
|
+
mode?: Mode;
|
|
23
|
+
};
|
|
24
|
+
importLoaders?: number;
|
|
25
|
+
url?: string;
|
|
26
|
+
import?(...args: unknown[]): boolean;
|
|
27
|
+
}
|
|
28
|
+
export default function LightningCssLoader(this: LoaderContext<LightningCssLoaderOption>, source: string, prevMap?: string): Promise<void>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";module.exports=function(t){let n=[];return n.toString=function(){return this.map(function(n){let o=function(t,n){let o=t[1]||"",c=t[3];if(!c)return o;if(n&&"function"==typeof btoa){let t=function(t){let n=btoa(unescape(encodeURIComponent(JSON.stringify(t))));return"/*# ".concat("sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(n)," */")}(c);return[o].concat(c.sources?.map(function(t){return"/*# sourceURL=".concat(c.sourceRoot||"").concat(t," */")})).concat([t]).join("\n")}return[o].join("\n")}(n,t);return n[2]?"@media ".concat(n[2]," {").concat(o,"}"):o}).join("")},n.i=function(t,o,c){"string"==typeof t&&(t=[[null,t,""]]);let e={};if(c)for(let t=0;t<this.length;t++){let n=this[t][0];null!==n&&(e[n]=!0)}for(let r=0;r<t.length;r++){let i=[].concat(t[r]);c&&e[i[0]]||(o&&(i[2]?i[2]="".concat(o," and ").concat(i[2]):i[2]=o),n.push(i))}},n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";module.exports=function(e,t){return(t||(t={}),"string"!=typeof(e=e&&e.__esModule?e.default:e))?e:(/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]/.test(e)||t.needQuotes)?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(exports,{camelCase:function(){return d},dashesCamelCase:function(){return h},getFilter:function(){return i},getPreRequester:function(){return u},isDataUrl:function(){return l},isUrlRequestable:function(){return s},normalizeSourceMapForRuntime:function(){return f},requestify:function(){return n},resolveRequests:function(){return o},urlToRequest:function(){return a}});const e=require("node:path"),t=require("node:url"),r=/^[A-Z]:[/\\]|^\\\\/i;function a(e,t){let a;if(""===e)return"";let o=/^[^?]*~/;if(r.test(e))a=e;else if(void 0!==t&&!1!==t&&e.startsWith("/"))switch(typeof t){case"string":a=o.test(t)?t.replace(/([^~/])$/,"$1/")+e.slice(1):t+e;break;case"boolean":a=e;break;default:throw Error(`Unexpected parameters to loader-utils 'urlToRequest': url = ${e}, root = ${t}.`)}else a=/^\.\.?\//.test(e)?e:`./${e}`;return o.test(a)&&(a=a.replace(o,"")),a}async function o(e,t,r){return e(t,r[0]).then(e=>e).catch(a=>{let[,...n]=r;if(0===n.length)throw a;return o(e,t,n)})}function n(e,r){return/^file:/i.test(e)?(0,t.fileURLToPath)(e):/^[a-z][a-z0-9+.-]*:/i.test(e)?e:"/"===e.charAt(0)?a(e,r):a(e)}function s(e){return!e.startsWith("//")&&(!!(/^file:/i.test(e)||/^[a-z][a-z0-9+.-]*:/i.test(e))||!e.startsWith("#"))}function l(e){return!!/^data:/i.test(e)}function u({loaders:e,loaderIndex:t}){let r=Object.create(null);return a=>{if(r[a])return r[a];if(!1===a)r[a]="";else{let o=e.slice(t,t+1+("number"!=typeof a?0:a)).map(e=>e.request).join("!");r[a]=`-!${o}!`}return r[a]}}function i(e,t){return(...r)=>"function"!=typeof e||e(...r,t)}const c=/^[a-z]:[/\\]|^\\\\/i,p=/^[a-z0-9+\-.]+:/i;function f(t,r){let a=t?t.toJSON():null;return a&&(delete a.file,a.sourceRoot="",a.sources=a.sources?.map(t=>{var a;if(t.startsWith("<")||"path-relative"!=("/"===t[0]?"/"===t[1]?"scheme-relative":"path-absolute":c.test(t)?"path-absolute":p.test(t)?"absolute":"path-relative"))return t;let o=(0,e.dirname)(r.resourcePath),n=(0,e.resolve)(o,t),s=(a=(0,e.relative)(r.rootContext,n),"\\"===e.sep?a.replace(/\\/g,"/"):a);return`webpack://${s}`})),JSON.stringify(a)}function h(e){return e.replace(/-+(\w)/g,(e,t)=>t.toUpperCase())}const C=(e,t)=>{let r=!1,a=!1,o=!1;for(let n=0;n<e.length;n++){let s=e[n];r&&/[\p{Lu}]/u.test(s)?(e=`${e.slice(0,n)}-${e.slice(n)}`,r=!1,o=a,a=!0,n++):a&&o&&/[\p{Ll}]/u.test(s)?(e=`${e.slice(0,n-1)}-${e.slice(n-1)}`,o=a,a=!1,r=!0):(r=s.toLocaleLowerCase(t)===s&&s.toLocaleUpperCase(t)!==s,o=a,a=s.toLocaleUpperCase(t)===s&&s.toLocaleLowerCase(t)!==s)}return e},L=e=>e.replace(/^[\p{Lu}](?![\p{Lu}])/gu,e=>e.toLowerCase()),g=(e,t)=>e.replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu,(e,r)=>r.toLocaleUpperCase(t.locale)).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu,e=>e.toLocaleUpperCase(t.locale)),d=(e,t)=>{if(!("string"==typeof e||Array.isArray(e)))throw TypeError("Expected the input to be `string | string[]`");return(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},0===(e=Array.isArray(e)?e.map(e=>e.trim()).filter(e=>e.length).join("-"):e.trim()).length)?"":1===e.length?t.pascalCase?e.toLocaleUpperCase(t.locale):e.toLocaleLowerCase(t.locale):(e!==e.toLocaleLowerCase(t.locale)&&(e=C(e,t.locale)),e=e.replace(/^[_.\- ]+/,""),e=t.preserveConsecutiveUppercase?L(e):e.toLocaleLowerCase(),t.pascalCase&&(e=e.charAt(0).toLocaleUpperCase(t.locale)+e.slice(1)),g(e,t))};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LoaderContext } from 'webpack';
|
|
2
|
+
export declare function urlToRequest(e: string, i?: string | boolean): string;
|
|
3
|
+
export declare function resolveRequests(resolve: (arg0: any, arg1: any) => Promise<any>, context: any, possibleRequests: any[]): Promise<any>;
|
|
4
|
+
export declare function requestify(url: string, rootContext: string): string;
|
|
5
|
+
export declare function isUrlRequestable(url: string): boolean;
|
|
6
|
+
export declare function isDataUrl(url: string): boolean;
|
|
7
|
+
export declare function getPreRequester({ loaders, loaderIndex, }: {
|
|
8
|
+
loaders: {
|
|
9
|
+
request: unknown;
|
|
10
|
+
}[];
|
|
11
|
+
loaderIndex: number;
|
|
12
|
+
}): (number: string | false | number) => any;
|
|
13
|
+
export declare function getFilter<T>(filter: T, resourcePath: string): (...args: T[]) => any;
|
|
14
|
+
export declare function normalizeSourceMapForRuntime(map: any, loaderContext: LoaderContext<unknown>): string;
|
|
15
|
+
export declare function dashesCamelCase(str: string): string;
|
|
16
|
+
export declare const camelCase: (input: string | string[], options?: Record<string, unknown>) => string;
|
package/lib/loader/mdx.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e;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 a}});const t=require("@moneko/mdx"),r=(e=require("../commom/log.mjs"))&&e.__esModule?e:{default:e};async function a(e){let a=this.async();this.cacheable&&this.cacheable();try{let r=await (0,t.mdx)({value:e,filepath:this.resourcePath,...this.getOptions()});a(null,r.code)}catch(e){a(e),(0,r.default)(e)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return a}});const t=(e=require("babel-plugin-react-compiler"))&&e.__esModule?e:{default:e}
|
|
1
|
+
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return a}});const t=require("@babel/core"),r=(e=require("babel-plugin-react-compiler"))&&e.__esModule?e:{default:e};async function a(e){let a=this.async();this.cacheable&&this.cacheable();let s=(0,t.transformSync)(e,{filename:this.resourcePath,sourceMaps:this.sourceMap,plugins:[[r.default,this.getOptions()]]});if(null===s){a(Error(`Failed to transform "${this.resourcePath}"`));return}a(null,s.code||"",null===s.map?void 0:s.map)}
|
package/lib/loader/solid.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { LoaderContext } from 'webpack';
|
|
2
1
|
import { type TransformOptions } from '@babel/core';
|
|
2
|
+
import type { LoaderContext } from 'webpack';
|
|
3
3
|
declare function solidLoader(this: LoaderContext<TransformOptions & {
|
|
4
4
|
refresh?: boolean;
|
|
5
5
|
}>, sourceCode: 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 u}});const e=require("fs"),t=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return u}});const e=require("fs"),t=s(require("../commom/log.mjs")),r=s(require("../commom/parse-module-meta.mjs"));function s(e){return e&&e.__esModule?e:{default:e}}const i={};function u(s){this.cacheable&&this.cacheable();let u=this.resourcePath;if(u.endsWith(".d.ts"))return s;try{let t=(0,e.statSync)(u).mtime.getTime();if(i[u]!==t){Object.assign(i,{[u]:t});let{comment:e,generateDoc:a,getCommentPath:c}=this.getOptions(),{file:n,pkg:o,meta:l}=(0,r.default)(c(u));e.setData(n,a(s,u)),e.setData(o,l)}}catch(e){(0,t.default)(e)}return s}
|
package/lib/loader/ts-doc.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type ReactiveObject from '../utils/reactive-object.mjs';
|
|
2
1
|
import type { LoaderContext } from 'webpack';
|
|
2
|
+
import type ReactiveObject from '../commom/reactive-object.mjs';
|
|
3
3
|
export default function (this: LoaderContext<{
|
|
4
4
|
comment: ReactiveObject<Record<string, string>>;
|
|
5
5
|
generateDoc(content: string, path: string): string;
|
package/lib/module.config.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
let e;import{
|
|
1
|
+
let e;import{join as o,sep as s}from"node:path";import{saveFileSync as t}from"@moneko/utils";import r from"./commom/has-pkg.mjs";import a,{CUSTOMCONFIG as m}from"./commom/paths.mjs";import n from"./commom/reactive-object.mjs";import i from"./commom/require.mjs";import l from"./commom/rule.mjs";import c from"./options/css-extract.mjs";import d from"./options/modify-vars.mjs";import p from"./options/reslove.mjs";import u from"./options/swcrc.mjs";import{getLightningCssTargets as f}from"./polyfills/targets.mjs";import{node_modules as j,resolveProgram as h,toCamelCase as v}from"./utils/index.mjs";import g from"./utils/svg-to-data-uri.mjs";import{comment as y,getCommentPath as x}from"./vm/docs.mjs";import w from"./vm/generate-doc.mjs";import{CONFIG as L}from"./config.mjs";import{FRAMEWORK as P,isDev as M,isLibrary as _}from"./process-env.mjs";let k={loader:o(a.corePath,"/loader/lightning-css/loader.cjs"),options:{sourceMap:!!L.sourceMap,targets:f(),rem:!!L.rem,esModule:!0,modules:{auto(e){if(e){if(e.endsWith(".css")&&!e.endsWith("module.css"))return!1;for(let o=0,s=b.length;o<s;o++)if(e.includes(b[o]))return l.css_module.test(e)}return l.node_modules_css_module.test(e)},localIdentName:"[name][hash]_[local]",namedExport:!0,exportLocalsConvention:"dashesOnly",exportOnlyLocals:!1,getJSON:L.cssModuleDefinition?function(e){Q.setData(`${e.resourcePath}.d.ts`,`${e.exports.map(({name:e,value:o})=>`export const ${v(e)}: '${o}';`).join("\n")}
|
|
2
|
+
`)}:void 0},importLoaders:2}},C={loader:p.lessLoader,options:{sourceMap:!!L.sourceMap,lessOptions:{modifyVars:d,javascriptEnabled:!0}}},O=new Map;function I(e){if(O.has(e))return O.get(e);try{let o;let t=i.resolve(e).split(s),r=t.lastIndexOf("node_modules");return o=-1!==r?t.slice(0,r).join(s):t.join(s),O.set(e,o),o}catch{let o=j(e);return O.set(e,o),o}}let b=[...L.cssModules,`@moneko/${P}`,"neko-ui"].map(I),W=["components","example","mock","site","src","server"].map(h);function $(e){return new Promise(o=>{o([...W,...L.rulesInclude?.[e]?.map(I)||[]])})}m&&W.push(h(m)),L.overrideResolve&&L.overrideResolve.override&&W.push(L.overrideResolve.override);let[R,B,S,z,D]=await Promise.all([$("css"),$("js"),$("media"),$("wasm"),$("font")]);p.sassLoader&&(e={loader:p.sassLoader,options:{implementation:await import("sass"),sassOptions:{}}});let E=_&&M&&{test:l.tsdoc,include:L.alias["@pkg"],exclude:[/node_modules\/(?!(@app|@moneko)).+/,l.__tests__],enforce:"pre",loader:o(a.corePath,"/loader/ts-doc.cjs"),options:{comment:y,generateDoc:w,getCommentPath:x}},J=[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename(e){let o=e.filename;return o&&o.toLocaleLowerCase().endsWith("wasm?url")?"wasm/[name][ext]":"assets/[name][ext]"}}},{test:l.wasm,type:"webassembly/async",include:z},{test:l.txt,type:"asset/source"},{test:l.image,type:"asset",dependency:{not:["url"]},parser:{dataUrlCondition:{maxSize:4096}},generator:{filename:e=>e.filename?.toLocaleLowerCase().endsWith(".svg")?"assets/svg/[name][ext]":"assets/images/[name][ext]",dataUrl:(e,o)=>o.filename.toLocaleLowerCase().endsWith(".svg")?g(e.toString()):e},include:S},{test:l.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:S},{test:l.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:D}],N=L.prefixJsLoader.filter(Boolean)||[];switch(P){case"react":L.reactCompiler&&N.unshift({loader:o(a.corePath,"/loader/react-compiler.cjs"),options:L.reactCompiler});break;case"solid":L.refresh=!1}!M&&r("@moneko/css")&&N.unshift(o(a.corePath,"/loader/css-in-js-minify.cjs"));let Q=new n({});Q.on("change",(e,o)=>{t(e,o)});export default(s=>{let t={loader:p.swcLoader,options:u(s)};return{parser:{javascript:{commonjsMagicComments:!0,dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,importMeta:!0,importMetaContext:!0}},noParse:L.noParse,rules:[!1!==L.htmlPluginOption&&E,{oneOf:[...J,{test:l.js,use:[...N,t],include:B},{test:l.css,use:[c,k],include:R},e&&{test:l.scss,use:[c,k,e],include:R},{test:l.less,use:[c,k,C],include:R},{test:l.markdown,use:[...N,{loader:o(a.corePath,"/loader/mdx.cjs"),options:L.mdx}],exclude:[/node_modules\/(?!(@app|@moneko)).+/]}].filter(Boolean)},...L.moduleRules].filter(Boolean)}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CONFIG as
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as t}from"../config.mjs";import{
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as t}from"../config.mjs";import{coreName as i,description as o,keywords as r,PACKAGENAME as a}from"../process-env.mjs";import{resolveProgram as n}from"../utils/index.mjs";let{favicon:l=`node_modules/${i}/lib/options/favicon.ico`,template:p,...m}=t.htmlPluginOption||{},s=t.seo&&`https://${t.seo.domain}${t.basename}`,d={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:o,keywords:Array.isArray(r)?r.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};s&&Object.assign(d,{relCanonical:{rel:"canonical",href:s}});let c=e({title:t.env?.PROJECTNAME||a.toLocaleUpperCase()||"Title",filename:"index.html",hash:!1,minify:{minifyJS:!0,minifyCSS:!0,collapseWhitespace:!0,removeComments:!0,removeRedundantAttributes:!1,removeScriptTypeAttributes:!1,removeStyleLinkTypeAttributes:!1,removeAttributeQuotes:!0,useShortDoctype:!0},meta:d,tags:[],favicon:l?n(l):l},m,p?{template:p?n(p):void 0}:{templateContent:function({htmlWebpackPlugin:{options:e}}){let t=e.tags,i="",o="";return t&&t.map(function(e){let{tag:t="script",textContent:r="",inject:a="head",...n}=e,l="";for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(l+=`${e}="${n[e]}" `);let p=`<${t} ${l}>${r}</${t}>`;"body"===a?o+=p:i+=p}),`<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<title>${e.title}</title>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import i
|
|
1
|
+
import{CONFIG as i}from"../config.mjs";import o from"./html-plugin-option.mjs";let f=i.prefixCls||"n",n={"@prefix-cls":f,"@ant-prefix":f,"@iconfont-css-prefix":`${f}-icon`,"@favicon":o.favicon};Object.assign(n,i.modifyVars);export default n;
|
package/lib/options/reslove.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../
|
|
1
|
+
import e from"../commom/has-pkg.mjs";import o from"../commom/require.mjs";let s={styleLoader:o.resolve("style-loader"),sassLoader:e("sass-loader"),lessLoader:o.resolve("less-loader"),swcLoader:o.resolve("swc-loader"),transformImports:e("@moneko/transform-imports"),jsxDomExpressions:e("@moneko/jsx-dom-expressions"),hotMiddlewareClient:o.resolve("webpack-hot-middleware/client.js")};export default s;
|
package/lib/options/swcrc.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import
|
|
1
|
+
import{merge as e}from"webpack-merge";import r from"../commom/paths.mjs";import{CONFIG as o}from"../config.mjs";import t,{coreJsVersion as s}from"../polyfills/polyfills.mjs";import{isDev as m,isReact as a,isSolid as l,jsxImportSource as p}from"../process-env.mjs";import i from"./reslove.mjs";let c=function(e){for(let r=0,o=Object.keys(e),t=o.length;r<t;r++)e[o[r]].transform=`${o[r]}/${e[o[r]].transform}`,e[o[r]].style&&(e[o[r]].style=`${o[r]}/${e[o[r]].style}`);return e}(o.importOnDemand||{}),n={include:t(),mode:"entry",coreJs:s};export default((t,s={})=>e({module:{type:"es6",resolveFully:!0},sync:!0,jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:o.polyfill?void 0:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:a&&m,development:m,importSource:p},optimizer:{simplify:!1}},experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[[i.transformImports,c],l&&[i.jsxDomExpressions,{...o.jsxDomExpressions,generate:t?"ssr":"dom",hydratable:t}]].filter(Boolean)}},env:o.polyfill?n:void 0,sourceMaps:!0,parseMap:!0},"function"==typeof o.swcrc?o.swcrc(m):o.swcrc||{},s));
|
package/lib/plugin/copy.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as e}from"path";import
|
|
1
|
+
import{resolve as e}from"node:path";import{loadFile as s,scanFolderSync as t}from"@moneko/utils";import i from"webpack";let l="CopyPlugin",{sources:{RawSource:o}}=i;export class CopyPlugin{constructor(s){this.cacheFiles=[],this.baseFiles=new Set(s.files?.map(s=>e(s))||[]),this.dirs=new Set(s.dirs||[])}getFiles(){let e=new Set(this.baseFiles);for(let s of this.dirs)t(s).forEach(s=>e.add(s));let s={deleted:[],files:[...e]};for(let t of new Set(this.cacheFiles))e.has(t)||s.deleted.push(t);return this.cacheFiles=s.files,s}apply(e){e.hooks.thisCompilation.tap({name:l,stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},e=>{e.hooks.processAssets.tapPromise(l,async()=>{let t=this.getFiles(),i=t.files.map(e=>s(e));(await Promise.all(i)).forEach((s,i)=>{null!==s&&e.emitAsset(t.files[i],new o(s))}),t.deleted.forEach(s=>{e.deleteAsset(s)})})})}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{join as t,resolve as e}from"node:path";import{loadFile as o}from"@moneko/utils";import s from"webpack";import a from"../utils/create-types.mjs";import{generateDeclaration as i}from"../utils/dts.mjs";let n="ModuleFederationExposesDeclarationPlugin";export class ModuleFederationExposesDeclarationPlugin{constructor(t){this.option=t}apply(r){let{exposes:p}=this.option,m=Object.keys(p).map(t=>{let o=t.replace(/\.tsx?$/i,"");return{key:t,name:o,path:e(`types/${this.option.name}/${o}.d.ts`),originPath:p[t]}});r.hooks.thisCompilation.tap({name:n,stage:r.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},e=>{e.hooks.processAssets.tapPromise(n,async()=>{let n=m.map(async e=>{let s=await o(e.originPath);return null!==s?a(t(this.option.name,e.name),i(s,`${e.name}.ts`)):""}),r=await Promise.all(n);e.emitAsset("module-federation.d.ts",new s.sources.RawSource(r.join("\n")),{javascriptModule:!1})})})}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Buffer as s}from"buffer";import{transform as t}from"lightningcss";import i from"webpack";
|
|
1
|
+
import{Buffer as s}from"node:buffer";import{transform as t}from"lightningcss";import i from"webpack";let o=new TextEncoder,{sources:{RawSource:n,SourceMapSource:e},ModuleFilenameHelpers:{matchObject:a}}=i,r="lightning-css-minify",m=/\.(c|le|sc|sa)ss(?:\?.*)?$/i;export class LightningCssMinifyPlugin{constructor(s={}){let{implementation:i,...o}=s;if(i&&"function"!=typeof i.transform)throw TypeError(`[LightningCssMinifyPlugin]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof i.transform}`);this.transform=i?.transform??t,this.options=o}apply(s){let t=JSON.stringify({name:r,version:"0.0.1",options:this.options});s.hooks.compilation.tap(r,s=>{s.hooks.chunkHash.tap(r,(s,i)=>i.update(t)),s.hooks.processAssets.tapPromise({name:r,stage:i.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,additionalAssets:!0},async()=>await this.transformAssets(s)),s.hooks.statsPrinter.tap(r,s=>{s.hooks.print.for("asset.info.minimized").tap(r,(s,{green:t,formatFlag:i})=>s?t(i("minimized")):void 0)})})}async transformAssets(t){let{options:{devtool:i}}=t.compiler,{include:r,exclude:p,test:f,sourceMap:c=void 0===this.options.sourceMap?!!(i&&i.includes("source-map")):this.options.sourceMap,...l}=this.options,h=t.getAssets().filter(s=>!s.info.minimized&&(f||m).test(s.name)&&a({include:r,exclude:p},s.name));await Promise.all(h.map(async i=>{let a;let r=i.source.source(),m="string"==typeof r?o.encode(r):r,p=this.transform({filename:i.name,code:m,minify:!0,sourceMap:c,...l}),f=s.from(p.code);a=c?new e(f,i.name,p.map||"",r,p.map||"",!0):new n(f),t.updateAsset(i.name,a,{...i.info,minimized:!0})}))}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"webpack";import r from"
|
|
1
|
+
import e from"webpack";import r from"../commom/require.mjs";import{CONFIG as t}from"../config.mjs";import s from"../utils/fetch-module-federation-dts.mjs";import{resolveProgram as o}from"../utils/index.mjs";import{ModuleFederationExposesDeclarationPlugin as m}from"./exposes-declararion.mjs";import a from"./external-remotes.mjs";let{NormalModuleReplacementPlugin:i,container:{ModuleFederationPlugin:n}}=e,l={},p=[],f=t.moduleFederation?.map(e=>{let t={},a={},i={};if(Array.isArray(e.remotes))for(let r=0,t=e.remotes.length;r<t;r++){let t=e.remotes[r],o=t.alias||t.name,m=t.filename||"remote_entry.js";if(a[o]=`${t.name}@${t.host}/${m}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)l[t.library[e]]=`${o}/${t.library[e]}`;s(t.host,t.name)}if(Array.isArray(e.exposes)){for(let s=0,m=e.exposes.length;s<m;s++){let m=e.exposes[s];if("string"==typeof m){let e=m.startsWith(".");t[`./${m}`]=r.resolve(e?o(m):m),e&&(i[m]=t[`./${m}`])}else if("[object Object]"===Object.prototype.toString.call(m)){let e=m.path.startsWith(".");t[`./${m.name}`]=r.resolve(e?o(m.path):m.path),e&&(i[`./${m.name}`]=t[`./${m.name}`])}}e.exposes?.length&&p.push(new m({exposes:i,name:e.name}))}return new n({filename:"remote_entry.js",...e,remotes:a,exposes:t})});f.length>0&&(f.push(new a),f.push(new i(/(.*)/,e=>{l[e.request]&&(e.request=l[e.request])})),p.forEach(e=>f.push(e))),t.env.injectRemoteReactRefresh=Object.keys(l).includes("react-dom");export default f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{relative as e}from"path";import
|
|
1
|
+
import{relative as e}from"node:path";import{fileExists as t}from"@moneko/utils";import r from"../commom/paths.mjs";let o="OverrideResolverPlugin";export default class{constructor(e){this.options=e}apply(a){let i=a.ensureHook("resolved"),{override:s,original:l}=this.options;if(s&&l){let p=`./${e(r.programPath,l)}`,n=`./${e(r.programPath,s)}`;a.getHook("existing-file").tapAsync(o,(e,r,h)=>{let m=e.request||e.path;if(m&&m.startsWith(l)&&e.relativePath){let u=m.replace(l,s);if(t(u)){let t=e.relativePath.replace(p,n);return Object.assign(e,{path:u,relativePath:t,__innerRequest_relativePath:t,__innerRequest:t}),a.doResolve(i,e,`${o} 使用目标模块${s}`,r,h)}}return h()})}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"webpack-virtual-modules";import
|
|
1
|
+
import t from"webpack-virtual-modules";import o from"../commom/parse-module-meta.mjs";import i from"../commom/paths.mjs";import{isLibrary as e}from"../process-env.mjs";import{node_modules as s}from"../utils/index.mjs";import{comment as r,docs as l}from"../vm/docs.mjs";import{examples as m}from"../vm/example.mjs";import{locales as n}from"../vm/locales.mjs";import p from"../vm/modules.mjs";import{route as a}from"../vm/routes.mjs";let f={};for(let t in p)if(Object.prototype.hasOwnProperty.call(p,t)){let{file:i,pkg:e,meta:s}=o(t);f[e]=s,f[i]=p[t]}export class VirtualModuleWebpackPlugin{constructor(i={}){this.virtualModules=new t(f),this.options={},this.init=!1;let e={};for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)){let{file:s,pkg:r,meta:l}=o(t),m=i[t],n=m;n=s.endsWith("json")?"string"==typeof m?m:JSON.stringify(m):"string"==typeof m?m:`export default ${JSON.stringify(m)}`,Object.assign(e,{[s]:n,[r]:l})}this.options=e}modify(t,o,e){let r=e||"",l=o.startsWith(i.nodeModules)?o:s(o),m=t.inputFileSystem;for(;m&&m._inputFileSystem;)m=m._inputFileSystem;let n=m?._virtualFiles?.[l];n&&n.contents===r||(this.virtualModules.writeModule(l,r),t.watching?.invalidate())}apply(t){this.virtualModules.apply(t);let o=(o,i)=>{this.modify(t,o,i)};a.on("change",o),n.on("change",o),e&&(m.on("change",o),l.on("change",o),r.on("change",o)),t.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.init){for(let t in this.init=!0,this.options)Object.prototype.hasOwnProperty.call(this.options,t)&&o(t,this.options[t]);for(let t of m)o(t[0],t[1]);for(let t of l)o(t[0],t[1]);for(let t of r)o(t[0],t[1])}})}}
|
package/lib/plugins.config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"html-webpack-plugin";import t from"webpack";import
|
|
1
|
+
import e from"html-webpack-plugin";import t from"webpack";import o from"./options/html-plugin-option.mjs";import{AddEntryAttributePlugin as l}from"./plugin/add-entry-attribute.mjs";import{CopyPlugin as i}from"./plugin/copy.mjs";import r from"./plugin/module-federation.mjs";import{VirtualModuleWebpackPlugin as p}from"./plugin/virtual-module.mjs";import{CONFIG as n}from"./config.mjs";import{isMicro as s}from"./process-env.mjs";let{DefinePlugin:m,SourceMapDevToolPlugin:a,IgnorePlugin:c}=t,u=n.basename.split("/").filter(Boolean).length,f=`${Array(u).fill("..").join("/")+(u?"/":"")}404.html`,{pathSegmentsToKeep:h=u,path:d=f}=n.fixBrowserRouter||{},g=[...r,new p(n.virtualModule),n.htmlPluginOption&&new e(o),n.fixBrowserRouter&&new e({filename:d,inject:!1,templateContent:()=>`<html lang="en"><head><title>${o.title}</title><script>const pathKeep = ${h||u};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>`}),new i(n.copy),s&&new l({test:/main\.bundle\.js$/}),new m({"process.env":JSON.stringify(n.env)}),new c({resourceRegExp:/\/(__(tests|mocks)__|test|spec|e2e)\//}),n.sourceMap&&new a(n.sourceMap),...n.plugins].filter(e=>!!e);export default g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"core-js-compat";import
|
|
1
|
+
import r from"core-js-compat";import o from"../commom/require.mjs";import{getBrowsersTargets as e}from"./targets.mjs";let s=o("core-js/package.json").version;export const coreJsVersion=s.substring(0,s.indexOf(".",2));export default function(){return r({targets:e(),version:coreJsVersion}).list}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let r,t;import e from"browserslist";import{browserslistToTargets as s}from"lightningcss";import o from"../paths.mjs";export function getBrowsersTargets(){return r||(r=e(void 0,{path:o.programPath,env:process.env.NODE_ENV}).filter(r=>!r.endsWith(" TP"))),r}export function getLightningCssTargets(){return t||(t=s(getBrowsersTargets())),t}
|
|
1
|
+
let r,t;import e from"browserslist";import{browserslistToTargets as s}from"lightningcss";import o from"../commom/paths.mjs";export function getBrowsersTargets(){return r||(r=e(void 0,{path:o.programPath,env:process.env.NODE_ENV}).filter(r=>!r.endsWith(" TP"))),r}export function getLightningCssTargets(){return t||(t=s(getBrowsersTargets())),t}
|
package/lib/process-env.d.mts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const SSR: boolean;
|
|
|
12
12
|
export declare const mainDirectory: string;
|
|
13
13
|
export declare const jsxImportSource: string;
|
|
14
14
|
declare const description: any, author: any, repository: any, keywords: any;
|
|
15
|
-
export { description,
|
|
15
|
+
export { author, description, keywords, repository };
|
|
16
16
|
/** 应用名称 */
|
|
17
17
|
export declare const PACKAGENAME: string;
|
|
18
18
|
/** 版本号 */
|
package/lib/process-env.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"./
|
|
1
|
+
import o from"./commom/has-pkg.mjs";import e from"./commom/require.mjs";export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const NODE_ENV=process.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"===process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];let{name:r,version:s,description:t,author:c,repository:p,keywords:i}=e(`${process.cwd()}/package.json`);export const PACKAGENAME=r;export const PACKAGEVERSION=s;export const coreName="@moneko/core";export const isDev="development"===NODE_ENV;export const refresh=isDev&&(o("solid-refresh")||o("react-refresh"));export{c as author,t as description,i as keywords,p as repository};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ModuleDeclarationKind as
|
|
1
|
+
import{resolve as e}from"node:path";import{ModuleDeclarationKind as t,Project as r,SyntaxKind as o}from"ts-morph";let n=new r({useInMemoryFileSystem:!0});export default function(r,a){let d=[],s=e(`@types/${r}.d.ts`),i=n.createSourceFile(s,a,{overwrite:!0});i.forEachDescendant(e=>{e.getKind()===o.DeclareKeyword&&e.replaceWithText(e.isFirstNodeOnLine()?"export":"")});let l=i.getStructure().statements;return i.removeText(),i.addModule({name:`'${r}'`,declarationKind:t.Module,hasDeclareKeyword:!0,statements:l}),d.push(`// remote module: ${r}`),d.push(i.getText(!0)),d.join("\n")}
|
package/lib/utils/dts.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{createDefaultMapFromNodeModules as e,createSystem as t,createVirtualTypeScriptEnvironment as r}from"@typescript/vfs";import i from"typescript";import o from"../commom/rule.mjs";let c={declaration:!0,emitDeclarationOnly:!0,target:i.ScriptTarget.ESNext,skipLibCheck:!0,checkJs:!1,skipDefaultLibCheck:!0},s=e(c),p=r(t(s),[],i,c);export function generateDeclaration(e,t){let r=o.js.test(t)?t:`${t}.ts`;return s.set(r,e),p.createFile(r,e),p.languageService.getEmitOutput(r).outputFiles.reduce((e,t)=>e+=t.text,"")}export function getExportKeys(e,t){s.set(t,e),p.createFile(t,e);let r=p.getSourceFile(t)?.symbol;return Array.from(r?.exports?.keys()||[])}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{updateFile as t}from"@moneko/utils";import
|
|
1
|
+
import{updateFile as t}from"@moneko/utils";import o from"../commom/log.mjs";import{node_modules as e}from"./index.mjs";async function m(m,i){try{let o=`${m.startsWith("//")?`http:${m}`:m}/module-federation.d.ts`,r=await fetch(o).then(t=>t.text());t(e(`@types/${i}/index.d.ts`),r)}catch(t){o(t)}}export default m;
|
package/lib/utils/index.d.mts
CHANGED
|
@@ -14,7 +14,7 @@ export declare function toCamelCase(str: string): string;
|
|
|
14
14
|
* @example
|
|
15
15
|
* convertToCamelCase('hello-world') // 'HelloWorld'
|
|
16
16
|
* convertToCamelCase('foo-bar-ui') // 'FooBarUI'
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
18
|
export declare function convertToCamelCase(name: string): string;
|
|
19
19
|
type ProgramPath<T extends string> = `${T extends string ? T : string}`;
|
|
20
20
|
/** 位于项目根目录下的位置
|
package/lib/utils/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as e}from"path";import
|
|
1
|
+
import{resolve as e}from"node:path";import o from"../commom/paths.mjs";export function toCamelCase(e){return e.replace(/-./g,e=>e.charAt(1).toUpperCase())}export function convertToCamelCase(e){return e.toLowerCase().replace(/-(\w)/g,(e,o)=>o?o.toUpperCase():"").replace(/^./,e=>e.toUpperCase()).replace(/Ui$/,"UI")}export function resolveProgram(t){return e(o.programPath,`./${t}`)}export function node_modules(t){return e(o.nodeModules,`./${t}`)}export function isObject(e){let o=typeof e;return null!==e&&("object"===o||"function"===o)}export function isFunction(e){return["[object Function]","[object AsyncFunction]","[object GeneratorFunction]","[object Proxy]"].includes(Object.prototype.toString.call(e))}export function empty(){}
|
package/lib/utils/run.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"vm";export default function(n,r){return e.runInThisContext(n||"",{filename:r,lineOffset:0,columnOffset:0,displayErrors:!0})}
|
|
1
|
+
import e from"node:vm";export default function(n,r){return e.runInThisContext(n||"",{filename:r,lineOffset:0,columnOffset:0,displayErrors:!0})}
|
package/lib/utils/seo.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{join as o}from"path";import{scanRouter as m,sitemap as t}from"@moneko/mdx";import{
|
|
1
|
+
import{join as o}from"node:path";import{scanRouter as m,sitemap as t}from"@moneko/mdx";import{saveFileSync as r}from"@moneko/utils";import{routeDir as e}from"../commom/paths.mjs";import{outputConfig as p}from"../common.mjs";import{CONFIG as i}from"../config.mjs";import{isLibrary as s}from"../process-env.mjs";import{resolveProgram as n}from"./index.mjs";export default(()=>{let{domain:f,jekyll:a,path:l}=i.seo||{},j=l&&n(l)||p?.path;if(!f||!j)return;let x=`https://${f}${i.basename}`;r(o(j,"CNAME"),f),r(o(j,"robots.txt"),`User-agent: *
|
|
2
2
|
Allow: /
|
|
3
3
|
|
|
4
|
-
Sitemap: ${x}/sitemap.txt`),
|
|
4
|
+
Sitemap: ${x}/sitemap.txt`),r(o(j,"sitemap.txt"),[x,...t(e,x,m(e,s))].join("\n")),a||r(o(j,".nojekyll"),"")});
|
package/lib/utils/vts.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{createContext as e,Script as o}from"node:vm";import{transformFileSync as r}from"@swc/core";import t from"../commom/require.mjs";import*as m from"../index.mjs";let s={inputSourceMap:!1,sourceMaps:!1,module:{type:"commonjs"},jsc:{target:"es2015",parser:{syntax:"typescript"},loose:!1}};export function vts(n,p){let u=r(n,s).code,i={exports:{default:null},require:e=>p?.modules[e]?p.modules[e]:"@moneko/core"===e?m:e.startsWith(".")?void 0:t(t.resolve(e))};return(e(i),new o(u,{filename:n}).runInNewContext(i),p?.namedExport)?i.exports:i.exports.default}
|
package/lib/vm/coverage.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{fileExists as e,parseXml as t}from"@moneko/utils";import{PACKAGENAME as r}from"../process-env.mjs";export default function(o){let i="export default {}";if(e(o)){let e={},s=t(o);if(s){let{metrics:t,package:o}=JSON.parse(s).coverage.project;Object.assign(e,{[r]:t.$});for(let t=0,r=o.length;t<r;t++){let r=o[t];Object.assign(e,{[r.$.name]:r.metrics.$})}}i=`export default ${JSON.stringify(e)}`}return i}
|
package/lib/vm/docs.d.mts
CHANGED
package/lib/vm/docs.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{relative as e,sep as t}from"path";import o from"
|
|
1
|
+
import{relative as e,sep as t}from"node:path";import{loadFile as o,scanFolderSync as m}from"@moneko/utils";import r from"../commom/parse-module-meta.mjs";import a from"../commom/paths.mjs";import n from"../commom/reactive-object.mjs";import s from"../commom/rule.mjs";import{CONFIG as p}from"../config.mjs";import{FRAMEWORK as c,isLibrary as l,isReact as i,isSolid as d}from"../process-env.mjs";import f from"./generate-doc.mjs";let u={react:"createElement",solid:"createComponent"}[c],{file:g,pkg:h,meta:$}=r("@app/docs");export const docsModuleName=g;export const docsModulePkgJson=h;export const docsModuleMeta=$;export const docs=new n({[g]:"export default {}",[h]:$});export const comment=new n({});export const getCommentPath=function(){let e=/\/(.+?)\.tsx?$/,t=p.alias["@pkg"]?.length;return o=>o.substring(t).replace(/\\/g,"/").replace(e,"@app/comment/$1.md")}();if(l&&!1!==p.htmlPluginOption){let n={},l=`import { ${u}${d?",Dynamic":""} } from "${{react:"react",solid:"solid-js"}[c]}${d?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${i?"() =>":""}${u}(${d?"Dynamic":"'div'"}, {${d?"innerHTML: res.default, component: 'div', class: 'n-md-box' ":"dangerouslySetInnerHTML: {__html:res.default}, className: 'n-md-box'"} })};}`,h=(e,o)=>{if(!e.endsWith("package.json")){let m=e.replace(/@app[/\\]comment[/\\]/,"").split(t),r=m.pop(),a=m.join("/");n[a]||(n[a]={}),o?n[a][r]&&delete n[a][r]:n[a][r]=`rr(() => ${u}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let p={};for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(p[e]=Object.values(n[e]));docs.setData(g,`${l}export default ${JSON.stringify(p).replace(s.extract_func,"$1")}`)}};comment.on("change",(t,o)=>{h(e(a.nodeModules,t),o?.length<0)});let $=m(p.alias["@pkg"],["\\.tsx?$"]).filter(e=>!/(^|\/)\.[^\\/\\.]|\.test\./i.test(e));await Promise.all($.map(async e=>({data:await o(e),file:e}))).then(e=>{for(let t=0;t<e.length;t++){let o=e[t];if(o.data){let{file:e,pkg:t,meta:m}=r(getCommentPath(o.file));comment.setData(e,f(o.data,o.file)),comment.setData(t,m)}}})}
|
package/lib/vm/example.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ReactiveObject from '../
|
|
1
|
+
import ReactiveObject from '../commom/reactive-object.mjs';
|
|
2
2
|
export declare const exampleModuleName = "@app/example";
|
|
3
3
|
export declare const examples: ReactiveObject<Record<string, string>>;
|
|
4
4
|
export declare function generatorExample(): void;
|
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 o from"../commom/parse-module-meta.mjs";import t from"../commom/paths.mjs";import m from"../commom/reactive-object.mjs";import r from"../commom/rule.mjs";import{CONFIG as p}from"../config.mjs";import{isDev as a,isLibrary as l}from"../process-env.mjs";import{watchFiles as n}from"./utils.mjs";export const exampleModuleName="@app/example";function s(){if(!l||!1===p.htmlPluginOption)return{};let m=JSON.parse(e(t.componentsPath,`${exampleModuleName}/`)),a={};for(let e in m)Object.prototype.hasOwnProperty.call(m,e)&&Object.assign(a,{[e]:`rr(() => import('${e}'))rr`});let n={...m,[exampleModuleName]:`export default ${JSON.stringify(a).replace(r.extract_func,"$1")}`},s={};for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e)){let{file:t,pkg:m,meta:r}=o(e);s[m]=r,s[t]=n[e]}return s}export const examples=new m(s());export function generatorExample(){let e=s();for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&examples.setData(o,e[o])}l&&a&&!1!==p.htmlPluginOption&&n(t.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorExample);
|
package/lib/vm/generate-doc.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dirname as e}from"path";import t from"typescript";import{CONFIG as n}from"../config.mjs";import l from"../options/md-to-html.mjs";let{ScriptKind:r,ScriptTarget:o,SyntaxKind:i,createSourceFile:a,forEachChild:c,getLeadingCommentRanges:s,isInterfaceDeclaration:u,isQuestionToken:f,isPropertySignature:m,isFunctionTypeNode:p,isUnionTypeNode:g,isMethodSignature:$}=t,d={};function b(e){let t=s(e.getSourceFile().text,e.pos);if(t){let n=e.getSourceFile().text.slice(t[0].pos,t[0].end).match(/\/\*\*([\s\S]*?)\*\//);if(n)return n[1].replaceAll(/^\s*\* ?/gm,"").replace(/\s+$/,"").trim()}}function h(e){if(!e)return;let t=e.match(/@since\s+([^\n]+)/);return t?t[1].trim():void 0}function y(e){if(!e)return;let t=e.match(/@author (\w+)\s*(?:<([^>]+)>)?/);if(t&&t.length>0){let e=t[1].trim(),n=t[2]?.trim(),l=/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(n);return n?l&&(n=`mailto:${n}`):n=`https://github.com/${e}`,`[${e}](${n})`}}function x(e){if(!e)return;let t=e.match(/@ignore\s+([^\n]+)/);return t?t[1].trim():void 0}let A=/(?<!['"])(unknown|any|void|bigint|object|undefined|null|boolean|number|string|symbol)(?!['"])/g;function j(e,t){if(!e)return;let l=e.replaceAll(/\b([A-Z][a-zA-Z0-9]*)\b/g,e=>{if(d[e]){let l=`/${[n.basename,d[e]].join("/").split("/").filter(Boolean).join("/")}`;return t?`[\\color{#009688}{${e}}](${l})`:`[${e}](${l})`}return t?`\\color{#009688}{${e}}`:e});return t&&(l=l.replaceAll(A,e=>`\\color{#009688}{${e}}`)),l}function k(e){if(e)return(function(e){let t;if(!e)return;let n=[];for(;t=/\\color{([^|}]*)\|?([^|}]*)\|?([^|}]*)\|?([^}]*)}{([^}]*)}/g.exec(e);)n.push(t[0]);return e.replaceAll(/[{}[\]()=>]|keyof|typeof|true|false/g,e=>n.some(t=>t.includes(e))?e:`\\color{#569cd6}{${e}}`)})(e)?.replaceAll(/^\s*\|\s*|\s*\|\s*$/gm,"").replaceAll(/\n/g,"<br/>").replaceAll(/\*/g,"\\*").replaceAll(/\|/g,"\\|").replaceAll(/(['"])((?:(?!\1).)*)\1/g,"\\color{#ce9178}{$1$2$1}")}function v(e){if(e)return e.replaceAll(/@example\s*([\s\S]*?)(?=@[a-zA-Z]|\n*$)/g,"").replaceAll(/^@[a-z].+/gm,"").replaceAll(/(\n\s+)+/g,"<br />").replaceAll(/\n/g,"<br />").replaceAll(/(<br \/>)$/g,"")}export default function S(s,A){let S=a(A,s,o.Latest,!0,r.TS),w="";return c(S,l=>{u(l)?w+=function(l){let r=l.name.text;Object.assign(d,{[l.name.text]:e(l.getSourceFile().fileName).replace(n.alias["@pkg"],"")});let o=b(l),a=h(o),c=v(o),s=x(o)?.split("|")||[],u=s.includes("comment"),A=s.includes("initial"),S=s.includes("optional"),w=s.includes("version"),T=s.includes("author"),B=c?`\\color{|4||0.45}{${r}}`:r,z=(function(e){let n=[];if(e.heritageClauses){for(let l of e.heritageClauses)if(l.token===t.SyntaxKind.ExtendsKeyword)for(let e of l.types)n.push(e.getText())}return n})(l)?.map(e=>`<n-tag color="#4c81db" css=".tag{gap:0px;}">${j(k(e))}</n-tag>`),F=[c,B,a&&`\\color{#52c11b|1||0.9}{${a}}`,z.length>0&&`<sub>\`extends\`</sub> ${z.join(" ")}`].filter(Boolean).join(" "),N=`## ${F}`,Z=l.members.filter(e=>m(e)&&e.type?.kind!==i.NeverKeyword||$(e)),K=[];if(Z.length>0){for(let e=0,t=Z.length;e<t;e++){let t=Z[e],n=j(k($(t)?`(${t.parameters.map(e=>`${e.name.getText()}: ${e.type?.getText()||"any"}`).join(", ")}): ${t.type?.getText()||"any"}`:t.type?.getText()||"any"),!0),l=b(t),r=k(t.name.getText());!r||r.startsWith("\\color")||($(t)||function(e){if(e.type){if(!g(e.type))return p(e.type);for(let t of e.type.types)if(p(t))return!0}return!1}(t)||n?.includes("=>")?r=`\\color{#f9a913}{${r}}`:/^["'](.+)["']$/.test(r)||(r=`\\color{#4c81db}{${r}}`));let i=t.questionToken&&f(t.questionToken);K.push([r,!S&&`\\color{${i?"#f9a913":"#52c11b"}\\|\\|\\|0.9}{${i?"✘":"✔"}}`,!u&&k(v(l)),n,!A&&k(function(e){if(!e)return;let t=e.match(/@default\s+([^\n]+)/);return t?t[1].trim():void 0}(l)),!w&&k(h(l)),!T&&(y(l)||y(o)),function(e){if(!e)return;let t=e.match(/@example\s*([\s\S]*?)(?=@[a-zA-Z]|\n*$)/);return t?t[1].trim():void 0}(l)])}let e=!1,t=!1,n=!1,l=!1;for(let r=0,o=K.length;r<o;r++){let o=K[r];!u&&o[2]&&(l=!0),!A&&o[4]&&(n=!0),!w&&o[5]&&(t=!0),!T&&o[6]&&(e=!0)}N+="\n";let r=["属性",!S&&"必要",l&&"说明","类型",n&&"默认值",t&&"版本",e&&"作者"].filter(Boolean).join("|");N+=`|${r}|`;let i=[":-",!S&&":-",l&&":-",":-",n&&":-",t&&":-",e&&":-"].filter(Boolean);N+="\n";let a=i.join("|");N+=`|${a}|`;for(let r=0,o=K.length;r<o;r++){let o=K[r];N+="\n";let i=[(o[7]?`<n-popover arrow="true" trigger="click" content=${JSON.stringify(`<n-md css=.n-md-body{margin-bottom:0;padding:0.5rem;background-color:transparent;backdrop-filter:none;box-shadow:none;}>${o[7]}</n-md>`)}><n-button size="small" type="primary" circle="true" style="margin-right:8px;">?</n-button></n-popover>`:"")+(o[0]||"-"),!S&&(o[1]||"-"),l&&(o[2]||"-"),o[3]||"-",n&&(o[4]||"-"),t&&(o[5]||"-"),e&&(o[6]||"-")].filter(Boolean).join("|");N+=`|${i}|`}N+="\n"}return N+"\n"}(l):t.isEnumDeclaration(l)&&(w+=function(l){let r=l.name.text,o=b(l),i=v(o),a=h(o);Object.assign(d,{[l.name.text]:e(l.getSourceFile().fileName).replace(n.alias["@pkg"],"")});let c=i?`\\color{|4||0.45}{${r}}`:r,s=[i,c,a&&`\\color{#52c11b|1||0.9}{${a}}`].filter(Boolean).join(" "),u=x(o)?.split("|")||[],f=u.includes("comment"),m=u.includes("version"),p=u.includes("author"),g=`## ${s}`;if(l.members.length>0){let e=[];for(let n=0,r=l.members.length;n<r;n++){let r=l.members[n],i=k(r.name.getText()),a=b(r),c=k(function(e){let n=e.initializer;if(n&&t.isStringLiteral(n))return` '${n.text}'`}(r)),s=k(h(a)),u=k(v(a));!i||i.startsWith("\\color")||/^["'](.+)["']$/.test(i)||(i=`\\color{#4c81db}{${i}}`),e.push([i,!f&&u,c,!m&&s,!p&&(y(a)||y(o))])}let n=!1,r=!1,i=!1;for(let t=0,l=e.length;t<l;t++){let l=e[t];!f&&l[1]&&(i=!0),!m&&l[3]&&(r=!0),!p&&l[4]&&(n=!0)}g+="\n";let a=["属性",i&&"说明","值",r&&"版本",n&&"作者"].filter(Boolean).join("|");g+=`|${a}|`;let c=[":-",i&&":-",":-",r&&":-",n&&":-"].filter(Boolean);g+="\n";let s=c.join("|");g+=`|${s}|`;for(let t=0,l=e.length;t<l;t++){let l=e[t];g+="\n";let o=[l[0]||"-",i&&(l[1]||"-"),l[2]||"-",r&&(l[3]||"-"),n&&(l[4]||"-")].filter(Boolean).join("|");g+=`|${o}|`}}return g+"\n\n"}(l))}),l(w)}
|
|
1
|
+
import{dirname as e}from"node:path";import t from"typescript";import{CONFIG as n}from"../config.mjs";import l from"../options/md-to-html.mjs";let{ScriptKind:r,ScriptTarget:o,SyntaxKind:i,createSourceFile:a,forEachChild:c,getLeadingCommentRanges:s,isInterfaceDeclaration:u,isQuestionToken:f,isPropertySignature:m,isFunctionTypeNode:p,isUnionTypeNode:g,isMethodSignature:$}=t,d={};function b(e){let t=s(e.getSourceFile().text,e.pos);if(t){let n=e.getSourceFile().text.slice(t[0].pos,t[0].end).match(/\/\*\*([\s\S]*?)\*\//);if(n)return n[1].replaceAll(/^\s*\* ?/gm,"").replace(/\s+$/,"").trim()}}function h(e){if(!e)return;let t=e.match(/@since\s+([^\n]+)/);return t?t[1].trim():void 0}function y(e){if(!e)return;let t=e.match(/@author (\w+)\s*(?:<([^>]+)>)?/);if(t&&t.length>0){let e=t[1].trim(),n=t[2]?.trim(),l=/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(n);return n?l&&(n=`mailto:${n}`):n=`https://github.com/${e}`,`[${e}](${n})`}}function x(e){if(!e)return;let t=e.match(/@ignore\s+([^\n]+)/);return t?t[1].trim():void 0}let A=/(?<!['"])(unknown|any|void|bigint|object|undefined|null|boolean|number|string|symbol)(?!['"])/g;function j(e,t){if(!e)return;let l=e.replaceAll(/\b([A-Z][a-zA-Z0-9]*)\b/g,e=>{if(d[e]){let l=`/${[n.basename,d[e]].join("/").split("/").filter(Boolean).join("/")}`;return t?`[\\color{#009688}{${e}}](${l})`:`[${e}](${l})`}return t?`\\color{#009688}{${e}}`:e});return t&&(l=l.replaceAll(A,e=>`\\color{#009688}{${e}}`)),l}function k(e){if(e)return(function(e){let t;if(!e)return;let n=[];for(;t=/\\color{([^|}]*)\|?([^|}]*)\|?([^|}]*)\|?([^}]*)}{([^}]*)}/g.exec(e);)n.push(t[0]);return e.replaceAll(/[{}[\]()=>]|keyof|typeof|true|false/g,e=>n.some(t=>t.includes(e))?e:`\\color{#569cd6}{${e}}`)})(e)?.replaceAll(/^\s*\|\s*|\s*\|\s*$/gm,"").replaceAll(/\n/g,"<br/>").replaceAll(/\*/g,"\\*").replaceAll(/\|/g,"\\|").replaceAll(/(['"])((?:(?!\1).)*)\1/g,"\\color{#ce9178}{$1$2$1}")}function v(e){if(e)return e.replaceAll(/@example\s*([\s\S]*?)(?=@[a-zA-Z]|\n*$)/g,"").replaceAll(/^@[a-z].+/gm,"").replaceAll(/(\n\s+)+/g,"<br />").replaceAll(/\n/g,"<br />").replaceAll(/(<br \/>)$/g,"")}export default function S(s,A){let S=a(A,s,o.Latest,!0,r.TS),w="";return c(S,l=>{u(l)?w+=function(l){let r=l.name.text;Object.assign(d,{[l.name.text]:e(l.getSourceFile().fileName).replace(n.alias["@pkg"],"")});let o=b(l),a=h(o),c=v(o),s=x(o)?.split("|")||[],u=s.includes("comment"),A=s.includes("initial"),S=s.includes("optional"),w=s.includes("version"),T=s.includes("author"),B=c?`\\color{|4||0.45}{${r}}`:r,z=(function(e){let n=[];if(e.heritageClauses){for(let l of e.heritageClauses)if(l.token===t.SyntaxKind.ExtendsKeyword)for(let e of l.types)n.push(e.getText())}return n})(l)?.map(e=>`<n-tag color="#4c81db" css=".tag{gap:0px;}">${j(k(e))}</n-tag>`),F=[c,B,a&&`\\color{#52c11b|1||0.9}{${a}}`,z.length>0&&`<sub>\`extends\`</sub> ${z.join(" ")}`].filter(Boolean).join(" "),N=`## ${F}`,Z=l.members.filter(e=>m(e)&&e.type?.kind!==i.NeverKeyword||$(e)),K=[];if(Z.length>0){for(let e=0,t=Z.length;e<t;e++){let t=Z[e],n=j(k($(t)?`(${t.parameters.map(e=>`${e.name.getText()}: ${e.type?.getText()||"any"}`).join(", ")}): ${t.type?.getText()||"any"}`:t.type?.getText()||"any"),!0),l=b(t),r=k(t.name.getText());!r||r.startsWith("\\color")||($(t)||function(e){if(e.type){if(!g(e.type))return p(e.type);for(let t of e.type.types)if(p(t))return!0}return!1}(t)||n?.includes("=>")?r=`\\color{#f9a913}{${r}}`:/^["'](.+)["']$/.test(r)||(r=`\\color{#4c81db}{${r}}`));let i=t.questionToken&&f(t.questionToken);K.push([r,!S&&`\\color{${i?"#f9a913":"#52c11b"}\\|\\|\\|0.9}{${i?"✘":"✔"}}`,!u&&k(v(l)),n,!A&&k(function(e){if(!e)return;let t=e.match(/@default\s+([^\n]+)/);return t?t[1].trim():void 0}(l)),!w&&k(h(l)),!T&&(y(l)||y(o)),function(e){if(!e)return;let t=e.match(/@example\s*([\s\S]*?)(?=@[a-zA-Z]|\n*$)/);return t?t[1].trim():void 0}(l)])}let e=!1,t=!1,n=!1,l=!1;for(let r=0,o=K.length;r<o;r++){let o=K[r];!u&&o[2]&&(l=!0),!A&&o[4]&&(n=!0),!w&&o[5]&&(t=!0),!T&&o[6]&&(e=!0)}N+="\n";let r=["属性",!S&&"必要",l&&"说明","类型",n&&"默认值",t&&"版本",e&&"作者"].filter(Boolean).join("|");N+=`|${r}|`;let i=[":-",!S&&":-",l&&":-",":-",n&&":-",t&&":-",e&&":-"].filter(Boolean);N+="\n";let a=i.join("|");N+=`|${a}|`;for(let r=0,o=K.length;r<o;r++){let o=K[r];N+="\n";let i=[(o[7]?`<n-popover arrow="true" trigger="click" content=${JSON.stringify(`<n-md css=.n-md-body{margin-bottom:0;padding:0.5rem;background-color:transparent;backdrop-filter:none;box-shadow:none;}>${o[7]}</n-md>`)}><n-button size="small" type="primary" circle="true" style="margin-right:8px;">?</n-button></n-popover>`:"")+(o[0]||"-"),!S&&(o[1]||"-"),l&&(o[2]||"-"),o[3]||"-",n&&(o[4]||"-"),t&&(o[5]||"-"),e&&(o[6]||"-")].filter(Boolean).join("|");N+=`|${i}|`}N+="\n"}return N+"\n"}(l):t.isEnumDeclaration(l)&&(w+=function(l){let r=l.name.text,o=b(l),i=v(o),a=h(o);Object.assign(d,{[l.name.text]:e(l.getSourceFile().fileName).replace(n.alias["@pkg"],"")});let c=i?`\\color{|4||0.45}{${r}}`:r,s=[i,c,a&&`\\color{#52c11b|1||0.9}{${a}}`].filter(Boolean).join(" "),u=x(o)?.split("|")||[],f=u.includes("comment"),m=u.includes("version"),p=u.includes("author"),g=`## ${s}`;if(l.members.length>0){let e=[];for(let n=0,r=l.members.length;n<r;n++){let r=l.members[n],i=k(r.name.getText()),a=b(r),c=k(function(e){let n=e.initializer;if(n&&t.isStringLiteral(n))return` '${n.text}'`}(r)),s=k(h(a)),u=k(v(a));!i||i.startsWith("\\color")||/^["'](.+)["']$/.test(i)||(i=`\\color{#4c81db}{${i}}`),e.push([i,!f&&u,c,!m&&s,!p&&(y(a)||y(o))])}let n=!1,r=!1,i=!1;for(let t=0,l=e.length;t<l;t++){let l=e[t];!f&&l[1]&&(i=!0),!m&&l[3]&&(r=!0),!p&&l[4]&&(n=!0)}g+="\n";let a=["属性",i&&"说明","值",r&&"版本",n&&"作者"].filter(Boolean).join("|");g+=`|${a}|`;let c=[":-",i&&":-",":-",r&&":-",n&&":-"].filter(Boolean);g+="\n";let s=c.join("|");g+=`|${s}|`;for(let t=0,l=e.length;t<l;t++){let l=e[t];g+="\n";let o=[l[0]||"-",i&&(l[1]||"-"),l[2]||"-",r&&(l[3]||"-"),n&&(l[4]||"-")].filter(Boolean).join("|");g+=`|${o}|`}}return g+"\n\n"}(l))}),l(w)}
|
package/lib/vm/info.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CONFIG as
|
|
1
|
+
import e from"../commom/require.mjs";import{CONFIG as r}from"../config.mjs";import{APPTYPE as o,author as s,description as m,FRAMEWORK as t,PACKAGENAME as i,PACKAGEVERSION as p,repository as a,SSR as n}from"../process-env.mjs";import{convertToCamelCase as f}from"../utils/index.mjs";let c=e(`${{react:"react",solid:"solid-js"}[t]}/package.json`).version,l="string"==typeof s,d={name:i,projectName:f(i),ssr:n,version:p,base:r.basename,type:o,routerMode:r.routerMode,prefixCls:r.prefixCls,theme:r.theme,description:m,author:l?{name:s}:s,repository:l?{url:a}:a,frameworkVersion:c};export default d;
|