ms-vite-plugin 0.0.14 → 0.0.16

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.
File without changes
File without changes
@@ -0,0 +1,43 @@
1
+ import t from "fs-extra";
2
+ import s from "path";
3
+ import * as m from "7zip-min";
4
+ async function l(c, i) {
5
+ const e = [];
6
+ async function a(r) {
7
+ const o = await t.readdir(r, { withFileTypes: !0 });
8
+ for (const n of o) {
9
+ const p = s.resolve(r, n.name);
10
+ n.isDirectory() ? await a(p) : n.isFile() && /\.(js|ts)$/.test(n.name) && e.push(s.relative(i, p));
11
+ }
12
+ }
13
+ return await a(c), e;
14
+ }
15
+ function w() {
16
+ const c = s.join(process.cwd(), "scripts");
17
+ return {
18
+ name: "ms-main-plugin",
19
+ async config(i) {
20
+ const e = await l(c, c);
21
+ i.build = {
22
+ lib: {
23
+ entry: [
24
+ "./scripts/main.js",
25
+ ...e.map((a) => `./scripts/${a}`)
26
+ ],
27
+ formats: ["cjs"]
28
+ },
29
+ outDir: "msbundle/ms"
30
+ };
31
+ },
32
+ async closeBundle() {
33
+ await t.copy("./res", s.join("msbundle", "ms", "res")), await t.copy("./ui", s.join("msbundle", "ms", "ui"));
34
+ const i = s.join(process.cwd(), "msbundle"), e = s.join(process.cwd(), "dist"), a = s.join(process.cwd(), "package.json"), r = s.join(i, "package.json"), o = await t.readJSON(a);
35
+ delete o.scripts, delete o.devDependencies, delete o.dependencies, await t.writeJSON(r, o, { spaces: 2 }), await t.emptyDir(e);
36
+ const n = s.join(e, "ms.zip"), p = s.join(e, "ms.msbundle");
37
+ await m.pack(i + "/*", n), await t.rename(n, p), await t.rm(i, { recursive: !0 });
38
+ }
39
+ };
40
+ }
41
+ export {
42
+ w as MSMainPlugin
43
+ };
@@ -0,0 +1 @@
1
+ (function(o,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("fs-extra"),require("path"),require("7zip-min")):typeof define=="function"&&define.amd?define(["exports","fs-extra","path","7zip-min"],n):(o=typeof globalThis<"u"?globalThis:o||self,n(o.MSPlugin={},o.fsExtra,o.path,o._7z))})(this,function(o,n,i,l){"use strict";function p(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const c=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(s,e,c.get?c:{enumerable:!0,get:()=>t[e]})}}return s.default=t,Object.freeze(s)}const m=p(l);async function f(t,s){const e=[];async function c(u){const a=await n.readdir(u,{withFileTypes:!0});for(const r of a){const d=i.resolve(u,r.name);r.isDirectory()?await c(d):r.isFile()&&/\.(js|ts)$/.test(r.name)&&e.push(i.relative(s,d))}}return await c(t),e}function j(){const t=i.join(process.cwd(),"scripts");return{name:"ms-main-plugin",async config(s){const e=await f(t,t);s.build={lib:{entry:["./scripts/main.js",...e.map(c=>`./scripts/${c}`)],formats:["cjs"]},outDir:"msbundle/ms"}},async closeBundle(){await n.copy("./res",i.join("msbundle","ms","res")),await n.copy("./ui",i.join("msbundle","ms","ui"));const s=i.join(process.cwd(),"msbundle"),e=i.join(process.cwd(),"dist"),c=i.join(process.cwd(),"package.json"),u=i.join(s,"package.json"),a=await n.readJSON(c);delete a.scripts,delete a.devDependencies,delete a.dependencies,await n.writeJSON(u,a,{spaces:2}),await n.emptyDir(e);const r=i.join(e,"ms.zip"),d=i.join(e,"ms.msbundle");await m.pack(s+"/*",r),await n.rename(r,d),await n.rm(s,{recursive:!0})}}}o.MSMainPlugin=j,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
package/dist/build.js CHANGED
@@ -83,9 +83,9 @@ const buildAll = async (isDev = true, workspacePath) => {
83
83
  entry: {
84
84
  [path.basename(entry, path.extname(entry))]: `./scripts/${entry}`,
85
85
  },
86
- fileName: entry,
86
+ fileName: () => entry,
87
87
  formats: ["iife"],
88
- name: "MagicScript", // IIFE 格式必需的全局变量名
88
+ name: "KuaiJS", // IIFE 格式必需的全局变量名
89
89
  },
90
90
  outDir: "msbundle/scripts",
91
91
  emptyOutDir: false, // 不要每次清空输出目录
package/dist/cli.js CHANGED
@@ -39,11 +39,11 @@ const path = __importStar(require("path"));
39
39
  const build_1 = require("./build");
40
40
  const fsExtra = __importStar(require("fs-extra"));
41
41
  /**
42
- * 检查工作目录是否为有效的 MagicScript 项目
42
+ * 检查工作目录是否为有效的 KuaiJS 项目
43
43
  * @param workspacePath 工作目录路径
44
44
  * @returns 是否为有效项目
45
45
  */
46
- async function isValidMagicScriptProject(workspacePath) {
46
+ async function isValidKuaiJSProject(workspacePath) {
47
47
  try {
48
48
  const packageJsonPath = path.join(workspacePath, "package.json");
49
49
  const scriptsPath = path.join(workspacePath, "scripts");
@@ -70,8 +70,8 @@ async function buildCommand(options) {
70
70
  : process.cwd();
71
71
  const isDev = options.dev || false;
72
72
  console.log(`🔍 检查项目目录: ${workspacePath}`);
73
- if (!(await isValidMagicScriptProject(workspacePath))) {
74
- console.error("❌ 错误: 当前目录不是有效的 MagicScript 项目");
73
+ if (!(await isValidKuaiJSProject(workspacePath))) {
74
+ console.error("❌ 错误: 当前目录不是有效的 快点JS 项目");
75
75
  console.error("请确保目录包含以下文件:");
76
76
  console.error(" - package.json");
77
77
  console.error(" - scripts/ 目录");
@@ -89,11 +89,11 @@ async function buildCommand(options) {
89
89
  }
90
90
  }
91
91
  // 配置 CLI 程序
92
- commander_1.program.name("ms-cli").description("MagicScript 构建工具").version("0.0.7");
92
+ commander_1.program.name("ms-cli").description("快点JS 构建工具").version("0.0.7");
93
93
  // 构建命令
94
94
  commander_1.program
95
95
  .command("build")
96
- .description("构建 MagicScript 项目")
96
+ .description("构建 快点JS 项目")
97
97
  .option("-d, --dev", "开发模式构建 (包含 source map)")
98
98
  .option("-p, --path <path>", "指定项目路径")
99
99
  .action(buildCommand);
@@ -0,0 +1,2 @@
1
+ import { Plugin } from 'vite';
2
+ export declare function MSMainPlugin(): Plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-vite-plugin",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -22,12 +22,12 @@
22
22
  "7zip-min": "^2.1.0",
23
23
  "@types/fs-extra": "^11.0.4",
24
24
  "commander": "^14.0.0",
25
- "fs-extra": "^11.3.0",
26
- "vite": "^7.1.1",
25
+ "fs-extra": "^11.3.1",
26
+ "vite": "^7.1.4",
27
27
  "vite-plugin-bundle-obfuscator": "^1.8.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@types/node": "^24.0.14",
31
- "typescript": "~5.8.3"
30
+ "@types/node": "^24.3.1",
31
+ "typescript": "~5.9.2"
32
32
  }
33
33
  }