@xfe-repo/mini-app 0.0.5 → 0.0.7

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/config/dev.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import type { UserConfigExport } from "@tarojs/cli";
2
+ import RoutesDefineWebpackPlugin from "@xfe-repo/routes-define-webpack-plugin";
3
+ import { appProjectSrcPath } from ".";
2
4
 
3
5
  export default {
4
6
  env: {
@@ -8,6 +10,31 @@ export default {
8
10
  quiet: false,
9
11
  stats: true
10
12
  },
11
- mini: {},
12
- h5: {}
13
+ mini: {
14
+ webpackChain(chain) {
15
+ // 生成路由定义文件
16
+ chain.plugin('routesDefine').use(RoutesDefineWebpackPlugin, [
17
+ {
18
+ routePrefix: 'pages',
19
+ routeSuffix: 'index',
20
+ outputPath: appProjectSrcPath,
21
+ },
22
+ ])
23
+ },
24
+ },
25
+ h5: {
26
+ webpackChain(chain) {
27
+ // 生成路由定义文件
28
+ chain.plugin('routesDefine').use(RoutesDefineWebpackPlugin, [
29
+ {
30
+ routePrefix: 'pages',
31
+ routeSuffix: 'index',
32
+ outputPath: appProjectSrcPath,
33
+ },
34
+ ])
35
+ },
36
+ devServer: {
37
+ port: 9000,
38
+ }
39
+ },
13
40
  } satisfies UserConfigExport<'webpack5'>
package/config/index.ts CHANGED
@@ -5,10 +5,12 @@ import devConfig from './dev'
5
5
  import prodConfig from './prod'
6
6
 
7
7
  // 获取APP_PROJECT_ROOT相对于当前文件的路径
8
- const appProjectRootRelPath = path.relative(path.join(__dirname, '..'), process.env.APP_PROJECT_ROOT || '')
8
+ export const appProjectRootRelPath = path.relative(path.join(__dirname, '..'), process.env.APP_PROJECT_ROOT || '')
9
+ export const appProjectSrcPath = path.join(appProjectRootRelPath, 'src')
10
+ export const appProjectDistPath = path.join(appProjectRootRelPath, 'dist')
9
11
 
10
12
  // 获取API_ENV环境变量 此处注意 需要stringify为带引号的字符串 这样在webpack中才能正确解析
11
- const API_ENV = JSON.stringify(process.env.API_ENV || '')
13
+ export const API_ENV = JSON.stringify(process.env.API_ENV || '')
12
14
 
13
15
  export default defineConfig<'webpack5'>(async (merge) => {
14
16
  const baseConfig: UserConfigExport<'webpack5'> = {
@@ -21,10 +23,10 @@ export default defineConfig<'webpack5'>(async (merge) => {
21
23
  375: 2,
22
24
  828: 1.81 / 2
23
25
  },
24
- sourceRoot: path.join(appProjectRootRelPath, 'src'),
25
- outputRoot: path.join(appProjectRootRelPath, 'dist'),
26
+ sourceRoot: appProjectSrcPath,
27
+ outputRoot: appProjectDistPath,
26
28
  env: {
27
- API_ENV,
29
+ API_ENV
28
30
  },
29
31
  alias: {
30
32
  react: path.resolve(appProjectRootRelPath, './node_modules/react')
@@ -91,7 +93,7 @@ export default defineConfig<'webpack5'>(async (merge) => {
91
93
  appName: 'xfe-mini',
92
94
  postcss: {
93
95
  cssModules: {
94
- enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
96
+ enable: true // 默认为 false,如需使用 css modules 功能,则设为 true
95
97
  }
96
98
  }
97
99
  }
package/package.json CHANGED
@@ -1,8 +1,6 @@
1
1
  {
2
2
  "name": "@xfe-repo/mini-app",
3
- "version": "0.0.5",
4
- "module": "dist/index.js",
5
- "types": "dist/index.d.ts",
3
+ "version": "0.0.7",
6
4
  "bin": {
7
5
  "xfe-mini": "./bin/index.js"
8
6
  },
@@ -14,8 +12,7 @@
14
12
  "scripts",
15
13
  "babel.config.js",
16
14
  "tsconfig.json",
17
- ".eslintrc.js",
18
- ".npmrc"
15
+ ".eslintrc.js"
19
16
  ],
20
17
  "dependencies": {
21
18
  "@babel/core": "^7.24.4",
@@ -53,12 +50,16 @@
53
50
  "tsconfig-paths-webpack-plugin": "^4.1.0",
54
51
  "typescript": "^5.4.5",
55
52
  "webpack": "5.91.0",
56
- "yaml": "^2.3.4"
53
+ "yaml": "^2.3.4",
54
+ "@xfe-repo/routes-define-webpack-plugin": "0.0.2"
57
55
  },
58
56
  "peerDependencies": {
59
57
  "react": "18.2.0",
60
58
  "react-dom": "18.2.0"
61
59
  },
60
+ "publishConfig": {
61
+ "registry": "https://registry.npmjs.org/"
62
+ },
62
63
  "scripts": {
63
64
  "build": "tsup",
64
65
  "dev": "tsup --watch",
package/.npmrc DELETED
@@ -1 +0,0 @@
1
- public-hoist-pattern[]=@tarojs/*
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import Taro from '@tarojs/taro';
2
- export { default } from '@tarojs/taro';
package/dist/index.js DELETED
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = function(target, all) {
9
- for(var name in all)__defProp(target, name, {
10
- get: all[name],
11
- enumerable: true
12
- });
13
- };
14
- var __copyProps = function(to, from, except, desc) {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
17
- try {
18
- var _loop = function() {
19
- var key = _step.value;
20
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
21
- get: function() {
22
- return from[key];
23
- },
24
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
25
- });
26
- };
27
- for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
28
- } catch (err) {
29
- _didIteratorError = true;
30
- _iteratorError = err;
31
- } finally{
32
- try {
33
- if (!_iteratorNormalCompletion && _iterator.return != null) {
34
- _iterator.return();
35
- }
36
- } finally{
37
- if (_didIteratorError) {
38
- throw _iteratorError;
39
- }
40
- }
41
- }
42
- }
43
- return to;
44
- };
45
- var __toESM = function(mod, isNodeMode, target) {
46
- return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
47
- // file that has been converted to a CommonJS file using a Babel-
48
- // compatible transform (i.e. "__esModule" has not been set), then set
49
- // "default" to the CommonJS "module.exports" for node compatibility.
50
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
51
- value: mod,
52
- enumerable: true
53
- }) : target, mod);
54
- };
55
- var __toCommonJS = function(mod) {
56
- return __copyProps(__defProp({}, "__esModule", {
57
- value: true
58
- }), mod);
59
- };
60
- // src/index.ts
61
- var src_exports = {};
62
- __export(src_exports, {
63
- default: function() {
64
- return src_default;
65
- }
66
- });
67
- module.exports = __toCommonJS(src_exports);
68
- var import_taro = __toESM(require("@tarojs/taro"));
69
- var src_default = import_taro.default;