@moneko/core 3.0.0-beta.163 → 3.0.0-beta.165
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/app.d.ts +4 -11
- package/lib/app.js +1 -1
- package/lib/coverage.d.ts +31 -2
- package/lib/coverage.js +1 -1
- package/lib/html-plugin-option.js +1 -1
- package/lib/locales.js +2 -2
- package/lib/module.config.js +1 -1
- package/lib/process-env.d.ts +3 -20
- package/lib/process-env.js +1 -1
- package/lib/webpack.common.js +1 -1
- package/lib/webpack.dev.js +2 -2
- package/package.json +1 -1
- package/typings/global.d.ts +0 -59
- package/lib/define.d.ts +0 -4
- package/lib/define.js +0 -1
package/lib/app.d.ts
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
declare const app: {
|
|
2
|
+
name: string;
|
|
3
|
+
projectName: string;
|
|
4
|
+
version: string;
|
|
2
5
|
base: string;
|
|
6
|
+
type: import("./index.js").AppType;
|
|
3
7
|
routerMode: "browser" | "hash" | "memory";
|
|
4
|
-
mode: "csr" | "ssr";
|
|
5
|
-
locales: boolean;
|
|
6
|
-
favicon: string | false | undefined;
|
|
7
8
|
prefixCls: string | undefined;
|
|
8
9
|
theme: import("./index.js").Theme | undefined;
|
|
9
|
-
type: import("./index.js").AppType;
|
|
10
|
-
projectName: string;
|
|
11
|
-
iconfont: {
|
|
12
|
-
scriptUrl?: string | string[] | undefined;
|
|
13
|
-
extraCommonProps?: Record<string, any> | undefined;
|
|
14
|
-
} | undefined;
|
|
15
|
-
name: string;
|
|
16
|
-
version: string;
|
|
17
10
|
description: string | undefined;
|
|
18
11
|
author: {
|
|
19
12
|
name: string | undefined;
|
package/lib/app.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{readFileSync as e}from"fs";import{CONFIG as r}from"./common.js";import{APPTYPE as o,PACKAGENAME as p,PACKAGEVERSION as s}from"./process-env.js";import{resolveProgramPath as t,toUpperCaseString as a}from"./utils.js";let n={name:p,projectName:JSON.stringify(a(p).replace(/-/g," ")),version:s,base:r.routeBaseName,type:o,routerMode:r.routerMode,prefixCls:r.prefixCls,theme:r.theme,description:process.env.npm_package_description,author:{name:process.env.npm_package_author_name,email:process.env.npm_package_author_email,url:process.env.npm_package_author_url},repository:{type:process.env.npm_package_repository_type,url:process.env.npm_package_repository_url,directory:process.env.npm_package_repository_directory}};if(parseInt(process.versions.node)>14){let r=e(t("package.json"),{encoding:"utf-8"}),{description:o,author:p,repository:s}=JSON.parse(r);n.author="string"==typeof p?{name:p}:p,n.repository="string"==typeof p?{url:s}:s,n.description=o}export default n;
|
package/lib/coverage.d.ts
CHANGED
|
@@ -1,2 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type CoverageType = {
|
|
2
|
+
/** 语句(statement coverage) */
|
|
3
|
+
statements: string;
|
|
4
|
+
/** 语句覆盖: 是不是每个语句都执行了 */
|
|
5
|
+
coveredstatements: string;
|
|
6
|
+
/** 条件(branch coverage) */
|
|
7
|
+
conditionals: string;
|
|
8
|
+
/** 条件覆盖: 是不是每个条件代码块都执行了 */
|
|
9
|
+
coveredconditionals: string;
|
|
10
|
+
/** 函数(function coverage) */
|
|
11
|
+
methods: string;
|
|
12
|
+
/** 函数覆盖: 是不是每个函数都调用了 */
|
|
13
|
+
coveredmethods: string;
|
|
14
|
+
};
|
|
15
|
+
type ProjectCoverageType = {
|
|
16
|
+
/** 元素 */
|
|
17
|
+
elements: string;
|
|
18
|
+
/** 覆盖元素 */
|
|
19
|
+
coveredelements: string;
|
|
20
|
+
complexity: string;
|
|
21
|
+
loc: string;
|
|
22
|
+
ncloc: string;
|
|
23
|
+
/** 经过测试的组件 */
|
|
24
|
+
packages: string;
|
|
25
|
+
/** 经过测试的文件 */
|
|
26
|
+
files: string;
|
|
27
|
+
/** 经过测试的类 */
|
|
28
|
+
classes: string;
|
|
29
|
+
};
|
|
30
|
+
export declare const coverage: Record<string, CoverageType & ProjectCoverageType>;
|
|
31
|
+
export {};
|
package/lib/coverage.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{accessSync as e,constants as r,readFileSync as c}from"fs";import{join as o}from"path";import{Parser as t}from"xml2js";import{PACKAGENAME as a,PROGRAMPATH as s}from"./process-env.js";export const coverage={};try{let
|
|
1
|
+
import{accessSync as e,constants as r,readFileSync as c}from"fs";import{join as o}from"path";import{Parser as t}from"xml2js";import{PACKAGENAME as a,PROGRAMPATH as i,isLibrary as s}from"./process-env.js";export const coverage={};if(s)try{let s=o(i,"./coverage/clover.xml");e(s,r.R_OK);let m=new t({explicitArray:!1,async:!1}),p=c(s,{encoding:"utf-8"});m.parseString(p,(e,r)=>{if(!e){let e=r.coverage.project.metrics.$,c=r.coverage.project.package;Object.assign(coverage,{[a]:e}),c.forEach(e=>{Object.assign(coverage,{[e.$.name]:e.metrics.$})})}})}catch(e){}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"path";import{merge as t}from"webpack-merge";import{CONFIG as
|
|
1
|
+
import e from"path";import{merge as t}from"webpack-merge";import i from"./app.js";import{CONFIG as o}from"./common.js";import{PACKAGENAME as a,PROGRAMPATH as m,pkgName as p}from"./process-env.js";let{template:r,favicon:n,...l}=Object.assign({template:`./node_modules/${p}/template/index.html`,favicon:`./node_modules/${p}/template/favicon.ico`},o.htmlPluginOption||{}),s=t({title:o.env?.PROJECTNAME||a.toLocaleUpperCase()||"Title",filename:"index.html",hash:!1,minify:{collapseWhitespace:!0,removeComments:!0,removeRedundantAttributes:!1,removeScriptTypeAttributes:!1,removeStyleLinkTypeAttributes:!1,removeAttributeQuotes:!0,useShortDoctype:!0},meta:{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",viewport:"width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no","apple-mobile-web-app-capable":"yes",renderer:"webkit",description:i.description||""},tags:[],template:e.join(m,r),favicon:e.join(m,n)},l);export default s;
|
package/lib/locales.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export function interpolateString(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(
|
|
1
|
+
import{existsSync as e}from"fs";import{basename as t,join as o}from"path";import{watch as a}from"chokidar";import{CONFIG as l}from"./common.js";import r from"./esm.js";import n from"./object-listener.js";import{FRAMEWORK as s,isLibrary as c}from"./process-env.js";import{resolveProgramPath as i,tfc as g}from"./utils.js";let p={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},f={react:'let storageKey="localizable.language",language=localStorage.getItem(storageKey)||"zh_CN",{translation:a,...defaultLocale}=Object.assign({title:"简体中文",language:"zh_CN",translation:{}},resources[language]||resources.zh_CN),localizable=sso({lang:defaultLocale,t:a});export function setLang(a){let{translation:e,...l}=resources[a]||{};e&&(localizable.lang=l,localizable.t=e,localStorage.setItem(storageKey,l.language))}export default localizable;',solid:'let locale=createRoot(()=>{let e="localizable.language",a=localStorage.getItem(e)||"zh_CN",{translation:l,...o}=Object.assign({title:"简体中文",language:"zh_CN",translation:{}},resources[a]||resources.zh_CN),[n,c]=createStore({lang:o,t:l});return createEffect(()=>{let a=resources[n.lang.language]?.translation;a&&(c("t",a),localStorage.setItem(e,n.lang.language))}),{localizable:n,setLocalizable:c,setLang:function(e){let{translation:a,...l}=resources[e]||{};a&&c("lang",l)}}},getOwner());export const setLocalizable=locale.setLocalizable;export const t=locale.localizable.t;export const lang=locale.localizable.lang;export const setLang=locale.setLang;'}[s];export const locales=n({name:"@app/locales",data:"export const locales = [];"});let u={};async function d(e,o){let a=t(e).replace(/\.[^.]+$/,"");if("deleted"===o)delete u[a];else{let t=await import(r`${g(e)}`);Object.assign(u,{[a]:t.default})}let l=[],n={};for(let e in u)if(Object.prototype.hasOwnProperty.call(u,e)){let t=u[e],{language:o=a,title:r=o,icon:s,translation:c={}}=t;l.push({language:o,title:r,icon:s}),n[o]={language:o,title:r,icon:s,translation:c}}Object.assign(locales.data,{data:`${p[s]}
|
|
2
|
+
export function interpolateString(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(l)};const _res = ${JSON.stringify(n)};const resources = deepFreeze(_res);${f}`})}e(o(l.alias["@"],"./locales"))&&function(e,t){let o=[],l=a(e,{ignored:t,persistent:!0,ignoreInitial:!1});l.on("add",e=>{d(e,"added"),o.push(e)}),l.on("change",e=>{d(e,"change")}),l.on("unlink",e=>{d(e,"deleted"),o.splice(o.indexOf(e),1)}),l.on("ready",()=>{o.forEach(e=>{d(e,"change")})}),process.on("SIGINT",function(){l.close()})}(i(c?"site/locales":"src/locales"),[/^\..*/,/!\.ts$/,/\.d\.ts$/]);
|
package/lib/module.config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as e}from"path";import s from"mini-css-extract-plugin";import o from"mini-svg-data-uri";import{CONFIG as t,PUBLICPATH as l}from"./common.js";import{hasPkg as r}from"./has-pkg.js";import a from"./modify-vars.js";import{
|
|
1
|
+
import{resolve as e}from"path";import s from"mini-css-extract-plugin";import o from"mini-svg-data-uri";import{CONFIG as t,PUBLICPATH as l}from"./common.js";import{hasPkg as r}from"./has-pkg.js";import a from"./modify-vars.js";import{FRAMEWORK as i,__dirname as n,isDev as c,isMicro as m}from"./process-env.js";import p from"./swcrc.js";import d from"./tsloader.config.js";import{resolveNodeModulesPath as u,resolveProgramPath as f}from"./utils.js";let y={loader:e(n,"./loader/css-unicode.cjs")},x=m?l:"../",$={loader:s.loader,options:{publicPath:"/"!==x?x:"../"}},g=r("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:await import("@moneko/postcss")}};c&&($="style-loader");let j=[...t.cssModules,`@moneko/${i}`,"neko-ui"].map(u),v=[...["src/styles/variables.less","src/styles/mixins.less","site/styles/variables.less","site/styles/mixins.less"].map(f)],b=["components","example","mock","site","src","server"].map(f),w=[$,{loader:"@teamsupercell/typings-for-css-modules-loader",options:{verifyOnly:!c}},{loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,o=j.length;s<o;s++)if(e&&e?.includes(j[s]))return/(.*(?<!\.?global\.(le|c)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly"},importLoaders:2}},g,y,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:a,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:v}}].filter(Boolean),h={loader:"tsc"===t.compiler?"ts-loader":"swc-loader",options:"tsc"===t.compiler?d:p(c)},k=b.concat(t.rulesInclude?.media?.map(u)||[]),I=b.concat(t.rulesInclude?.fonts?.map(u)||[]),O=b.concat(t.rulesInclude?.less?.map(u)||[]),B=b.concat(t.rulesInclude?.css?.map(u)||[]),L=b.concat(t.rulesInclude?.js?.map(u)||[]),M={rules:[{test:/\.mdx?$/i,include:[f("components")],exclude:[/(.+)\/examples\/(.+).mdx?$/i],enforce:"pre",use:[{loader:e(n,"./loader/frontmatter.cjs")}]},{oneOf:[{resourceQuery:/raw/,type:"asset/source"},{test:/\.wasm$/i,type:"webassembly/async"},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:k},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>o("string"!=typeof e?e.toString():e)},include:k},{test:/\.(gif|png|jpe?g|mp4)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext][query]"},include:k},{test:/\.(eot|ttf|otf|woff|woff2)$/i,type:"asset",generator:{filename:"assets/fonts/[name][ext][query]"},include:I},{test:/\.less$/i,use:w,include:O},{test:/\.css$/i,use:[$,"css-loader",g,y].filter(Boolean),include:B},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...t.prefixJsLoader,h].filter(Boolean),include:L},{test:/\.mdx?$/i,use:[...t.prefixJsLoader,h,{loader:"@mdx-js/loader",options:t.mdx}].filter(Boolean),include:b,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/i,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...t.moduleRules]};export default M;
|
package/lib/process-env.d.ts
CHANGED
|
@@ -13,26 +13,9 @@ export declare const PROGRAMPATH: string;
|
|
|
13
13
|
export declare const PACKAGENAME: string;
|
|
14
14
|
export declare const PACKAGEVERSION: string;
|
|
15
15
|
export declare const pkgName: string;
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const isDev: boolean;
|
|
17
17
|
export declare const cacheDir: string;
|
|
18
|
-
export declare const NODE_ENV: string | undefined;
|
|
19
18
|
export declare const CUSTOMCONFIG: string | undefined;
|
|
20
|
-
export declare
|
|
21
|
-
export declare
|
|
19
|
+
export declare const hasEslintConfig: boolean;
|
|
20
|
+
export declare const hasStylelintConfig: boolean;
|
|
22
21
|
export declare const hasAntd: boolean;
|
|
23
|
-
export declare const programInfo: {
|
|
24
|
-
name: string;
|
|
25
|
-
version: string;
|
|
26
|
-
type: AppType;
|
|
27
|
-
description: string | undefined;
|
|
28
|
-
author: {
|
|
29
|
-
name: string | undefined;
|
|
30
|
-
email: string | undefined;
|
|
31
|
-
url: string | undefined;
|
|
32
|
-
};
|
|
33
|
-
repository: {
|
|
34
|
-
type: string | undefined;
|
|
35
|
-
url: string | undefined;
|
|
36
|
-
directory: string | undefined;
|
|
37
|
-
};
|
|
38
|
-
};
|
package/lib/process-env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as e,mkdirSync as o,readFileSync as
|
|
1
|
+
import{existsSync as e,mkdirSync as o,readFileSync as t}from"fs";import{join as r}from"path";import s from"url";import{hasPkg as n}from"./has-pkg.js";import c from"./yarn-argv.js";export const __dirname=s.fileURLToPath(new URL(".",import.meta.url));export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const createElement={react:"createElement",solid:"createComponent"}[FRAMEWORK];export const FRAMEWORKNAME={react:"react",solid:"solid-js"}[FRAMEWORK];export const PROGRAMPATH=process.cwd();export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;let p=t(r(__dirname,"../package.json"),{encoding:"utf-8"});export const pkgName=JSON.parse(p).name;export const isDev="development"===process.env.NODE_ENV;export const cacheDir=r(PROGRAMPATH,"./node_modules/.cache/.mo/");e(cacheDir)||o(cacheDir,{recursive:!0});export const CUSTOMCONFIG=process.env.npm_config_config||c.config;let i=Object.keys(process.env);export const hasEslintConfig=-1!==i.findIndex(e=>e.startsWith("npm_package_eslintConfig_"));export const hasStylelintConfig=-1!==i.findIndex(e=>e.startsWith("npm_package_stylelint_"));export const hasAntd=n("antd");
|
package/lib/webpack.common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"fs";import t from"add-asset-html-webpack-plugin";import s from"html-webpack-plugin";import o from"webpack";import
|
|
1
|
+
import e from"fs";import t from"add-asset-html-webpack-plugin";import s from"html-webpack-plugin";import o from"webpack";import n from"webpackbar";import"./cleanup.js";import{CONFIG as l,PUBLICPATH as r}from"./common.js";import i from"./done.js";import a from"./html-add-entry-attr.js";import p from"./html-plugin-option.js";import{moduleFederation as c}from"./module-federation.js";import m from"./module.config.js";import{CUSTOMCONFIG as u,PACKAGENAME as f,PROGRAMPATH as d,hasEslintConfig as h,hasStylelintConfig as y,isDev as j,isLibrary as g,isMicro as w}from"./process-env.js";import{seo as b}from"./seo.js";import{resolveNodeModulesPath as x,resolveProgramPath as k}from"./utils.js";import v from"./virtual-module-plugin.js";import C from"./virtual-modules.js";let{AutomaticPrefetchPlugin:O,DefinePlugin:$,SourceMapDevToolPlugin:N,WatchIgnorePlugin:B}=o,D=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],P=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],S=e.readdirSync(d),A=!1,E=!1;for(let e=0,t=S.length;e<t;e++)P.includes(S[e])&&(E=!0),D.includes(S[e])&&(A=!0);A||(A=h),E||(E=y);let M=E?(await import("stylelint-webpack-plugin")).default:null,T=A?(await import("eslint-webpack-plugin")).default:null,_=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:k(g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:"js/[chunkhash].js",assetModuleFilename:"assets/[hash][ext][query]",library:{name:f,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${f}`,pathinfo:j,clean:!0,publicPath:r,asyncChunks:!0};let K={main:x("@app/entry")};l.entry&&("string"==typeof l.entry?K=l.entry:Object.keys(l.entry)&&Object.assign(K,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let L=l.routeBaseName.split("/").filter(Boolean).length,F=`${Array(L).fill("..").join("/")+(L?"/":"")}404.html`,{pathSegmentsToKeep:J=L,path:R=F}=l.fixBrowserRouter||{},V=!1;l.cacheDirectory&&(V={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:l.cacheDirectory,memoryCacheUnaffected:!0,name:`${u||"default"}-${j?"development":"production"}`});export const clientConfig={entry:K,stats:"errors-only",cache:V,infrastructureLogging:{level:"none"},target:"web",externalsPresets:l.externalsPresets,plugins:[new O,...c,T&&new T({fix:!0,threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),M&&new M({fix:!0,threads:!0,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","docs/","coverage/","dist/"]}),l.htmlPluginOption&&new s(p),l.fixBrowserRouter&&new s({filename:R,inject:!1,templateContent:()=>`<html html><head><title>${p.title}</title><script>var pathSegmentsToKeep = ${J||L};var l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new t(_),w&&new a(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new $({"process.env":JSON.stringify({...l.env,NODE_ENV:process.env.NODE_ENV})}),new B({paths:[/\.d\.ts$/]}),l.sourceMap&&new N(l.sourceMap),l.bar&&new n(l.bar),new i({done:()=>{!j&&l.seo&&b(),l.done?.(),j||setTimeout(()=>{process.exit(0)},2e3)}}),new v(C),...l.plugins].filter(Boolean),experiments:{topLevelAwait:!0,syncWebAssembly:!0,asyncWebAssembly:!0},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:l.alias,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:m,externals:l.externals,output:outputConfig};
|
package/lib/webpack.dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e from"@soda/friendly-errors-webpack-plugin";import o from"chalk";import r from"webpack";import{merge as t}from"webpack-merge";import{CONFIG as s}from"./common.js";import{hasPkg as p}from"./has-pkg.js";import{getIPv4 as
|
|
1
|
+
import e from"@soda/friendly-errors-webpack-plugin";import o from"chalk";import r from"webpack";import{merge as t}from"webpack-merge";import{CONFIG as s}from"./common.js";import{hasPkg as p}from"./has-pkg.js";import{getIPv4 as i,getPort as a}from"./net.js";import{isReact as m}from"./process-env.js";import{isFunction as n,resolveProgramPath as l}from"./utils.js";import{clientConfig as d}from"./webpack.common.js";let{HotModuleReplacementPlugin:c}=r,{yellow:v,green:h}=o,w=i(),f=s.devServer.port||3e3,u=await a(f,65535,s.devServer.host),k=s.devServer.port!==u,g=p("@moneko/mock"),$=g&&(await import("@moneko/mock")).default,S=m&&await import("@pmmmwh/react-refresh-webpack-plugin"),b=!1===s.devtool||s.devtool?s.devtool:"eval-cheap-module-source-map";s.devServer.port=u;let y="/"===s.routeBaseName,j=s.devServer.https?"https:":"http:",x=y?"":s.routeBaseName,A=t(d,{devtool:b,mode:"development",devServer:{headers:{"Access-Control-Allow-Origin":"*"},compress:s.devServer.compress,host:"0.0.0.0",port:u,historyApiFallback:y||{index:x.endsWith("/")?x:`${x}/`,disableDotRule:!0},https:s.devServer.https,proxy:s.proxy,allowedHosts:s.devServer.allowedHosts,client:{progress:!1,logging:"info",overlay:!1},static:{watch:{ignored:e=>e.endsWith(".d.ts")||/\/node_modules\//.test(e)}},setupMiddlewares:(e,o)=>{if(!o)throw Error("webpack-dev-server is not defined");return o.app&&n($)&&$(o.app,l("mock/")),e},open:!1,hot:!0},plugins:[new c,S&&new S,new e({compilationSuccessInfo:{messages:[`You application is running here:
|
|
2
2
|
|
|
3
3
|
Local: ${o.cyan(`${j}//${s.devServer.host}:${u}${x}`)}
|
|
4
|
-
Network: ${o.cyan(`${j}//${
|
|
4
|
+
Network: ${o.cyan(`${j}//${w}:${u}${x}`)}`],notes:k?[`Port ${v(f)} is in use, trying ${h(u)} instead`]:[]},clearConsole:!0})].filter(Boolean)});export default[A];
|
package/package.json
CHANGED
package/typings/global.d.ts
CHANGED
|
@@ -435,65 +435,6 @@ export declare interface SourceMapDevToolPluginOptions {
|
|
|
435
435
|
sourceRoot?: string;
|
|
436
436
|
test?: string | RegExp | Rule[];
|
|
437
437
|
}
|
|
438
|
-
export type ProgramInfoType = {
|
|
439
|
-
/** 应用名称 */
|
|
440
|
-
name: string;
|
|
441
|
-
/** 应用描述 */
|
|
442
|
-
description: string;
|
|
443
|
-
/** 应用版本 */
|
|
444
|
-
version: string;
|
|
445
|
-
/** 应用类型 */
|
|
446
|
-
type: 'mobile' | 'site' | 'backstage' | 'micro' | 'library';
|
|
447
|
-
/** 开发者 */
|
|
448
|
-
author: {
|
|
449
|
-
name: string;
|
|
450
|
-
url?: string;
|
|
451
|
-
email?: string;
|
|
452
|
-
};
|
|
453
|
-
/** 存储库 */
|
|
454
|
-
repository: {
|
|
455
|
-
type?: string;
|
|
456
|
-
url?: string;
|
|
457
|
-
directory?: string;
|
|
458
|
-
};
|
|
459
|
-
/** 路由模式 */
|
|
460
|
-
routerMode: 'hash' | 'browser' | 'memory';
|
|
461
|
-
/** 根路由 */
|
|
462
|
-
routeBaseName: string;
|
|
463
|
-
/** 渲染模式 */
|
|
464
|
-
renderMode: 'ssr' | 'csr';
|
|
465
|
-
};
|
|
466
|
-
|
|
467
|
-
export type CoverageType = {
|
|
468
|
-
/** 语句(statement coverage) */
|
|
469
|
-
statements: string;
|
|
470
|
-
/** 语句覆盖: 是不是每个语句都执行了 */
|
|
471
|
-
coveredstatements: string;
|
|
472
|
-
/** 条件(branch coverage) */
|
|
473
|
-
conditionals: string;
|
|
474
|
-
/** 条件覆盖: 是不是每个条件代码块都执行了 */
|
|
475
|
-
coveredconditionals: string;
|
|
476
|
-
/** 函数(function coverage) */
|
|
477
|
-
methods: string;
|
|
478
|
-
/** 函数覆盖: 是不是每个函数都调用了 */
|
|
479
|
-
coveredmethods: string;
|
|
480
|
-
};
|
|
481
|
-
|
|
482
|
-
export type ProjectCoverageType = {
|
|
483
|
-
/** 元素 */
|
|
484
|
-
elements: string;
|
|
485
|
-
/** 覆盖元素 */
|
|
486
|
-
coveredelements: string;
|
|
487
|
-
complexity: string;
|
|
488
|
-
loc: string;
|
|
489
|
-
ncloc: string;
|
|
490
|
-
/** 经过测试的组件 */
|
|
491
|
-
packages: string;
|
|
492
|
-
/** 经过测试的文件 */
|
|
493
|
-
files: string;
|
|
494
|
-
/** 经过测试的类 */
|
|
495
|
-
classes: string;
|
|
496
|
-
};
|
|
497
438
|
|
|
498
439
|
export declare interface OptimizationSplitChunksOptions {
|
|
499
440
|
/**
|
package/lib/define.d.ts
DELETED
package/lib/define.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{CONFIG as o}from"./common.js";import{NODE_ENV as e}from"./process-env.js";let r={"process.env":JSON.stringify({NODE_ENV:e,...o.env})};export default r;
|