@unmagic/vms 0.0.3-beta.0 → 0.0.3

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/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import dotenv from 'dotenv-flow';
2
2
 
3
3
  async function runVMS(options) {
4
4
  dotenv.config({ node_env: options.mode });
5
- const { dev, prod } = await import('./cli-vfgVOW0G.js');
5
+ const { dev, prod } = await import('./cli-R8YB9UUi.js');
6
6
  if (options.mode === 'production') {
7
7
  return prod(options);
8
8
  }
@@ -10,9 +10,5 @@ async function runVMS(options) {
10
10
  return dev();
11
11
  }
12
12
  }
13
- async function runBuildPackage() {
14
- const { buildPackage } = await import('./build-package-B3ztw0_M.js');
15
- return buildPackage();
16
- }
17
13
 
18
- export { runBuildPackage, runVMS };
14
+ export { runVMS };
package/dist/macro.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ComponentContext, ShallowRef } from '@vue-mini/core'
1
+ import type { ComponentContext, ShallowRef } from '@unmagic/vue-mini'
2
2
 
3
3
  type TemplateRef<T = unknown> = Readonly<ShallowRef<T | null>>
4
4
 
@@ -12,7 +12,7 @@ declare global {
12
12
  function defineContext(): ComponentContext
13
13
 
14
14
  /**
15
- * 定义@vue-mini/core缺少的组件上下文
15
+ * 定义@unmagic/vue-mini缺少的组件上下文
16
16
  * @param key
17
17
  */
18
18
  function useTemplateRef<T = unknown, Keys extends string = string>(key: Keys): TemplateRef<T>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unmagic/vms",
3
- "version": "0.0.3-beta.0",
3
+ "version": "0.0.3",
4
4
  "description": "基于 @unmagic/vue-mini 的Vue3 单文件组件构建工具",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -38,15 +38,17 @@
38
38
  "@types/babel__traverse": "^7.28.0",
39
39
  "@types/fs-extra": "^11.0.4",
40
40
  "@types/node": "^25.5.0",
41
+ "@vue/reactivity": "3.5.32",
42
+ "execa": "^9.6.1",
41
43
  "fast-check": "^4.7.0",
44
+ "husky": "^9.1.7",
45
+ "lint-staged": "^16.4.0",
46
+ "miniprogram-api-typings": "4.0.8",
42
47
  "oxfmt": "^0.46.0",
43
48
  "oxlint": "^1.61.0",
44
49
  "oxlint-tsgolint": "^0.21.1",
45
- "typescript": "~6.0.3",
46
- "lint-staged": "^16.4.0",
47
50
  "tsx": "^4.21.0",
48
- "husky": "^9.1.7",
49
- "execa": "^9.6.1",
51
+ "typescript": "~6.0.3",
50
52
  "vitest": "^4.1.5"
51
53
  },
52
54
  "dependencies": {
@@ -1,86 +0,0 @@
1
- import { transformFileAsync, transformAsync } from '@babel/core';
2
- import { bold, green } from 'kolorist';
3
- import fs from 'fs-extra';
4
- import path from 'node:path';
5
- import { performance } from 'perf_hooks';
6
- import { t as transformVueToMiniProgram, b as config } from './transformer-DjOYWuap.js';
7
- import '@vue/compiler-sfc';
8
- import 'node:fs';
9
- import 'node:fs/promises';
10
- import 'node:crypto';
11
- import '@babel/parser';
12
- import '@babel/types';
13
- import '@babel/generator';
14
- import '@babel/traverse';
15
- import '@babel/code-frame';
16
- import '@vue/compiler-dom';
17
- import 'node:url';
18
- import 'path';
19
- import 'url';
20
- import '@vue/compiler-core';
21
-
22
- async function buildPackage() {
23
- const cwd = process.cwd();
24
- const packageJsonPath = path.join(cwd, 'package.json');
25
- if (!(await fs.pathExists(packageJsonPath))) {
26
- console.error('❌ 当前目录下未找到 package.json,请在组件包根目录下执行此命令');
27
- process.exit(1);
28
- }
29
- const packageJson = await fs.readJson(packageJsonPath);
30
- const sourceDir = path.join(cwd, 'src');
31
- const outputDir = path.join(cwd, 'dist');
32
- if (!(await fs.pathExists(sourceDir))) {
33
- console.error('❌ 当前目录下未找到 src/ 目录');
34
- process.exit(1);
35
- }
36
- // 清空 dist
37
- await fs.remove(outputDir);
38
- await fs.ensureDir(outputDir);
39
- console.log(bold(green(`开始构建组件包 ${packageJson.name}...`)));
40
- // 递归编译
41
- const compileDir = async (dir) => {
42
- const entries = await fs.readdir(dir, { withFileTypes: true });
43
- for (const entry of entries) {
44
- const fullPath = path.join(dir, entry.name);
45
- const relativePath = path.relative(sourceDir, fullPath);
46
- const outputPath = path.join(outputDir, relativePath);
47
- if (entry.isDirectory()) {
48
- if (entry.name === 'node_modules')
49
- continue;
50
- await fs.ensureDir(outputPath);
51
- await compileDir(fullPath);
52
- continue;
53
- }
54
- if (entry.name.endsWith('.vue')) {
55
- const t = performance.now();
56
- await transformVueToMiniProgram(fullPath, outputDir, false, async (generatedCode) => {
57
- const result = await transformAsync(generatedCode, {
58
- filename: fullPath.replace('.vue', '.js'),
59
- ...config,
60
- });
61
- return result?.code ?? generatedCode;
62
- }, sourceDir);
63
- console.log(bold(green(`✓ ${relativePath} (${(performance.now() - t).toFixed(0)}ms)`)));
64
- }
65
- else if (entry.name.endsWith('.ts')) {
66
- const result = await transformFileAsync(fullPath, { ast: false, ...config });
67
- if (result?.code) {
68
- await fs.writeFile(outputPath.replace(/\.ts$/, '.js'), result.code);
69
- }
70
- }
71
- else if (entry.name.endsWith('.js')) {
72
- const result = await transformFileAsync(fullPath, { ast: false, ...config });
73
- if (result?.code) {
74
- await fs.writeFile(outputPath, result.code);
75
- }
76
- }
77
- else {
78
- await fs.copy(fullPath, outputPath);
79
- }
80
- }
81
- };
82
- await compileDir(sourceDir);
83
- console.log(bold(green(`构建完成,输出到 ${outputDir}`)));
84
- }
85
-
86
- export { buildPackage };