@das-fed/cli 6.4.0-dev.55.2 → 6.4.0-dev.55.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@das-fed/cli",
3
- "version": "6.4.0-dev.55.2",
3
+ "version": "6.4.0-dev.55.21",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -1 +1 @@
1
- import{initPublicConfig}from"../dev-helper/init-public-config.js";import{initWatchers}from"../dev-helper/watchers/index.js";import{extra}from"../extra/index.js";import{execSync}from"child_process";import{resolve,relative,dirname}from"path";import{fileURLToPath}from"url";import minimist from"minimist";import fs from"fs-extra";import{getWindowConfig}from"../../utils/get-window-config/index.js";import{getCliConfig}from"../../utils/get-cli-config/index.js";let __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);export default{handle:async i=>{var[,...e]=i,i=minimist(i),t=process.cwd(),o={cwd:t,isDev:!1,isBuild:!0,...await getCliConfig(),...i};if(!(o.isLib??!1)){await initPublicConfig(o),await initWatchers(o);let i=await getWindowConfig(resolve(t,"public/config.js"));try{var r,n=resolve(t,"config.js");await fs.exists(n)&&(r=(await import(relative(resolve(__dirname),n))).default,""===i.microAppName&&delete i.microAppName,i={...r,...i})}catch(i){console.log("get rootConfig error",i)}}(e||[]).join(" ");let a="";i.c&&(a+="-c "+i.c),execSync("npx vite build "+a,{cwd:t,stdio:"inherit"})}};
1
+ import{initPublicConfig}from"../dev-helper/init-public-config.js";import{initWatchers}from"../dev-helper/watchers/index.js";import{execSync}from"child_process";import{resolve,relative,dirname}from"path";import{fileURLToPath}from"url";import minimist from"minimist";import fs from"fs-extra";import{getWindowConfig}from"../../utils/get-window-config/index.js";import{getCliConfig}from"../../utils/get-cli-config/index.js";let __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);export default{handle:async i=>{var[,...e]=i,i=minimist(i),t=process.cwd(),o={cwd:t,isDev:!1,isBuild:!0,...await getCliConfig(),...i};if(!(o.isLib??!1)){await initPublicConfig(o),await initWatchers(o);let i=await getWindowConfig(resolve(t,"public/config.js"));try{var r,n=resolve(t,"config.js");await fs.exists(n)&&(r=(await import(relative(resolve(__dirname),n))).default,""===i.microAppName&&delete i.microAppName,i={...r,...i})}catch(i){console.log("get rootConfig error",i)}}(e||[]).join(" ");let a="";i.c&&(a+="-c "+i.c),execSync("npx vite build "+a,{cwd:t,stdio:"inherit"})}};
@@ -1 +1 @@
1
- import glob from"fast-glob";import fs from"fs-extra";import json5 from"json5";import{resolve}from"path";import{getExportDefaultsByAst}from"../../../../utils/ts-morph/index.js";import{json2type}from"../../../../utils/json2type/index.js";import{getCliConfig}from"../../../../utils/get-cli-config/index.js";let watchGlob=["src/**/i18n/*.ts"],handle=async(t={})=>{var e=t.cwd,a=(await getCliConfig()).i18n?.watchGlob||[],a=getExportDefaultsByAst([...watchGlob,...a],t);let o={};a.map((t,e)=>{t=t.defaultText;Object.assign(o,json5.parse(t))});var s,r=[];for(s of await glob(["src/**/*.vue","src/**/*.tsx"]))for(var i=(await fs.readFile(s)).toString(),l=/i18n\(\s*(.+)\s*\)/g;null!==(n=l.exec(i));){var[,n]=n;r.push(n)}r.forEach(t=>{for(var e=/['"](.*?)['"]/g;null!==(a=e.exec(t));){var[,a]=a;o[a]||(o[a]={})}});let f={"zh-CN":""};Object.values(o).filter(t=>!!t["zh-CN"]).map(t=>Object.assign(f,t)),0===Object.keys(o).length&&(o.any="");t=resolve(e,"src/das-fe-local-runtime/i18n-runtime/type.d.ts");await json2type({data:[{title:"I18NName",type:"string",enum:Object.keys(f)},{title:"I18NKey",type:"string",enum:Object.keys(o)}],outputFilePath:t})};export default{name:"das-i18n",glob:watchGlob,ignoreGlob:[],load:handle,change:handle};
1
+ import glob from"fast-glob";import fs from"fs-extra";import{resolve}from"path";import vm from"vm";import{json2type}from"../../../../utils/json2type/index.js";import{getCliConfig}from"../../../../utils/get-cli-config/index.js";let watchGlob=["src/**/**/i18n/*.ts","!src/**/**/i18n/useI18.ts"];function getExportedDefault(t){var e={data:{}},t=new vm.Script("data = "+t.replace("export default","")),a=vm.createContext(e);return t.runInContext(a),e.data}let handle=async(t={})=>{var{isDev:t,cwd:a}=t;if(t){var o,t=(await getCliConfig()).i18n?.watchGlob||[],r={};for(o of await glob([...watchGlob,...t],{cwd:a,absolute:!0,onlyFiles:!0}))try{var i=getExportedDefault((await fs.readFile(o)).toString());Object.assign(r,i)}catch(t){console.log("i18n文件解析错误",o),console.error(t)}let e={"zh-CN":""};Object.values(r).filter(t=>!!t["zh-CN"]).map(t=>Object.assign(e,t)),0===Object.keys(r).length&&(r.any="");t=resolve(a,"src/das-fe-local-runtime/i18n-runtime/type.d.ts");await json2type({data:[{title:"I18NName",type:"string",enum:Object.keys(e)},{title:"I18NKey",type:"string",enum:Object.keys(r)}],outputFilePath:t})}};export default{name:"das-i18n",glob:watchGlob,ignoreGlob:[],load:handle,change:handle};