@moneko/core 3.26.8 → 3.26.10
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 +1 -1
- package/lib/bin/build-app.mjs +1 -1
- package/lib/bin/build.d.mts +4 -7
- package/lib/bin/build.mjs +1 -1
- package/lib/bin/convert.d.mts +1 -1
- package/lib/bin/convert.mjs +1 -1
- package/lib/bin/lessc.d.mts +1 -1
- package/lib/bin/lessc.mjs +1 -1
- package/lib/bin/tsc.d.mts +5 -0
- package/lib/bin/tsc.mjs +1 -0
- package/lib/options/modify-vars.d.mts +1 -6
- package/package.json +1 -1
package/lib/bin/build-app.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import { argv } from 'node:process';
|
|
5
5
|
import { buildPlist, buildXml, createDir, ink, jsonToYaml, loadFileSync, parsePlist, parseXml, parseYaml, print, println, removeDir, saveFile, saveFileSync } from '@moneko/utils';
|
|
6
6
|
import { bundleApk, bundleIOS } from './utils/bundle-app.mjs';
|
|
7
|
-
import {
|
|
7
|
+
import { cwd } from './utils/config.mjs';
|
|
8
8
|
import { __dirname } from './file.mjs';
|
|
9
9
|
export declare function copyFileSync(source: string, target: string);
|
|
10
10
|
export declare function copyFolderRecursiveSync(source: string, target: string, sun?: boolean);
|
package/lib/bin/build-app.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{execSync as e}from"node:child_process";import{existsSync as i,readdirSync as n,statSync as o}from"node:fs";import s from"node:path";import{argv as r}from"node:process";import{buildPlist as t,buildXml as l,createDir as a,ink as c,jsonToYaml as d,loadFileSync as p,parsePlist as m,parseXml as u,parseYaml as f,print as y,println as S,removeDir as $,saveFile as b,saveFileSync as j}from"@moneko/utils";import{bundleApk as _,bundleIOS as g}from"./utils/bundle-app.mjs";import{
|
|
1
|
+
import{execSync as e}from"node:child_process";import{existsSync as i,readdirSync as n,statSync as o}from"node:fs";import s from"node:path";import{argv as r}from"node:process";import{buildPlist as t,buildXml as l,createDir as a,ink as c,jsonToYaml as d,loadFileSync as p,parsePlist as m,parseXml as u,parseYaml as f,print as y,println as S,removeDir as $,saveFile as b,saveFileSync as j}from"@moneko/utils";import{bundleApk as _,bundleIOS as g}from"./utils/bundle-app.mjs";import{cwd as w}from"./utils/config.mjs";import{__dirname as k}from"./file.mjs";export function copyFileSync(e,i){let n=p(e);if(null!==n){let r=i;o(i).isDirectory()&&(r=s.join(i,s.basename(e))),j(r,n)}}export function copyFolderRecursiveSync(e,i,r){let t=i;r&&(t=s.join(i,s.basename(e))),o(e).isDirectory()&&n(e).forEach(function(i){let n=s.join(e,i);o(n).isDirectory()?copyFolderRecursiveSync(n,t,!0):copyFileSync(n,t)})}export default async function O(){r.slice(3).forEach(e=>{let[i,n]=e.replace(/^--/,"").split("=");process.env[`__args__${i}__`]=n});let{CONFIG:j}=await import("../config.mjs"),O=j.bundleId;O||(S(c("请配置 bundleId","red")),process.exit(1)),/(^com\.)([a-zA-Z_][a-zA-Z0-9_]*[.])*([a-zA-Z_][a-zA-Z0-9_]*)$/.test(O)&&3===O.split(".").length||(S(c("软件包名不合法","red")),process.exit(1));let A=j.bundles;A&&0!==A.length||(S(c("请配置 bundles (打包类型)","red")),process.exit(1));let N=O.split(".").splice(-1,1).join(""),x=s.join(w,"/dist"),h=`flutter create -t app --org ${O} -i swift -a kotlin ${N}`,E=s.join(w,`/${N}`),R=s.join(E,"assets/web/");e(h,{encoding:"utf-8"}),a(R),y(c("正在注册资产...","yellow"),!0),copyFolderRecursiveSync(x,R);let T=s.join(E,"pubspec.yaml"),V=JSON.parse(await f(T)||"{}"),v=[],I=(e,i="assets/web")=>{let s=n(e);!function n(r){r!=s.length&&(o(`${e}/${s[r]}`).isDirectory()&&(v.push(`${i}/${s[r]}/`),I(`${e}/${s[r]}`,`${i}/${s[r]}`)),n(r+1))}(0)};if(I(x),V.dependencies.webview_flutter_plus="^0.2.3",V.flutter.assets=["assets/web/",...v],b(T,await d(JSON.stringify(V))),y(`${c("注册资产","cyan")}: ${c("完成","cyan")}`,!0),A.includes("apk -release")||A.includes("apk -debug")){y(c("正在配置安卓权限...","yellow"),!0);let e=s.join(E,"android/app/src/main/AndroidManifest.xml"),i=JSON.parse(u(e));i.manifest.application.$["android:usesCleartextTraffic"]="true",i.manifest["uses-permission"]=[{$:{"android:name":"android.permission.INTERNET"}},{$:{"android:name":"android.permission.ACCESS_NETWORK_STATE"}},{$:{"android:name":"android.permission.WAKE_LOCK"}}],b(e,l(JSON.stringify(i)));let n=s.join(E,"android/app/build.gradle"),o=p(n)||"",r="minSdkVersion flutter.minSdkVersion";if(o?.includes(r))o=o.replace(r,"minSdkVersion 20");else{let e=o.indexOf("minSdkVersion "),i=o.substring(e,e+16);o=o.replace(i,"minSdkVersion 20")}let t="compileSdkVersion flutter.compileSdkVersion";o.includes(t)&&(o=o.replace(t,"compileSdkVersion 32")),b(n,o),y(`${c("安卓权限配置","cyan")}: ${c("完成","cyan")}`,!0)}if(A.includes("ios -release")||A.includes("ios -debug")){y(c("开始配置IOS权限","yellow"),!0);let e=s.join(E,"ios/Runner/Info.plist"),i=Object.assign(JSON.parse(await m(e)),{NSAppTransportSecurity:{NSAllowsArbitraryLoads:!0},"io.flutter.embedded_views_preview":!0});b(e,await t(JSON.stringify(i))),y(`${c("IOS权限配置","cyan")}: ${c("完成","cyan")}`,!0)}b(s.join(E,"lib/main.dart"),p(s.join(k,"./conf/bootstrap"))||"");let J=s.join(w,"./bundle/");a(J),setTimeout(()=>{A.forEach(e=>{let i=e.split(" ");"apk"===i[0]&&_(E,J,i[1]),"ios"===i[0]&&g(E,J,i[1])}),$(E),i(s.join(J,"Runner"))&&$(s.join(J,"Runner")),y(`✨ ${c("Done","green")}`,!0),process.exit(0)},1e3)}
|
package/lib/bin/build.d.mts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { join, relative } from 'node:path';
|
|
1
|
+
import { join } from 'node:path';
|
|
3
2
|
import { argv } from 'node:process';
|
|
4
|
-
import { deleteEmptyDirs, ink, println, removeDir, removeFile, scanFolderSync
|
|
5
|
-
import require from '../commom/require.mjs';
|
|
3
|
+
import { deleteEmptyDirs, ink, println, removeDir, removeFile, scanFolderSync } from '@moneko/utils';
|
|
6
4
|
import setupEnv from '../commom/setup-env.mjs';
|
|
7
|
-
import { cwd,
|
|
5
|
+
import { cwd, swcCachePath } from './utils/config.mjs';
|
|
8
6
|
import { getSwcOption } from './utils/setup-swcrc.mjs';
|
|
9
7
|
import convert from './convert.mjs';
|
|
10
|
-
import { __dirname } from './file.mjs';
|
|
11
8
|
import { lesscCommonjs } from './lessc.mjs';
|
|
12
|
-
|
|
9
|
+
import tsc from './tsc.mjs';
|
|
13
10
|
declare async function build();
|
|
14
11
|
export default build;
|
package/lib/bin/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{join as o}from"node:path";import{argv as e}from"node:process";import{deleteEmptyDirs as t,ink as s,println as i,removeDir as r,removeFile as m,scanFolderSync as n}from"@moneko/utils";import l from"../commom/setup-env.mjs";import{cwd as c,swcCachePath as p}from"./utils/config.mjs";import{getSwcOption as d}from"./utils/setup-swcrc.mjs";import f from"./convert.mjs";import{lesscCommonjs as a}from"./lessc.mjs";import u from"./tsc.mjs";async function j(){let j=e[3],y=e[4],b=e.slice(5);j||(i(s(`type: 无效值 ${s(j,"245")}`,"red")),process.exit(1));let g=!b.includes("no-docs"),x=!b.includes("no-lib"),h=!b.includes("no-es"),v=!b.includes("no-dts"),w=b.filter(o=>!["no-docs","no-es","no-lib"].includes(o));if(await l("production",j,y,w),"library"===j){let{CONFIG:e}=await import("../config.mjs"),s="swc"===e.dts,i=[x&&{type:"commonjs",dir:"lib",msg:"Convert to CommonJS"},h&&{type:"es6",dir:"es",msg:"Convert to ES Module"}].filter(Boolean);for(let e=0,l=i.length;e<l;e++){let l=o(c,`./${i[e].dir}`);r(l);let j=d(y);"es6"===i[e].type&&(j.jsc.target="es2015"),j.jsc.experimental.emitIsolatedDts=v&&s,j.jsc.experimental.cacheRoot=p,j.module.type=i[e].type,f({outDir:i[e].dir,filenames:["components"],copyFiles:!0,ignore:["**/*.test.(js|ts)x?$"]},j,function(){n(l,["README.mdx","examples","__*__"]).forEach(m),t(l),"commonjs"===i[e].type&&a()}),v&&!s&&u(i[e].dir)}}("library"!==j||g&&"library"===j)&&import("../build.mjs")}export default j;
|
package/lib/bin/convert.d.mts
CHANGED
|
@@ -10,5 +10,5 @@ export type CliOptions = {
|
|
|
10
10
|
copyFiles?: boolean;
|
|
11
11
|
ignore?: string[];
|
|
12
12
|
};
|
|
13
|
-
declare function convert(cliOptions: CliOptions, swcOptions: SwcConfig, onSuccess: VoidFunction);
|
|
13
|
+
declare async function convert(cliOptions: CliOptions, swcOptions: SwcConfig, onSuccess: VoidFunction);
|
|
14
14
|
export default convert;
|
package/lib/bin/convert.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{swcDir as s}from"@swc/cli";
|
|
1
|
+
import{swcDir as s}from"@swc/cli";async function t(t,c,i){s({cliOptions:{extensions:[".ts",".js",".tsx",".jsx",".mts",".mjs",".cts",".cjs"],stripLeadingPaths:!0,quiet:!0,...t},swcOptions:c,callbacks:{onSuccess:i}})}export default t;
|
package/lib/bin/lessc.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { exec } from 'node:child_process';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { loadFile, saveFile, scanFolderSync } from '@moneko/utils';
|
|
4
4
|
import require from '../commom/require.mjs';
|
|
5
|
-
import {
|
|
5
|
+
import { runtimePath } from './utils/config.mjs';
|
|
6
6
|
declare let modifyVarBash: string;
|
|
7
7
|
declare function lessc(file: string);
|
|
8
8
|
declare const lessRegExp: RegExp;
|
package/lib/bin/lessc.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{exec as e}from"node:child_process";import{join as o}from"node:path";import{loadFile as s,saveFile as t,scanFolderSync as
|
|
1
|
+
import{exec as e}from"node:child_process";import{join as o}from"node:path";import{loadFile as s,saveFile as t,scanFolderSync as r}from"@moneko/utils";import i from"../commom/require.mjs";import{runtimePath as l}from"./utils/config.mjs";let m="";function n(s){let t=o(i.resolve("less"),"../bin/lessc");return new Promise((o,r)=>{e(`${l} ${t} --js ${m} ${s} > ${s.replace(/\.less$/g,".css")}`,function(e){if(e)return r(e);o(!0)})})}let a=/\*?\.less/g;async function c(e){let o=await s(e);o&&a.test(o)&&await t(e,o.replace(a,".css"))}export async function lesscCommonjs(){let e=r("lib",["\\.less$"]),o=(await import("../options/modify-vars.mjs")).default;for(let e in o)Object.hasOwnProperty.call(o,e)&&(m+=`--modify-var="${e}=${o[e]}" `);Promise.all(e.map(n)),e.length&&Promise.all(r("lib",["\\.js$"]).map(c))}
|
package/lib/bin/tsc.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{join as e}from"node:path";import t from"typescript";import{cwd as o}from"./utils/config.mjs";async function s(s){return new Promise(i=>{let n=t.parseJsonConfigFileContent({extends:e(o,"tsconfig.json"),compilerOptions:{outDir:s,typeRoots:["node_modules/@types/","node_modules/.pnpm/node_modules/@types/"],declaration:!0,emitDeclarationOnly:!0,skipLibCheck:!0,skipDefaultLibCheck:!0,noEmitOnError:!1},include:[e(o,"components"),e(o,"typings")],exclude:[e(o,"components/**/examples/*"),e(o,"components/**/__tests__/*"),e(o,"components/**/__mocks__/*")]},t.sys,o);n.options.incremental&&(n.options.tsBuildInfoFile=n.options.tsBuildInfoFile??e(s,".tsbuildinfo"));let r=t.createProgram(n.fileNames,n.options),l=r.emit();t.getPreEmitDiagnostics(r).concat(l.diagnostics).forEach(e=>{if(process.stdout.write("\n"),e.file){let{line:o,character:s}=e.file.getLineAndCharacterOfPosition(e.start),i=t.flattenDiagnosticMessageText(e.messageText,"\n");process.stdout.write(`${e.file.fileName} (${o+1},${s+1}): ${i}`)}else process.stdout.write(t.flattenDiagnosticMessageText(e.messageText,"\n"))}),i(!0)})}export default s;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { CONFIG } from '../config.mjs';
|
|
2
2
|
import htmlPluginOption from './html-plugin-option.mjs';
|
|
3
3
|
declare const prefixCls: string;
|
|
4
|
-
declare const modifyVars:
|
|
5
|
-
readonly '@prefix-cls';
|
|
6
|
-
readonly '@ant-prefix';
|
|
7
|
-
readonly '@iconfont-css-prefix';
|
|
8
|
-
readonly '@favicon';
|
|
9
|
-
};
|
|
4
|
+
declare const modifyVars: Record<string, string | false | undefined>;
|
|
10
5
|
export default modifyVars;
|